/*
 * ============================================================
 *  CHARTE GRAPHIQUE – Polyclinique Les Cocotiers
 *  Toutes les couleurs et polices de l'application sont ici.
 *
 *  ⚠ Ces valeurs sont une interprétation (teal « lagon » + jaune « soleil »)
 *  car le site officiel n'a pas pu être lu automatiquement.
 *  Remplacez simplement les variables ci-dessous par les couleurs exactes
 *  de https://www.polycliniquelescocotiers.com/ : tout le reste suit.
 * ============================================================
 */
:root {
    /* Couleur principale */
    --brand-900: #073d39;
    --brand-800: #07534e;
    --brand-700: #08736b;
    --brand-600: #0b8b80;
    --brand-500: #21a99b;
    --brand-200: #b6e2dc;
    --brand-100: #dff2ee;
    --brand-50: #f1f8f6;

    /* Couleur d'accent */
    --accent-600: #d98a14;
    --accent-500: #f0a53a;
    --accent-100: #fdf0d9;

    /* Neutres */
    --ink: #183a37;
    --ink-soft: #355451;
    --muted: #68817e;
    --line: #dce8e5;
    --bg: #f3f7f6;
    --surface: #ffffff;

    /* États */
    --ok: #1f9d6b;
    --ok-bg: #e3f6ee;
    --warn: #b97a0a;
    --warn-bg: #fdf0d9;
    --danger: #c0392b;
    --danger-bg: #fbe9e6;
    --info: #1d6fa5;
    --info-bg: #e5f1f9;

    /* Échelle de satisfaction 1 → 5 */
    --s1: #d1493f;
    --s2: #ec8a3a;
    --s3: #e5c04b;
    --s4: #6dbb8a;
    --s5: #1f9d8f;
    --s-neutral: #9db3b1;

    /* Typographie */
    --font: 'Segoe UI', system-ui, -apple-system, 'Helvetica Neue', Arial, sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

    /* Forme */
    --radius: 16px;
    --radius-sm: 10px;
    --shadow: 0 1px 2px rgb(7 61 57 / 4%), 0 8px 24px rgb(7 61 57 / 5%);
    --shadow-lg: 0 18px 48px rgb(7 61 57 / 16%);
}

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

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.55;
    color: var(--ink);
    background:
        radial-gradient(900px 400px at 100% -12%, rgb(223 242 238 / 58%), transparent 72%),
        var(--bg);
}

h1, h2, h3 { line-height: 1.2; margin: 0 0 .4em; color: var(--brand-900); }
h1 { font-size: clamp(1.5rem, 1.2rem + 1.2vw, 2.1rem); }
h2 { font-size: 1.2rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 1em; }
a { color: var(--brand-700); }
a:hover { color: var(--brand-900); }
img { max-width: 100%; }
small { font-size: .8em; }
[hidden] { display: none !important; }

.muted { color: var(--muted); }
.center { text-align: center; }
.right { text-align: right; }
.mono { font-family: var(--font-mono); word-break: break-all; }
.small { font-size: .8rem; }
.lead { font-size: 1.05rem; color: var(--ink-soft); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

:focus-visible { outline: 3px solid var(--accent-500); outline-offset: 2px; }

/* ---------- Boutons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .45em;
    min-height: 2.65rem; padding: .62em 1.15em;
    border: 1.5px solid transparent; border-radius: 10px;
    font: inherit; font-weight: 600; line-height: 1.2; text-decoration: none;
    cursor: pointer; transition: background .15s, border-color .15s, transform .05s, box-shadow .15s;
}
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--brand-700); color: #fff; box-shadow: 0 2px 8px rgb(10 106 100 / 25%); }
.btn-primary:hover { background: var(--brand-800); color: #fff; }
.btn-ghost { background: var(--surface); color: var(--brand-800); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--brand-500); background: var(--brand-50); color: var(--brand-900); }
.btn-danger { background: var(--surface); color: var(--danger); border-color: #f0c4be; }
.btn-danger:hover { background: var(--danger-bg); color: var(--danger); }
.btn-sm { padding: .4em .85em; font-size: .85rem; }
.btn-lg { padding: .85em 1.6em; font-size: 1.05rem; }
.btn-block { display: flex; width: 100%; }
.btn-icon {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 2.6rem; min-height: 2.6rem;
    padding: .45rem;
    font-size: 1.2rem;
    background: var(--surface);
    border: 1px solid var(--line); border-radius: 999px;
    cursor: pointer; transition: background .15s, border-color .15s, transform .05s;
}
.btn-icon:hover { border-color: var(--brand-500); background: var(--brand-50); transform: translateY(-1px); }
.btn-icon:active { transform: translateY(1px); }

/* ---------- Formulaires ---------- */
form { min-width: 0; margin: 0; }
.field { display: flex; flex-direction: column; gap: .15rem; margin: 0; padding: 0; border: 0; min-width: 0; }
.field > label, .field > legend { font-weight: 600; font-size: .92rem; color: var(--ink-soft); padding: 0; margin: 0; }
.field > legend small { font-weight: 400; color: var(--muted); }

input[type='text'], input[type='email'], input[type='password'], input[type='number'], input[type='date'], input[type='tel'],
input[type='search'],
select, textarea {
    width: 100%; padding: .5em .7em;
    font: inherit; color: var(--ink);
    background: var(--surface);
    min-height: 2.7rem; border: 1.5px solid var(--line); border-radius: var(--radius-sm);
    transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; min-height: 5em; }
input:focus, select:focus, textarea:focus {
    outline: none; border-color: var(--brand-500); box-shadow: 0 0 0 4px var(--brand-100);
}

.field-check { flex-direction: row; align-items: center; gap: .55rem; }
.field-check > label { font-weight: 500; }
input[type='checkbox'], input[type='radio'] { width: 1.15rem; height: 1.15rem; accent-color: var(--brand-700); flex-shrink: 0; }

.field-help { margin: 0; font-size: .82rem; color: var(--muted); }
.field-error { margin: 0; font-size: .85rem; font-weight: 600; color: var(--danger); }
.has-error > input, .has-error > select, .has-error > textarea { border-color: var(--danger); }
.field > input, .field > select, .field > textarea { min-width: 0; max-width: 100%; }

/* ---------- Messages flash ---------- */
.flash {
    display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem;
    padding: .8em 1em; margin-bottom: 1rem;
    border-radius: var(--radius-sm); border: 1px solid transparent;
    font-size: .95rem; transition: opacity .2s;
}
.flash.is-leaving { opacity: 0; }
.flash-success { background: var(--ok-bg); border-color: #b9e6d2; color: #0f6d49; }
.flash-error { background: var(--danger-bg); border-color: #f0c4be; color: #8f2a20; }
.flash-info { background: var(--info-bg); border-color: #bcd9ec; color: #174f75; }
.flash-close { border: 0; background: transparent; font-size: 1.3rem; line-height: 1; cursor: pointer; color: inherit; opacity: .6; }
.flash-close:hover { opacity: 1; }

/* ---------- Marque ---------- */
.brand { display: inline-flex; align-items: center; gap: .65rem; text-decoration: none; color: var(--brand-900); }
.brand-logo { display: block; width: 3rem; height: 3rem; object-fit: contain; flex-shrink: 0; }
.brand-mark {
    display: grid; place-items: center; width: 2.6rem; height: 2.6rem;
    font-size: 1.5rem; border-radius: 12px;
    background: linear-gradient(145deg, var(--brand-100), #fff); border: 1px solid var(--brand-200);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-text strong { font-size: 1.05rem; letter-spacing: .01em; }
.brand-text small { color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .12em; margin-top: .2rem; }
.brand-light { color: #fff; }
.brand-light .brand-mark { background: rgb(255 255 255 / 12%); border-color: rgb(255 255 255 / 20%); }
.brand-light .brand-text small { color: var(--brand-200); }

/* ---------- Liens et tags ---------- */
.link-small { font-size: .88rem; font-weight: 600; text-decoration: none; }
.link-small:hover { text-decoration: underline; }

.tag {
    display: inline-flex; align-items: center; gap: .3em;
    padding: .18em .65em; margin: .1em .25em .1em 0;
    font-size: .78rem; font-weight: 600;
    color: var(--brand-800); background: var(--brand-100); border-radius: 999px; white-space: nowrap;
}
.tag-ok { color: #0f6d49; background: var(--ok-bg); }
.tag-warn { color: var(--warn); background: var(--warn-bg); }
.tag-off { color: var(--muted); background: #eaf0ef; }
.tag-role { color: var(--brand-900); background: var(--accent-100); }

/* ---------- Préférence de thème ---------- */
.theme-toggle {
    display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
    min-height: 2.6rem; padding: .45rem .85rem;
    color: var(--ink-soft); background: var(--surface);
    border: 1px solid var(--line); border-radius: 999px;
    font: inherit; font-size: .88rem; font-weight: 600;
    cursor: pointer; transition: background .15s, border-color .15s, color .15s;
}
.theme-toggle:hover { color: var(--brand-700); border-color: var(--brand-500); background: var(--brand-50); }
.theme-toggle-icon { font-size: 1.1rem; line-height: 1; }

:root[data-theme='dark'] {
    color-scheme: dark;
    --ink: #e4efed;
    --ink-soft: #c0d2cf;
    --muted: #9bb0ad;
    --line: #344a48;
    --bg: #101c1d;
    --surface: #192a2b;
    --brand-50: #1d3030;
    --brand-100: #24403e;
    --brand-200: #8bc8c1;
    --accent-100: #3b3020;
    --ok: #60d6a1;
    --ok-bg: #17392d;
    --warn: #edbd58;
    --warn-bg: #3a301d;
    --danger: #ff887b;
    --danger-bg: #402725;
    --info: #78bee8;
    --info-bg: #1d3444;
    --s-neutral: #607c79;
    --shadow: 0 1px 2px rgb(0 0 0 / 18%), 0 6px 20px rgb(0 0 0 / 18%);
    --shadow-lg: 0 10px 40px rgb(0 0 0 / 32%);
}

:root[data-theme='dark'] h1,
:root[data-theme='dark'] h2,
:root[data-theme='dark'] h3,
:root[data-theme='dark'] .brand:not(.brand-light),
:root[data-theme='dark'] .parcours-card-body strong,
:root[data-theme='dark'] .q-title,
:root[data-theme='dark'] .kpi-value,
:root[data-theme='dark'] .poster-cta,
:root[data-theme='dark'] .qa dt,
:root[data-theme='dark'] .tag-role {
    color: var(--ink);
}
:root[data-theme='dark'] .flash-success { border-color: #285d48; color: #a3e9c5; }
:root[data-theme='dark'] .flash-error { border-color: #75423b; color: #ffb1a7; }
:root[data-theme='dark'] .flash-info { border-color: #365c75; color: #a6d7f4; }
:root[data-theme='dark'] .tag { color: #b7e5df; }
:root[data-theme='dark'] .tag-ok { color: #a3e9c5; }
:root[data-theme='dark'] .tag-warn { color: #f2d28b; }
:root[data-theme='dark'] .tag-off { background: #293b3a; }
:root[data-theme='dark'] .tag-role { background: var(--accent-100); }
:root[data-theme='dark'] .btn-ghost:hover,
:root[data-theme='dark'] .segmented a:hover,
:root[data-theme='dark'] a.pager-page:hover,
:root[data-theme='dark'] a.pager-step:hover { color: var(--ink); }
:root[data-theme='dark'] .content a:not(.btn):not(.pager-page):not(.pager-step),
:root[data-theme='dark'] .pub-main a,
:root[data-theme='dark'] .pub-footer a,
:root[data-theme='dark'] .auth-foot a { color: #74cfc5; }
:root[data-theme='dark'] input,
:root[data-theme='dark'] select,
:root[data-theme='dark'] textarea { color-scheme: dark; }
:root[data-theme='dark'] .topbar { background: rgb(16 28 29 / 90%); }
:root[data-theme='dark'] .stepper-head { background: rgb(16 28 29 / 94%); }
:root[data-theme='dark'] .survey-actions { background: rgb(25 42 43 / 96%); }
:root[data-theme='dark'] .kpi-alert.has-alert { background: linear-gradient(180deg, var(--surface), var(--danger-bg)); }
:root[data-theme='dark'] .swal2-popup.swal-dialog { background: var(--surface); color: var(--ink); }
:root[data-theme='dark'] .swal-title { color: var(--ink); }
:root[data-theme='dark'] .swal-message { color: var(--ink-soft); }
.swal2-popup.swal-dialog { border-radius: var(--radius); }
.swal2-popup .swal-actions { gap: .65rem; }
.swal2-popup .swal-title { color: var(--brand-900); }
.swal2-popup .swal-message { color: var(--ink-soft); }
.swal2-popup .swal-actions .btn { margin: 0; }

@media (max-width: 520px) {
    body { font-size: 15px; }
    .btn { min-height: 2.8rem; }
}
@media print {
    :root[data-theme='dark'] body.poster-page { color-scheme: light; background: #fff; }
}
