/* ── Chez Yolande — Générateur d'étiquettes ──────────────────
   Habillage aligné sur la DA du planning bénévoles.
   Polices : Poppins (titres) · Nunito (texte) · IBM Plex Mono (mentions)
   Vendorisées dans /vendor/fonts (pas de CDN).
   ──────────────────────────────────────────────────────────── */

@font-face {
  font-family: 'Poppins';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('/vendor/fonts/Poppins-Medium.woff2') format('woff2');
}
@font-face {
  font-family: 'Poppins';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('/vendor/fonts/Poppins-SemiBold.woff2') format('woff2');
}
@font-face {
  font-family: 'Poppins';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('/vendor/fonts/Poppins-Bold.woff2') format('woff2');
}
@font-face {
  font-family: 'Nunito';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/vendor/fonts/Nunito-Regular.woff2') format('woff2');
}
@font-face {
  font-family: 'Nunito';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('/vendor/fonts/Nunito-SemiBold.woff2') format('woff2');
}
@font-face {
  font-family: 'Nunito';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('/vendor/fonts/Nunito-Bold.woff2') format('woff2');
}
@font-face {
  font-family: 'Nunito';
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url('/vendor/fonts/Nunito-ExtraBold.woff2') format('woff2');
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/vendor/fonts/IBMPlexMono-Regular.woff2') format('woff2');
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('/vendor/fonts/IBMPlexMono-Medium.woff2') format('woff2');
}

:root {
  --canvas: #f4eedb;
  --surface: #fffdf7;
  --ligne: #e6dcc0;

  --titre: #084d29;
  --texte: #5f5541;
  --fort: #2c2416;
  --doux: #8b8272;

  --vert: #0b6b39;
  --vert-fonce: #084d29;
  --vert-bg: #e7f0e9;
  --vert-bord: #cfe0d4;

  --ambre-bg: #fbf3cd;
  --ambre-ink: #8a6a04;
  --ambre-bord: #eadfae;

  --orange-bg: #fdeae2;
  --orange-ink: #8d2f0c;
  --orange-bord: #f6cdb9;
  --orange-vif: #cf4e24;

  --lime: #d7db45;
  --beige-f: #f9f5e8;
  --beige-depot: #faf6e9;

  --font-titre: "Poppins", system-ui, sans-serif;
  --font-texte: "Nunito", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;

  --r-sm: 14px;
  --r-md: 20px;
  --r-lg: 26px;

  --ombre-carte: 0 2px 4px rgba(44, 36, 22, .06), 0 18px 40px rgba(44, 36, 22, .07);
  --ombre-douce: 0 1px 2px rgba(44, 36, 22, .07);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--canvas);
  color: var(--fort);
  font-family: var(--font-texte);
  font-size: 16px;
  line-height: 1.55;
}

h1, h2, h3 { font-family: var(--font-titre); font-weight: 700; line-height: 1.14; margin: 0; }
a { color: var(--titre); text-decoration: none; }
a:hover { color: var(--vert); }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }

@keyframes cy-rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes cy-spin { to { transform: rotate(360deg); } }
@keyframes cy-bars { from { opacity: .3; } to { opacity: 1; } }

/* ── Barre d'application ─────────────────────────────────── */
.app-header {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 14px;
  padding: 12px 28px;
  background: linear-gradient(180deg, var(--vert) 0%, var(--vert-fonce) 100%);
  box-shadow: 0 1px 0 rgba(0, 0, 0, .12);
}
.app-header img {
  height: 40px; width: 40px; flex: none;
  border-radius: 999px; object-fit: cover; background: var(--surface);
}
.app-header .marque { font-family: var(--font-titre); font-size: 15px; font-weight: 600; line-height: 1.15; color: #fff; }
.app-header .sous { font-size: 12px; line-height: 1.2; color: rgba(248, 243, 223, .8); }
.app-header .badge {
  margin-left: auto;
  padding: 6px 13px; border-radius: 999px;
  background: rgba(255, 255, 255, .13);
  font-family: var(--font-mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase;
  color: rgba(248, 243, 223, .9);
}

/* ── Page ────────────────────────────────────────────────── */
.page { max-width: 1120px; margin: 0 auto; padding: 34px 28px 72px; }

.intro { max-width: 44ch; animation: cy-rise .5s cubic-bezier(.2, .7, .2, 1) both; }
.eyebrow { margin: 0; font-family: var(--font-mono); font-size: 11.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--ambre-ink); }
.intro h1 { margin: 8px 0 0; font-size: clamp(28px, 3.6vw, 34px); color: var(--titre); text-wrap: pretty; }
.intro .lead { margin: 10px 0 0; font-size: 16.5px; color: var(--texte); text-wrap: pretty; }

.layout {
  display: grid; grid-template-columns: minmax(0, 1fr) 340px;
  gap: 24px; align-items: stretch; margin-top: 26px;
}

/* ── Carte principale ────────────────────────────────────── */
.card {
  display: flex; flex-direction: column; justify-content: space-between; gap: 18px;
  padding: 28px; border-radius: var(--r-lg);
  border: 1px solid var(--ligne); background: var(--surface);
  box-shadow: var(--ombre-carte);
  animation: cy-rise .5s .05s cubic-bezier(.2, .7, .2, 1) both;
}
.step { display: flex; align-items: center; gap: 11px; }
.step-num {
  display: flex; height: 28px; width: 28px; flex: none;
  align-items: center; justify-content: center; border-radius: 999px;
  background: var(--vert-bg); color: var(--titre);
  font-family: var(--font-mono); font-size: 13px;
}
.step-title { display: block; font-family: var(--font-titre); font-size: 17px; font-weight: 600; line-height: 1.2; color: var(--titre); }
.step-sub { display: block; font-size: 13.5px; color: var(--texte); }
.sep { height: 1px; background: var(--ligne); }

/* ── Dépôt du fichier ────────────────────────────────────── */
.drop-zone {
  position: relative;
  display: flex; flex-direction: column; align-items: center; text-align: center;
  padding: 34px 22px; border-radius: var(--r-md);
  border: 2px dashed #d9cca8; background: var(--beige-depot);
  cursor: pointer;
  transition: border-color .16s ease, background .16s ease, transform .12s ease;
}
.drop-zone:hover { border-color: var(--vert); background: #f7f2e2; }
.drop-zone.over { border-color: var(--vert); background: var(--vert-bg); transform: translateY(-2px); }
.drop-zone.has-file { border-style: solid; border-color: var(--vert); background: #f2f7f2; }
.drop-zone input[type=file] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.dz-icon {
  display: flex; height: 56px; width: 56px; align-items: center; justify-content: center;
  border-radius: 999px; background: var(--surface); border: 1px solid var(--ligne);
  box-shadow: 0 3px 10px rgba(44, 36, 22, .10);
}
.dz-label { margin-top: 13px; font-family: var(--font-titre); font-size: 16px; font-weight: 600; color: var(--titre); }
.dz-sub { margin-top: 4px; font-size: 13.5px; color: var(--texte); }

.file-chip {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px 10px 16px; border-radius: 999px;
  background: var(--vert-bg); border: 1px solid var(--vert-bord);
  animation: cy-rise .22s ease both;
}
.file-chip svg { flex: none; color: var(--titre); }
.file-chip .name {
  flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 14px; font-weight: 700; color: var(--titre);
}
.file-chip .clear { display: flex; padding: 5px; border-radius: 999px; color: var(--texte); }
.file-chip .clear:hover { background: var(--ligne); color: var(--fort); }

/* ── Choix du format ─────────────────────────────────────── */
.cols-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.cols-option {
  display: block; padding: 15px 10px; text-align: center;
  border-radius: 18px; border: 2px solid var(--ligne); background: var(--beige-f);
  transition: transform .12s ease, box-shadow .12s ease, background .14s ease, border-color .14s ease;
}
.cols-option:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(44, 36, 22, .10); }
.cols-option.selected { border-color: var(--vert); background: var(--vert-bg); }
.cols-option .swatch { display: grid; gap: 3px; width: 36px; margin: 0 auto; }
.cols-option .swatch span { height: 14px; border-radius: 2px; background: #c9bd9c; }
.cols-option.selected .swatch span { background: var(--vert); }
.cols-option .big { display: block; margin-top: 11px; font-family: var(--font-titre); font-size: 16px; font-weight: 600; color: var(--fort); }
.cols-option.selected .big { color: var(--titre); }
.cols-option .small { display: block; margin-top: 2px; font-size: 12.5px; color: var(--texte); }

/* ── Traits de coupe ─────────────────────────────────────── */
.crop-row {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px;
  padding: 13px 15px; border-radius: 18px;
  border: 1px solid var(--ligne); background: var(--beige-f);
}
.crop-text { flex: 1; min-width: 180px; }
.crop-text b { display: block; font-family: var(--font-titre); font-size: 14.5px; font-weight: 600; color: var(--fort); }
.crop-text i { display: block; font-style: normal; font-size: 13px; color: var(--texte); }
.segmented { display: flex; gap: 3px; padding: 3px; border-radius: 999px; background: #ece7dc; }
.segmented button {
  display: inline-flex; align-items: center; min-height: 34px; padding: 0 17px;
  border-radius: 999px; font-family: var(--font-titre); font-size: 14px; font-weight: 600;
  color: var(--texte); transition: background .14s ease, color .14s ease;
}
.segmented button.on { background: var(--vert); color: var(--surface); }

/* ── Bouton principal ────────────────────────────────────── */
.btn-generate {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  width: 100%; min-height: 56px; margin-top: 4px;
  border-radius: 999px; background: var(--vert); color: var(--surface);
  font-family: var(--font-titre); font-size: 16.5px; font-weight: 600;
  box-shadow: 0 6px 16px rgba(11, 107, 57, .22);
  transition: background .16s ease;
}
.btn-generate:hover:not(:disabled) { background: var(--vert-fonce); }
.btn-generate:disabled { background: #6d9880; cursor: default; box-shadow: none; }
.btn-generate .spinner {
  height: 18px; width: 18px; flex: none; border-radius: 999px;
  border: 2.5px solid rgba(255, 255, 255, .35); border-top-color: var(--surface);
  animation: cy-spin .8s linear infinite;
}

/* ── Résultat / erreur ───────────────────────────────────── */
.result-box {
  padding: 18px; border-radius: var(--r-md);
  background: var(--vert-bg); border: 1px solid var(--vert-bord);
  animation: cy-rise .25s ease both;
}
.result-box .title { display: flex; align-items: center; gap: 9px; font-family: var(--font-titre); font-size: 16.5px; font-weight: 600; color: var(--titre); }
.result-box .title svg { color: var(--vert); }
.result-box .tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.result-tag {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 13px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--vert-bord);
  font-size: 13px; color: var(--titre);
}
.result-tag b { font-family: var(--font-mono); font-weight: 500; }
.result-box .again { margin-top: 14px; font-size: 13.5px; font-weight: 700; color: var(--titre); text-decoration: underline; text-underline-offset: 3px; }

.error-box {
  display: flex; gap: 11px; padding: 18px; border-radius: var(--r-md);
  background: var(--orange-bg); border: 1px solid var(--orange-bord);
  animation: cy-rise .25s ease both;
}
.error-box svg { flex: none; margin-top: 2px; color: var(--orange-vif); }
.error-box .titre { display: block; font-family: var(--font-titre); font-size: 15.5px; font-weight: 600; color: var(--orange-ink); }
.error-box .txt { display: block; margin-top: 3px; font-size: 14px; color: var(--orange-ink); text-wrap: pretty; }

/* ── Colonne d'aide ──────────────────────────────────────── */
.aside { display: flex; flex-direction: column; gap: 16px; animation: cy-rise .5s .1s cubic-bezier(.2, .7, .2, 1) both; }
.tip-box { padding: 20px; border-radius: 22px; border: 1px solid var(--ligne); background: var(--ambre-bg); }
.tip-box .titre { margin: 6px 0 0; font-family: var(--font-titre); font-size: 16.5px; font-weight: 600; line-height: 1.25; color: var(--fort); }
.tip-cols { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.tip-cols span {
  display: inline-flex; padding: 5px 11px; border-radius: 999px;
  background: rgba(255, 253, 247, .75); border: 1px solid var(--ambre-bord);
  font-family: var(--font-mono); font-size: 11.5px; color: var(--texte);
}

/* ── Aperçu de l'étiquette ───────────────────────────────── */
.preview-box { padding: 20px; border-radius: 22px; border: 1px solid var(--ligne); background: var(--surface); box-shadow: var(--ombre-douce); }
.preview-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.mono-note { font-family: var(--font-mono); font-size: 11px; color: var(--doux); }
.preview-stage {
  display: flex; align-items: center; justify-content: center;
  height: 142px; margin-top: 13px; padding: 12px; border-radius: 14px; background: var(--canvas);
}
.label-frame { position: relative; }
/* Traits de coupe : 4 repères d'angle, comme crop() dans pdf_core.py */
.label-frame.with-crop::before, .label-frame.with-crop::after,
.label-frame.with-crop > .label::before, .label-frame.with-crop > .label::after {
  content: ''; position: absolute; pointer-events: none;
  background:
    linear-gradient(#a0a0a0, #a0a0a0) left center / 7px 1px no-repeat,
    linear-gradient(#a0a0a0, #a0a0a0) center top / 1px 7px no-repeat;
  width: 7px; height: 7px;
}
.label-frame.with-crop::before { top: -8px; left: -8px; }
.label-frame.with-crop::after { top: -8px; right: -8px; transform: scaleX(-1); }
.label-frame.with-crop > .label::before { bottom: -8px; left: -8px; transform: scaleY(-1); }
.label-frame.with-crop > .label::after { bottom: -8px; right: -8px; transform: scale(-1); }

/* Échelle 2,8 px / mm — hauteur constante 39 mm, largeur selon le format */
.label {
  position: relative; flex: none;
  border: 2px solid #1a6b3a; border-radius: 2px; background: #fff; overflow: visible;
  transition: width .22s cubic-bezier(.2, .7, .2, 1);
}
.label > * { overflow: hidden; }
.lb-lib {
  display: flex; align-items: center; height: 25px; padding: 0 4px;
  font-family: var(--font-titre); font-size: 9.5px; font-weight: 700; color: #111;
  text-transform: uppercase; white-space: nowrap; text-overflow: ellipsis;
}
.lb-cont {
  display: flex; align-items: center; height: 13px; padding: 0 4px;
  background: #f0f5f0; border-top: 1px solid #bbb; border-bottom: 1px solid #bbb;
  font-size: 7px; color: #505050;
}
.lb-prix { display: flex; align-items: center; gap: 5px; height: 31px; padding: 0 4px; border-bottom: 1px solid #bbb; }
.lb-unit { flex: none; padding-right: 5px; border-right: 1px solid #bbb; }
.lb-unit b { display: block; font-size: 7px; font-weight: 400; line-height: 1.35; color: #3c3c3c; }
.lb-unit i { display: block; font-style: normal; font-size: 6px; line-height: 1.3; color: #787878; }
.lb-ttc { flex: 1; min-width: 0; text-align: right; font-family: var(--font-titre); font-size: 19px; font-weight: 700; line-height: 1; color: #e8724a; }
.lb-code { display: flex; flex-direction: column; justify-content: flex-end; height: 27px; padding: 3px 5px 1px; }
.lb-bars { display: flex; align-items: flex-end; justify-content: center; height: 15px; }
.lb-bars span { display: block; flex: 1 1 0; min-width: 0; height: 100%; }
.lb-bars span.on { background: #111; }
.lb-digits { font-family: var(--font-mono); font-size: 6px; letter-spacing: .14em; line-height: 1.5; color: #111; text-align: center; }
.lb-ref { display: flex; height: 14px; }
.lb-ref span { flex: 0 0 58%; display: flex; align-items: center; padding-left: 4px; background: #1a6b3a; font-family: var(--font-mono); font-size: 7px; color: #fff; }
.lb-ref i { flex: 1; background: #e8724a; }
.preview-note { margin: 11px 0 0; font-size: 13px; color: var(--texte); text-wrap: pretty; }
.preview-note b { color: var(--fort); }

/* ── Ce que fait l'outil (carré) ─────────────────────────── */
.how-box { display: flex; flex-direction: column; aspect-ratio: 1; padding: 22px; border-radius: 22px; border: 1px solid var(--ligne); background: var(--surface); box-shadow: var(--ombre-douce); }
.how-box .eyebrow { color: var(--texte); }
.how-list { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 14px; }
.how-list li { display: flex; gap: 11px; list-style: none; }
.how-list { padding: 0; margin: 13px 0 0; }
.how-box .bars { margin-top: auto; }
.how-num {
  display: flex; height: 24px; width: 24px; flex: none; align-items: center; justify-content: center;
  border-radius: 999px; background: var(--canvas);
  font-family: var(--font-mono); font-size: 11.5px; color: var(--texte);
}
.how-txt { flex: 1; min-width: 0; font-size: 14px; color: var(--texte); text-wrap: pretty; }
.how-txt b { color: var(--fort); }

.bars {
  display: flex; align-items: flex-end; justify-content: center; gap: 3px;
  height: 40px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--ligne);
}
.bars span { display: block; background: var(--vert); opacity: .5; animation: cy-bars ease-in-out infinite alternate; }

.page-footer {
  margin: 44px 0 0; text-align: center;
  font-family: var(--font-mono); font-size: 11.5px; letter-spacing: .06em; color: var(--doux);
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 900px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .app-header { padding: 10px 18px; }
  .app-header .badge { display: none; }
  .page { padding: 26px 18px 56px; }
  .card { padding: 20px; gap: 15px; }
  .cols-grid { gap: 8px; }
  .cols-option { padding: 12px 6px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; }
}
