/* header.css - header */

/* Loading screen */
.loadingOverlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(11, 11, 11, 0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999;
}

.loadingOverlay.loading-complete {
  animation: fadeOut 0.8s ease-in-out forwards;
}

.loadingContent {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100000;
}

.loadingLogo {
  display: block;
  width: 420px;
  /* larger starting size so animation visibly shrinks */
  height: auto;
  transform-origin: center center;
}

/* removed CSS movement animation; JS will drive precise movement to header */

@keyframes fadeOut {
  0% {
    opacity: 1;
    visibility: visible;
  }

  100% {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
  }
}

.header {
  position: fixed;
  /* fixed so it can hide on scroll */
  top: 1rem;
  left: 50%;
  transform: translateX(-50%) translateY(0);
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 1rem;
  width: min(1100px, calc(100% - 2rem));
  max-width: 1100px;
  min-height: 56px;
  margin: 0 auto;
  padding: 8px 14px;
  background-color: rgba(34, 34, 34, 0.55);
  backdrop-filter: blur(6px);
  border-radius: 12px;
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.45);
  z-index: 9999;
  transition: transform 800ms cubic-bezier(.22, .9, .37, 1), opacity 700ms ease;
}

/* nav hidden when scrolling down */
.header--hidden {
  transform: translateX(-50%) translateY(-130%);
  opacity: 0;
  pointer-events: none;
}

.headerLogo {
  height: 2.1rem;
  margin-right: 6px;
}

/* main nav list */
.headerNav {
  margin-left: 8px;
}

.headerNav .headerLinks {
  display: flex;
  gap: 1.25rem;
  align-items: center;
}

.headerNav .headerLinks a {
  color: #fff;
  font-weight: 600;
  letter-spacing: 0.4px;
  opacity: 0.95;
  transition: color 200ms ease, opacity 200ms ease;
}

.headerNav .headerLinks a:hover {
  color: #01D6F5;
  opacity: 1;
}

.headerActions {
  margin-left: auto;
  display: flex;
  gap: 0.6rem;
  align-items: center;
}

/* mobile-only actions are hidden by default and shown only inside the dropdown on small screens */
.headerActionsMobile {
  display: none;
}

/* Generic dropdown container */
.dropdown {
  position: relative;
  display: inline-block;
}

/* Generic dropdown menu (used for language/profile) */
.dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 180px;
  background: rgba(24, 24, 24, 0.95);
  backdrop-filter: blur(8px);
  border-radius: 10px;
  padding: 8px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  z-index: 10000;
}

.dropdown.active .dropdown-menu {
  display: block;
  animation: fadeInDown 0.25s ease;
}

/* Backwards compatibility: keep old classnames working */
.languageSelector {
  position: relative;
  display: inline-block;
}
.languageDropdown {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 180px;
  background: rgba(24, 24, 24, 0.95);
  backdrop-filter: blur(8px);
  border-radius: 10px;
  padding: 8px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  z-index: 10000;
}
.languageSelector.active .languageDropdown {
  display: block;
  animation: fadeInDown 0.25s ease;
}

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }

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

.languageOption {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  padding: 10px 12px;
  color: #fff;
  font-size: 0.95rem;
  font-weight: 500;
  border-radius: 6px;
  cursor: pointer;
  transition: background 150ms ease, color 150ms ease;
}

.languageOption:hover {
  background: rgba(1, 214, 245, 0.15);
  color: #01D6F5;
}

.languageOption.selected {
  background: rgba(1, 214, 245, 0.1);
  color: #01D6F5;
}

.languageOption .flag {
  width: 44px;
  height: 32px; /* 4:3 ratio */
  display: inline-block;
  border-radius: 4px;
  overflow: hidden;
}

/* mobile toggle (hidden on desktop) */
/* visually hide the checkbox but keep it accessible to assistive tech */
.headerToggle {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* label hidden on desktop, becomes visible on small screens */
.headerToggleLabel {
  display: none;
}

.headerToggleLabel span {
  display: block;
  width: 22px;
  height: 2px;
  background: #fff;
  position: relative;
}

.headerToggleLabel span::before,
.headerToggleLabel span::after {
  content: '';
  position: absolute;
  left: 0;
  width: 22px;
  height: 2px;
  background: #fff;
}

.headerToggleLabel span::before {
  top: -6px;
}

.headerToggleLabel span::after {
  top: 6px;
}

/* Button icons (language and profile) */
.btnGlobe,
.btnProfile {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.18);
  cursor: pointer;
  transition: background 200ms ease, transform 200ms ease, border-color 200ms ease;
}

.btnGlobe:hover,
.btnProfile:hover {
  background: rgba(1, 214, 245, 0.15);
  border-color: rgba(1, 214, 245, 0.3);
  transform: scale(1.05);
}

.btnGlobe img,
.btnProfile img {
  width: 28px;
  height: 28px;
  display: block;
  transition: filter 200ms ease;
}

/* Responsive nav */
@media (max-width:800px) {
  /* Consistent flag sizes on mobile */
  .languageOption .flag {
    width: 32px;
    height: 24px; /* 4:3 ratio */
  }

  .header {
    width: calc(100% - 2rem);
    padding: 10px 12px;
    top: 12px;
  }

  .headerLogo {
    height: 2rem;
  }

  /* Right-aligned dropdown (not full width) */
  .headerNav {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 8px;
    left: auto;
    min-width: 220px;
    max-width: calc(100% - 24px);
    background: rgba(24, 24, 24, 0.92);
    border-radius: 8px;
    padding: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  }

  .headerNav .headerLinks {
    flex-direction: column;
    gap: 0.75rem;
  }

  .headerNav .headerLinks a {
    padding: 10px 12px;
    display: block;
    border-radius: 8px;
  }

  .headerToggle {
    display: block;
  }

  /* align the toggle label to the right so it appears on the same side as actions */
  .headerToggleLabel {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    cursor: pointer;
    margin-left: auto;
    background: transparent;
    border-radius: 8px;
  }

  .headerToggle:checked~.headerNav {
    display: block;
  }

  .headerActions {
    display: none;
  }

  /* mobile-only actions placed inside the dropdown */
  .headerActionsMobile {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    align-items: center;
    justify-content: center;
    margin-top: 1rem;
    width: 100%;
  }

  .headerActionsMobile .dropdown {
    flex-shrink: 0;
  }
}

/* ==================== EXTRA SMALL DEVICES (320px) ==================== */
@media (max-width: 320px) {
  .loadingLogo {
    width: 280px;
  }

  .header {
    width: calc(100% - 1rem);
    padding: 6px 10px;
    min-height: 48px;
  }

  .headerLogo {
    height: 1.8rem;
  }

  .headerNav .headerLinks {
    gap: 0.8rem;
  }

  .headerNav .headerLinks a {
    font-size: 13px;
  }

  .btn {
    padding: 8px 12px;
    font-size: 12px;
  }

  .btnGlobe img,
  .btnProfile img {
    width: 18px;
    height: 18px;
  }

  .dropdown-menu {
    min-width: 120px;
    padding: 6px;
  }

  .languageOption {
    padding: 8px;
    font-size: 12px;
  }
}