/* ========== Unified Header Styles ========== */

/* Reset and Base */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* Sticky Header */
.navbar {
  position: sticky;
  top: 0;
  z-index: 1000;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  width: 100%;
}

/* Light mode - solid white background with gray border */
[data-theme="light"] .navbar,
html:not([data-theme]) .navbar {
  background: #ffffff !important;
  border-bottom: 1px solid #d1d5db !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Dark mode - solid dark background with dark border */
[data-theme="dark"] .navbar {
  background: #000000 !important;
  border-bottom: 1px solid #374151 !important;
  box-shadow: 0 1px 3px rgba(255, 255, 255, 0.1);
}

/* Header Container */
.navbar-container {
  width: 100%;
  padding: 0 2rem;
  height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Left Section - Logo */
.navbar-left {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
}

.logo-link {
  display: flex;
  align-items: center;
  text-decoration: none;
  outline: none;
  cursor: pointer;
  transition: transform 0.3s ease, opacity 0.3s ease;
  position: relative;
}

.logo-link:hover {
  transform: scale(1.05);
  opacity: 0.9;
}

.logo-link:active {
  transform: scale(0.98);
}

/* Tooltip on hover */
.logo-link::after {
  content: 'Home';
  position: absolute;
  bottom: -25px;
  left: 50%;
  transform: translateX(-50%) scale(0);
  background: var(--primary, #059669);
  color: white;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: all 0.3s ease;
}

.logo-link:hover::after {
  transform: translateX(-50%) scale(1);
  opacity: 1;
}

/* Clean Navbar Logo Styling - No Contours, No Filters */
.navbar-logo {
  height: 90px;
  width: auto;
  object-fit: contain;
  display: block;
  max-width: 360px;
  /* Completely clean rendering */
  filter: none !important;
  opacity: 1 !important;
  transition: transform 0.3s ease;
  /* Crisp image rendering */
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* Remove all borders and outlines */
  border-radius: 0 !important;
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  background: transparent !important;
  padding: 0 !important;
  margin: 0 !important;
  /* Hardware acceleration for smooth rendering */
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
  /* Ensure the logo is always visible */
  min-height: 50px;
  pointer-events: none; /* Let the parent link handle clicks */
}

/* Logo theme styling - COMPLETELY NATURAL APPEARANCE across all themes */
.navbar-logo,
[data-theme="light"] .navbar-logo,
[data-theme="dark"] .navbar-logo,
html:not([data-theme]) .navbar-logo,
.navbar [data-theme="light"] .navbar-logo,
.navbar [data-theme="dark"] .navbar-logo,
.navbar .navbar-logo {
  /* Absolute no filters - use original logo colors */
  filter: none !important;
  opacity: 1 !important;
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  background: transparent !important;
}

/* Clean hover effect - no filter artifacts */
.logo-link:hover .navbar-logo {
  filter: none !important;
  opacity: 1 !important;
  transform: scale(1.02) translateZ(0) !important;
  transition: transform 0.3s ease !important;
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
}

/* Make sure the link wrapper handles all interactions */
.logo-link {
  pointer-events: auto;
  z-index: 10;
}

/* Center Section - Navigation */
.navbar-center {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
  justify-content: center;
}

.nav-link {
  position: relative;
  padding: 0.5rem 1rem;
  color: var(--text-primary, #111827);
  text-decoration: none;
  font-weight: 500;
  font-size: 1.1rem;
  border-radius: 8px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
}

/* Ensure strong contrast in light mode - use very dark text */
[data-theme="light"] .nav-link,
html:not([data-theme]) .nav-link {
  color: #000000 !important;
  font-weight: 600;
  opacity: 0.9;
}

/* Dark theme - light text */
[data-theme="dark"] .nav-link {
  color: #f3f4f6 !important;
  font-weight: 500;
}

.nav-link::before {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 0;
  height: 2px;
  background: var(--primary, #059669);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  transform: translateX(-50%);
}

.nav-link:hover {
  color: var(--primary, #059669) !important;
  background: rgba(5, 150, 105, 0.05);
  opacity: 1;
}

.nav-link:hover::before {
  width: calc(100% - 2rem);
}

.nav-link.active {
  color: var(--primary, #059669) !important;
  background: rgba(5, 150, 105, 0.1);
  font-weight: 600;
}

.nav-link.active::before {
  width: calc(100% - 2rem);
}

/* Right Section - Controls */
.navbar-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 0 0 auto;
}

/* Language Toggle Button */
.language-toggle {
  padding: 0.5rem 1rem;
  background: transparent;
  border: 2px solid var(--border, #e5e7eb);
  color: var(--text-primary, #111827);
  border-radius: 8px;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  min-width: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 36px;
}

/* Strong contrast in light mode */
[data-theme="light"] .language-toggle,
html:not([data-theme]) .language-toggle {
  color: #000000 !important;
  border-color: #6b7280;
  font-weight: 600;
}

/* Dark theme */
[data-theme="dark"] .language-toggle {
  color: #f3f4f6 !important;
  border-color: #374151;
}

.language-toggle:hover {
  background: var(--primary, #059669);
  border-color: var(--primary, #059669);
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(5, 150, 105, 0.2);
}

.language-toggle:active {
  transform: translateY(0);
}

/* Theme Toggle Button */
.theme-toggle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: transparent;
  border: 2px solid var(--border, #e5e7eb);
  color: var(--text-primary, #111827);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

/* Strong contrast in light mode */
[data-theme="light"] .theme-toggle,
html:not([data-theme]) .theme-toggle {
  color: #000000 !important;
  border-color: #6b7280;
}

/* Dark theme */
[data-theme="dark"] .theme-toggle {
  color: #f3f4f6 !important;
  border-color: #374151;
}

.theme-toggle::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: var(--primary, #059669);
  transform: translate(-50%, -50%);
  transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: -1;
}

.theme-toggle:hover {
  border-color: var(--primary, #059669);
  color: var(--primary, #059669);
  transform: rotate(180deg);
}

.theme-toggle:hover::before {
  width: 100%;
  height: 100%;
}

.theme-toggle:hover .theme-icon {
  color: white;
}

.theme-icon {
  width: 20px;
  height: 20px;
  transition: all 0.3s ease;
  position: absolute;
}

.sun-icon {
  display: none;
}

.moon-icon {
  display: block;
}

[data-theme="dark"] .sun-icon {
  display: block;
}

[data-theme="dark"] .moon-icon {
  display: none;
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
  display: none;
  width: 40px;
  height: 40px;
  background: transparent;
  border: 2px solid var(--border, #e5e7eb);
  border-radius: 8px;
  cursor: pointer;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Light theme */
[data-theme="light"] .mobile-menu-toggle,
html:not([data-theme]) .mobile-menu-toggle {
  border-color: #6b7280;
}

/* Dark theme */
[data-theme="dark"] .mobile-menu-toggle {
  border-color: #374151;
}

.hamburger-line {
  width: 20px;
  height: 2px;
  background: var(--text-primary, #111827);
  border-radius: 2px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Strong contrast in light mode */
[data-theme="light"] .hamburger-line,
html:not([data-theme]) .hamburger-line {
  background: #000000;
}

/* Dark theme */
[data-theme="dark"] .hamburger-line {
  background: #f3f4f6;
}

.mobile-menu-toggle:hover {
  background: rgba(5, 150, 105, 0.05);
  border-color: var(--primary, #059669);
}

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

.mobile-menu-toggle.active .hamburger-line:nth-child(2) {
  opacity: 0;
  transform: translateX(-10px);
}

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

/* Mobile Navigation Menu */
.mobile-nav {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  max-height: 0;
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Light mode mobile nav */
[data-theme="light"] .mobile-nav,
html:not([data-theme]) .mobile-nav {
  background: #ffffff;
  border-bottom: 1px solid #d1d5db;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

.mobile-nav.active {
  max-height: 400px;
  padding: 1rem 0;
}

.mobile-nav-link {
  display: block;
  padding: 0.75rem 2rem;
  color: var(--text-primary, #111827);
  text-decoration: none;
  font-weight: 500;
  transition: all 0.3s ease;
  position: relative;
}

/* Strong contrast in light mode */
[data-theme="light"] .mobile-nav-link,
html:not([data-theme]) .mobile-nav-link {
  color: #000000 !important;
  font-weight: 600;
}

/* Dark theme */
[data-theme="dark"] .mobile-nav-link {
  color: #f3f4f6 !important;
  font-weight: 500;
}

.mobile-nav-link::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  width: 3px;
  height: 0;
  background: var(--primary, #059669);
  transform: translateY(-50%);
  transition: height 0.3s ease;
}

.mobile-nav-link:hover {
  background: rgba(5, 150, 105, 0.05);
  color: var(--primary, #059669);
  padding-left: 2.5rem;
}

.mobile-nav-link:hover::before {
  height: 60%;
}

.mobile-nav-link.active {
  background: rgba(5, 150, 105, 0.1);
  color: var(--primary, #059669);
  font-weight: 600;
}

.mobile-nav-link.active::before {
  height: 60%;
}

/* Responsive Design */
@media (max-width: 968px) {
  .navbar-container {
    padding: 0 1.5rem;
  }
  
  .navbar-center {
    display: none;
  }
  
  .mobile-menu-toggle {
    display: flex;
  }
  
  .mobile-nav {
    display: block;
  }
  
  .navbar-logo {
    height: 75px;
  }
  
  .logo-link:active .navbar-logo {
    transform: scale(0.95);
  }
  
  .navbar-right {
    gap: 0.6rem;
  }
}

@media (max-width: 640px) {
  .navbar-container {
    padding: 0 1rem;
    height: 75px;
  }
  
  .navbar-logo {
    height: 65px;
  }
  
  .language-toggle {
    padding: 0.4rem 0.8rem;
    font-size: 0.9rem;
    min-width: 45px;
    height: 32px;
  }
  
  .theme-toggle {
    width: 36px;
    height: 36px;
  }
  
  .mobile-menu-toggle {
    width: 36px;
    height: 36px;
  }
  
  .navbar-right {
    gap: 0.5rem;
  }
}

@media (max-width: 480px) {
  .navbar-container {
    padding: 0 0.75rem;
    height: 70px;
  }
  
  .navbar-logo {
    height: 60px;
  }
  
  .language-toggle {
    padding: 0.5rem 0.8rem;
    font-size: 0.9rem;
    min-width: 44px;
    min-height: 44px;
  }
  
  .theme-toggle {
    width: 44px;
    height: 44px;
  }
  
  .mobile-menu-toggle {
    width: 44px;
    height: 44px;
  }
  
  .hamburger-line {
    width: 16px;
    height: 2px;
  }
  
  .navbar-right {
    gap: 0.4rem;
  }
  
  .mobile-nav-link {
    padding: 0.875rem 1.5rem;
    font-size: 1rem;
    min-height: 48px;
    display: flex;
    align-items: center;
  }
  
  .theme-icon {
    width: 16px;
    height: 16px;
  }
}

/* Smooth Scrolling */
html {
  scroll-behavior: smooth;
}

/* Focus Styles for Accessibility */
.nav-link:focus-visible,
.language-toggle:focus-visible,
.theme-toggle:focus-visible,
.mobile-menu-toggle:focus-visible {
  outline: 2px solid var(--primary, #059669);
  outline-offset: 2px;
}

.logo-link:focus-visible {
  outline: 2px solid var(--primary, #059669);
  outline-offset: 4px;
  border-radius: 8px;
}

/* Animation Classes */
@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.navbar {
  animation: slideDown 0.3s ease-out;
}

/* Dark mode mobile nav */
[data-theme="dark"] .mobile-nav {
  background: #000000;
  border-bottom: 1px solid #374151;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
}

/* Print Styles */
@media print {
  .navbar {
    position: static;
    border-bottom: 1px solid #000;
  }
  
  .language-toggle,
  .theme-toggle,
  .mobile-menu-toggle {
    display: none;
  }
}