/* ============================================================
   Mon Club Parfum — Thème commun (élégant / parfumerie)
   ============================================================ */
:root {
  /* Club Parfum Grasse — or, vert citron, teal, rose */
  --plum: #333333;
  --plum-soft: #4FB68D;
  --gold: #D4AF37;
  --gold-soft: #E8D48B;
  --gold-muted: #C5A059;
  --lime: #A2E635;
  --teal: #4FB68D;
  --teal-dark: #2D6B56;
  --pink: #F8C8DC;
  --cream: #FFFFFF;
  --cream-card: #FFFFFF;
  --ink: #333333;
  --ink-muted: #6B7280;
  --line: #E5EBE8;
  --danger: #b23b4b;
  --ok: #4FB68D;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 12px 34px rgba(51, 51, 51, 0.10);
  --shadow-sm: 0 4px 14px rgba(51, 51, 51, 0.08);
  --maxw: 760px;
  --font-serif: 'Playfair Display', Georgia, 'Times New Roman', serif;
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-sans);
  color: var(--ink);
  background:
    radial-gradient(70% 45% at 95% 5%, rgba(162, 230, 53, 0.14) 0%, transparent 55%),
    radial-gradient(55% 40% at 5% 95%, rgba(248, 200, 220, 0.22) 0%, transparent 50%),
    radial-gradient(90% 50% at 50% -5%, rgba(212, 175, 55, 0.12) 0%, transparent 55%),
    linear-gradient(180deg, #fff 0%, #FAFCFA 100%);
  -webkit-font-smoothing: antialiased;
}

/* ---------- En-tête ---------- */
.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: #fff;
  color: var(--ink);
  padding: 16px 18px;
  border-bottom: 3px solid var(--gold);
  box-shadow: 0 2px 16px rgba(51, 51, 51, 0.06);
}
.app-header .brand {
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: var(--maxw);
  margin: 0 auto;
}
.app-header .brand-logo {
  width: 42px; height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold-muted) 100%);
  display: grid; place-items: center;
  color: #fff; font-weight: 800; font-size: 20px;
  font-family: var(--font-serif);
  flex-shrink: 0;
  box-shadow: 0 2px 10px rgba(212, 175, 55, 0.35);
}
.app-header .brand-title {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.3px;
  line-height: 1.1;
}
.app-header .brand-sub {
  font-size: 0.72rem;
  color: var(--teal-dark);
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

/* ---------- Conteneur ---------- */
.container {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 18px 16px 110px;
}

/* ---------- Onglets bas (conseiller) ---------- */
.tabbar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 60;
  display: flex;
  background: var(--cream-card);
  border-top: 1px solid var(--line);
  box-shadow: 0 -6px 20px rgba(51, 51, 51, 0.06);
  padding: 6px max(8px, env(safe-area-inset-left)) max(6px, env(safe-area-inset-bottom));
}
.tabbar button {
  flex: 1;
  border: none;
  background: none;
  color: var(--ink-muted);
  font-family: var(--font-sans);
  font-size: 0.68rem;
  font-weight: 600;
  padding: 8px 2px 6px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  border-radius: 12px;
  transition: color 0.15s, background 0.15s;
}
.tabbar button .ic { font-size: 1.2rem; line-height: 1; }
.tabbar button.active { color: var(--teal-dark); background: rgba(162, 230, 53, 0.18); }

/* ---------- Sections / panneaux ---------- */
.panel { display: none; }
.panel.active { display: block; animation: fade 0.2s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 6px 0 14px;
}
.section-head h2 {
  font-family: var(--font-serif);
  font-size: 1.4rem;
  margin: 0;
  color: var(--teal-dark);
}

/* ---------- Cartes ---------- */
.card {
  background: var(--cream-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 16px;
  margin-bottom: 14px;
}

/* ---------- Statistiques (accueil) ---------- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}
.stat {
  background: var(--cream-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}
.stat .num {
  font-family: var(--font-serif);
  font-size: 1.7rem;
  font-weight: 700;
  color: var(--plum);
}
.stat .lbl { font-size: 0.78rem; color: var(--ink-muted); margin-top: 2px; }
.stat.gold { background: linear-gradient(135deg, var(--teal-dark) 0%, var(--teal) 55%, var(--gold-muted) 100%); border: none; }
.stat.gold .num { color: var(--gold-soft); }
.stat.gold .lbl { color: rgba(255,255,255,0.9); }

/* ---------- Cadre statistiques ---------- */
.vp-cumul {
  background: linear-gradient(135deg, var(--teal-dark) 0%, var(--teal) 60%, var(--gold-muted) 100%);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.vp-cumul-label { color: rgba(255,255,255,0.85); font-size: 0.82rem; font-weight: 600; }
.vp-cumul-num { font-family: var(--font-serif); font-size: 1.6rem; font-weight: 700; color: var(--gold-soft); }

.stat-block { margin-top: 18px; }
.stat-block-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--teal-dark);
  margin-bottom: 10px;
  letter-spacing: 0.2px;
}

/* Graphique en barres verticales */
.bar-chart {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 6px;
  height: 150px;
  padding-top: 14px;
}
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; }
.bar-val { font-size: 0.62rem; color: var(--ink-muted); font-weight: 700; margin-bottom: 3px; min-height: 12px; }
.bar-track { flex: 1; width: 100%; display: flex; align-items: flex-end; }
.bar-fill {
  width: 100%;
  min-height: 3px;
  background: linear-gradient(180deg, var(--gold) 0%, var(--gold-soft) 100%);
  border-radius: 6px 6px 0 0;
  transition: height 0.4s ease;
}
.bar-lbl { font-size: 0.68rem; color: var(--ink-muted); margin-top: 6px; text-transform: capitalize; }

/* Barres horizontales (catégories) */
.hbar-row { margin-bottom: 12px; }
.hbar-head { display: flex; justify-content: space-between; font-size: 0.82rem; font-weight: 600; margin-bottom: 4px; }
.hbar-head .muted { font-size: 0.76rem; }
.hbar-track { height: 9px; background: var(--line); border-radius: 999px; overflow: hidden; }
.hbar-fill { height: 100%; background: linear-gradient(90deg, var(--teal-dark) 0%, var(--lime) 100%); border-radius: 999px; transition: width 0.4s ease; }

/* Meilleures ventes */
.best-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.84rem;
}
.best-row:last-child { border-bottom: none; }
.best-rank { font-size: 1rem; width: 24px; text-align: center; flex-shrink: 0; }
.best-name { flex: 1; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.best-qty { color: var(--ink-muted); font-size: 0.74rem; white-space: nowrap; }
.best-amount { font-weight: 700; color: var(--plum); white-space: nowrap; }

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: none;
  border-radius: 999px;
  padding: 11px 18px;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.08s, box-shadow 0.15s, opacity 0.15s;
  text-decoration: none;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: linear-gradient(135deg, var(--gold) 0%, var(--gold-muted) 100%); color: #fff; box-shadow: 0 4px 14px rgba(212, 175, 55, 0.28); }
.btn-plum { background: var(--teal-dark); color: #fff; }
.btn-wa { background: #25D366; color: #fff; }
.btn-ghost { background: transparent; color: var(--plum); border: 1.5px solid var(--line); }
.btn-danger { background: transparent; color: var(--danger); border: 1.5px solid #e6c4ca; }
.btn-sm { padding: 7px 12px; font-size: 0.8rem; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---------- Formulaires ---------- */
.field { margin-bottom: 12px; }
.field label {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--teal-dark);
  margin-bottom: 5px;
  letter-spacing: 0.2px;
}
.field .hint { font-weight: 500; color: var(--ink-muted); font-size: 0.72rem; }
.input, .select, .textarea {
  width: 100%;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 11px 12px;
  font-family: var(--font-sans);
  font-size: 0.95rem;
  color: var(--ink);
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(79, 182, 141, 0.22);
}
.textarea { resize: vertical; min-height: 70px; }
.field-row { display: flex; gap: 10px; }
.field-row > .field { flex: 1; }

/* ---------- Liste produits (conseiller) ---------- */
.list { display: flex; flex-direction: column; gap: 12px; }
.prod-row {
  display: flex;
  gap: 12px;
  align-items: center;
  background: var(--cream-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px;
  box-shadow: var(--shadow-sm);
}
.prod-thumb {
  width: 64px; height: 64px;
  border-radius: 12px;
  object-fit: cover;
  background: #f0e7d8;
  flex-shrink: 0;
}
.prod-thumb.placeholder { display: grid; place-items: center; color: var(--gold); font-size: 1.5rem; }
.prod-info { flex: 1; min-width: 0; }
.prod-info .name { font-weight: 700; color: var(--ink); }
.prod-info .meta { font-size: 0.76rem; color: var(--ink-muted); margin-top: 2px; }
.prod-info .prices { font-size: 0.82rem; margin-top: 4px; }
.prod-info .prices .pv { color: var(--plum); font-weight: 700; }
.prod-info .prices .pa { color: var(--ink-muted); }
.prod-info .prices .mg {
  display: inline-block;
  background: rgba(79, 182, 141, 0.14);
  color: var(--ok);
  border-radius: 6px;
  padding: 1px 6px;
  font-weight: 700;
  font-size: 0.72rem;
  margin-left: 4px;
}
.prod-actions { display: flex; flex-direction: column; gap: 6px; }

.badge-cat {
  display: inline-block;
  background: rgba(162, 230, 53, 0.2);
  color: var(--teal-dark);
  border-radius: 999px;
  padding: 2px 9px;
  font-size: 0.7rem;
  font-weight: 700;
}

/* Code / référence produit */
.prod-code {
  display: inline-block;
  background: var(--teal-dark);
  color: var(--gold-soft);
  border-radius: 6px;
  padding: 1px 7px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.4px;
  font-family: ui-monospace, 'SF Mono', Menlo, monospace;
}
.product-card .pref {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: 0.4px;
}

/* Points valeur (VP) */
.vp-badge {
  display: inline-block;
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold-muted) 100%);
  color: #fff;
  border-radius: 6px;
  padding: 1px 7px;
  font-weight: 800;
  font-size: 0.72rem;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

/* ---------- Catégorie titre (catalogue) ---------- */
.cat-title {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  color: var(--teal-dark);
  margin: 22px 0 12px;
  display: flex; align-items: center; gap: 10px;
}
.cat-title::after { content: ''; flex: 1; height: 1px; background: var(--line); }

/* ---------- Grille catalogue client ---------- */
.cat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}
.product-card {
  background: var(--cream-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
}
.product-card .ph {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  background: #f0e7d8;
}
.product-card .ph.placeholder { display: grid; place-items: center; color: var(--gold); font-size: 2.2rem; }
.product-card .body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.product-card .pname { font-weight: 700; font-size: 0.92rem; line-height: 1.2; }
.product-card .pdesc { font-size: 0.74rem; color: var(--ink-muted); flex: 1; }
.product-card .pprice { font-family: var(--font-serif); font-size: 1.15rem; color: var(--plum); font-weight: 700; }
.qty-control { display: flex; align-items: center; gap: 8px; }
.qty-control button {
  width: 30px; height: 30px;
  border-radius: 50%;
  border: 1.5px solid var(--line);
  background: #fff;
  color: var(--plum);
  font-size: 1.1rem; font-weight: 700;
  cursor: pointer;
  display: grid; place-items: center;
}
.qty-control .qv { min-width: 22px; text-align: center; font-weight: 700; }

/* ---------- Panier flottant ---------- */
.cart-bar {
  position: fixed;
  bottom: 16px; left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 32px);
  max-width: calc(var(--maxw) - 0px);
  z-index: 70;
  background: linear-gradient(135deg, var(--teal-dark) 0%, var(--teal) 100%);
  color: #fff;
  border-radius: 999px;
  padding: 12px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.2s, opacity 0.2s;
}
.cart-bar.hidden { transform: translateX(-50%) translateY(120px); opacity: 0; pointer-events: none; }
.cart-bar .ct-count { font-weight: 700; }
.cart-bar .ct-total { font-family: var(--font-serif); font-size: 1.1rem; color: var(--gold-soft); }

/* ---------- Modale ---------- */
.modal-overlay {
  position: fixed; inset: 0;
  z-index: 100;
  background: rgba(51, 51, 51, 0.48);
  backdrop-filter: blur(3px);
  display: none;
  align-items: flex-end;
  justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--cream-card);
  width: 100%;
  max-width: var(--maxw);
  max-height: 92vh;
  overflow-y: auto;
  border-radius: 22px 22px 0 0;
  padding: 18px 18px calc(18px + env(safe-area-inset-bottom));
  position: relative;
  animation: slideUp 0.22s ease;
}
@media (min-width: 640px) {
  .modal-overlay { align-items: center; }
  .modal { border-radius: 22px; }
}
@keyframes slideUp { from { transform: translateY(30px); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
}
.modal-head h3 { font-family: var(--font-serif); color: var(--teal-dark); margin: 0; font-size: 1.3rem; }
.modal-close {
  border: none; background: rgba(79, 182, 141, 0.12);
  width: 36px; height: 36px; border-radius: 50%;
  font-size: 1.2rem; cursor: pointer; color: var(--teal-dark);
}

/* ---------- Divers ---------- */
.empty {
  text-align: center;
  color: var(--ink-muted);
  padding: 40px 20px;
}
.empty .ic { font-size: 2.6rem; opacity: 0.5; }
.empty p { margin: 10px 0 0; }

.toast {
  position: fixed;
  bottom: 90px; left: 50%; transform: translateX(-50%);
  background: var(--teal-dark); color: #fff;
  padding: 12px 20px; border-radius: 999px;
  box-shadow: var(--shadow); z-index: 200;
  font-size: 0.88rem; font-weight: 600;
  opacity: 0; pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(-6px); }

.muted { color: var(--ink-muted); }
.center { text-align: center; }
.mt { margin-top: 14px; }
.divider { height: 1px; background: var(--line); margin: 14px 0; border: none; }

/* Lien de partage catalogue */
.share-box {
  background: rgba(248, 200, 220, 0.25);
  border: 1px dashed var(--teal);
  border-radius: var(--radius-sm);
  padding: 12px;
  font-size: 0.82rem;
  word-break: break-all;
  color: var(--plum);
}
