/**
 * Site Header Styles
 * Unified navigation bar with Home button and language selector
 */

/* Aggressively remove all focus/active outlines and underlines on mouse click */
.site-header *:focus:not(:focus-visible) {
  outline: none !important;
  box-shadow: none !important;
  text-decoration: none !important;
}

.site-header a,
.site-header button {
  text-decoration: none !important;
}

.site-header a:focus,
.site-header a:active,
.site-header a:hover,
.site-header button:focus,
.site-header button:active,
.site-header button:hover {
  outline: none !important;
  text-decoration: none !important;
  box-shadow: none !important;
}

/* Specifically target language selector and nav elements */
.site-header nav:focus,
.site-header nav:active {
  outline: none !important;
  box-shadow: none !important;
}

.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  padding: 0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  width: 100%;
  overflow-x: hidden;
}

.site-header-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--spacing-md) var(--spacing-xl);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--spacing-2xl);
  width: 100%;
}

/* Right side controls container */
.header-controls {
  display: flex;
  align-items: center;
  gap: var(--spacing-2xl);
}

/* Site Navigation */
.site-nav {
  display: flex;
  align-items: center;
  gap: var(--spacing-2);
  flex-shrink: 0;
  position: relative;
}

/* Remove separator */
.site-nav::after {
  display: none;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-6);
  padding: var(--spacing-sm) var(--spacing-lg);
  text-decoration: none !important;
  color: var(--color-text-secondary, #6c757d);
  background: transparent;
  border: none;
  border-radius: var(--radius-full, 50px);
  font-family: 'Fredoka', -apple-system, BlinkMacSystemFont, sans-serif;
  font-weight: 500;
  font-size: 0.95em;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  outline: none !important;
  white-space: nowrap;
  position: relative;
  letter-spacing: 0.02em;
}

.nav-icon {
  font-size: 1.1em;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.1));
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-link:hover .nav-icon {
  transform: scale(1.1) rotate(-5deg);
}

.nav-link.active .nav-icon {
  transform: scale(1.05);
  filter: drop-shadow(0 2px 4px rgba(0, 123, 255, 0.3));
}

.nav-link:hover,
.nav-link:focus,
.nav-link:active {
  text-decoration: none !important;
  outline: none !important;
}

.nav-link:hover {
  color: var(--color-text-primary, #212529);
  background: rgba(0, 0, 0, 0.04);
  transform: translateY(-1px);
}

/* Active/current page indicator */
.nav-link.active {
  color: var(--color-bg-primary, #fff);
  background: var(--color-accent, #007bff);
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(0, 123, 255, 0.25),
              0 1px 3px rgba(0, 0, 0, 0.1);
}

.nav-link.active:hover {
  background: var(--color-accent, #007bff);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3),
              0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Only show focus outline for keyboard navigation */
.nav-link:focus-visible {
  outline: 2px solid var(--color-accent, #007bff) !important;
  outline-offset: 2px;
}

.nav-link:active {
  transform: translateY(0);
  outline: none !important;
}

.nav-icon {
  font-size: 1.1em;
  line-height: 1;
}

.nav-text {
  font-size: 0.95em;
}

/* Language Selector Integration */
.site-header .language-selector {
  background: transparent;
  border: none;
  padding: 0;
  margin: 0;
  display: flex;
  align-items: center;
  gap: var(--spacing-2);
}

.site-header .language-selector .globe-icon {
  font-size: 1em;
  margin-right: 0;
  color: var(--color-text-secondary);
}

.site-header .language-selector .lang-link {
  text-decoration: none;
  color: var(--color-text-secondary);
  padding: var(--spacing-xs) var(--spacing-md);
  border-radius: var(--radius-full);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  font-weight: var(--font-weight-medium);
  font-size: 0.85em;
  background: transparent;
  border: none;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.site-header .language-selector .lang-link:hover:not(.active) {
  background-color: rgba(0, 0, 0, 0.04);
  color: var(--color-text-primary);
  transform: translateY(-1px);
}

.site-header .language-selector .lang-link.active {
  background-color: rgba(0, 123, 255, 0.1);
  color: var(--color-accent);
  font-weight: var(--font-weight-semibold);
  cursor: default;
}

.site-header .language-selector .lang-link:focus-visible {
  outline: 2px solid var(--color-border-focus);
  outline-offset: 2px;
}

.site-header .language-selector .separator {
  display: none;
}

/* Theme Toggle Button */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  font-size: 1.1em;
  outline: none !important;
  color: var(--color-text-secondary);
}

.theme-toggle:hover,
.theme-toggle:focus,
.theme-toggle:active {
  outline: none !important;
}

.theme-toggle:hover {
  background: rgba(0, 0, 0, 0.04);
  color: var(--color-text-primary);
  transform: translateY(-1px);
}

/* Only show focus outline for keyboard navigation */
.theme-toggle:focus-visible {
  outline: 2px solid var(--color-accent, #007bff) !important;
  outline-offset: 2px;
}

.theme-toggle:active {
  transform: translateY(0) scale(0.95);
  outline: none !important;
}

.theme-toggle.toggling .theme-icon {
  animation: themeToggleRotate 0.5s ease-out;
}

@keyframes themeToggleRotate {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(180deg);
  }
}

.theme-icon {
  display: inline-block;
  line-height: 1;
  transition: transform 0.25s ease-out;
}

.theme-icon[hidden] {
  display: none;
}

.theme-toggle:hover .theme-icon {
  transform: scale(1.1);
}

/* Responsive Design */
@media (max-width: 600px) {
  .site-header-content {
    padding: var(--spacing-sm) var(--spacing-md);
    gap: var(--spacing-md);
    flex-wrap: nowrap;
  }

  .site-nav {
    gap: var(--spacing-1);
    flex-shrink: 1;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
  }

  .site-nav::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
  }

  .header-controls {
    gap: var(--spacing-xs);
    flex-shrink: 0;
  }

  /* Ensure nav links meet minimum touch target size (44x44px) */
  .nav-link {
    padding: var(--spacing-sm);
    min-width: 40px;
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.85em;
  }

  /* Mobile tap feedback - subtle scale on active */
  .nav-link:active {
    transform: scale(0.92);
  }

  .nav-text {
    display: none; /* Hide text on mobile, show only icon */
  }

  .nav-icon {
    font-size: 1.3em;
  }

  .site-header .language-selector .globe-icon {
    display: none; /* Hide globe icon on mobile */
  }

  /* Ensure language links meet minimum touch target size */
  .site-header .language-selector .lang-link {
    padding: var(--spacing-xs) var(--spacing-sm);
    font-size: 0.75em;
    min-width: 32px;
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  /* Mobile tap feedback for language links */
  .site-header .language-selector .lang-link:active:not(.active) {
    transform: scale(0.92);
  }

  /* Ensure theme toggle meets minimum touch target size */
  .theme-toggle {
    width: 40px;
    height: 40px;
    font-size: 1em;
    flex-shrink: 0;
  }

  /* Mobile tap feedback for theme toggle */
  .theme-toggle:active {
    transform: scale(0.92);
  }
}

/* Tablet optimizations */
@media (min-width: 601px) and (max-width: 768px) {
  .site-header-content {
    gap: var(--spacing-lg);
    padding: var(--spacing-sm) var(--spacing-lg);
  }

  .site-nav {
    gap: var(--spacing-xs);
  }

  .header-controls {
    gap: var(--spacing-sm);
  }

  /* Ensure adequate touch targets on tablets */
  .nav-link {
    min-width: 40px;
    min-height: 40px;
    padding: var(--spacing-sm) var(--spacing-md);
  }

  .site-header .language-selector .lang-link {
    min-width: 36px;
    min-height: 40px;
  }

  .theme-toggle {
    min-width: 40px;
    min-height: 40px;
  }

  /* Tablet tap feedback */
  .nav-link:active {
    transform: scale(0.95);
  }

  .site-header .language-selector .lang-link:active:not(.active) {
    transform: scale(0.95);
  }

  .theme-toggle:active {
    transform: scale(0.95);
  }
}

/* Print Styles */
@media print {
  .site-header {
    display: none; /* Hide navigation in print */
  }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
  .site-header {
    background: rgba(26, 32, 44, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  }

  .nav-link {
    color: rgba(255, 255, 255, 0.7);
  }

  .nav-link:hover {
    color: rgba(255, 255, 255, 0.95);
    background: rgba(255, 255, 255, 0.08);
  }

  .nav-link.active {
    color: #90cdf4;
    background: rgba(66, 153, 225, 0.2);
    box-shadow: 0 0 0 1px rgba(66, 153, 225, 0.3);
  }

  .nav-link.active:hover {
    background: rgba(66, 153, 225, 0.25);
    box-shadow: 0 0 0 1px rgba(66, 153, 225, 0.4), 0 4px 12px rgba(66, 153, 225, 0.2);
  }

  /* Language Selector Dark Mode */
  .site-header .language-selector .globe-icon {
    color: rgba(255, 255, 255, 0.6);
  }

  .site-header .language-selector .lang-link {
    color: rgba(255, 255, 255, 0.7);
  }

  .site-header .language-selector .lang-link:hover:not(.active) {
    background-color: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.95);
  }

  .site-header .language-selector .lang-link.active {
    color: #90cdf4;
    background: rgba(66, 153, 225, 0.2);
    box-shadow: 0 0 0 1px rgba(66, 153, 225, 0.3);
  }

  /* Theme Toggle Dark Mode */
  .theme-toggle {
    color: rgba(255, 255, 255, 0.7);
  }

  .theme-toggle:hover {
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.95);
  }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
  .site-header {
    background: #fff;
    border-bottom: 2px solid #000;
  }

  .nav-link {
    border: 2px solid #000;
  }

  .nav-link:hover {
    background: #000;
    color: #fff;
  }

  .nav-link.active {
    background: #000;
    color: #fff;
    border: 2px solid #000;
  }
}
