/* MOLOK - style.css */
:root {
  --navy: #0b1b3a;
  --navy-2: #13294f;
  --navy-3: #1c3868;
  --gold: #d4a72c;
  --gold-2: #f0c85a;
  --white: #ffffff;
  --bg: #f4f6fb;
  --text: #14213d;
  --muted: #667391;
  --line: #e2e7f1;
  --ok: #1a8f5a;
  --warn: #c98200;
  --err: #c2392f;
  --radius: 18px;
  --shadow: 0 6px 24px rgba(11, 27, 58, .08);
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
body[data-private]:not(.ready) { visibility: hidden; }
img, svg { max-width: 100%; }
a { color: var(--navy-3); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5rem; color: var(--navy); }
h1 { font-size: 1.9rem; } h2 { font-size: 1.3rem; } h3 { font-size: 1.05rem; }
p { margin: 0 0 .8rem; }
[hidden] { display: none !important; }

.ico { display: inline-flex; width: 20px; height: 20px; vertical-align: middle; }
.ico svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.container { width: 100%; max-width: 720px; margin: 0 auto; padding: 16px; }
.has-nav .container { padding-bottom: 96px; }

/* Barre du haut */
.topbar {
  position: sticky; top: 0; z-index: 20; background: var(--navy); color: var(--white);
  padding: calc(10px + env(safe-area-inset-top, 0px)) 16px 10px;
  display: flex; align-items: center; justify-content: space-between;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--white); text-decoration: none; font-weight: 800; letter-spacing: .08em; }
.brand-mark { width: 34px; height: 34px; border-radius: 8px; display: block; flex-shrink: 0; object-fit: contain; }
.topbar .btn-ghost { color: var(--white); }

/* Navigation basse */
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: var(--white);
  border-top: 1px solid var(--line); display: flex; justify-content: space-around;
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom, 0px));
}
.bottom-nav a {
  display: flex; flex-direction: column; align-items: center; gap: 2px; flex: 1;
  font-size: .72rem; color: var(--muted); text-decoration: none; padding: 4px 0;
}
.bottom-nav a.active { color: var(--navy); font-weight: 700; }
.bottom-nav a.active .ico { color: var(--gold); }

/* Cartes */
.card { background: var(--white); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); margin-bottom: 14px; }
.card-navy { background: linear-gradient(145deg, var(--navy), var(--navy-3)); color: var(--white); }
.card-navy h2, .card-navy h3 { color: var(--white); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat { background: var(--white); border-radius: 14px; padding: 12px; box-shadow: var(--shadow); }
.stat small { display: block; color: var(--muted); font-size: .75rem; }
.stat strong { font-size: 1.15rem; color: var(--navy); }
.card-navy .stat { background: rgba(255,255,255,.08); box-shadow: none; }
.card-navy .stat small { color: #b9c5e2; } .card-navy .stat strong { color: var(--gold-2); }
.big-balance { font-size: 2rem; font-weight: 800; color: var(--gold-2); }

/* Boutons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 14px; padding: 12px 18px; font: inherit; font-weight: 700;
  cursor: pointer; text-decoration: none; transition: transform .15s, opacity .15s; min-height: 46px;
}
.btn:active { transform: scale(.98); }
.btn[disabled] { opacity: .6; cursor: not-allowed; }
.btn-gold { background: linear-gradient(135deg, var(--gold), var(--gold-2)); color: var(--navy); }
.btn-navy { background: var(--navy); color: var(--white); }
.btn-outline { background: transparent; border: 1.5px solid var(--navy); color: var(--navy); }
.btn-ghost { background: transparent; color: var(--navy); padding: 8px 10px; min-height: 0; }
.btn-danger { background: var(--err); color: var(--white); }
.btn-ok { background: var(--ok); color: var(--white); }
.btn-block { width: 100%; }
.btn-sm { padding: 8px 12px; min-height: 36px; font-size: .85rem; border-radius: 10px; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* Formulaires */
.field { margin-bottom: 14px; }
.field label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 12px 14px; border: 1.5px solid var(--line); border-radius: 12px;
  font: inherit; background: var(--white); color: var(--text);
}
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--gold); border-color: var(--gold); }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: .9rem; margin-bottom: 14px; }
.check input { margin-top: 4px; width: 18px; height: 18px; }
.hint { font-size: .85rem; color: var(--muted); min-height: 1.2em; margin-top: 4px; }
.hint.ok { color: var(--ok); } .hint.err { color: var(--err); }
.msg { padding: 12px 14px; border-radius: 12px; margin-bottom: 14px; font-size: .92rem; }
.msg-ok { background: #e6f6ee; color: #11623e; }
.msg-err { background: #fbe9e7; color: #8e2a22; }
.msg-info { background: #e8eefb; color: #1c3868; }

/* Badges */
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: .72rem; font-weight: 700; letter-spacing: .02em; background: #e8eefb; color: var(--navy-3); }
.badge-pending { background: #fff3d6; color: #8a5a00; }
.badge-approved { background: #e1ecff; color: #1c3f8f; }
.badge-confirmed, .badge-paid, .badge-active { background: #e1f5eb; color: #11623e; }
.badge-rejected, .badge-suspended { background: #fbe3e0; color: #8e2a22; }

/* Onglets */
.tabs, .subtabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 8px; margin-bottom: 8px; scrollbar-width: none; }
.tabs::-webkit-scrollbar, .subtabs::-webkit-scrollbar { display: none; }
.tab {
  flex: 0 0 auto; border: 0; background: var(--white); color: var(--navy); padding: 10px 16px;
  border-radius: 999px; font: inherit; font-weight: 600; font-size: .9rem; cursor: pointer; box-shadow: var(--shadow);
}
.tab.active { background: var(--navy); color: var(--gold-2); }

/* Listes */
.list-row { display: flex; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.list-row:last-child { border-bottom: 0; }
.list-row .sub { color: var(--muted); font-size: .82rem; }
.list-row .right { text-align: right; flex: 0 0 auto; }
.amount-plus { color: var(--ok); font-weight: 700; } .amount-minus { color: var(--err); font-weight: 700; }
.empty { text-align: center; color: var(--muted); padding: 18px 0; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: .9rem; margin: 8px 0; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; word-break: break-word; }

/* Étapes numérotées */
.steps { list-style: none; counter-reset: s; padding: 0; margin: 0 0 12px; }
.steps li { counter-increment: s; display: flex; gap: 12px; align-items: flex-start; padding: 8px 0; }
.steps li::before {
  content: counter(s); flex: 0 0 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  background: var(--gold); color: var(--navy); font-weight: 800; font-size: .85rem;
}
.merchant { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: var(--bg); border: 1.5px dashed var(--gold); border-radius: 14px; padding: 12px 14px; margin: 10px 0; }
.merchant strong { font-size: 1.3rem; letter-spacing: .08em; color: var(--navy); word-break: break-all; }
.notice { font-size: .82rem; color: var(--muted); border-left: 3px solid var(--gold); padding-left: 10px; margin: 10px 0; }
.link-box { background: rgba(255,255,255,.1); border-radius: 12px; padding: 10px 12px; font-size: .85rem; word-break: break-all; margin: 8px 0 12px; }

/* Accueil public */
.hero { background: linear-gradient(160deg, var(--navy), var(--navy-3)); color: var(--white); padding: 48px 20px 56px; text-align: center; }
.hero h1 { color: var(--white); font-size: 2.2rem; }
.hero .slogan { color: var(--gold-2); font-size: 1.15rem; margin-bottom: 20px; }
.hero p { max-width: 520px; margin-inline: auto; color: #d4dcf0; }
.section { padding: 28px 16px; max-width: 720px; margin: 0 auto; }
.pill-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pill { background: var(--white); border-radius: 16px; padding: 14px; box-shadow: var(--shadow); }
.pill strong { display: block; color: var(--navy); font-size: 1.2rem; }
.pill span { color: var(--muted); font-size: .85rem; }
details.faq { background: var(--white); border-radius: 14px; padding: 12px 14px; margin-bottom: 10px; box-shadow: var(--shadow); }
details.faq summary { font-weight: 700; cursor: pointer; }
.footer { text-align: center; color: var(--muted); font-size: .82rem; padding: 24px 16px calc(24px + env(safe-area-inset-bottom, 0px)); }
.footer a { color: var(--muted); }

/* Authentification */
.auth-wrap { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; padding: 20px 16px; max-width: 440px; margin: 0 auto; }
.auth-wrap .brand { color: var(--navy); justify-content: center; margin-bottom: 18px; }
.auth-wrap .brand-mark { width: 56px; height: 56px; border-radius: 12px; }
.hero-logo { width: 96px; height: 96px; border-radius: 20px; display: block; margin: 0 auto 14px; }
.footer-logo { width: 32px; height: 32px; border-radius: 8px; display: block; margin: 0 auto 8px; }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: calc(90px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%);
  background: var(--navy); color: var(--white); padding: 12px 18px; border-radius: 14px; z-index: 100;
  max-width: 90%; font-size: .92rem; box-shadow: var(--shadow); animation: pop .25s ease;
}
.toast.error { background: var(--err); } .toast.success { background: var(--ok); }
@keyframes pop { from { opacity: 0; transform: translate(-50%, 10px); } to { opacity: 1; transform: translate(-50%, 0); } }
.fade-in { animation: fade .3s ease; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.spinner { width: 28px; height: 28px; border: 3px solid var(--line); border-top-color: var(--gold); border-radius: 50%; animation: spin .8s linear infinite; margin: 24px auto; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (min-width: 720px) {
  .bottom-nav { max-width: 720px; left: 50%; transform: translateX(-50%); border-radius: 18px 18px 0 0; }
  .hero h1 { font-size: 2.8rem; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }

/* Mode démo */
.demo-banner {
  position: relative; z-index: 40; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--gold); color: var(--navy); font-size: .8rem; padding: calc(6px + env(safe-area-inset-top, 0px)) 12px 6px;
}
.demo-banner button { border: 1.5px solid var(--navy); background: transparent; color: var(--navy); border-radius: 8px; padding: 3px 10px; font: inherit; font-weight: 700; cursor: pointer; white-space: nowrap; }

/* Espace annonceur */
.badge-c-pending_review { background: #fff3d6; color: #8a5a00; }
.badge-c-approved { background: #e1f5eb; color: #11623e; }
.badge-c-paused { background: #eef0f6; color: #4a5575; }
.badge-c-completed { background: #e1ecff; color: #1c3f8f; }
.badge-c-rejected, .badge-c-suspended { background: #fbe3e0; color: #8e2a22; }
.progress { height: 8px; border-radius: 99px; background: var(--line); overflow: hidden; margin: 6px 0 2px; }
.progress > span { display: block; height: 100%; background: linear-gradient(90deg, var(--gold), var(--gold-2)); border-radius: 99px; }
.actions-grid { display: grid; grid-template-columns: 1fr; gap: 8px; }
.actions-grid .btn { justify-content: flex-start; }
.type-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 14px; }
.type-switch label { display: flex; gap: 8px; align-items: center; padding: 12px; border: 1.5px solid var(--line); border-radius: 14px; background: var(--white); font-weight: 700; cursor: pointer; }
.type-switch input { width: 18px; height: 18px; accent-color: var(--navy); }
.type-switch label:has(input:checked) { border-color: var(--gold); background: #fffbe8; }
.banner-preview { max-width: 100%; max-height: 160px; border-radius: 12px; margin-top: 8px; display: block; }
.camp-banner { width: 100%; max-height: 120px; object-fit: cover; border-radius: 12px; margin-bottom: 8px; }
.demo-tag { display: inline-block; font-size: .7rem; font-weight: 700; background: var(--gold); color: var(--navy); border-radius: 6px; padding: 1px 6px; margin-left: 6px; }
.camp-actions { margin-top: 10px; }
@media (min-width: 560px) { .actions-grid { grid-template-columns: 1fr 1fr; } }
/* Évite tout débordement horizontal sur petit écran (champs de date, grilles) */
.grid-2 > *, .grid-3 > * { min-width: 0; }
.field input[type=date] { min-width: 0; width: 100%; max-width: 100%; }
.field input:disabled { background: #f1f3f9; color: var(--muted); }
.card > p.sub { font-size: .85rem; color: var(--muted); }

/* Bonus d'abonnement, tombola, règles de retrait */
.plat { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; border-radius: 12px; font-weight: 800; color: #fff; background: var(--navy-3); flex: 0 0 auto; }
.plat-facebook { background: #1877f2; } .plat-instagram { background: #c13584; } .plat-tiktok { background: #111; }
.plat-youtube { background: #e02424; } .plat-whatsapp { background: #1fa855; } .plat-telegram { background: #229ed9; } .plat-x { background: #000; }
.rules { list-style: none; margin: 0 0 8px; padding: 0; }
.rules li { padding: 8px 0 8px 2px; border-bottom: 1px solid var(--line); font-size: .92rem; }
.rules li:last-child { border-bottom: 0; }
.rule-ok { color: #11623e; } .rule-ko { color: #8e2a22; }
.field textarea { width: 100%; }

/* Publicités */
.ad { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 14px; overflow: hidden; border: 1px solid var(--line); }
.ad-head { display: flex; align-items: center; gap: 8px; padding: 8px 12px 6px; font-size: .72rem; color: var(--muted); }
.ad-tag { background: #eef0f6; color: #4a5575; border-radius: 6px; padding: 1px 6px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; }
.ad-by { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ad-hide { color: var(--muted); white-space: nowrap; }
.ad-link { display: block; color: inherit; text-decoration: none; }
.ad-banner .ad-link img { display: block; width: 100%; aspect-ratio: 16 / 5; object-fit: cover; }
.ad-banner .ad-text { padding: 4px 14px 14px; }
.ad-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ad-text strong { color: var(--navy); }
.ad-text span { color: var(--muted); font-size: .85rem; }
.ad-card .ad-link { display: flex; align-items: center; gap: 12px; padding: 4px 12px 12px; }
.ad-card .ad-link img { width: 72px; height: 72px; object-fit: cover; border-radius: 12px; flex: 0 0 auto; }
.ad-card .ad-text { flex: 1; }
.sub-state { display: flex; justify-content: space-between; gap: 10px; align-items: center; }

/* ---- Rotation des pubs (toutes les 15 s) : apparition en fondu ---- */
.ad-in { animation: ad-fade .45s ease both; }
@keyframes ad-fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .ad-in { animation: none; } }

/* ---- Centres d'intérêt (puces à cocher) ---- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.chip { position: relative; display: inline-flex; cursor: pointer; }
.chip input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.chip span { display: inline-block; padding: 7px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--white);
  font-size: .86rem; color: var(--navy); line-height: 1.2; transition: background .15s, border-color .15s, color .15s; }
.chip input:checked + span { background: var(--navy); border-color: var(--navy); color: #fff; font-weight: 600; }
.chip input:focus-visible + span { outline: 2px solid var(--gold); outline-offset: 2px; }
.chip input:disabled + span { opacity: .45; cursor: not-allowed; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 0; }
.tag { background: #eef0f6; color: #4a5575; border-radius: 999px; padding: 3px 10px; font-size: .78rem; font-weight: 600; }

/* Assistant local */
.ast-fab { position: fixed; right: 14px; bottom: calc(14px + env(safe-area-inset-bottom, 0px)); z-index: 40; display: flex; align-items: center; gap: 6px; border: 0; border-radius: 999px; padding: 12px 16px; background: linear-gradient(135deg, var(--gold), var(--gold-2)); color: var(--navy); font: 700 .95rem/1 inherit; box-shadow: var(--shadow); cursor: pointer; }
.ast-fab.ast-up { bottom: calc(84px + env(safe-area-inset-bottom, 0px)); }
.ast-fab svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ast-box { position: fixed; z-index: 50; left: 0; right: 0; bottom: 0; height: min(86vh, 640px); display: flex; flex-direction: column; background: var(--white); border-radius: var(--radius) var(--radius) 0 0; box-shadow: 0 -8px 32px rgba(11, 27, 58, .25); padding-bottom: env(safe-area-inset-bottom, 0px); }
@media (min-width: 640px) { .ast-box { left: auto; right: 16px; bottom: 16px; width: 380px; border-radius: var(--radius); } }
.ast-head { display: flex; justify-content: space-between; align-items: center; background: var(--navy); color: var(--white); padding: 12px 16px; border-radius: inherit; border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.ast-x { border: 0; background: none; color: var(--white); font-size: 1.6rem; line-height: 1; cursor: pointer; padding: 0 4px; }
.ast-warn { background: #fff4d6; color: #6b4a00; font-size: .8rem; padding: 8px 14px; border-bottom: 1px solid var(--line); }
.ast-log { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.ast-msg { max-width: 88%; padding: 9px 12px; border-radius: 14px; font-size: .92rem; overflow-wrap: anywhere; }
.ast-msg.bot { background: var(--bg); align-self: flex-start; }
.ast-msg.me { background: var(--navy); color: var(--white); align-self: flex-end; }
.ast-chips { display: flex; gap: 6px; overflow-x: auto; padding: 4px 12px 8px; }
.ast-chips button { flex: none; max-width: 240px; border: 1px solid var(--line); background: var(--white); color: var(--navy); border-radius: 999px; padding: 6px 12px; font-size: .8rem; cursor: pointer; text-align: left; }
.ast-form { display: flex; gap: 8px; padding: 8px 12px 12px; border-top: 1px solid var(--line); }
.ast-form input { flex: 1; min-width: 0; font-size: 16px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; }
.ast-form button { border: 0; border-radius: 12px; padding: 0 16px; background: var(--navy); color: var(--white); font-weight: 700; cursor: pointer; }
.ast-gate { padding: 16px; overflow-y: auto; flex: 1; }
.notice { border-left: 5px solid var(--warn); background: #fff9e8; }

/* Catalogue produits */
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 10px; }
.chip { flex: none; border: 1px solid var(--line); background: var(--white); color: var(--navy); border-radius: 999px; padding: 7px 14px; font-size: .85rem; cursor: pointer; }
.chip.on { background: var(--navy); color: var(--white); border-color: var(--navy); }
.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-bottom: 14px; }
.pcard { display: flex; flex-direction: column; text-align: left; padding: 0; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--white); box-shadow: var(--shadow); cursor: pointer; font: inherit; color: var(--text); }
.pcard img, .pimg img, .pimg-ph { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; display: block; }
.pimg-ph { display: grid; place-items: center; font-size: 2.4rem; background: var(--bg); }
.pbody { display: flex; flex-direction: column; gap: 4px; padding: 10px 12px 12px; font-size: .9rem; }
.pprice { color: var(--navy-3); font-weight: 800; }
.pdetail { margin-top: 12px; }
.pdetail .pimg { margin: -16px -16px 12px; overflow: hidden; border-radius: var(--radius) var(--radius) 0 0; }
.ptext { white-space: pre-line; background: var(--bg); border-radius: 12px; padding: 12px; margin-bottom: 14px; font-size: .92rem; }
