/* Custom font declaration */
@font-face {
  font-family: 'Neuropol X';
  src: url('fonts/Neuropol X Rg.otf') format('opentype');
  font-weight: normal;
  font-style: normal;
}

/* Base styles & CSS variables */
:root {
  --bg-dark: #020307;
  --bg-surface-mid: #0b0d1e;
  --bg-surface-light: #121429;
  --text-main: #c7cae0;
  --text-bright: #e6e9f5;
  --text-muted: #8e94b8;
  --text-accent: #aeb4d4;
  --border-glass: rgba(150, 158, 195, 0.22);
  --border-glass-strong: rgba(175, 183, 220, 0.45);
  --glass-shadow: 0 8px 32px rgba(1, 2, 6, 0.95);
  --accent-success: #86efac;
  --accent-error: #f87171;
  --transition-fast: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  text-transform: lowercase;
  background: 
    radial-gradient(circle at 50% 100%, rgba(51, 55, 89, 0.35), transparent 75%),
    radial-gradient(circle at 15% 20%, rgba(42, 40, 64, 0.4), transparent 50%),
    radial-gradient(circle at 85% 30%, rgba(29, 31, 51, 0.5), transparent 60%),
    linear-gradient(180deg, var(--bg-dark) 0%, #060712 35%, var(--bg-surface-mid) 70%, var(--bg-surface-light) 100%);
  min-height: 100vh;
  color: var(--text-main);
  position: relative;
  overflow-x: hidden;
}

/* Starry background elements */
.sky-background {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  will-change: transform;
}

.stars-static {
  position: absolute;
  inset: 0;
  background-image: 
    radial-gradient(1px 1px at 20px 40px, rgba(220, 225, 245, 0.6), transparent),
    radial-gradient(1px 1px at 90px 180px, rgba(180, 185, 210, 0.5), transparent),
    radial-gradient(1.5px 1.5px at 150px 70px, rgba(160, 165, 195, 0.6), transparent),
    radial-gradient(1px 1px at 280px 240px, rgba(200, 205, 225, 0.5), transparent),
    radial-gradient(1.5px 1.5px at 350px 50px, rgba(150, 155, 185, 0.6), transparent),
    radial-gradient(1px 1px at 490px 200px, rgba(220, 225, 245, 0.6), transparent),
    radial-gradient(1.5px 1.5px at 620px 120px, rgba(175, 180, 210, 0.7), transparent),
    radial-gradient(1px 1px at 730px 290px, rgba(190, 195, 220, 0.5), transparent),
    radial-gradient(1.5px 1.5px at 850px 80px, rgba(220, 225, 245, 0.6), transparent),
    radial-gradient(1px 1px at 980px 220px, rgba(150, 155, 185, 0.5), transparent);
  background-size: 600px 380px;
  opacity: 0.55;
}

.stars-twinkle {
  position: absolute;
  inset: 0;
  background-image: 
    radial-gradient(2px 2px at 130px 60px, #e2e5f5, transparent),
    radial-gradient(2px 2px at 320px 210px, #c3c7de, transparent),
    radial-gradient(2.5px 2.5px at 580px 80px, #aeb3cf, transparent),
    radial-gradient(2px 2px at 810px 190px, #b8bcd9, transparent);
  background-size: 700px 420px;
  animation: star-glow 5s infinite alternate ease-in-out;
  will-change: opacity;
}

@keyframes star-glow {
  0% { opacity: 0.15; }
  100% { opacity: 0.7; }
}

.shooting-star {
  position: absolute;
  top: 15%;
  left: 60%;
  width: 120px;
  height: 1px;
  background: linear-gradient(90deg, rgba(184, 190, 220, 0.8), transparent);
  opacity: 0;
  transform: rotate(-35deg) translateX(0);
  animation: shoot 8s infinite ease-in-out;
  will-change: transform, opacity;
}

.shooting-star.delay {
  top: 35%;
  left: 25%;
  width: 90px;
  animation-delay: 4s;
}

@keyframes shoot {
  0% { transform: rotate(-35deg) translateX(0); opacity: 0; }
  5% { opacity: 0.8; }
  12% { transform: rotate(-35deg) translateX(-350px); opacity: 0; }
  100% { transform: rotate(-35deg) translateX(-350px); opacity: 0; }
}

/* Topbar layout wrapper */
.topbar-wrapper {
  width: 98%;
  max-width: 1800px;
  margin: 12px auto 0 auto;
  position: relative;
  z-index: 10;
}

.topbar {
  display: flex;
  align-items: center;
  padding: 0 24px;
  height: 56px;
  border-radius: 8px;
  background: linear-gradient(
    180deg, 
    rgba(255, 255, 255, 0.16) 0%, 
    rgba(78, 83, 118, 0.12) 48%, 
    rgba(12, 13, 24, 0.85) 50%, 
    rgba(21, 23, 40, 0.95) 100%
  );
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  border: 1px solid var(--border-glass);
  box-shadow: 
    var(--glass-shadow),
    0 0 20px rgba(78, 83, 118, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.4),
    inset 0 -1px 2px rgba(0, 0, 0, 0.95);
  position: relative;
  overflow: hidden;
}

.topbar::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 48%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.22) 0%, rgba(255, 255, 255, 0.01) 100%);
  pointer-events: none;
}

.site-title {
  display: flex;
  align-items: center;
  text-decoration: none;
  position: relative;
  z-index: 1;
}

.site-name {
  font-family: 'Neuropol X', 'Segoe UI', sans-serif;
  font-size: 1.15rem;
  letter-spacing: 1px;
  color: var(--text-bright);
  text-transform: lowercase;
  text-shadow: 0 0 10px rgba(150, 158, 195, 0.7), 0 0 20px rgba(78, 83, 118, 0.5);
}

.separator {
  width: 1px;
  height: 26px;
  margin: 0 24px;
  background: rgba(150, 158, 195, 0.22);
  box-shadow: 1px 0 0 rgba(2, 3, 7, 0.9);
  z-index: 1;
}

.nav-links {
  display: flex;
  list-style: none;
  gap: 10px;
  z-index: 1;
}

.nav-btn {
  display: inline-block;
  padding: 7px 20px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-accent);
  text-decoration: none;
  text-transform: lowercase;
  border-radius: 4px;
  border: 1px solid transparent;
  transition: var(--transition-fast);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
}

.nav-btn:hover {
  color: #ffffff;
  background: linear-gradient(
    180deg, 
    rgba(255, 255, 255, 0.18) 0%, 
    rgba(100, 108, 150, 0.3) 50%, 
    rgba(35, 38, 60, 0.6) 100%
  );
  border-color: var(--border-glass-strong);
  box-shadow: 0 0 14px rgba(90, 98, 138, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

.nav-btn.active {
  color: #ffffff;
  background: linear-gradient(
    180deg, 
    rgba(110, 118, 160, 0.55) 0%, 
    rgba(70, 77, 112, 0.75) 50%, 
    rgba(40, 44, 70, 0.9) 100%
  );
  border: 1px solid rgba(175, 183, 220, 0.6);
  box-shadow: 0 0 16px rgba(90, 98, 138, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

/* Auth topbar actions */
.auth-buttons {
  margin-left: auto;
  display: flex;
  gap: 8px;
  z-index: 1;
}

.auth-btn {
  background: rgba(110, 118, 160, 0.15);
  border: 1px solid var(--border-glass);
  color: var(--text-accent);
  cursor: pointer;
  font-family: inherit;
  padding: 6px 14px;
  border-radius: 4px;
  transition: var(--transition-fast);
}

.auth-btn:hover {
  color: #ffffff;
  border-color: var(--border-glass-strong);
}

.signup-btn {
  background: linear-gradient(180deg, rgba(110, 118, 160, 0.4) 0%, rgba(40, 44, 70, 0.8) 100%);
  border-color: rgba(175, 183, 220, 0.5);
  color: var(--text-main);
}

.signup-btn:hover {
  color: #ffffff;
}

/* Main layout wrapper */
.content-wrapper {
  width: 98%;
  max-width: 1800px;
  margin: 20px auto;
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 20px;
  position: relative;
  z-index: 10;
}

/* Base vista glass container */
.glass-box {
  padding: 20px;
  border-radius: 8px;
  background: linear-gradient(
    180deg, 
    rgba(255, 255, 255, 0.12) 0%, 
    rgba(78, 83, 118, 0.08) 48%, 
    rgba(12, 13, 24, 0.75) 50%, 
    rgba(21, 23, 40, 0.85) 100%
  );
  backdrop-filter: blur(14px) saturate(130%);
  -webkit-backdrop-filter: blur(14px) saturate(130%);
  border: 1px solid var(--border-glass);
  box-shadow: 
    0 8px 24px rgba(1, 2, 6, 0.85),
    inset 0 1px 0 rgba(255, 255, 255, 0.3),
    inset 0 -1px 2px rgba(0, 0, 0, 0.8);
  position: relative;
  overflow: hidden;
}

.glass-box::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 40%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.15) 0%, rgba(255, 255, 255, 0.01) 100%);
  pointer-events: none;
}

/* Left sidebar gadgets */
.sidebar {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.gadget-title {
  font-family: 'Neuropol X', 'Segoe UI', sans-serif;
  font-size: 0.85rem;
  letter-spacing: 1px;
  color: #dbe0f0;
  margin-bottom: 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(150, 158, 195, 0.2);
}

.status-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  margin-bottom: 8px;
}

.status-item:last-child {
  margin-bottom: 0;
}

.status-label {
  color: var(--text-accent);
}

.status-value {
  color: var(--text-bright);
  font-weight: 600;
}

.status-open {
  color: var(--accent-success);
  text-shadow: 0 0 8px rgba(134, 239, 172, 0.5);
}

.status-closed {
  color: var(--accent-error);
  text-shadow: 0 0 8px rgba(248, 113, 113, 0.5);
}

.gadget-text {
  font-size: 0.85rem;
  line-height: 1.4;
  color: var(--text-accent);
}

.gadget-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 0.85rem;
}

.gadget-list a {
  color: var(--text-accent);
  text-decoration: none;
  transition: var(--transition-fast);
}

.gadget-list a:hover {
  color: #ffffff;
  text-shadow: 0 0 6px rgba(175, 183, 220, 0.6);
}

/* Main content area */
.main-content {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.intro-box {
  border-color: rgba(175, 183, 220, 0.35);
}

.intro-title {
  font-family: 'Neuropol X', 'Segoe UI', sans-serif;
  font-size: 1.1rem;
  letter-spacing: 1px;
  color: #ffffff;
  margin-bottom: 10px;
  text-shadow: 0 0 10px rgba(150, 158, 195, 0.6);
}

.intro-text {
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--text-main);
}

.blog-feed {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.section-title {
  font-family: 'Neuropol X', 'Segoe UI', sans-serif;
  font-size: 0.95rem;
  letter-spacing: 1px;
  color: #dbe0f0;
  padding-left: 4px;
}

.blog-card {
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.blog-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-glass-strong);
  box-shadow: 0 10px 30px rgba(1, 2, 6, 0.9);
}

.blog-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.blog-tag {
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(110, 118, 160, 0.2);
  border: 1px solid rgba(150, 158, 195, 0.25);
  color: var(--text-main);
}

.blog-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-bright);
  cursor: pointer;
  transition: var(--transition-fast);
}

.blog-title:hover {
  color: #ffffff;
  text-shadow: 0 0 8px rgba(175, 183, 220, 0.6);
}

.blog-excerpt {
  font-size: 0.88rem;
  line-height: 1.5;
  color: var(--text-accent);
  margin-bottom: 12px;
}

.read-more-btn {
  background: transparent;
  border: none;
  color: var(--text-main);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  transition: var(--transition-fast);
}

.read-more-btn:hover {
  color: #ffffff;
  text-decoration: underline;
}

/* Embedded blog media styles */
.blog-media {
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid rgba(150, 158, 195, 0.25);
  background: rgba(12, 13, 24, 0.6);
}

.blog-media img {
  display: block;
}

.blog-media figcaption {
  padding: 6px 12px;
  font-size: 0.75rem;
  color: var(--text-muted);
  background: rgba(8, 9, 16, 0.8);
  border-top: 1px solid rgba(150, 158, 195, 0.15);
}

.blog-media-thumb {
  max-width: 280px;
  max-height: 140px;
  margin: 10px 0;
}

.blog-media-thumb img {
  width: 100%;
  height: 140px;
  object-fit: cover;
}

.blog-content {
  font-size: 0.88rem;
  line-height: 1.6;
  color: var(--text-accent);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Modals */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(2, 3, 7, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-box {
  width: 90%;
  max-width: 360px;
  padding: 28px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.9);
}

.post-modal-box {
  max-width: 680px;
  max-height: 85vh;
  overflow-y: auto;
}

.reader-title {
  font-size: 1.25rem;
  margin-bottom: 12px;
}

.blog-media-full {
  margin: 14px 0;
}

.blog-media-full img {
  width: 100%;
  max-height: 480px;
  object-fit: cover;
}

.modal-close-btn {
  position: absolute;
  top: 10px;
  right: 14px;
  background: transparent;
  border: none;
  color: var(--text-accent);
  font-size: 1.4rem;
  cursor: pointer;
  transition: var(--transition-fast);
}

.modal-close-btn:hover {
  color: #ffffff;
}

.modal-title {
  font-family: 'Neuropol X', 'Segoe UI', sans-serif;
  font-size: 1rem;
  color: #ffffff;
  margin-bottom: 18px;
}

/* Forms & Inputs */
.input-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.input-group label {
  font-size: 0.8rem;
  color: var(--text-accent);
}

.input-group input {
  padding: 8px 12px;
  border-radius: 4px;
  background: rgba(12, 13, 24, 0.8);
  border: 1px solid rgba(150, 158, 195, 0.3);
  color: #ffffff;
  font-family: inherit;
  font-size: 0.85rem;
  outline: none;
  transition: var(--transition-fast);
}

.input-group input:focus {
  border-color: rgba(175, 183, 220, 0.7);
  box-shadow: 0 0 8px rgba(90, 98, 138, 0.4);
}

.auth-error {
  font-size: 0.78rem;
  color: var(--accent-error);
  margin-bottom: 12px;
  min-height: 16px;
}

.auth-submit-btn {
  width: 100%;
  margin-top: 1rem;
  padding: 0.6rem 1rem;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  color: #fff;
  font-family: inherit;
  font-size: 0.95rem;
  cursor: pointer;
  transition: var(--transition-fast);
}

.auth-submit-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.4);
  box-shadow: 0 0 12px rgba(255, 255, 255, 0.15);
  transform: translateY(-1px);
}

.auth-submit-btn:active:not(:disabled) {
  transform: translateY(0);
  background: rgba(255, 255, 255, 0.25);
}

.auth-submit-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  border-color: rgba(255, 255, 255, 0.1);
}

.user-badge {
  font-size: 0.82rem;
  color: var(--accent-success);
  align-self: center;
  padding-right: 8px;
  text-shadow: 0 0 8px rgba(134, 239, 172, 0.4);
}

/* Comments System */
.blog-comment-count {
  margin-left: auto;
  font-size: 0.78rem;
  color: var(--text-accent);
}

.comments-section {
  margin-top: 30px;
  padding-top: 20px;
  border-top: 1px solid rgba(150, 158, 195, 0.22);
}

.comments-title {
  font-family: 'Neuropol X', 'Segoe UI', sans-serif;
  font-size: 0.95rem;
  letter-spacing: 1px;
  color: #dbe0f0;
  margin-bottom: 16px;
}

.comment-input-box {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

.comment-input-box textarea,
.comment-edit-box textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 6px;
  background: rgba(12, 13, 24, 0.85);
  border: 1px solid rgba(150, 158, 195, 0.3);
  color: #ffffff;
  font-family: inherit;
  font-size: 0.85rem;
  outline: none;
  resize: vertical;
  transition: var(--transition-fast);
}

.comment-input-box textarea:focus,
.comment-edit-box textarea:focus {
  border-color: rgba(175, 183, 220, 0.7);
  box-shadow: 0 0 8px rgba(90, 98, 138, 0.4);
}

.comment-submit-btn {
  align-self: flex-end;
  cursor: pointer;
  background: linear-gradient(180deg, rgba(110, 118, 160, 0.4) 0%, rgba(40, 44, 70, 0.8) 100%);
  border: 1px solid rgba(175, 183, 220, 0.5);
  border-radius: 4px;
  color: var(--text-bright);
  padding: 6px 16px;
  transition: var(--transition-fast);
}

.comment-submit-btn:hover {
  background: linear-gradient(180deg, rgba(130, 138, 180, 0.5) 0%, rgba(50, 54, 80, 0.9) 100%);
  border-color: rgba(200, 208, 245, 0.7);
}

.comment-login-prompt {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 20px;
  padding: 12px;
  background: rgba(12, 13, 24, 0.4);
  border: 1px dashed rgba(150, 158, 195, 0.25);
  border-radius: 6px;
}

.comments-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.no-comments {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-style: italic;
}

.comment-item {
  padding: 12px 14px;
  border-radius: 6px;
  background: rgba(12, 13, 24, 0.6);
  border: 1px solid rgba(150, 158, 195, 0.18);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.comment-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
}

.comment-author {
  font-weight: 600;
  color: var(--text-bright);
}

.comment-date {
  color: var(--text-muted);
}

.edited-tag {
  font-size: 0.72rem;
  color: var(--text-accent);
  font-style: italic;
  margin-left: 2px;
}

.comment-actions {
  margin-left: auto;
  display: flex;
  gap: 8px;
}

.comment-action-btn {
  background: transparent;
  border: none;
  color: var(--text-accent);
  font-size: 0.75rem;
  cursor: pointer;
  padding: 0;
  transition: var(--transition-fast);
}

.comment-action-btn:hover {
  color: #ffffff;
  text-decoration: underline;
}

.comment-action-btn.delete:hover {
  color: var(--accent-error);
}

.comment-body {
  font-size: 0.85rem;
  line-height: 1.4;
  color: var(--text-main);
  word-break: break-word;
}

.comment-edit-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}

.comment-edit-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  align-items: center;
}

.comment-body,
.comment-author,
.comment-input-box textarea,
.comment-edit-box textarea {
  text-transform: none;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
  .content-wrapper {
    grid-template-columns: 1fr;
  }
  
  .topbar {
    height: auto;
    padding: 12px 16px;
    flex-wrap: wrap;
    gap: 12px;
  }

  .separator {
    display: none;
  }

  .nav-links {
    width: 100%;
    order: 3;
    justify-content: space-between;
  }

  .auth-buttons {
    margin-left: auto;
  }
}