/* ─── Header shell ───────────────────────────────────────────── */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  /* Default: transparent — becomes glass on scroll */
  background: transparent;
  border-bottom: 1px solid transparent;
  transition: background 0.4s ease, border-color 0.4s ease, box-shadow 0.4s ease;
}

.header--scrolled {
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid rgba(15, 23, 42, 0.07);
  box-shadow: 0 1px 24px rgba(15, 23, 42, 0.07);
}

/* ─── Three-column layout ────────────────────────────────────── */
.header__container {
  position: relative;
  display: flex;
  align-items: center;
  height: 72px;
  padding: 0 var(--spacing-md);
  gap: 0;
}

/* Left: logo */
.header__left {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  flex-shrink: 0;
  z-index: 1;
}

/* Center: nav — absolutely centered regardless of left/right widths */
.header__nav {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: none; /* hidden on mobile */
  align-items: center;
  gap: 0.25rem;
}

/* Right: lang + auth + hamburger */
.header__right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
  flex-shrink: 0;
  z-index: 1;
}

/* ─── New logo ────────────────────────────────────────────────── */
.header__logo {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  transition: transform 0.25s ease;
}

.header__logo:hover {
  transform: scale(1.06) rotate(-3deg);
}

.header__brand {
  font-size: 1.1875rem;
  font-weight: 800;
  color: var(--color-text-primary);
  letter-spacing: -0.03em;
}

/* ─── Desktop nav links ──────────────────────────────────────── */
.header__nav-link {
  display: inline-flex;
  align-items: center;
  height: 36px;
  padding: 0 0.75rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-text-secondary);
  border-radius: var(--radius-sm);
  transition: color 0.18s ease, background 0.18s ease;
  white-space: nowrap;
}

.header__nav-link:hover {
  color: var(--color-text-primary);
  background: rgba(15, 23, 42, 0.05);
}

/* ─── Language dropdown ──────────────────────────────────────── */
.header__lang {
  position: relative;
  flex-shrink: 0;
}

/* Trigger button */
.header__lang-trigger {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  height: 36px;
  padding: 0 0.625rem 0 0.75rem;
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--color-text-primary);
  background: rgba(15, 23, 42, 0.05);
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 0.625rem;
  cursor: pointer;
  letter-spacing: 0.04em;
  transition: background 0.18s ease, border-color 0.18s ease;
  white-space: nowrap;
}

.header__lang-trigger:hover {
  background: rgba(15, 23, 42, 0.08);
  border-color: rgba(15, 23, 42, 0.14);
}

.header__lang-trigger .lang-flag {
  font-size: 1rem;
  line-height: 1;
}

.header__lang-trigger .lang-code {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.header__lang-trigger .lang-chevron {
  width: 14px;
  height: 14px;
  color: var(--color-text-secondary);
  transition: transform 0.22s ease;
  flex-shrink: 0;
}

.header__lang.is-open .header__lang-trigger {
  background: rgba(4, 120, 87, 0.06);
  border-color: rgba(4, 120, 87, 0.2);
  color: var(--color-accent-emerald);
}

.header__lang.is-open .lang-chevron {
  transform: rotate(180deg);
}

/* Dropdown panel */
.header__lang-dropdown {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  min-width: 160px;
  background: #ffffff;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 0.875rem;
  box-shadow: 0 8px 32px rgba(15, 23, 42, 0.12), 0 2px 8px rgba(15, 23, 42, 0.06);
  padding: 0.375rem;
  z-index: 200;
  /* Hidden by default — GSAP controls visibility */
  opacity: 0;
  pointer-events: none;
  transform-origin: top right;
}

.header__lang.is-open .header__lang-dropdown {
  pointer-events: auto;
}

/* Individual option */
.header__lang-option {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.625rem 0.75rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-text-secondary);
  background: transparent;
  border: none;
  border-radius: 0.625rem;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s ease, color 0.15s ease;
  white-space: nowrap;
}

.header__lang-option:hover {
  background: rgba(15, 23, 42, 0.04);
  color: var(--color-text-primary);
}

.header__lang-option.is-active {
  color: var(--color-accent-emerald);
  font-weight: 700;
  background: rgba(4, 120, 87, 0.06);
}

.header__lang-option .lang-flag {
  font-size: 1.125rem;
  line-height: 1;
  flex-shrink: 0;
}

.header__lang-option .lang-label {
  flex: 1;
}

.header__lang-option .lang-check {
  width: 15px;
  height: 15px;
  color: var(--color-accent-emerald);
  opacity: 0;
  flex-shrink: 0;
  transition: opacity 0.15s ease;
}

.header__lang-option.is-active .lang-check {
  opacity: 1;
}

/* ─── Auth buttons (desktop only) ───────────────────────────── */
.header__auth {
  display: none;
  align-items: center;
  gap: 0.5rem;
}

.header__auth .btn {
  height: 36px;
  padding: 0 1rem;
  font-size: 0.8125rem;
}

/* ─── User avatar dropdown (logged-in state) ─────────────────── */
.header__user {
  display: none;   /* shown only when body.is-authed */
  position: relative;
  flex-shrink: 0;
}

.header__user-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  height: 38px;
  padding: 0 0.625rem 0 0.375rem;
  background: transparent;
  border: 1px solid rgba(15, 23, 42, 0.1);
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.header__user-btn:hover {
  background: rgba(15, 23, 42, 0.04);
  border-color: rgba(15, 23, 42, 0.16);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
}

.header__user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, #047857, #059669);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  letter-spacing: 0.02em;
}

.header__user-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-text-primary);
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header__user-chevron {
  width: 14px;
  height: 14px;
  color: var(--color-text-secondary);
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.header__user.is-open .header__user-chevron {
  transform: rotate(180deg);
}

/* User dropdown panel */
.header__user-dropdown {
  position: absolute;
  top: calc(100% + 0.625rem);
  right: 0;
  min-width: 240px;
  background: #ffffff;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 1rem;
  box-shadow: 0 12px 40px rgba(15, 23, 42, 0.12), 0 2px 8px rgba(15, 23, 42, 0.06);
  padding: 0.375rem;
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-6px) scale(0.98);
  transform-origin: top right;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.header__user.is-open .header__user-dropdown {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

/* Profile info block at top */
.header__user-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 0.875rem 0.875rem;
}

.header__user-info-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #047857, #059669);
  color: #fff;
  font-size: 1rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.header__user-info-name {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--color-text-primary);
  line-height: 1.3;
}

.header__user-info-plan {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  margin-top: 0.25rem;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #047857;
  background: rgba(4, 120, 87, 0.1);
  padding: 0.125rem 0.5rem;
  border-radius: 999px;
  border: 1px solid rgba(4, 120, 87, 0.15);
}

/* Divider */
.header__user-divider {
  height: 1px;
  background: rgba(15, 23, 42, 0.07);
  margin: 0.25rem 0;
}

/* Dropdown links */
.header__user-link {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.5625rem 0.875rem;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--color-text-primary);
  border-radius: 0.625rem;
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
  white-space: nowrap;
  width: 100%;
  border: none;
  background: transparent;
  cursor: pointer;
  text-align: left;
  font-family: var(--font-family);
}

.header__user-link:hover {
  background: rgba(15, 23, 42, 0.04);
  color: var(--color-text-primary);
}

.header__user-link--active {
  background: rgba(4, 120, 87, 0.07);
  color: var(--color-accent-emerald);
  font-weight: 600;
}

.header__user-link--active:hover {
  background: rgba(4, 120, 87, 0.1);
}

.header__user-link--danger {
  color: #ef4444;
}

.header__user-link--danger:hover {
  background: rgba(239, 68, 68, 0.06);
  color: #ef4444;
}

.header__user-link svg {
  flex-shrink: 0;
  opacity: 0.7;
}

.header__user-link--active svg,
.header__user-link--danger svg {
  opacity: 1;
}

/* ─── is-authed state: swap auth ↔ user ──────────────────────── */
body.is-authed .header__auth {
  display: none !important;
}

body.is-authed .header__user {
  display: flex;
}

/* On desktop, show the user button */
@media (min-width: 768px) {
  body:not(.is-authed) .header__auth {
    display: flex;
  }
}

/* ─── Hamburger ──────────────────────────────────────────────── */
.header__menu-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  width: 40px;
  height: 40px;
  gap: 5px;
  padding: 0.5rem;
  border-radius: 0.625rem;
  background: transparent;
  border: none;
  cursor: pointer;
  transition: background 0.18s ease;
  flex-shrink: 0;
}

.header__menu-btn:hover {
  background: rgba(15, 23, 42, 0.06);
}

.header__menu-icon {
  height: 2px;
  background: var(--color-text-primary);
  border-radius: var(--radius-full);
  display: block;
  transform-origin: center;
  transition: width 0.22s ease;
}

/* Three asymmetric lines: full / shorter / shortest */
.header__menu-icon--top { width: 20px; }
.header__menu-icon--mid { width: 14px; }
.header__menu-icon--bot { width: 8px; }

.header__menu-btn:hover .header__menu-icon--top { width: 20px; }
.header__menu-btn:hover .header__menu-icon--mid { width: 20px; }
.header__menu-btn:hover .header__menu-icon--bot { width: 20px; }

/* ─── Responsive ─────────────────────────────────────────────── */
@media (min-width: 768px) {
  .header__container {
    padding: 0 var(--spacing-xl);
  }

  .header__nav {
    display: flex;
  }

  .header__auth {
    display: flex;
  }
}

/* ─── Overlay: wrapper ───────────────────────────────────────── */
.overlay-menu {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: none;
  pointer-events: none;
}

.overlay-menu.is-open {
  display: block;
  pointer-events: auto;
}

/* Blurred backdrop */
.overlay-menu__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.38);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  opacity: 0;
  will-change: opacity;
}

/* Side panel sliding from right */
.overlay-menu__panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(380px, 92vw);
  background: #ffffff;
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow-y: auto;
  box-shadow: -8px 0 48px rgba(15, 23, 42, 0.12);
  will-change: transform;
}

/* ─── Panel header ───────────────────────────────────────────── */
.overlay-menu__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem 1.75rem;
  border-bottom: 1px solid rgba(15, 23, 42, 0.07);
  flex-shrink: 0;
}

.overlay-menu__brand {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  text-decoration: none;
}

.overlay-menu__brand span {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--color-text-primary);
  letter-spacing: -0.02em;
}

.overlay-menu__close {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-secondary);
  background: rgba(15, 23, 42, 0.05);
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 50%;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
  flex-shrink: 0;
}

.overlay-menu__close:hover {
  background: rgba(4, 120, 87, 0.08);
  border-color: rgba(4, 120, 87, 0.2);
  color: var(--color-accent-emerald);
  transform: rotate(90deg) scale(1.08);
}

/* ─── Nav links ──────────────────────────────────────────────── */
.overlay-menu__nav {
  display: flex;
  flex-direction: column;
  padding: 1.75rem 1.75rem 1rem;
  gap: 0.25rem;
  flex-shrink: 0;
}

.overlay-menu__link {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.875rem 1rem;
  font-size: 1.375rem;
  font-weight: 600;
  color: rgba(15, 23, 42, 0.45);
  text-decoration: none;
  border-radius: 0.875rem;
  position: relative;
  transition: color 0.2s ease, background 0.2s ease;
  overflow: hidden;
}

.overlay-menu__link::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(4, 120, 87, 0.06), transparent);
  opacity: 0;
  transition: opacity 0.2s ease;
  border-radius: inherit;
}

.overlay-menu__link:hover {
  color: var(--color-text-primary);
}

.overlay-menu__link:hover::before {
  opacity: 1;
}

.overlay-menu__link-num {
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--color-accent-emerald);
  letter-spacing: 0.06em;
  font-variant-numeric: tabular-nums;
  min-width: 22px;
  opacity: 0.6;
}

/* ─── Divider ────────────────────────────────────────────────── */
.overlay-menu__divider {
  height: 1px;
  background: rgba(15, 23, 42, 0.07);
  margin: 0.5rem 1.75rem 1.25rem;
  flex-shrink: 0;
}

/* ─── Contact ────────────────────────────────────────────────── */
.overlay-menu__contact {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0 1.75rem;
  flex-shrink: 0;
}

.overlay-menu__contact-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 0.875rem;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--color-text-secondary);
  text-decoration: none;
  border-radius: 0.75rem;
  transition: color 0.18s ease, background 0.18s ease;
}

.overlay-menu__contact-item:hover {
  color: var(--color-text-primary);
  background: rgba(15, 23, 42, 0.04);
}

.overlay-menu__contact-item svg {
  flex-shrink: 0;
  color: var(--color-accent-emerald);
  opacity: 0.7;
}

/* ─── Socials ────────────────────────────────────────────────── */
.overlay-menu__socials {
  display: flex;
  gap: 0.625rem;
  padding: 1.25rem 1.75rem 0;
  flex-shrink: 0;
}

.overlay-menu__social {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-secondary);
  background: rgba(15, 23, 42, 0.05);
  border: 1px solid rgba(15, 23, 42, 0.07);
  border-radius: 0.625rem;
  text-decoration: none;
  transition: color 0.18s ease, background 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.overlay-menu__social:hover {
  color: var(--color-accent-emerald);
  background: rgba(4, 120, 87, 0.07);
  border-color: rgba(4, 120, 87, 0.18);
  transform: translateY(-2px);
}

/* ─── CTA buttons ────────────────────────────────────────────── */
.overlay-menu__actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1.5rem 1.75rem;
  margin-top: auto;
  flex-shrink: 0;
}

.overlay-menu__btn {
  display: block;
  text-align: center;
  padding: 0.9rem 1.5rem;
  border-radius: 0.875rem;
  font-size: 0.9375rem;
  font-weight: 600;
  text-decoration: none;
  font-family: var(--font-family);
  border: none;
  cursor: pointer;
  width: 100%;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.overlay-menu__btn:active {
  transform: scale(0.97);
}

.overlay-menu__btn--secondary {
  color: var(--color-text-secondary);
  background: rgba(15, 23, 42, 0.05);
  border: 1px solid rgba(15, 23, 42, 0.1);
}

.overlay-menu__btn--secondary:hover {
  background: rgba(15, 23, 42, 0.09);
  color: var(--color-text-primary);
}

.overlay-menu__btn--primary {
  color: #ffffff;
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  box-shadow: 0 4px 16px rgba(4, 120, 87, 0.35);
}

.overlay-menu__btn--primary:hover {
  box-shadow: 0 6px 24px rgba(4, 120, 87, 0.5);
}

@media (min-width: 768px) {
  .header__container {
    padding: 0 var(--spacing-xl);
  }

  .header__right {
    display: flex;
  }
}
