/* ═══════════════════════════════════════════════
   VARIABLES
═══════════════════════════════════════════════ */
:root {
  --bg: #f8f6ff;
  --card: #ffffff;
  --text: #1a1730;
  --muted: #8b87a0;
  --line: #ede8f8;
  --primary: #7c3aed;
  --primary2: #6d28d9;
  --accent: #f43f7a;
  --dark: #1a1730;
  --ok: #059669;
  --bad: #dc2626;
  --warn: #d97706;
  --radius: 16px;
  --shadow: 0 4px 24px rgba(124, 58, 237, .08);
  --shadow-lg: 0 8px 40px rgba(124, 58, 237, .13);
}

/* ═══════════════════════════════════════════════
   RESET
═══════════════════════════════════════════════ */
*,*::before,*::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body { max-width: 100%; overflow-x: hidden; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

/* ═══════════════════════════════════════════════
   LAYOUT
═══════════════════════════════════════════════ */
.container { width: min(1200px, calc(100% - 40px)); margin: 0 auto; }
.row { display: flex; gap: 16px; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 220px; }

/* ═══════════════════════════════════════════════
   HEADER
═══════════════════════════════════════════════ */
.site-header { position: sticky; top: 0; z-index: 1000; background: #fff; overflow: visible; }

.header-promo {
  background: linear-gradient(90deg, var(--primary), var(--accent));
  color: #fff; font-size: 13px; font-weight: 600;
  padding: 8px 0; overflow: hidden; white-space: nowrap;
}

.promo-track { display: inline-flex; gap: 60px; animation: promo-scroll 25s linear infinite; }
.promo-track span { flex-shrink: 0; padding-right: 60px; }

@keyframes promo-scroll {
  0% { transform: translateX(0); }
  100% { transform: translateX(-33.333%); }
}

.header-main { background: #fff; border-bottom: 1px solid var(--line); padding: 12px 0; }
.header-main-inner { display: flex; align-items: center; gap: 20px; flex-wrap: nowrap; }

.brand { display: flex; align-items: center; gap: 10px; flex-shrink: 0; text-decoration: none; }
.brand-icon {
  width: 42px; height: 42px; border-radius: 12px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff; font-size: 22px; font-weight: 900;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.brand-text { font-size: 18px; font-weight: 900; color: var(--dark); line-height: 1.2; }
.brand-text em { font-style: normal; font-weight: 400; font-size: 12px; color: var(--muted); display: block; }

.header-search {
  flex: 1; display: flex; align-items: center;
  background: #f5f3ff; border: 1.5px solid var(--line);
  border-radius: 999px; overflow: hidden;
  transition: border-color .18s, box-shadow .18s;
  min-width: 0; height: 46px;
}
.header-search:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(124,58,237,.1); background: #fff; }
.header-search input { flex: 1; border: none; background: transparent; padding: 0 18px; font-size: 14px; outline: none; box-shadow: none; width: 100%; height: 100%; border-radius: 0; }
.header-search button {
  width: 46px; height: 46px; min-width: 46px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff; border: none; display: flex; align-items: center; justify-content: center;
  cursor: pointer; flex-shrink: 0; padding: 0; border-radius: 0; box-shadow: none;
}

.header-icons { display: flex; align-items: center; gap: 2px; flex-shrink: 0; }
.header-icon-btn {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 6px 10px; border-radius: 12px; color: var(--text);
  text-decoration: none; transition: background .15s, color .15s; cursor: pointer; white-space: nowrap;
}
.header-icon-btn:hover { background: #f3f0ff; color: var(--primary); }
.header-icon-label { font-size: 11px; font-weight: 600; color: var(--muted); }

.cart-badge {
  position: absolute; top: -6px; right: -8px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff; border-radius: 999px; min-width: 18px; height: 18px;
  font-size: 11px; font-weight: 700; display: flex; align-items: center;
  justify-content: center; padding: 0 4px; border: 2px solid #fff;
}

/* ═══════════════════════════════════════════════
   NAV + MEGA MENU
═══════════════════════════════════════════════ */
.header-nav {
  background: #fff; border-bottom: 2px solid var(--line);
  box-shadow: 0 2px 8px rgba(0,0,0,.04);
  position: relative; z-index: 9990; overflow: hidden;
}
.header-nav-inner { display: flex; align-items: center; overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; position: relative; -webkit-overflow-scrolling: touch; }
.header-nav-inner::-webkit-scrollbar { display: none; }

.nav-link {
  display: inline-block; padding: 13px 16px; font-size: 14px; font-weight: 600;
  color: var(--muted); white-space: nowrap;
  border-bottom: 2.5px solid transparent; margin-bottom: -2px;
  transition: color .15s, border-color .15s;
}
.nav-link:hover { color: var(--primary); border-bottom-color: var(--primary); }
.nav-link.active { color: var(--primary); border-bottom-color: var(--primary); }

.nav-dropdown { position: static; }
.nav-dropdown > .nav-link::after { content: ' ▾'; font-size: 11px; display: inline-block; transition: transform .2s; }
.nav-dropdown:hover > .nav-link::after { transform: rotate(180deg); }

.nav-submenu {
  visibility: hidden; opacity: 0; pointer-events: none;
  position: fixed; left: 0; right: 0; width: 100%;
  background: #fff; border-top: 3px solid var(--primary);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 16px 48px rgba(0,0,0,.15);
  z-index: 9999; display: flex; flex-direction: row;
  align-items: flex-start; gap: 0; padding: 28px 60px;
  transition: opacity .2s, visibility .2s;
}
.nav-dropdown:hover .nav-submenu { visibility: visible; opacity: 1; pointer-events: auto; }

.mega-col { flex: 1; min-width: 160px; padding: 0 32px 0 0; border-right: 1px solid var(--line); margin-right: 32px; }
.mega-col:last-of-type { border-right: none; margin-right: 0; }
.mega-col-title { font-size: 12px; font-weight: 800; color: var(--primary); text-transform: uppercase; letter-spacing: .07em; margin-bottom: 10px; padding-bottom: 8px; border-bottom: 2px solid var(--line); }
a.mega-col-title { display: block; transition: color .15s, padding-left .15s; border-radius: 0; padding-left: 0; }
a.mega-col-title:hover { color: var(--accent); padding-left: 4px; background: transparent; }
.nav-submenu a { display: block; padding: 5px 0; font-size: 13px; font-weight: 500; color: var(--text); border-radius: 0; transition: color .12s, padding-left .12s; }
.nav-submenu a:hover { color: var(--primary); padding-left: 6px; }

.mega-col-promo { flex: 0 0 180px; background: linear-gradient(135deg, #ede9fe, #fce7f3); border-radius: 16px; padding: 24px 20px; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; gap: 10px; }
.mega-col-promo .promo-emoji { font-size: 48px; }
.mega-col-promo .promo-text { font-size: 13px; font-weight: 700; color: var(--primary); line-height: 1.4; }
.mega-col-promo .promo-btn { background: var(--primary); color: #fff !important; border-radius: 999px; padding: 7px 18px; font-size: 12px; font-weight: 700; display: inline-block; transition: background .15s; }
.mega-col-promo .promo-btn:hover { background: var(--accent) !important; padding-left: 18px; }

/* ═══════════════════════════════════════════════
   MAIN
═══════════════════════════════════════════════ */
.page-space { padding: 32px 0 72px; }

/* ═══════════════════════════════════════════════
   HERO
═══════════════════════════════════════════════ */
.hero {
  background: linear-gradient(135deg, #ede9fe 0%, #fce7f3 50%, #fff7ed 100%);
  border-radius: 24px; padding: 48px 40px; margin-bottom: 32px;
  position: relative; overflow: hidden;
}
.hero h1 { font-size: clamp(26px, 4vw, 46px); font-weight: 900; letter-spacing: -.03em; color: var(--dark); margin-bottom: 12px; line-height: 1.15; }
.hero p { color: var(--muted); font-size: 16px; max-width: 560px; }

/* ═══════════════════════════════════════════════
   GRID & CARDS PRODUITS (style Jumia)
═══════════════════════════════════════════════ */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  transition: box-shadow .22s, transform .22s;
}
.card:hover { box-shadow: var(--shadow-lg); transform: translateY(-3px); }

/* Carte produit style Jumia */
.product-card {
  display: flex;
  flex-direction: column;
  cursor: pointer;
}

/* Image grande */
.product-card .visual {
  aspect-ratio: 1 / 1;
  background: #f9f9f9;
  overflow: hidden;
  position: relative;
}

.product-card .visual img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .35s ease;
}

.product-card:hover .visual img { transform: scale(1.06); }

/* Badge catégorie sur l'image */
.product-card .visual .cat-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  background: rgba(124,58,237,.85);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: .04em;
}

/* Corps de la carte */
.card-body {
  padding: 12px 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

/* Nom du produit — 2 lignes max */
.product-card .product-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 36px;
}

/* Meta (age group) */
.meta {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}

/* Prix style Jumia */
.price {
  font-size: 17px;
  font-weight: 900;
  color: var(--accent);
  margin: 6px 0 10px;
}

/* Bouton Ajouter au panier */
.product-card .btn-primary {
  width: 100%;
  padding: 10px;
  font-size: 13px;
  margin-top: auto;
  border-radius: 8px;
}

/* ═══════════════════════════════════════════════
   BOUTONS
═══════════════════════════════════════════════ */
.btn, button {
  cursor: pointer; border: none; border-radius: 999px;
  padding: 11px 22px; font-size: 14px; font-weight: 700;
  transition: all .18s; display: inline-flex; align-items: center;
  justify-content: center; gap: 6px; line-height: 1;
}
.btn-primary { background: linear-gradient(135deg, var(--primary), var(--accent)); color: #fff; box-shadow: 0 4px 14px rgba(124,58,237,.25); }
.btn-primary:hover { box-shadow: 0 6px 20px rgba(124,58,237,.4); transform: translateY(-1px); }
.btn-secondary { background: #fff; color: var(--text); border: 1.5px solid var(--line); }
.btn-secondary:hover { border-color: var(--primary); color: var(--primary); background: #faf5ff; }
.btn-danger { background: #fff0f0; color: var(--bad); border: 1.5px solid #fecaca; }
.btn-danger:hover { background: #fee2e2; }
.btn-warning { background: #fffbeb; color: var(--warn); border: 1.5px solid #fde68a; }

/* ═══════════════════════════════════════════════
   ALERTES
═══════════════════════════════════════════════ */
.alert { padding: 14px 18px; border-radius: 14px; margin-bottom: 20px; font-weight: 600; font-size: 14px; border: 1px solid; }
.alert.success { background: #ecfdf5; color: var(--ok); border-color: #a7f3d0; }
.alert.error { background: #fef2f2; color: var(--bad); border-color: #fecaca; }
.alert.info { background: #eff6ff; color: #2563eb; border-color: #bfdbfe; }

/* ═══════════════════════════════════════════════
   FORMULAIRES
═══════════════════════════════════════════════ */
.form-card { max-width: 900px; margin: 0 auto; padding: 32px; }
.form-group { margin-bottom: 18px; }
label { display: block; margin-bottom: 7px; font-weight: 700; font-size: 14px; }
input, select, textarea { width: 100%; padding: 12px 16px; border-radius: 12px; border: 1.5px solid var(--line); background: #fff; font-size: 15px; color: var(--text); transition: border-color .18s, box-shadow .18s; outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(124,58,237,.1); }
textarea { min-height: 110px; resize: vertical; }

/* ═══════════════════════════════════════════════
   TABLEAUX
═══════════════════════════════════════════════ */
table { width: 100%; border-collapse: collapse; background: #fff; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
th { padding: 14px 16px; text-align: left; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); background: #faf8ff; border-bottom: 2px solid var(--line); }
td { padding: 14px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; font-size: 14px; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #faf8ff; }

/* ═══════════════════════════════════════════════
   STATS ADMIN
═══════════════════════════════════════════════ */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 28px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; position: relative; overflow: hidden; transition: box-shadow .2s; }
.stat:hover { box-shadow: var(--shadow); }
.stat::before { content: ''; position: absolute; top: 0; left: 0; width: 4px; height: 100%; background: linear-gradient(180deg, var(--primary), var(--accent)); }
.stat .small { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 6px; }
.stat .num { font-size: 30px; font-weight: 900; background: linear-gradient(135deg, var(--primary), var(--accent)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }

/* ═══════════════════════════════════════════════
   BADGES
═══════════════════════════════════════════════ */
.badge { display: inline-flex; align-items: center; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.badge-ok { background: #ecfdf5; color: var(--ok); }
.badge-off { background: #fef2f2; color: var(--bad); }
.badge-soft { background: #eff6ff; color: #2563eb; }
.badge-status { display: inline-block; padding: 5px 12px; border-radius: 999px; background: #f3f0ff; border: 1px solid #ddd6fe; font-size: 12px; font-weight: 700; color: var(--primary); }

/* ═══════════════════════════════════════════════
   THUMBNAIL
═══════════════════════════════════════════════ */
.thumbnail { width: 56px; height: 56px; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); background: #f3f0ff; flex-shrink: 0; }
.thumbnail img { width: 100%; height: 100%; object-fit: cover; }

/* ═══════════════════════════════════════════════
   EMPTY / SMALL
═══════════════════════════════════════════════ */
.empty { padding: 40px 24px; background: #fff; border: 2px dashed var(--line); border-radius: var(--radius); text-align: center; color: var(--muted); font-size: 14px; }
.small { font-size: 13px; color: var(--muted); }

/* ═══════════════════════════════════════════════
   FOOTER
═══════════════════════════════════════════════ */
.site-footer { border-top: 1px solid var(--line); background: #fff; margin-top: 40px; }
.footer-row { display: flex; justify-content: space-between; align-items: center; padding: 20px 0; color: var(--muted); font-size: 13px; flex-wrap: wrap; gap: 10px; }
.footer-row a { color: var(--muted); transition: color .15s; }
.footer-row a:hover { color: var(--primary); }

/* ═══════════════════════════════════════════════
   DIVERS
═══════════════════════════════════════════════ */
.actions-inline { display: flex; gap: 8px; flex-wrap: wrap; }
.kpis { display: grid; grid-template-columns: 1.1fr .9fr; gap: 18px; }

/* Cacher hamburger sur desktop */
#hamburger-btn { display: none; }

/* ═══════════════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════════════ */
@media (max-width: 900px) { .stats { grid-template-columns: 1fr 1fr; } }

@media (max-width: 768px) {
  /* Montrer hamburger et cacher texte KIDO sur mobile */
  #hamburger-btn { display: flex; }
  #brand-text-desktop { display: none; }

  .row { flex-direction: row; flex-wrap: wrap; }
  .row .btn { flex: 0 0 auto; min-width: unset; }

  /* Header : logo + icônes sur une ligne, recherche en dessous */
  .header-main-inner {
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
  }
  .brand { flex-shrink: 0; order: 1; }
  .header-search { order: 2; flex: 1; min-width: 0; margin: 0 8px; }
  .header-icons { order: 3; flex-shrink: 0; margin-left: 0; gap: 0; }
  .brand-text { display: none; }
  .header-icon-label { display: none; }
  .header-icon-btn { padding: 6px 8px; }
  .header-nav-inner { overflow-x: auto; }
  .header-nav { overflow: hidden; }

  .hero { padding: 20px 16px; }
  .hero h1 { font-size: 22px; }
  .hero p { font-size: 14px; }
  .form-card { padding: 20px 16px; }
  .grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .nav-submenu { display: none !important; }
  .page-space { padding: 16px 0 48px; }

  /* Filtres catégories en ligne défilante sur mobile */
  .filter-bar {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 8px;
    padding-bottom: 8px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .filter-bar::-webkit-scrollbar { display: none; }
  .filter-bar .btn {
    flex-shrink: 0;
    padding: 8px 14px;
    font-size: 13px;
  }

  /* Cards produit plus compactes */
  .product-card .product-name { font-size: 12px; min-height: 32px; }
  .price { font-size: 15px; }
  .card-body { padding: 8px 10px 12px; }
  .product-card .btn-primary { font-size: 12px; padding: 8px; }
}

@media (max-width: 400px) {
  .grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .brand-text { font-size: 16px; }
}

@media (max-width: 680px) {
  .stats, .kpis { grid-template-columns: 1fr; }
  .footer-row { flex-direction: column; text-align: center; }
  table { display: block; overflow-x: auto; }
}