/* =============================================================================
   styles.css — feuille de style unique (formulaire + admin)
   Les couleurs se modifient en un seul endroit : les variables ci-dessous.
   ========================================================================== */

:root {
    --brand:          #2563eb;
    --brand-dark:     #1d4ed8;
    --brand-soft:     #eff6ff;

    --text:           #111827;
    --text-muted:     #6b7280;
    --border:         #e5e7eb;
    --bg:             #f6f7f9;
    --surface:        #ffffff;

    --danger:         #b91c1c;
    --danger-soft:    #fef2f2;
    --success:        #15803d;

    --radius:         10px;
    --radius-sm:      6px;
    --shadow:         0 1px 2px rgba(16, 24, 40, .04), 0 8px 24px rgba(16, 24, 40, .06);
    --wrap:           820px;
    --font:           system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans Arabic", sans-serif;
}

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

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

body {
    margin: 0;
    padding: 0 0 3rem;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.6;
}

body.admin { --wrap: 1080px; }

.wrap {
    width: 100%;
    max-width: var(--wrap);
    margin: 0 auto;
    padding: 0 1rem;
}

/* ----------------------------------------------------------------- Header */

.site-header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 2rem 0 1.75rem;
    margin-bottom: 2rem;
}

.site-header h1 {
    margin: 0 0 .35rem;
    font-size: 1.6rem;
    line-height: 1.25;
    letter-spacing: -.01em;
}

.lead {
    margin: 0;
    color: var(--text-muted);
    font-size: .95rem;
}

.header-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
    justify-content: space-between;
}

.header-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
}

/* ------------------------------------------------------------------ Carte */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.75rem;
}

@media (min-width: 640px) {
    .card { padding: 2.25rem; }
}

/* -------------------------------------------------------------- Sections */

.section {
    border: 0;
    border-top: 1px solid var(--border);
    margin: 0 0 1.5rem;
    padding: 1.5rem 0 0;
}

.section:first-of-type {
    border-top: 0;
    padding-top: 0;
}

.section legend {
    padding: 0;
    margin-bottom: 1.1rem;
    font-size: 1.05rem;
    font-weight: 650;
    color: var(--brand-dark);
}

/* ---------------------------------------------------------------- Champs */

.field { margin-bottom: 1.35rem; }

.field > label {
    display: block;
    margin-bottom: .45rem;
    font-weight: 550;
    font-size: .94rem;
}

.req { color: var(--danger); }

input[type="text"],
input[type="email"],
input[type="number"],
input[type="date"],
input[type="password"],
select,
textarea {
    width: 100%;
    padding: .65rem .75rem;
    font: inherit;
    font-size: .95rem;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    transition: border-color .15s, box-shadow .15s;
}

textarea { resize: vertical; min-height: 96px; }

input:focus, select:focus, textarea:focus {
    outline: 0;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .15);
}

.help {
    margin: .4rem 0 0;
    font-size: .84rem;
    color: var(--text-muted);
}

/* Choix multiples (radio / checkbox) */

.choices {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
}

.choice {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    padding: .5rem .8rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    font-size: .93rem;
    cursor: pointer;
    transition: background .15s, border-color .15s;
}

.choice:hover { border-color: var(--brand); background: var(--brand-soft); }
.choice input { accent-color: var(--brand); margin: 0; }

/* Champ anti-spam : invisible pour l'humain, present pour les robots */
.hp-field {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

/* --------------------------------------------------------------- Boutons */

.actions { margin-top: 1.75rem; }

.btn {
    display: inline-block;
    padding: .7rem 1.4rem;
    font: inherit;
    font-size: .95rem;
    font-weight: 550;
    color: #fff;
    background: var(--brand);
    border: 1px solid var(--brand);
    border-radius: var(--radius-sm);
    text-decoration: none;
    cursor: pointer;
    transition: background .15s;
}

.btn:hover { background: var(--brand-dark); }

.btn-ghost {
    color: var(--brand-dark);
    background: transparent;
    border-color: var(--border);
}

.btn-ghost:hover { background: var(--brand-soft); }

.btn-small { padding: .4rem .8rem; font-size: .85rem; }

/* --------------------------------------------------------------- Alertes */

.alert {
    padding: .9rem 1.1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1.5rem;
    font-size: .93rem;
}

.alert-error {
    color: var(--danger);
    background: var(--danger-soft);
    border: 1px solid #fecaca;
}

.alert ul { margin: .5rem 0 0; padding-left: 1.2rem; }

/* ------------------------------------------------------------ Remerciement */

.thanks { text-align: center; margin-top: 3rem; }

.thanks h1 { margin: .5rem 0 .25rem; font-size: 1.7rem; }

.thanks-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #dcfce7;
    color: var(--success);
    font-size: 1.7rem;
    font-weight: 700;
}

/* ----------------------------------------------------------------- Admin */

.login-page .wrap { max-width: 420px; }
.login-card { margin-top: 12vh; }
.login-card h1 { margin: 0 0 .25rem; font-size: 1.35rem; }

.table-scroll { overflow-x: auto; }

.list-table, .meta-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .93rem;
}

.list-table th, .list-table td,
.meta-table th, .meta-table td {
    padding: .7rem .6rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}

.list-table th {
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--text-muted);
    white-space: nowrap;
}

.list-table tbody tr:hover { background: var(--brand-soft); }

.meta-table { margin-bottom: 1.5rem; }
.meta-table th { width: 150px; color: var(--text-muted); font-weight: 550; }

.section-title {
    margin: 1.75rem 0 .5rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border);
    font-size: 1rem;
    color: var(--brand-dark);
}

.section-title small { color: var(--text-muted); font-weight: 400; }

.answers { margin: 0; }

.answers dt {
    margin-top: 1rem;
    font-weight: 550;
    font-size: .92rem;
}

.answers dd {
    margin: .25rem 0 0;
    padding: .6rem .8rem;
    background: var(--bg);
    border-radius: var(--radius-sm);
    font-size: .93rem;
    white-space: normal;
    overflow-wrap: anywhere;
}

.answers dd.empty, .empty { color: var(--text-muted); font-style: italic; }

.back-link { color: var(--brand-dark); text-decoration: none; font-size: .9rem; }
.back-link:hover { text-decoration: underline; }

.pagination {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem;
    margin-top: 1.25rem;
}

.page {
    display: inline-block;
    min-width: 34px;
    padding: .35rem .5rem;
    text-align: center;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    text-decoration: none;
    font-size: .88rem;
}

.page.current, .page:hover { background: var(--brand); border-color: var(--brand); color: #fff; }

/* ---------------------------------------------------------------- Footer */

.site-footer {
    margin-top: 2.5rem;
    color: var(--text-muted);
    font-size: .82rem;
    text-align: center;
}

/* Le texte arabe reste lisible meme sans mise en page RTL globale */
[lang="ar"], .rtl { direction: rtl; text-align: right; }
