/* ═══════════════════════════════════════════════
 * AME Custom Theme - header.css
 * Top bar + glass navbar + mega menus (desktop)
 *
 * @package AME_Custom
 * @version 1.0.0
 * ═══════════════════════════════════════════════ */

/* ── TOP BAR ────────────────────────────────────── */
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1001;
  height: var(--topbar-height);
  background: var(--ame-bleu-nuit);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.topbar__inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  max-width: var(--max-width);
  width: 100%;
  padding: 0 24px;
  position: relative;
}

.topbar__text {
  font-size: 13px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.9);
  white-space: nowrap;
}

.topbar__highlight {
  color: var(--ame-lime);
  font-weight: 700;
}

.topbar__sep {
  display: inline-block;
  width: 1px;
  height: 14px;
  background: rgba(255, 255, 255, 0.25);
  margin: 0 10px;
  vertical-align: middle;
}

.topbar__cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 16px;
  background: var(--ame-lime);
  color: var(--ame-bleu-nuit);
  font-size: 12px;
  font-weight: 700;
  border-radius: var(--radius-pill);
  white-space: nowrap;
  transition: background 0.25s var(--ease-out), transform 0.25s var(--ease-out);
}

.topbar__cta:hover {
  background: #d4ff99;
  transform: translateY(-1px);
}

.topbar__close {
  position: absolute;
  right: 24px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  color: rgba(255, 255, 255, 0.5);
  transition: color 0.2s ease, background 0.2s ease;
}

.topbar__close:hover {
  color: var(--ame-blanc);
  background: rgba(255, 255, 255, 0.1);
}

/* ── HEADER / NAVBAR ────────────────────────────── */
.site-header {
  position: fixed;
  top: var(--topbar-height);
  left: 0;
  right: 0;
  z-index: 1000;
  height: var(--header-height);
  background: rgba(255, 255, 255, 0.65);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border-bottom: 1px solid var(--ame-border);
  transition: top 0.3s var(--ease-out), box-shadow 0.3s ease;
}

.topbar-closed .site-header {
  top: 0;
}

.header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: var(--max-width);
  height: 100%;
  margin: 0 auto;
  padding: 0 32px;
}

/* ── Logo ─────────────────────────────────────── */
.header__logo {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  transition: opacity 0.2s ease;
}

.header__logo:hover {
  opacity: 0.8;
}

.header__logo img {
  height: 40px;
  width: auto;
}

/* ── Desktop Nav ──────────────────────────────── */
.header__nav {
  display: flex;
  align-items: center;
}

.nav-list {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav-item {
  position: relative;
  /* Extend hover zone downward to bridge gap to mega menu panel */
  padding-bottom: 16px;
  margin-bottom: -16px;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 8px 18px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ame-bleu-nuit);
  border-radius: var(--radius-sm);
  transition: background 0.2s ease, color 0.2s ease;
  cursor: pointer;
}

.nav-link:hover,
.nav-link[aria-expanded="true"] {
  background: rgba(212, 194, 252, 0.15);
  color: var(--ame-lavande);
}

.nav-chevron {
  transition: transform 0.3s var(--ease-out);
}

.nav-link[aria-expanded="true"] .nav-chevron {
  transform: rotate(180deg);
}

/* ── Right Actions ────────────────────────────── */
.header__actions {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
}

.header__phone {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  transition: opacity 0.2s ease;
}

.header__phone:hover {
  opacity: 0.7;
}

.header__phone-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--ame-lavande-clair);
  color: var(--ame-bleu-nuit);
  flex-shrink: 0;
}

.header__phone-number {
  font-size: 14px;
  font-weight: 600;
  color: var(--ame-bleu-nuit);
  white-space: nowrap;
}

.header__cta {
  padding: 10px 24px;
  font-size: 13px;
  font-weight: 700;
  border-radius: var(--radius-pill);
  white-space: nowrap;
}

/* ── OVERLAY ────────────────────────────────────── */
.mega-overlay {
  position: fixed;
  inset: 0;
  z-index: 999;
  background: rgba(28, 33, 67, 0.12);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
}

.mega-overlay.is-active {
  opacity: 1;
  pointer-events: auto;
}

/* ═══════════════════════════════════════════════
 * MEGA MENUS — Shared Styles
 * ═══════════════════════════════════════════════ */
.mega-menu {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: var(--max-width);
  background: #fff;
  border: 1px solid var(--ame-border);
  border-top: none;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  box-shadow:
    0 12px 40px rgba(28, 33, 67, 0.10),
    0 4px 16px rgba(28, 33, 67, 0.05);
  padding: 32px;
  opacity: 0;
  pointer-events: none;
  will-change: opacity;
  transition: opacity 0.18s ease;
}

.mega-menu[hidden] {
  display: block; /* Keep in DOM so transition works */
}

.mega-menu.is-open {
  opacity: 1;
  pointer-events: auto;
}

/* ── Mega Menu Inner Grids ──────────────────────── */
.mega-menu__inner {
  display: grid;
  gap: 32px;
}

.mega-menu__inner--assurances {
  grid-template-columns: 280px 1fr 1fr;
}

.mega-menu__inner--financements {
  grid-template-columns: 280px 1fr 280px;
}

.mega-menu__inner--ressources {
  grid-template-columns: 300px 1fr 280px;
}

/* ── Column Titles ──────────────────────────────── */
.mega-menu__col-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--ame-lavande);
  padding-bottom: 10px;
  margin-bottom: 16px;
  border-bottom: 2px solid var(--ame-lavande-clair);
}

/* ── Links ──────────────────────────────────────── */
.mega-menu__links {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.mega-menu__link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition:
    background 0.2s ease,
    transform 0.2s var(--ease-out);
}

.mega-menu__link:hover {
  background: rgba(212, 194, 252, 0.2);
  transform: translateX(4px);
}

.mega-menu__link-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, #f5f5f0, #ebebeb);
  font-size: 18px;
  flex-shrink: 0;
  transition: background 0.2s ease;
}

.mega-menu__link:hover .mega-menu__link-icon {
  background: linear-gradient(135deg, var(--ame-lavande-clair), var(--ame-lavande));
}

.mega-menu__link-content {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.mega-menu__link-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--ame-bleu-nuit);
  line-height: 1.3;
}

.mega-menu__link-desc {
  font-size: 12px;
  color: #888;
  line-height: 1.3;
}

/* ── Compact Links (Ressources) ─────────────────── */
.mega-menu__link--compact {
  padding: 8px 12px;
  gap: 8px;
}

.mega-menu__link--compact .mega-menu__link-content {
  flex-direction: row;
  align-items: center;
  gap: 8px;
}

.mega-menu__link--compact .mega-menu__link-label {
  font-size: 13px;
  font-weight: 600;
}

.mega-menu__link--all .mega-menu__link-label {
  color: var(--ame-lavande);
}

.mega-menu__link-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 1px 8px;
  background: var(--ame-lavande-clair);
  color: var(--ame-bleu-nuit);
  font-size: 11px;
  font-weight: 700;
  border-radius: var(--radius-pill);
  margin-left: auto;
}

/* ── Split Column (Ressources col 2) ────────────── */
.mega-menu__col--split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
}

.mega-menu__subcol {
  display: flex;
  flex-direction: column;
}

/* ═══════════════════════════════════════════════
 * PROMO CARDS (Column 1)
 * ═══════════════════════════════════════════════ */
.mega-menu__promo {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 28px 24px;
  border-radius: var(--radius-md);
  overflow: hidden;
  min-height: 280px;
}

/* Dark promo (Assurances) */
.mega-menu__promo--dark {
  background: linear-gradient(160deg, #1C2143 0%, #2a3060 50%, #1C2143 100%);
  color: var(--ame-blanc);
}

/* Lime promo (Financements) */
.mega-menu__promo--lime {
  background: linear-gradient(160deg, var(--ame-lime) 0%, #a8e85c 50%, #d4ff99 100%);
  color: var(--ame-bleu-nuit);
}

/* Lavender promo (Ressources) */
.mega-menu__promo--lavender {
  background: linear-gradient(160deg, var(--ame-lavande-clair) 0%, var(--ame-lavande) 100%);
  color: var(--ame-blanc);
}

.mega-menu__promo-badge {
  display: inline-block;
  align-self: flex-start;
  padding: 4px 12px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.15);
  color: rgba(255, 255, 255, 0.9);
  margin-bottom: 16px;
}

.mega-menu__promo-badge--dark {
  background: rgba(28, 33, 67, 0.12);
  color: var(--ame-bleu-nuit);
}

.mega-menu__promo-title {
  font-size: 22px;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 8px;
}

.mega-menu__promo-title--dark {
  color: var(--ame-bleu-nuit);
}

.mega-menu__promo-accent {
  color: var(--ame-lime);
  font-size: 28px;
}

.mega-menu__promo-text {
  font-size: 13px;
  line-height: 1.5;
  opacity: 0.8;
  margin-bottom: 20px;
}

.mega-menu__promo-text--dark {
  color: var(--ame-bleu-nuit);
  opacity: 0.7;
}

.mega-menu__promo-cta {
  align-self: flex-start;
  padding: 10px 20px;
  font-size: 12px;
  font-weight: 700;
  border-radius: var(--radius-pill);
  white-space: nowrap;
}

/* ── Google Stars Badge ─────────────────────────── */
.mega-menu__promo-stars {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.mega-menu__stars {
  display: flex;
  gap: 2px;
}

.mega-menu__stars-label {
  font-size: 12px;
  font-weight: 600;
  opacity: 0.8;
}

/* ═══════════════════════════════════════════════
 * STATS CARD (Financements col 3)
 * ═══════════════════════════════════════════════ */
.mega-menu__stats {
  display: flex;
  align-items: stretch;
}

.mega-menu__stats-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 20px;
  width: 100%;
  padding: 28px 24px;
  background: var(--ame-fond-card);
  border-radius: var(--radius-md);
  border: 1px solid var(--ame-border);
}

.mega-menu__stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: center;
}

.mega-menu__stat-value {
  font-size: 32px;
  font-weight: 900;
  color: var(--ame-bleu-nuit);
  line-height: 1;
  letter-spacing: -1px;
}

.mega-menu__stat-value--lime {
  color: #5a8a1a; /* Darker lime for readability on light bg */
}

.mega-menu__stat-label {
  font-size: 12px;
  color: #888;
  line-height: 1.4;
}

.mega-menu__stat-divider {
  height: 1px;
  background: var(--ame-border);
}

/* ═══════════════════════════════════════════════
 * FEATURED ARTICLE (Ressources col 3)
 * ═══════════════════════════════════════════════ */
.mega-menu__featured {
  display: flex;
  align-items: stretch;
}

.mega-menu__featured-card {
  display: flex;
  flex-direction: column;
  width: 100%;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--ame-border);
  background: var(--ame-blanc);
  transition: box-shadow 0.3s ease, transform 0.3s var(--ease-out);
}

.mega-menu__featured-card:hover {
  box-shadow: 0 8px 24px rgba(28, 33, 67, 0.08);
  transform: translateY(-2px);
}

.mega-menu__featured-img {
  position: relative;
  height: 140px;
  overflow: hidden;
  background: linear-gradient(135deg, var(--ame-lavande-clair) 0%, var(--ame-lavande) 100%);
}

.mega-menu__featured-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.mega-menu__featured-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  padding: 4px 10px;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--ame-bleu-nuit);
  background: var(--ame-lime);
  border-radius: var(--radius-pill);
}

.mega-menu__featured-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.mega-menu__featured-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--ame-bleu-nuit);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.mega-menu__featured-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 700;
  color: var(--ame-lavande);
  margin-top: auto;
  transition: color 0.2s ease, gap 0.2s var(--ease-out);
}

.mega-menu__featured-link:hover {
  color: var(--ame-bleu-nuit);
  gap: 8px;
}

/* ═══════════════════════════════════════════════
 * BODY OFFSET
 * Push page content below fixed header + topbar
 * ═══════════════════════════════════════════════ */
body {
  padding-top: calc(var(--topbar-height) + var(--header-height));
}

body.topbar-closed {
  padding-top: var(--header-height);
}

/* ═══════════════════════════════════════════════
 * RESPONSIVE — Hide desktop nav on mobile
 * (Mobile menu handled in header-mobile.css)
 * ═══════════════════════════════════════════════ */
@media (max-width: 1023px) {
  .header__nav,
  .header__phone,
  .header__cta,
  .mega-menu,
  .mega-overlay {
    display: none;
  }
}

@media (max-width: 767px) {
  .topbar__cta {
    display: none;
  }

  .topbar__text {
    font-size: 11px;
  }

  .topbar__sep {
    margin: 0 6px;
  }
}
