/* ============================================================
   KIDILAND — Header & Mega Menu
   Thème jouets : coloré, joyeux, arrondi
   ============================================================ */

/* ── HEADER ─────────────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 200;
  background: var(--white);
  border-bottom: 3px solid transparent;
  background-clip: padding-box;
  box-shadow: 0 2px 16px rgba(30, 27, 75, 0.06);
  transition: box-shadow 0.3s ease;
}
.site-header::after {
  content: '';
  position: absolute;
  bottom: -3px;
  left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--secondary), var(--accent), var(--blue), var(--purple), var(--pink));
  background-size: 200% 100%;
  animation: rainbow-bar 4s linear infinite;
}
@keyframes rainbow-bar {
  0%   { background-position: 0% 0%; }
  100% { background-position: 200% 0%; }
}
.site-header.scrolled {
  box-shadow: 0 4px 24px rgba(30, 27, 75, 0.12);
}

.header-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 2rem;
  height: 72px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1rem;
}

/* ── LOGO ───────────────────────────────────────────── */
.header-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.1;
  text-decoration: none;
  justify-self: center;
}
.logo-main {
  font-family: var(--font-titre);
  font-size: 1.8rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary), var(--purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: 0.02em;
}
.logo-sub {
  font-size: 0.6rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gray);
  font-family: var(--font-corps);
  font-weight: 700;
}

/* ── BOUTON MENU CATS ───────────────────────────────── */
.header-left {
  display: flex;
  align-items: center;
}
.menu-cats-btn {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: var(--gray-light);
  border: 2px solid transparent;
  border-radius: var(--radius-full);
  padding: 0.5rem 1.1rem;
  cursor: pointer;
  color: var(--dark);
  font-family: var(--font-corps);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  transition: all 0.2s ease;
}
.menu-cats-btn:hover {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
}
.menu-cats-btn.open {
  background: var(--primary);
  color: var(--white);
  border-color: var(--primary);
}
.menu-cats-btn.open .hamburger-lines span {
  background: var(--white);
}
.hamburger-lines {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 18px;
}
.hamburger-lines span {
  display: block;
  width: 100%;
  height: 2px;
  background: var(--dark);
  transition: all 0.25s ease;
  transform-origin: center;
  border-radius: 2px;
}
.menu-cats-btn.open .hamburger-lines span:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}
.menu-cats-btn.open .hamburger-lines span:nth-child(2) {
  opacity: 0; transform: scaleX(0);
}
.menu-cats-btn.open .hamburger-lines span:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}

/* ── NAV DROITE ─────────────────────────────────────── */
.header-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 1.5rem;
}
.header-nav-links {
  display: flex;
  gap: 0.25rem;
}
.header-nav-links a {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--gray);
  text-decoration: none;
  padding: 0.4rem 0.9rem;
  border-radius: var(--radius-full);
  transition: all 0.2s ease;
}
.header-nav-links a:hover {
  background: var(--primary-light);
  color: var(--primary);
}

/* ── ICÔNES ─────────────────────────────────────────── */
.header-icons {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}
.header-icon-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  color: var(--dark);
  text-decoration: none;
  transition: background 0.2s, color 0.2s, transform 0.2s;
}
.header-icon-btn:hover {
  background: var(--primary-light);
  color: var(--primary);
  transform: scale(1.1);
}
.header-icon-btn.active svg {
  fill: var(--primary);
  stroke: var(--primary);
}
.cart-count, .favoris-count {
  position: absolute;
  top: 2px; right: 2px;
  background: var(--primary);
  color: white;
  font-size: 0.6rem;
  font-family: var(--font-corps);
  font-weight: 800;
  width: 17px; height: 17px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  border: 2px solid var(--white);
}
.favoris-count {
  background: var(--pink);
}

/* ── MOBILE ─────────────────────────────────────────── */
.header-mobile-actions {
  display: none;
  align-items: center;
  gap: 0.25rem;
}
.mobile-burger {
  display: flex;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  width: 40px;
  height: 40px;
  justify-content: center;
  align-items: center;
}
.mobile-burger span {
  display: block;
  width: 22px; height: 2px;
  background: var(--dark);
  transition: all 0.25s;
  border-radius: 2px;
}
.mobile-nav {
  display: none;
  flex-direction: column;
  padding: 0.75rem 1.5rem 1.5rem;
  border-top: 2px solid var(--gray-light);
  gap: 0;
  background: var(--white);
}
.mobile-nav a {
  padding: 0.85rem 0;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--dark);
  border-bottom: 1px solid var(--gray-light);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: color 0.2s;
}
.mobile-nav a:hover { color: var(--primary); }
.mobile-nav.open { display: flex; }

/* ═══════════════════════════════════════════════════ */
/* MEGA MENU                                          */
/* ═══════════════════════════════════════════════════ */

/* Overlay */
.mega-menu-overlay {
  position: fixed;
  inset: 0;
  background: rgba(30, 27, 75, 0.5);
  z-index: 290;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
  backdrop-filter: blur(4px);
}
.mega-menu-overlay.visible {
  opacity: 1;
  pointer-events: all;
}

/* Panneau coulissant */
.mega-menu {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: 700px;
  max-width: 95vw;
  background: var(--white);
  z-index: 300;
  transform: translateX(-100%);
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  box-shadow: 8px 0 48px rgba(30, 27, 75, 0.18);
  border-radius: 0 var(--radius-xl) var(--radius-xl) 0;
}
.mega-menu.open {
  transform: translateX(0);
}

/* En-tête du mega menu */
.mega-menu-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 2rem;
  height: 72px;
  border-bottom: 2px solid var(--gray-light);
  flex-shrink: 0;
  background: linear-gradient(135deg, var(--dark) 0%, var(--dark-soft) 100%);
  border-radius: 0 var(--radius-xl) 0 0;
}
.mega-menu-header span {
  font-family: var(--font-titre);
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--white);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.mega-menu-close {
  background: rgba(255,255,255,0.1);
  border: 2px solid rgba(255,255,255,0.2);
  cursor: pointer;
  color: var(--white);
  width: 38px; height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s;
  font-size: 1.2rem;
}
.mega-menu-close:hover {
  background: rgba(255,255,255,0.2);
  border-color: rgba(255,255,255,0.4);
  transform: scale(1.1);
}

/* Corps du mega menu */
.mega-menu-body {
  display: grid;
  grid-template-columns: 230px 1fr;
  flex: 1;
  overflow: hidden;
}

/* ── Colonne catégories ── */
.mega-cats-list {
  border-right: 2px solid var(--gray-light);
  overflow-y: auto;
  padding: 1rem 0;
  background: var(--gray-light);
}
.mega-cat-all {
  display: flex !important;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 1.25rem !important;
  text-decoration: none;
  color: var(--dark) !important;
  font-size: 0.88rem;
  font-weight: 700;
  border-bottom: 2px solid var(--white);
  margin-bottom: 0.5rem;
  transition: background 0.15s;
}
.mega-cat-all:hover {
  background: var(--primary-light) !important;
  color: var(--primary) !important;
}

.mega-cat-item {
  display: flex;
  align-items: center;
  padding: 0 1.25rem;
  transition: background 0.15s;
  border-left: 3px solid transparent;
  cursor: pointer;
}
.mega-cat-item:hover,
.mega-cat-item.active {
  background: rgba(255, 71, 87, 0.06);
  border-left-color: var(--primary);
}
.mega-cat-link {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 0;
  text-decoration: none;
  color: var(--dark);
}
.mega-cat-name {
  font-size: 0.88rem;
  font-family: var(--font-corps);
  font-weight: 700;
  color: var(--dark);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.mega-cat-emoji { font-size: 1.1rem; }
.mega-cat-count {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--white);
  background: var(--primary);
  border-radius: var(--radius-full);
  padding: 0.1rem 0.5rem;
  font-family: var(--font-corps);
}
.mega-cat-arrow {
  color: var(--gray-medium);
  flex-shrink: 0;
  margin-left: 0.5rem;
  transition: transform 0.2s, color 0.2s;
}
.mega-cat-item.active .mega-cat-arrow {
  transform: translateX(3px);
  color: var(--primary);
}

/* ── Panneau produits ── */
.mega-produits-panel {
  overflow-y: auto;
  padding: 1.5rem;
  position: relative;
}
.mega-produits-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--gray-medium);
  text-align: center;
  gap: 1rem;
}
.mega-produits-placeholder-icon { font-size: 3.5rem; }
.mega-produits-placeholder p {
  font-size: 0.85rem;
  color: var(--gray);
  max-width: 180px;
  line-height: 1.5;
  font-weight: 600;
}
.mega-produits-group {
  display: none;
  animation: fadeInPanel 0.2s ease;
}
.mega-produits-group.active { display: block; }

@keyframes fadeInPanel {
  from { opacity: 0; transform: translateX(8px); }
  to   { opacity: 1; transform: translateX(0); }
}

.mega-produits-titre {
  font-family: var(--font-titre);
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--dark);
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid var(--gray-light);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.mega-produits-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}
.mega-produit-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  border-radius: var(--radius);
  text-decoration: none;
  border: 2px solid transparent;
  transition: all 0.18s ease;
  background: var(--gray-light);
}
.mega-produit-card:hover {
  background: var(--primary-light);
  border-color: rgba(255, 71, 87, 0.25);
  transform: translateY(-2px);
  box-shadow: var(--ombre);
}
.mega-produit-img {
  width: 54px; height: 54px;
  flex-shrink: 0;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
}
.mega-produit-img img {
  width: 100%; height: 100%;
  object-fit: cover;
}
.mega-produit-info {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  overflow: hidden;
}
.mega-produit-nom {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--dark);
  font-family: var(--font-corps);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 150px;
}
.mega-produit-prix {
  font-family: var(--font-titre);
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--primary);
}
.mega-voir-tout {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--white);
  background: var(--primary);
  text-decoration: none;
  padding: 0.5rem 1.2rem;
  border-radius: var(--radius-full);
  transition: all 0.2s;
  box-shadow: 0 4px 12px rgba(255, 71, 87, 0.3);
}
.mega-voir-tout:hover {
  background: var(--primary-dark);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(255, 71, 87, 0.4);
}

/* ═══════════════════════════════════════════════════ */
/* RESPONSIVE                                         */
/* ═══════════════════════════════════════════════════ */
@media (max-width: 1024px) {
  .header-nav-links { display: none; }
}
@media (max-width: 768px) {
  .header-inner { grid-template-columns: auto 1fr auto; }
  .header-left .menu-cats-label { display: none; }
  .menu-cats-btn { padding: 0.5rem 0.75rem; }
  .header-right { display: none; }
  .header-mobile-actions { display: flex; }
  .mega-menu { width: 100vw; border-radius: 0; }
  .mega-menu-header { border-radius: 0; }
  .mega-menu-body { grid-template-columns: 180px 1fr; }
  .mega-produits-grid { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .mega-menu-body { grid-template-columns: 1fr; }
  .mega-produits-panel { display: none; }
  .mega-cats-list { background: var(--white); }
}
