/**
 * SinAI Inc - Unified Header Styles
 * Glassmorphism with liquid animations
 */

/* Unified Header Base Styles */
.unified-header {
  position: sticky;
  top: 0;
  z-index: var(--z-fixed);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  border: none;
  box-shadow: none;
  pointer-events: auto; /* Ensure header can receive clicks (orb canvas has pointer-events:none) */
}

/* Glassmorphism effect - default (not scrolled) */
.unified-header {
  background: rgba(255, 255, 255, 0.7);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid rgba(102, 126, 234, 0.1);
}

[data-theme="dark"] .unified-header {
  background: rgba(26, 32, 44, 0.7);
  border-bottom: 1px solid rgba(167, 139, 250, 0.1);
}

/* Enhanced glassmorphism when scrolled */
.unified-header.scrolled {
  background: rgba(255, 255, 255, 0.85);
  -webkit-backdrop-filter: blur(30px) saturate(200%);
  backdrop-filter: blur(30px) saturate(200%);
  border-bottom: 1px solid rgba(102, 126, 234, 0.2);
  box-shadow: 0 4px 30px rgba(102, 126, 234, 0.1);
}

[data-theme="dark"] .unified-header.scrolled {
  background: rgba(26, 32, 44, 0.9);
  border-bottom: 1px solid rgba(167, 139, 250, 0.2);
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.3);
}

/* Liquid animation overlay */
.unified-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: -50%;
  width: 200%;
  height: 100%;
  background: radial-gradient(
    circle at 20% 50%,
    rgba(102, 126, 234, 0.08) 0%,
    transparent 50%
  );
  animation: liquidHeaderMove 25s ease-in-out infinite;
  pointer-events: none;
  opacity: 0.5;
}

[data-theme="dark"] .unified-header::before {
  background: radial-gradient(
    circle at 20% 50%,
    rgba(167, 139, 250, 0.12) 0%,
    transparent 50%
  );
}

.unified-header::after {
  content: '';
  position: absolute;
  top: 0;
  right: -50%;
  width: 200%;
  height: 100%;
  background: radial-gradient(
    circle at 80% 50%,
    rgba(244, 114, 182, 0.08) 0%,
    transparent 50%
  );
  animation: liquidHeaderMove 30s ease-in-out infinite reverse;
  pointer-events: none;
  opacity: 0.5;
}

[data-theme="dark"] .unified-header::after {
  background: radial-gradient(
    circle at 80% 50%,
    rgba(139, 92, 246, 0.12) 0%,
    transparent 50%
  );
}

@keyframes liquidHeaderMove {
  0%, 100% {
    transform: translateX(0) scale(1);
  }
  33% {
    transform: translateX(5%) scale(1.05);
  }
  66% {
    transform: translateX(-5%) scale(0.95);
  }
}

/* Header content positioning */
.unified-header .container {
  position: relative;
  z-index: 1;
}

/* Logo styling with hover effect */
.unified-header .navbar-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 600;
  font-size: 1.25rem;
  color: var(--text-primary);
  transition: all 0.3s ease;
  position: relative;
  padding: 0.5rem 0;
}

.unified-header .navbar-brand:hover {
  transform: translateY(-2px);
}

.unified-header .logo-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: rgba(102, 126, 234, 0.1);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  transition: all 0.3s ease;
}

[data-theme="dark"] .unified-header .logo-wrapper {
  background: rgba(167, 139, 250, 0.15);
}

.unified-header .navbar-brand:hover .logo-wrapper {
  background: rgba(102, 126, 234, 0.2);
  transform: rotate(-5deg) scale(1.05);
}

[data-theme="dark"] .unified-header .navbar-brand:hover .logo-wrapper {
  background: rgba(167, 139, 250, 0.25);
}

.unified-header .logo-wrapper img {
  width: 32px;
  height: 32px;
  transition: transform 0.3s ease;
}

.unified-header .brand-text {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-weight: 700;
}

/* Navigation links with glassmorphism hover */
.unified-header .nav-link {
  position: relative;
  color: var(--text-primary);
  font-weight: 500;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  transition: all 0.3s ease;
  margin: 0 0.25rem;
}

.unified-header .nav-link:hover {
  color: #667eea;
  background: rgba(102, 126, 234, 0.08);
}

[data-theme="dark"] .unified-header .nav-link:hover {
  color: #a78bfa;
  background: rgba(167, 139, 250, 0.12);
}

.unified-header .nav-link.active {
  color: #667eea;
  background: rgba(102, 126, 234, 0.12);
  font-weight: 600;
}

[data-theme="dark"] .unified-header .nav-link.active {
  color: #a78bfa;
  background: rgba(167, 139, 250, 0.18);
}

/* Contact button with glassmorphism */
.unified-header .btn-contact {
  position: relative;
  background: rgba(102, 126, 234, 0.1);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(102, 126, 234, 0.3);
  color: #667eea;
  font-weight: 600;
  padding: 0.5rem 1.5rem;
  border-radius: 12px;
  transition: all 0.3s ease;
  overflow: hidden;
}

.unified-header .btn-contact::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(102, 126, 234, 0.2);
  transform: translate(-50%, -50%);
  transition: width 0.4s ease, height 0.4s ease;
}

.unified-header .btn-contact:hover::before {
  width: 300px;
  height: 300px;
}

.unified-header .btn-contact:hover {
  background: rgba(102, 126, 234, 0.2);
  border-color: rgba(102, 126, 234, 0.5);
  color: #5568d3;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.unified-header .btn-contact span {
  position: relative;
  z-index: 1;
}

[data-theme="dark"] .unified-header .btn-contact {
  background: rgba(167, 139, 250, 0.15);
  border-color: rgba(167, 139, 250, 0.3);
  color: #a78bfa;
}

[data-theme="dark"] .unified-header .btn-contact:hover {
  background: rgba(167, 139, 250, 0.25);
  border-color: rgba(167, 139, 250, 0.5);
  color: #c4b5fd;
}

/* Admin indicator - pulsing dot */
.admin-indicator {
  position: absolute;
  top: 0.25rem;
  right: -0.5rem;
  width: 10px;
  height: 10px;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.9);
  animation: adminPulse 2s ease-in-out infinite;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.5);
}

[data-theme="dark"] .admin-indicator {
  border-color: rgba(26, 32, 44, 0.9);
}

@keyframes adminPulse {
  0%, 100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.2);
    opacity: 0.8;
  }
}

/* Admin button styling */
.unified-header .btn-admin {
  position: relative;
  background: rgba(16, 185, 129, 0.1);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #10b981;
  font-weight: 600;
  padding: 0.5rem 1rem;
  border-radius: 10px;
  transition: all 0.3s ease;
  margin-left: 0.5rem;
}

.unified-header .btn-admin:hover {
  background: rgba(16, 185, 129, 0.2);
  border-color: rgba(16, 185, 129, 0.5);
  color: #059669;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

[data-theme="dark"] .unified-header .btn-admin {
  background: rgba(52, 211, 153, 0.15);
  border-color: rgba(52, 211, 153, 0.3);
  color: #34d399;
}

[data-theme="dark"] .unified-header .btn-admin:hover {
  background: rgba(52, 211, 153, 0.25);
  border-color: rgba(52, 211, 153, 0.5);
  color: #6ee7b7;
}

/* Theme toggle button */
.unified-header .theme-toggle-btn {
  color: var(--text-primary);
  padding: 0.5rem;
  border-radius: 8px;
  transition: all 0.3s ease;
  background: rgba(102, 126, 234, 0.05);
  border: 1px solid rgba(102, 126, 234, 0.1);
}

.unified-header .theme-toggle-btn:hover {
  background: rgba(102, 126, 234, 0.12);
  border-color: rgba(102, 126, 234, 0.2);
  transform: rotate(15deg);
}

[data-theme="dark"] .unified-header .theme-toggle-btn {
  background: rgba(167, 139, 250, 0.1);
  border-color: rgba(167, 139, 250, 0.15);
}

[data-theme="dark"] .unified-header .theme-toggle-btn:hover {
  background: rgba(167, 139, 250, 0.18);
  border-color: rgba(167, 139, 250, 0.3);
}

/* Mobile controls container - ensure above orb canvas */
/* NOTE: Uses Bootstrap's d-lg-none utility class in HTML for responsive visibility */
.unified-header .mobile-controls {
  position: relative;
  z-index: 1051; /* Above orb canvas (9999) and modal (1050) */
  align-items: center;
  gap: 0.5rem;
}

/* Mobile menu styling - DO NOT override Bootstrap display classes */
.unified-header .navbar-toggler {
  /* display controlled by Bootstrap's navbar-expand-lg */
  border: none;
  padding: 0.5rem;
  background: rgba(102, 126, 234, 0.1);
  border-radius: 8px;
  transition: all 0.3s ease;
  position: relative;
  z-index: inherit; /* Inherit from parent mobile-controls */
  pointer-events: auto; /* Ensure clickable */
  width: 40px;
  height: 40px;
}

.unified-header .navbar-toggler:hover {
  background: rgba(102, 126, 234, 0.2);
  transform: scale(1.05);
}

.unified-header .navbar-toggler:focus {
  box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
}

[data-theme="dark"] .unified-header .navbar-toggler {
  background: rgba(167, 139, 250, 0.15);
}

[data-theme="dark"] .unified-header .navbar-toggler:hover {
  background: rgba(167, 139, 250, 0.25);
}

/* Responsive adjustments */
@media (max-width: 991.98px) {
  .unified-header .navbar-collapse {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 1rem;
    left: auto;
    width: 280px;
    max-width: calc(100vw - 2rem);
    margin-top: 0;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.95);
    -webkit-backdrop-filter: blur(30px) saturate(180%);
    backdrop-filter: blur(30px) saturate(180%);
    border-radius: 16px;
    border: 1px solid rgba(102, 126, 234, 0.15);
    box-shadow: 0 8px 32px rgba(102, 126, 234, 0.12), 0 2px 8px rgba(0, 0, 0, 0.05);
    z-index: 1040;
  }
  
  [data-theme="dark"] .unified-header .navbar-collapse {
    background: rgba(26, 32, 44, 0.95);
    -webkit-backdrop-filter: blur(30px) saturate(180%);
    backdrop-filter: blur(30px) saturate(180%);
    border-color: rgba(167, 139, 250, 0.2);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4), 0 2px 8px rgba(167, 139, 250, 0.1);
  }

  .unified-header .navbar-nav .nav-item {
    margin: 0.25rem 0;
  }
  
  .unified-header .navbar-nav .nav-link {
    padding: 0.65rem 1rem;
    border-radius: 10px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 500;
    display: flex;
    align-items: center;
    font-size: 0.9rem;
  }
  
  .unified-header .navbar-nav .nav-link:hover,
  .unified-header .navbar-nav .nav-link.active {
    background: rgba(102, 126, 234, 0.12);
    transform: translateX(4px);
    color: #667eea;
  }
  
  [data-theme="dark"] .unified-header .navbar-nav .nav-link:hover,
  [data-theme="dark"] .unified-header .navbar-nav .nav-link.active {
    background: rgba(167, 139, 250, 0.15);
    color: #a78bfa;
  }

  .unified-header .btn-contact,
  .unified-header .btn-admin {
    width: 100%;
    justify-content: center;
    margin: 0.5rem 0 0.25rem 0;
    padding: 0.65rem 1rem;
    border-radius: 10px;
    font-size: 0.875rem;
  }
  
  .unified-header .btn-contact {
    background: rgba(102, 126, 234, 0.15);
    border-color: rgba(102, 126, 234, 0.3);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.15);
  }
  
  .unified-header .btn-admin {
    background: rgba(16, 185, 129, 0.15);
    border-color: rgba(16, 185, 129, 0.3);
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.15);
  }
  
  [data-theme="dark"] .unified-header .btn-contact {
    background: rgba(167, 139, 250, 0.2);
    border-color: rgba(167, 139, 250, 0.35);
    box-shadow: 0 2px 8px rgba(167, 139, 250, 0.2);
  }
  
  [data-theme="dark"] .unified-header .btn-admin {
    background: rgba(52, 211, 153, 0.2);
    border-color: rgba(52, 211, 153, 0.35);
    box-shadow: 0 2px 8px rgba(52, 211, 153, 0.2);
  }
}

/* Smooth scrolling for header height changes */
html {
  scroll-padding-top: 80px;
}

/* Accessibility improvements */
.unified-header .nav-link:focus,
.unified-header .btn-contact:focus,
.unified-header .btn-admin:focus {
  outline: 2px solid #667eea;
  outline-offset: 2px;
}

[data-theme="dark"] .unified-header .nav-link:focus,
[data-theme="dark"] .unified-header .btn-contact:focus,
[data-theme="dark"] .unified-header .btn-admin:focus {
  outline-color: #a78bfa;
}
