/* Header Component - Modern Flexible Implementation with Store Logos */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  background-color: var(--color-dark-blue, #081229);
  height: var(--header-height, 80px);
  z-index: 1000;
  box-shadow: 0 2px 20px rgba(8, 18, 41, 0.15);
  transition: all var(--transition-fast, 0.2s ease);
}

.header-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  max-width: var(--container-max-width, 1200px);
  margin: 0 auto;
  padding: 0 var(--container-padding, 20px);
  gap: 2rem;
}

/* Logo Section */
.header-logo {
  display: flex;
  align-items: center;
  height: 100%;
  flex-shrink: 0;
  z-index: 1001;
  transition: transform var(--transition-fast, 0.2s ease);
}

.header-logo:hover {
  transform: scale(1.05);
}

.header-logo:focus-visible {
  outline: 2px solid var(--color-peach, #e27d5a);
  outline-offset: 2px;
  border-radius: 4px;
}

.header-logo img {
  height: 58px;
  width: auto;
  max-width: 200px;
  object-fit: contain;
  object-position: left center;
}

/* Navigation Section */
.header-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2rem;
  height: 100%;
  flex: 1;
  max-width: 400px;
}

.header-nav a {
  font-family: var(--font-secondary, 'Inter', sans-serif);
  font-weight: 400;
  font-size: 16px;
  line-height: 1.5;
  color: var(--color-white, #ffffff);
  text-decoration: none;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  transition: all var(--transition-fast, 0.2s ease);
  position: relative;
  white-space: nowrap;
}

.header-nav a::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 0;
  height: 2px;
  background: var(--color-peach, #e27d5a);
  transition: all var(--transition-fast, 0.2s ease);
  transform: translateX(-50%);
}

.header-nav a:hover {
  color: var(--color-peach, #e27d5a);
  background: rgba(255, 255, 255, 0.05);
}

.header-nav a:hover::after {
  width: 80%;
}

.header-nav a:focus-visible {
  outline: 2px solid var(--color-peach, #e27d5a);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Store Logos Section */
.header-store-logos {
  display: flex;
  align-items: center;
  gap: 1rem;
  height: 100%;
  flex-shrink: 0;
}

.store-logo-link {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  border-radius: 8px;
  transition: all var(--transition-fast, 0.2s ease);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.store-logo-link:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

.store-logo-link:focus-visible {
  outline: 2px solid var(--color-peach, #e27d5a);
  outline-offset: 2px;
}

.store-logo-link:active {
  transform: translateY(0);
}

.store-logo {
  height: 32px;
  width: auto;
  max-width: 120px;
  object-fit: contain;
  transition: all var(--transition-fast, 0.2s ease);
  filter: brightness(1.1) contrast(1.1);
}

.store-logo-link:hover .store-logo {
  filter: brightness(1.2) contrast(1.2);
  transform: scale(1.05);
}

/* Specific styling for each store logo */
.app-store-link {
  min-width: 120px;
  height: 48px;
}

.play-store-link {
  min-width: 120px;
  height: 48px;
}

.app-store-logo,
.play-store-logo {
  max-height: 28px;
}

/* Mobile Navigation Toggle */
.mobile-nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 44px;
  height: 44px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
  transition: all var(--transition-fast, 0.2s ease);
  z-index: 1002;
}

.mobile-nav-toggle:hover {
  background: rgba(255, 255, 255, 0.1);
}

.mobile-nav-toggle:focus-visible {
  outline: 2px solid var(--color-peach, #e27d5a);
  outline-offset: 2px;
}

.hamburger-line {
  width: 24px;
  height: 2px;
  background: var(--color-white, #ffffff);
  border-radius: 1px;
  transition: all var(--transition-normal, 0.3s ease);
  transform-origin: center;
}

.hamburger-line:not(:last-child) {
  margin-bottom: 4px;
}

/* Mobile Navigation Toggle Animation */
.mobile-nav-toggle.active .hamburger-line:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.mobile-nav-toggle.active .hamburger-line:nth-child(2) {
  opacity: 0;
  transform: scaleX(0);
}

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

/* Responsive Design */
@media (max-width: 1200px) {
  .header-container {
    gap: 1.5rem;
  }
  
  .header-nav {
    gap: 1.5rem;
  }
  
  .header-store-logos {
    gap: 0.75rem;
  }
  
  .store-logo-link {
    min-width: 100px;
    height: 44px;
  }
  
  .store-logo {
    height: 28px;
    max-width: 100px;
  }
}

@media (max-width: 1024px) {
  .header-container {
    gap: 1rem;
  }
  
  .header-nav {
    gap: 1rem;
  }
  
  .header-nav a {
    font-size: 15px;
    padding: 0.5rem 0.75rem;
  }
  
  .store-logo-link {
    min-width: 90px;
    height: 40px;
    padding: 6px;
  }
  
  .store-logo {
    height: 24px;
    max-width: 90px;
  }
}

@media (max-width: 768px) {
  :root {
    --header-height: 70px;
  }
  
  .header {
    height: var(--header-height);
  }
  
  .header-logo img {
    height: 48px;
  }
  
  .mobile-nav-toggle {
    display: flex;
  }
  
  .header-nav {
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    background: var(--color-dark-blue, #081229);
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;
    padding: 2rem var(--container-padding, 20px);
    gap: 0;
    max-width: none;
    height: auto;
    max-height: calc(100vh - var(--header-height));
    transform: translateX(-100%);
    transition: transform var(--transition-normal, 0.3s ease);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    overflow-y: auto;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
  }
  
  .header-nav.active {
    transform: translateX(0);
  }
  
  .header-nav a {
    padding: 1rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0;
    font-size: 18px;
    text-align: left;
  }
  
  .header-nav a:last-child {
    border-bottom: none;
  }
  
  .header-nav a::after {
    display: none;
  }
  
  .header-store-logos {
    position: fixed;
    top: calc(var(--header-height) + 200px); /* Position below nav items */
    left: 0;
    right: 0;
    background: var(--color-dark-blue, #081229);
    flex-direction: column;
    padding: 1.5rem var(--container-padding, 20px);
    gap: 1rem;
    height: auto;
    transform: translateX(-100%);
    transition: transform var(--transition-normal, 0.3s ease);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
  }
  
  .header-store-logos.active {
    transform: translateX(0);
  }
  
  .store-logo-link {
    width: 100%;
    height: 56px;
    min-width: auto;
    justify-content: center;
    padding: 12px;
  }
  
  .store-logo {
    height: 32px;
    max-width: 140px;
  }
}

@media (max-width: 480px) {
  .header-container {
    padding: 0 12px;
  }
  
  .header-logo img {
    height: 42px;
  }
  
  .mobile-nav-toggle {
    width: 40px;
    height: 40px;
  }
  
  .hamburger-line {
    width: 20px;
  }
  
  .store-logo-link {
    height: 52px;
    padding: 10px;
  }
  
  .store-logo {
    height: 30px;
    max-width: 130px;
  }
}

/* Loading and Error States */
.store-logo-link.loading {
  pointer-events: none;
  opacity: 0.7;
}

.store-logo-link.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top: 2px solid var(--color-white, #ffffff);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  transform: translate(-50%, -50%);
}

.store-logo.error {
  background: var(--color-dark, #2e2f3e);
  color: var(--color-white, #ffffff);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  text-align: center;
  padding: 4px;
  border-radius: 4px;
}

.store-logo.error::after {
  content: attr(alt);
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .header {
    border-bottom: 2px solid var(--color-white, #ffffff);
  }
  
  .header-nav a,
  .store-logo-link {
    border: 2px solid transparent;
  }
  
  .header-nav a:focus-visible,
  .store-logo-link:focus-visible {
    border-color: var(--color-peach, #e27d5a);
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  .header-logo,
  .header-nav a,
  .store-logo-link,
  .store-logo,
  .mobile-nav-toggle,
  .hamburger-line,
  .header-nav,
  .header-store-logos {
    transition: none;
    animation: none;
  }
  
  .header-nav a::after {
    transition: none;
  }
  
  .store-logo-link:hover .store-logo {
    transform: none;
  }
}

/* Print styles */
@media print {
  .header {
    position: static;
    box-shadow: none;
    background: transparent;
    color: black;
  }
  
  .header-nav a {
    color: black;
  }
  
  .header-store-logos,
  .mobile-nav-toggle {
    display: none;
  }
}

/* Animation keyframes */
@keyframes spin {
  0% { transform: translate(-50%, -50%) rotate(0deg); }
  100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Smooth reveal animation for header elements */
.header-logo,
.header-nav a,
.store-logo-link {
  opacity: 0;
  transform: translateY(-20px);
  animation: fadeInUp 0.6s ease-out forwards;
}

.header-logo {
  animation-delay: 0.1s;
}

.header-nav a:nth-child(1) {
  animation-delay: 0.2s;
}

.header-nav a:nth-child(2) {
  animation-delay: 0.3s;
}

.header-nav a:nth-child(3) {
  animation-delay: 0.4s;
}

.store-logo-link:nth-child(1) {
  animation-delay: 0.5s;
}

.store-logo-link:nth-child(2) {
  animation-delay: 0.6s;
}

@keyframes fadeInUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Disable animations for users who prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
  .header-logo,
  .header-nav a,
  .store-logo-link {
    animation: none;
    opacity: 1;
    transform: none;
  }
}

/* Focus management for accessibility */
.header-nav a:focus-visible,
.store-logo-link:focus-visible,
.mobile-nav-toggle:focus-visible {
  outline: 2px solid var(--color-peach, #e27d5a);
  outline-offset: 2px;
}

/* Prevent body scrolling when menu is open */
body.nav-open {
  overflow: hidden;
}

/* Loading state for store badges */
.store-badge.loading {
  pointer-events: none;
  opacity: 0.7;
}

.store-badge.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top: 2px solid var(--color-white, #ffffff);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  transform: translate(-50%, -50%);
}

@keyframes spin {
  0% { transform: translate(-50%, -50%) rotate(0deg); }
  100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Smooth reveal animation for header elements */
.header-logo,
.header-nav a,
.store-badge {
  opacity: 0;
  transform: translateY(-20px);
  animation: fadeInUp 0.6s ease-out forwards;
}

.header-logo {
  animation-delay: 0.1s;
}

.header-nav a:nth-child(1) {
  animation-delay: 0.2s;
}

.header-nav a:nth-child(2) {
  animation-delay: 0.3s;
}

.header-nav a:nth-child(3) {
  animation-delay: 0.4s;
}

.store-badge:nth-child(1) {
  animation-delay: 0.5s;
}

.store-badge:nth-child(2) {
  animation-delay: 0.6s;
}

@keyframes fadeInUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Disable animations for users who prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
  .header-logo,
  .header-nav a,
  .store-badge {
    animation: none;
    opacity: 1;
    transform: none;
  }
}

/* Loading and Error States */
.store-badge.loading {
  pointer-events: none;
  opacity: 0.7;
}

.store-badge.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top: 2px solid var(--color-white, #ffffff);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  transform: translate(-50%, -50%);
}

.store-badge.error {
  background: var(--color-dark, #2e2f3e);
  color: var(--color-white, #ffffff);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  text-align: center;
  padding: 4px;
  border-radius: 4px;
}

.store-badge.error::after {
  content: attr(alt);
}

/* Prevent body scrolling when menu is open */
body.nav-open {
  overflow: hidden;
}

/* Animation keyframes */
@keyframes spin {
  0% { transform: translate(-50%, -50%) rotate(0deg); }
  100% { transform: translate(-50%, -50%) rotate(360deg); }
}