/* ==========================================
   ENHANCED HEADER - Glassmorphism Style
   Matches the hero section design
   ========================================== */

/* Header Container */
.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: rgba(15,23,42,0.85) !important;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(255,255,255,0.1);
  box-shadow: 0 4px 30px rgba(0,0,0,0.3);
  transition: all 0.3s ease;
}

.site-header.scrolled {
  background: rgba(15,23,42,0.95) !important;
  box-shadow: 0 8px 40px rgba(0,0,0,0.4);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 0;
  gap: 2rem;
}

/* Logo Styling */
.logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  position: relative;
  z-index: 1001;
}

.logo-img {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  box-shadow: 0 4px 15px rgba(var(--primary-rgb), 0.3);
  transition: transform 0.3s ease;
}

.logo:hover .logo-img {
  transform: scale(1.05) rotate(5deg);
}

.logo span {
  font-size: 1.5rem;
  font-weight: 800;
  background: linear-gradient(135deg, #fff 0%, rgba(255,255,255,0.8) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.5px;
}

/* Desktop Navigation */
.nav-desktop {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.nav-desktop a {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1rem;
  border-radius: 10px;
  font-weight: 500;
  font-size: 0.9rem;
  color: rgba(255,255,255,0.85);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.nav-desktop a::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0.05) 100%);
  opacity: 0;
  transition: opacity 0.3s ease;
  border-radius: 10px;
}

.nav-desktop a:hover::before {
  opacity: 1;
}

.nav-desktop a:hover {
  color: #fff;
  transform: translateY(-1px);
}

.nav-desktop a.active {
  background: linear-gradient(135deg, rgba(255,255,255,0.15) 0%, rgba(255,255,255,0.08) 100%);
  color: #fff;
  box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

/* Navigation Icons */
.nav-ico {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
}

.nav-ico svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Header Buttons */
.nav-desktop .btn {
  padding: 0.6rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.nav-desktop .btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-600) 100%);
  border: none;
  color: #fff;
  box-shadow: 0 4px 15px rgba(var(--primary-rgb), 0.4);
}

.nav-desktop .btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(var(--primary-rgb), 0.5);
}

.nav-desktop .btn:not(.btn-primary) {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  color: #fff;
}

.nav-desktop .btn:not(.btn-primary):hover {
  background: rgba(255,255,255,0.15);
  border-color: rgba(255,255,255,0.3);
  transform: translateY(-2px);
}

/* Auth User Section */
.auth-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 1rem;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px;
}

.auth-user .muted {
  color: rgba(255,255,255,0.7);
  font-size: 0.85rem;
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auth-user .btn-sm {
  padding: 0.4rem 0.75rem;
  font-size: 0.8rem;
  border-radius: 8px;
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  padding: 10px;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 10px;
  cursor: pointer;
  z-index: 1001;
  transition: all 0.3s ease;
}

.mobile-menu-toggle:hover {
  background: rgba(255,255,255,0.15);
}

.mobile-menu-toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background: #fff;
  border-radius: 2px;
  transition: all 0.3s ease;
}

.mobile-menu-toggle.active span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.mobile-menu-toggle.active span:nth-child(2) {
  opacity: 0;
}

.mobile-menu-toggle.active span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

/* Mobile Menu Backdrop */
.mobile-menu-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  z-index: 999;
}

.mobile-menu-backdrop.active {
  opacity: 1;
  visibility: visible;
}

/* Mobile Navigation */
@media (max-width: 1024px) {
  .mobile-menu-toggle {
    display: flex;
  }
  
  .nav-desktop {
    position: fixed;
    top: 0;
    right: -100%;
    width: min(320px, 80%);
    height: 100vh;
    background: rgba(11,15,26,0.98);
    backdrop-filter: blur(20px);
    flex-direction: column;
    align-items: stretch;
    padding: 5rem 1.5rem 2rem;
    gap: 0.5rem;
    transition: right 0.3s ease;
    z-index: 1000;
    border-left: 1px solid rgba(255,255,255,0.1);
    overflow-y: auto;
  }
  
  .nav-desktop.active {
    right: 0;
  }
  
  .nav-desktop a {
    padding: 1rem;
    border-radius: 12px;
    font-size: 1rem;
  }
  
  .nav-desktop .btn {
    justify-content: center;
    padding: 1rem;
  }
  
  .auth-user {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
  }
  
  .auth-user .muted {
    max-width: none;
    text-align: center;
  }
}

/* Dropdown Animation for Mobile */
@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.nav-desktop.active a {
  animation: slideIn 0.4s ease forwards;
}

.nav-desktop.active a:nth-child(1) { animation-delay: 0.05s; }
.nav-desktop.active a:nth-child(2) { animation-delay: 0.1s; }
.nav-desktop.active a:nth-child(3) { animation-delay: 0.15s; }
.nav-desktop.active a:nth-child(4) { animation-delay: 0.2s; }
.nav-desktop.active a:nth-child(5) { animation-delay: 0.25s; }
.nav-desktop.active a:nth-child(6) { animation-delay: 0.3s; }

/* Header Badge (optional) */
.header-badge {
  position: absolute;
  top: -8px;
  right: -8px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-600) 100%);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: 20px;
  box-shadow: 0 2px 8px rgba(var(--primary-rgb), 0.4);
}

/* Theme Color Support */
.theme-emerald {
  --primary-rgb: 16,185,129;
}

.theme-gold {
  --primary-rgb: 245,158,11;
}

.theme-purple {
  --primary-rgb: 139,92,246;
}

.theme-rose {
  --primary-rgb: 244,63,94;
}

.theme-teal {
  --primary-rgb: 20,184,166;
}

.theme-blue {
  --primary-rgb: 91,140,255;
}

/* Scroll Behavior Enhancement */
html {
  scroll-padding-top: 80px;
}

/* Hover Glow Effect for Logo */
@keyframes logo-glow {
  0%, 100% {
    box-shadow: 0 4px 15px rgba(var(--primary-rgb), 0.3);
  }
  50% {
    box-shadow: 0 4px 25px rgba(var(--primary-rgb), 0.5);
  }
}

.logo-img {
  animation: logo-glow 3s ease-in-out infinite;
}

/* Active Link Indicator */
.nav-desktop a::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%) scaleX(0);
  width: 30px;
  height: 2px;
  background: var(--primary);
  border-radius: 2px;
  transition: transform 0.3s ease;
}

.nav-desktop a:hover::after,
.nav-desktop a.active::after {
  transform: translateX(-50%) scaleX(1);
}

/* Post Button Special Styling */
.nav-desktop a[href="/post"].btn-primary {
  position: relative;
  overflow: hidden;
}

.nav-desktop a[href="/post"].btn-primary::before {
  content: '+';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.2) 0%, transparent 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.nav-desktop a[href="/post"].btn-primary:hover::before {
  opacity: 1;
}

/* Header on Scroll Effect */
@supports (animation-timeline: scroll()) {
  .site-header {
    animation: header-shrink linear both;
    animation-timeline: scroll();
    animation-range: 0 100px;
  }
  
  @keyframes header-shrink {
    to {
      padding: 0.5rem 0;
    }
  }
}
