/**
 * dossard.ma — feuille de style partagée.
 *
 * Lien avec le brief client : identité « startup », simple et minimale —
 * beaucoup de blanc, une seule couleur d'accent, typographie forte.
 *
 * Lien avec le reste de l'app : utilisée par toutes les vues Blade — pages
 * publiques (accueil, éditeur, confirmation) et espace admin. Le dossard lui-même n'est PAS stylé ici
 * (voir bib.js) afin que l'export PNG reste fidèle à l'aperçu.
 */

/* ---------- Jetons de design (couleurs, rayons, ombres) ---------- */
:root {
  --bg: #fafaf7;
  --surface: #ffffff;
  --ink: #111111;
  --muted: #6b6b66;
  --line: #e8e7e1;
  --accent: #ff4d2e;
  --accent-ink: #ffffff;
  --wa: #25d366;      /* vert de la marque WhatsApp */
  --wa-ink: #06301a;  /* texte lisible sur ce vert */
  --radius: 16px;
  --shadow: 0 1px 2px rgba(17, 17, 17, 0.04), 0 12px 32px rgba(17, 17, 17, 0.08);
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
h1, h2, h3 { line-height: 1.08; letter-spacing: -0.03em; margin: 0; }
p { margin: 0; }
.container { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 20px; }

/* ---------- Éléments communs : navigation, boutons ---------- */
.nav {
  position: sticky; top: 0; z-index: 20;
  background: rgba(250, 250, 247, 0.85);
  backdrop-filter: saturate(160%) blur(12px);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.nav-inner { display: flex; align-items: center; justify-content: space-between; height: 64px; }
/* Logo : le symbole « dossard » (voir favicon.svg) sert de « d » initial, suivi
   de « ossard.ma » ; l'écart est donc serré pour que l'ensemble se lise d'un trait. */
.logo { display: inline-flex; align-items: center; gap: 4px; }
.logo-mark { display: block; flex: none; transform: rotate(-6deg); transition: transform 0.2s ease; }
.logo:hover .logo-mark { transform: rotate(0deg); }
.logo-word { font-weight: 800; font-size: 20px; letter-spacing: -0.04em; }
.logo-word span { color: var(--accent); }
.nav-links { display: flex; align-items: center; gap: 28px; font-size: 15px; color: var(--muted); }
.nav-links a:hover { color: var(--ink); }
.nav-links .hide-sm { display: none; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 13px 22px; border-radius: 999px; border: 1px solid transparent;
  font: inherit; font-weight: 600; font-size: 15px; cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
.btn-primary { background: var(--ink); color: #fff; }
.btn-primary:hover { box-shadow: 0 8px 20px rgba(17, 17, 17, 0.2); }
.btn-accent { background: var(--accent); color: var(--accent-ink); }
.btn-accent:hover { box-shadow: 0 8px 20px rgba(255, 77, 46, 0.3); }
.btn-wa { background: var(--wa); color: var(--wa-ink); }
.btn-wa:hover { box-shadow: 0 8px 20px rgba(37, 211, 102, 0.35); }
.wa-icon { flex: none; display: block; }
.btn-ghost .wa-icon { color: var(--wa); }
.btn-ghost { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn-sm { padding: 9px 16px; font-size: 14px; }
.btn-block { width: 100%; }

/* ---------- Page d'accueil : héro ---------- */
.hero { padding: 56px 0 40px; overflow: hidden; }
.hero-grid { display: grid; gap: 48px; align-items: center; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 12px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line);
  font-size: 13px; font-weight: 600; color: var(--muted);
}
.eyebrow i { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.hero h1 { font-size: clamp(40px, 8vw, 72px); font-weight: 800; margin: 20px 0 18px; }
.hero h1 em { font-style: normal; color: var(--accent); }
.lead { font-size: clamp(17px, 2.2vw, 20px); color: var(--muted); max-width: 520px; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 30px; }

/* Pile de dossards de démonstration (rendus par landing.js via bib.js). */
.bib-stack { position: relative; width: 100%; max-width: 540px; margin: 0 auto; aspect-ratio: 84 / 80; }
.bib-stack svg {
  position: absolute; width: 70%; height: auto; border-radius: 3.2% / 4.4%;
  box-shadow: var(--shadow); transition: transform 0.4s ease;
}
.bib-stack svg:nth-child(1) { left: 0; top: 2%; transform: rotate(-7deg); }
.bib-stack svg:nth-child(2) { right: 0; top: 20%; transform: rotate(6deg); }
.bib-stack svg:nth-child(3) { left: 10%; top: 44%; transform: rotate(-2deg); }
.bib-stack:hover svg:nth-child(1) { transform: rotate(-11deg) translate(-6px, -4px); }
.bib-stack:hover svg:nth-child(2) { transform: rotate(9deg) translate(6px, -4px); }

/* ---------- Page d'accueil : sections ---------- */
.section { padding: 72px 0; }
.section-head { max-width: 620px; margin-bottom: 40px; }
.section-head h2 { font-size: clamp(30px, 5vw, 44px); font-weight: 800; }
.section-head p { color: var(--muted); margin-top: 14px; font-size: 18px; }
.kicker { font-size: 13px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); margin-bottom: 12px; }

.grid-3 { display: grid; gap: 16px; }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 28px;
}
.card h3 { font-size: 20px; font-weight: 700; margin-bottom: 8px; letter-spacing: -0.02em; }
.card p { color: var(--muted); font-size: 15px; }
.step-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 50%; margin-bottom: 20px;
  background: var(--ink); color: #fff; font-weight: 700; font-size: 14px;
}
.icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 12px; margin-bottom: 20px;
  background: #fff1ee; color: var(--accent);
}
.tags { display: flex; flex-wrap: wrap; gap: 10px; }
.tag { padding: 10px 18px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); font-weight: 600; font-size: 15px; }

.cta-band {
  background: var(--ink); color: #fff; border-radius: 28px;
  padding: 56px 28px; text-align: center;
}
.cta-band h2 { font-size: clamp(30px, 5vw, 48px); font-weight: 800; }
.cta-band p { color: #b9b9b3; margin: 14px auto 28px; max-width: 460px; font-size: 18px; }

/* ---------- Page d'accueil : contact direct (WhatsApp / e-mail) ---------- */
.hero-note { margin-top: 18px; font-size: 14px; color: var(--muted); }
.hero-note a { color: var(--ink); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.contact {
  display: grid; gap: 28px; align-items: center;
  background: var(--surface); border: 1px solid var(--line); border-radius: 28px; padding: 32px 24px;
}
.contact-text h2 { font-size: clamp(28px, 4.5vw, 40px); font-weight: 800; }
.contact-text p:last-child { color: var(--muted); margin-top: 14px; font-size: 17px; max-width: 440px; }
.contact-way {
  display: flex; align-items: center; gap: 16px; padding: 20px 22px;
  border-radius: var(--radius); background: var(--wa); color: var(--wa-ink);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.contact-way:hover { transform: translateY(-2px); box-shadow: 0 12px 28px rgba(37, 211, 102, 0.35); }
.wa-badge {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 48px; height: 48px; border-radius: 14px; background: #fff; color: var(--wa);
}
.contact-way-body { flex: 1; min-width: 0; }
.contact-way-body strong { display: block; font-size: 18px; }
.contact-way-body small { display: block; font-size: 15px; opacity: 0.8; }
.contact-way-arrow { font-weight: 700; font-size: 18px; }

/* Bouton flottant WhatsApp (page d'accueil). */
.fab {
  position: fixed; right: 16px; bottom: 16px; z-index: 30;
  display: inline-flex; align-items: center; gap: 9px; padding: 13px 18px;
  border-radius: 999px; background: var(--wa); color: var(--wa-ink); font-weight: 700; font-size: 15px;
  box-shadow: 0 10px 28px rgba(6, 48, 26, 0.3); transition: transform 0.15s ease;
}
.fab:hover { transform: translateY(-2px); }

.footer { border-top: 1px solid var(--line); padding: 28px 0 88px; color: var(--muted); font-size: 14px; }
.footer-inner { display: flex; flex-wrap: wrap; gap: 14px 28px; align-items: center; justify-content: space-between; }
.footer-links { display: flex; flex-wrap: wrap; gap: 20px; }
.footer a:hover { color: var(--ink); }

/* ---------- Éditeur : mise en page aperçu + panneau ---------- */
.editor { display: grid; gap: 20px; padding-top: 20px; padding-bottom: 56px; }
.stage {
  position: sticky; top: 64px; z-index: 10;
  background: var(--bg); padding: 12px 0 8px;
}
.stage-canvas {
  background:
    radial-gradient(circle at 1px 1px, #dddcd5 1px, transparent 0) 0 0 / 22px 22px,
    #f1f0ea;
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: clamp(14px, 4vw, 48px);
  display: flex; align-items: center; justify-content: center;
}
#bib { width: 100%; max-width: 640px; height: auto; display: block; border-radius: 3.2% / 4.4%; box-shadow: var(--shadow); }
.stage-meta { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 10px; font-size: 13px; color: var(--muted); }
.stage-meta button { background: none; border: 0; padding: 4px 0; font: inherit; font-weight: 600; color: var(--ink); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.tabs { display: grid; grid-template-columns: 1fr 1fr; border-bottom: 1px solid var(--line); }
.tab {
  padding: 16px 12px; background: #f6f5f0; border: 0; font: inherit; font-weight: 600; font-size: 15px;
  color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent;
}
.tab[aria-selected="true"] { background: var(--surface); color: var(--ink); border-bottom-color: var(--accent); }
.tab-body { padding: 22px; }
.tab-body[hidden] { display: none; }

/* ---------- Éditeur : champs de formulaire ---------- */
.group { margin-bottom: 26px; }
.group-title { font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin-bottom: 12px; }
.field { display: block; margin-bottom: 12px; }
.field > span { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.field small { display: block; color: var(--muted); font-size: 12px; margin-top: 5px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
input[type="text"], input[type="tel"], input[type="email"], input[type="number"], select, textarea {
  width: 100%; padding: 11px 13px; border: 1px solid var(--line); border-radius: 10px;
  background: #fff; color: var(--ink); font: inherit; font-size: 16px;
}
textarea { resize: vertical; min-height: 84px; }
input[aria-invalid="true"] { border-color: #d92d20; }

.templates { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.template-btn {
  padding: 6px 6px 8px; border: 1.5px solid var(--line); border-radius: 12px; background: #fff;
  font: inherit; font-size: 11px; font-weight: 600; color: var(--muted); cursor: pointer;
}
.template-btn svg { width: 100%; height: auto; display: block; margin-bottom: 6px; border-radius: 4px; }
.template-btn[aria-pressed="true"] { border-color: var(--ink); color: var(--ink); }

.palettes { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.palette {
  display: flex; width: 44px; height: 30px; padding: 0; border-radius: 8px; overflow: hidden;
  border: 1.5px solid var(--line); cursor: pointer; background: none;
}
.palette i { flex: 1; }
.colors { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.color { display: flex; align-items: center; gap: 8px; padding: 6px 10px 6px 6px; border: 1px solid var(--line); border-radius: 10px; font-size: 13px; font-weight: 600; cursor: pointer; }
.color input { width: 30px; height: 30px; padding: 0; border: 0; background: none; cursor: pointer; flex: none; }

.upload { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.upload input[type="file"] { position: absolute; width: 1px; height: 1px; opacity: 0; }
.upload input[type="file"]:focus-visible + label { outline: 2px solid var(--accent); outline-offset: 2px; }
.linklike { background: none; border: 0; padding: 0; font: inherit; font-size: 13px; color: var(--muted); text-decoration: underline; cursor: pointer; }

/* ---------- Éditeur : récapitulatif et messages de commande ---------- */
.summary { background: #f6f5f0; border-radius: 12px; padding: 14px 16px; font-size: 14px; margin-bottom: 18px; }
.summary div { display: flex; justify-content: space-between; gap: 16px; padding: 3px 0; }
.summary span { color: var(--muted); }
.summary strong { text-align: right; }
.actions { display: grid; gap: 10px; }
.notice { font-size: 13px; color: var(--muted); margin-top: 12px; }
.alert { border-radius: 12px; padding: 12px 14px; font-size: 14px; margin-bottom: 14px; }
.alert[hidden] { display: none; }
.alert-error { background: #fef3f2; color: #b42318; }
.alert-ok { background: #ecfdf3; color: #067647; }

/* Sur mobile, l'aperçu reste collé en haut mais compact, pour laisser la place
   aux champs (et au clavier) pendant la saisie. */
@media (max-width: 959px) {
  .stage-canvas { padding: 12px; }
  #bib { max-width: min(640px, 36vh); }
  .stage-meta span { display: none; }
  .stage-meta { justify-content: flex-end; margin-top: 6px; }
}

/* ---------- Adaptation aux écrans larges ---------- */
@media (min-width: 720px) {
  .nav-links .hide-sm { display: inline; }
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
  .cta-band { padding: 80px 40px; }
  .contact { grid-template-columns: 1fr 1fr; gap: 40px; padding: 48px; }
}
@media (min-width: 960px) {
  .hero { padding: 88px 0 72px; }
  .hero-grid { grid-template-columns: 1.05fr 1fr; }
  .section { padding: 96px 0; }
  .editor { grid-template-columns: minmax(0, 1fr) 420px; align-items: start; gap: 28px; padding-top: 28px; }
  .stage { top: 92px; padding: 0; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}

/* ---------- Bouton désactivé pendant l'envoi d'une commande ---------- */
.btn:disabled { opacity: 0.6; cursor: progress; transform: none; box-shadow: none; }

/* ---------- Page de confirmation de commande (orders/thanks) ---------- */
.thanks { max-width: 620px; margin: 0 auto; padding: 72px 0 96px; text-align: center; }
.thanks-check {
  display: inline-flex; align-items: center; justify-content: center;
  width: 64px; height: 64px; border-radius: 50%; background: #ecfdf3; color: #067647; margin-bottom: 24px;
}
.thanks h1 { font-size: clamp(32px, 6vw, 48px); font-weight: 800; }
.thanks .lead { margin: 16px auto 0; }
.thanks .summary { text-align: left; margin: 32px 0 28px; background: var(--surface); border: 1px solid var(--line); padding: 18px 20px; font-size: 15px; }
.thanks .reference { font-variant-numeric: tabular-nums; letter-spacing: 0.04em; }
.thanks-actions { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }

/* ---------- Espace admin (layouts/admin, admin/*) ---------- */
.admin { padding: 28px 0 72px; }
.admin h1 { font-size: 28px; font-weight: 800; }
.admin-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.filter { padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-size: 14px; font-weight: 600; color: var(--muted); }
.filter[aria-current="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 760px; }
.table th { text-align: left; font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); padding: 12px 14px; border-bottom: 1px solid var(--line); }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #fafaf7; }
.table .thumb { width: 84px; height: 60px; object-fit: contain; border-radius: 6px; border: 1px solid var(--line); display: block; background: #f1f0ea; }
.table a.ref { font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.num { font-variant-numeric: tabular-nums; }
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; background: #f1f0ea; color: var(--muted); white-space: nowrap; }
.badge-new { background: #fff1ee; color: #c2300f; }
.badge-contacted { background: #eff6ff; color: #1d4ed8; }
.badge-confirmed, .badge-done { background: #ecfdf3; color: #067647; }
.empty { padding: 48px 20px; text-align: center; color: var(--muted); }
.pagination { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 16px; font-size: 14px; color: var(--muted); }
.order-grid { display: grid; gap: 20px; }
.order-image { width: 100%; height: auto; display: block; border-radius: 12px; border: 1px solid var(--line); }
.dl { display: grid; grid-template-columns: minmax(110px, 38%) 1fr; gap: 8px 14px; font-size: 15px; margin: 0; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.swatch { display: inline-block; width: 14px; height: 14px; border-radius: 4px; border: 1px solid var(--line); vertical-align: -2px; margin-right: 6px; }
.card h2 { font-size: 13px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin-bottom: 14px; }
.card-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.status-form { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.status-form select { width: auto; flex: 1; min-width: 160px; }
.login { max-width: 400px; margin: 72px auto; }
.login h1 { font-size: 26px; font-weight: 800; margin-bottom: 20px; }
input[type="password"] { width: 100%; padding: 11px 13px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); font: inherit; font-size: 16px; }
@media (min-width: 960px) { .order-grid { grid-template-columns: 1.2fr 1fr; align-items: start; } }
