/* onboarding/assets/css/styles.css */

/* ==============================
   Variables & reset
============================== */
:root{
  --bg: #f2f2f7;               /* iOS grouped bg */
  --card: #fff;
  --text: #111;
  --muted: #6b7280;
  --blue: #2563eb;
  --green: #16a34a;
  --orange: #ea580c;
  --shadow: 0 8px 20px rgba(0,0,0,.08);
  --radius: 16px;
}

* { box-sizing: border-box; }
html, body {
  margin:0; padding:0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color:var(--text); background:var(--bg);
}
.muted { color: var(--muted); }
.sr-only{
  position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0;
}

/* ==============================
   Topbar
============================== */
.topbar{
  position: sticky; top:0; z-index: 5;
  display:flex; align-items:center; justify-content:space-between;
  padding: 12px 16px; background: var(--card); box-shadow: var(--shadow);
}
.topbar__title{ font-weight: 700; }
.topbar__actions button{
  margin-left: 8px; border:0; background:#f5f5f5; border-radius:10px; padding:8px 10px; cursor:pointer;
}

/* --- Topbar iOS-like --- */
.topbar--ios {
  display:flex; align-items:center; justify-content:center;
  position: sticky; top:0; z-index:5;
  background: var(--card); box-shadow: var(--shadow); padding: 10px 12px;
}
.topbar--ios .topbar__title { font-weight:700; }
.topbar--ios .topbar__spacer { width:96px; } /* équilibre avec le bouton gauche */
.navpill{
  border:0; background:#f1f5f9; padding:8px 14px; border-radius:999px; cursor:pointer;
  position:absolute; left:12px; display:flex; align-items:center; gap:6px;
  box-shadow: 0 1px 0 rgba(0,0,0,.06) inset, 0 1px 8px rgba(0,0,0,.06);
  transition: filter .15s ease, transform .06s ease;
}
.navpill .chev{ font-size:18px; line-height:1; }
.navpill:hover{ filter:brightness(0.98); }
.navpill:active{ transform: translateY(1px); }

/* ==============================
   Login card
============================== */
.login{ display:flex; justify-content:center; padding:16px; }
.login__card{
  width:100%; max-width:900px; background:var(--card); box-shadow:var(--shadow); border-radius:var(--radius); padding:16px;
}
.login h2{ margin:0 0 8px 0; }
.login__row{ display:flex; gap:8px; margin-top:8px; flex-wrap:wrap; }
.login__row input, .login__row select{
  flex:1 1 280px; padding:10px 12px; border:1px solid #e5e7eb; border-radius:10px;
}
.login__row button{
  padding:10px 14px; border:0; border-radius:10px; background:var(--blue); color:#fff; cursor:pointer;
}

/* ==============================
   User details card
============================== */
.details{ display:flex; justify-content:center; padding: 8px 16px 0; }
.details__card{
  display:flex; gap:16px; width:100%; max-width:900px; background:var(--card);
  border-radius:var(--radius); box-shadow:var(--shadow); padding:16px;
}
.details__text{ flex:1; }
.details__user{ font-weight:700; font-size:1.1rem; }
.details__email{ color:var(--muted); margin-top:2px; }
.details__oje{ margin-top:12px; }
.details__oje-title{ font-weight:600; }
.details__oje-sub{ color:var(--muted); }

.details__branding{ width:220px; text-align:right; }
.details__branding img{ max-width:200px; max-height:80px; object-fit:contain; }
.details__address{ color:var(--muted); font-size:.9rem; margin-top:6px; white-space:pre-line; }

/* ==============================
   Lists
============================== */
.list{ display:flex; flex-direction:column; align-items:center; padding: 12px 16px 100px; }
.list__section{ width:100%; max-width:900px; margin-top:12px; }
.list__section h3{ margin:6px 4px; color:#111; }
.list__ul{
  list-style:none; padding:0; margin:0; background:var(--card);
  border-radius:var(--radius); overflow:hidden; box-shadow:var(--shadow);
}
.list__li{ display:flex; align-items:center; gap:12px; padding:12px 14px; border-top:1px solid #f0f0f0; }
.list__li:first-child{ border-top:0; }
.item__icon{ font-size:1.2rem; width:1.8rem; text-align:center; }
.item__main{ flex:1; }
.item__title{ font-weight:600; }
.item__sub{ color:var(--muted); font-size:.95rem; }
.item__chev{ opacity:.5; }

.badge--orange{ color:#fff; background:var(--orange); padding:2px 8px; border-radius:999px; font-size:.75rem; }
.badge--blue{ color:#fff; background:var(--blue); padding:2px 8px; border-radius:999px; font-size:.75rem; }
.badge--green{ color:#fff; background:var(--green); padding:2px 8px; border-radius:999px; font-size:.75rem; }

.list__footer{ color:var(--muted); margin:8px 2px; }

/* ==============================
   Floating buttons
============================== */
.fab{
  position: fixed; bottom: 18px; width:54px; height:54px; border-radius:50%;
  border:0; color:#fff; cursor:pointer; box-shadow: var(--shadow); font-size:1.2rem;
}
.fab--right{ right:18px; background:var(--blue); }
.fab--left{ left:18px; background:var(--green); }

/* ==============================
   Modal / dialog
============================== */
.modal{ width:min(940px, 96vw); border:0; border-radius:12px; padding:0; }
.modal__header{
  display:flex; justify-content:space-between; align-items:center;
  padding:12px 14px; border-bottom:1px solid #eee;
}
.modal__body{ padding:12px 14px; max-height:70vh; overflow:auto; }
.modal__body embed, .modal__body img{ width:100%; height:auto; border-radius: 8px; }
.modal::backdrop{ background: rgba(0,0,0,.35); }

/* ==============================
   Toast & confetti
============================== */
.toast{
  position: fixed; top:12px; left:50%; transform:translateX(-50%);
  background:#111; color:#fff; padding:10px 12px; border-radius:10px; box-shadow:var(--shadow);
  z-index: 6;
}
.confetti{
  position: fixed; inset:0; pointer-events:none; display:block;
  z-index: 4;
}

/* ==============================
   Apple-like login (optional)
============================== */
.apple-hero{
  min-height: calc(100dvh - 64px);
  display:flex; align-items:center; justify-content:center;
  background: radial-gradient(1200px 600px at 10% -10%, rgba(0,0,0,.06), transparent),
              radial-gradient(900px 400px at 120% 10%, rgba(0,0,0,.05), transparent);
  padding: 24px;
}
.apple-card{
  width:min(560px, 96vw);
  padding: 28px; border-radius: 24px; background: rgba(255,255,255, .55);
  box-shadow: 0 20px 60px rgba(0,0,0,.12);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border: 1px solid rgba(255,255,255,.6);
}
.apple-title{ font-size: 28px; font-weight: 700; letter-spacing: .1px; }
.apple-subtitle{ margin-top: 4px; color:#6b7280; font-size: 16px; }
.apple-form{ display:flex; gap:10px; margin-top: 16px; flex-wrap: wrap; }
.apple-input{
  flex:1; padding: 14px 16px; font-size:16px;
  border-radius: 999px; border:1px solid rgba(0,0,0,.08);
  background: rgba(255,255,255,.7);
}
.apple-input:focus{ outline:none; border-color: rgba(0,0,0,.2); background:#fff; }
.apple-button{
  padding: 14px 18px; border:0; border-radius:999px; cursor:pointer;
  font-weight:600; background: linear-gradient(to bottom, #2e7af0, #2a66d7);
  color:#fff; box-shadow: 0 10px 24px rgba(46,122,240,.35); transition: transform .06s ease;
}
.apple-button:active{ transform: translateY(1px); }
.apple-hint{ margin-top: 10px; color:#6b7280; min-height: 18px; }

/* ==============================
   Form fields (Apple-ish)
============================== */
.formgrid{ display:grid; grid-template-columns: repeat(auto-fit, minmax(240px,1fr)); gap:12px; }
.field { display:flex; flex-direction:column; gap:6px; }
.field__label{ font-size:.9rem; color:var(--muted); }
.field__input{
  appearance:none; -webkit-appearance:none;
  padding:12px 14px; border-radius:14px; border:1px solid #e5e7eb;
  background: #fafafa; outline:none; transition:border .15s, background .15s, box-shadow .15s;
}
.field__input:focus{
  border-color:#c7d2fe; background:#ffffff;
  box-shadow: 0 0 0 4px rgba(99,102,241,.14);
}

/* Segmented Control "Cassier Judiciaire Vierge" */
.seg{ display:inline-flex; border:1px solid #e5e7eb; border-radius:12px; overflow:hidden; }
.seg__btn{
  background:#f5f5f7; border:0; padding:8px 12px; cursor:pointer; font-weight:600;
}
.seg__btn + .seg__btn{ border-left:1px solid #e5e7eb; }
.seg__btn--active{ background:var(--blue); color:#fff; }


/* ==============================
   Buttons
============================== */
.btn{ border:0; border-radius:14px; padding:12px 16px; cursor:pointer; font-weight:600; }
.btn--primary{ color:#fff; background:var(--blue); }
.btn--secondary{ color:#111; background:#e5e7eb; }
.btn--ghost{ background:transparent; border:1px solid #e5e7eb; }
.btn:focus-visible{
  outline: 3px solid rgba(37,99,235,.4);
  outline-offset: 2px;
}
.actions{ display:flex; align-items:center; gap:10px; margin-top:12px; flex-wrap:wrap; }

/* ==============================
   Signature pad box + canvas
============================== */
.signbox{
  background: var(--card); border-radius:16px; box-shadow: var(--shadow);
  padding:12px; border:1px solid #eef2f7;
}
.signbox__actions{ display:flex; align-items:center; gap:10px; margin-top:8px; }

/* Canvas de signature :
   - taille CSS fixe pour garantir clientWidth/Height != 0
   - empêche le scroll (touch), sélection de texte, etc.
   - curseur en croix sur desktop
*/
#sigPad{
  width:100%;
  height:220px; /* important: fixe côté CSS pour que le JS calcule correctement */
  background:#fff;
  border-radius:10px; border:1px dashed #cbd5e1;
  touch-action: none;
  -webkit-user-select: none; user-select: none;
  -webkit-touch-callout: none;
  cursor: crosshair;
}

/* ==============================
   PDF preview
============================== */
.previewwrap{
  background: var(--card); border-radius:16px; box-shadow: var(--shadow);
  padding:8px; border:1px solid #eef2f7;
}
#pdfPreview{ width:100%; min-height:70vh; border-radius:10px; display:block; }

/* ==============================
   Dark mode (léger)
============================== 
@media (prefers-color-scheme: dark){
  :root{
    --bg:#0b0b0f; --card:#141418; --text:#f5f5f5; --muted:#9aa0aa;
    --shadow: 0 8px 20px rgba(0,0,0,.5);
  }
  .topbar, .topbar--ios, .login__card, .details__card, .list__ul,
  .previewwrap, .signbox, .modal, .apple-card{
    background: var(--card);
  }
  .login__row input, .login__row select{ background:#0f0f13; color:var(--text); border-color:#2a2a32; }
  .modal__header{ border-bottom-color:#222; }
  .list__li{ border-top-color:#1d1d23; }
  .navpill{ background:#1b1b22; }
  .btn--secondary{ background:#1d1d23; color:#eaeaea; }
  #sigPad{ border-color:#2a2a32; }
}
*/