/* ==================================================================
   Administration — interface du bureau
   Outil de travail : sobre, dense, lisible. Pas de décor inutile.
   ================================================================== */

:root {
    --a-fond: #F5F6F8;
    --a-blanc: #FFFFFF;
    --a-encre: #111827;
    --a-texte: #374151;
    --a-dim: #5C6472;
    --a-bordure: #E3E6EB;
    --a-bleu: #1F6B70;
    --a-bleu-pale: #E3F1F2;
    --a-corail: #D9232B;
    --a-vert: #0A7350;
    --a-vert-pale: #E4F4EE;
    --a-or: #8A5A0B;
    --a-or-pale: #FBF0DA;
    --a-rouge: #C0392B;
    --a-rouge-pale: #FBEAE7;
    --a-ombre: 0 6px 20px -12px rgba(17, 24, 39, .28);
    --a-tex: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='28'%3E%3Cpath d='M28 0H0v28' fill='none' stroke='%23111827' stroke-opacity='.05' stroke-width='1'/%3E%3C/svg%3E");
}

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

/* Doit primer sur les règles de mise en page (.ligne-champs est en display:grid) */
[hidden] { display: none !important; }

html { font-size: 16px; }

body {
    margin: 0;
    background: var(--a-fond);
    color: var(--a-texte);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: .96rem;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { color: var(--a-encre); font-weight: 700; line-height: 1.2; margin: 0 0 .5em; letter-spacing: -.015em; }
h1 { font-size: 1.55rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.02rem; }

a { color: var(--a-bleu); }
img { max-width: 100%; height: auto; display: block; }

:focus-visible { outline: 3px solid var(--a-corail); outline-offset: 2px; border-radius: 4px; }

/* ---------- Structure ---------- */

.admin { display: flex; min-height: 100vh; }

.laterale {
    flex: 0 0 250px;
    width: 250px;
    background: var(--a-blanc);
    border-right: 1px solid var(--a-bordure);
    padding: 20px 16px;
    display: flex;
    flex-direction: column;
    gap: 22px;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.laterale-marque {
    display: flex;
    align-items: center;
    gap: 11px;
    text-decoration: none;
    color: var(--a-encre);
    padding: 4px 6px 14px;
    border-bottom: 1px solid var(--a-bordure);
}
.laterale-logo {
    display: grid; place-items: center;
    width: 38px; height: 38px;
    flex: 0 0 38px;
    border-radius: 11px;
    background: var(--a-bleu);
    color: #fff;
    font-weight: 800;
    font-size: .9rem;
}
.laterale-nom { font-weight: 700; font-size: .95rem; line-height: 1.2; }
.laterale-image {
    width: 100%;
    max-width: 190px;
    height: auto;
    margin-bottom: 6px;
    object-fit: contain;
}
.laterale-role { font-size: .76rem; color: var(--a-dim); }

.menu { display: grid; gap: 3px; }
.menu-titre {
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--a-dim);
    padding: 12px 10px 6px;
}
.menu a {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 10px 12px;
    border-radius: 10px;
    color: var(--a-texte);
    text-decoration: none;
    font-size: .93rem;
    font-weight: 500;
    transition: background-color .14s ease;
}
.menu a:hover { background: var(--a-fond); }
.menu a.actif { background: var(--a-bleu-pale); color: var(--a-bleu); font-weight: 600; }
.menu a svg { flex: 0 0 18px; opacity: .8; }
.menu a.actif svg { opacity: 1; }

.laterale-bas { margin-top: auto; border-top: 1px solid var(--a-bordure); padding-top: 14px; }

.principale { flex: 1; min-width: 0; padding: 26px clamp(16px, 3vw, 34px) 60px; }
.principale-large { max-width: 1080px; }

.barre-titre {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}
.barre-titre h1 { margin: 0; }
.barre-titre p { margin: 4px 0 0; color: var(--a-dim); font-size: .92rem; }

/* ---------- Cartes et tableaux ---------- */

.bloc {
    background: var(--a-blanc);
    border: 1px solid var(--a-bordure);
    border-radius: 16px;
    box-shadow: var(--a-ombre);
    overflow: hidden;
}
.bloc + .bloc { margin-top: 20px; }
.bloc-entete {
    padding: 16px 20px;
    border-bottom: 1px solid var(--a-bordure);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
}
.bloc-entete h2 { margin: 0; font-size: 1.02rem; }
.bloc-corps { padding: 20px; }

table { width: 100%; border-collapse: collapse; }
th, td { padding: 13px 20px; text-align: left; vertical-align: middle; }
th {
    font-size: .76rem;
    font-weight: 700;
    letter-spacing: .07em;
    text-transform: uppercase;
    color: var(--a-dim);
    border-bottom: 1px solid var(--a-bordure);
    background: #FAFBFC;
}
tbody tr + tr td { border-top: 1px solid var(--a-bordure); }
tbody tr:hover { background: #FAFBFC; }
td .titre-ligne { font-weight: 600; color: var(--a-encre); }
td .sous-ligne { font-size: .84rem; color: var(--a-dim); }
.colonne-actions { text-align: right; white-space: nowrap; }
.table-defilante { overflow-x: auto; }

.vignette-table {
    width: 54px; height: 54px;
    border-radius: 9px;
    object-fit: cover;
    background: var(--a-fond);
}
.vignette-vide {
    display: grid; place-items: center;
    width: 54px; height: 54px;
    border-radius: 9px;
    background: var(--a-fond) var(--a-tex);
    color: var(--a-dim);
}

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

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 40px;
    padding: 9px 16px;
    border: 1px solid transparent;
    border-radius: 10px;
    font: 600 .9rem/1.2 'Inter', sans-serif;
    text-decoration: none;
    cursor: pointer;
    transition: background-color .14s ease, border-color .14s ease;
}
.btn-primaire { background: var(--a-bleu); color: #fff; }
.btn-primaire:hover { background: #17565A; color: #fff; }
.btn-secondaire { background: var(--a-blanc); color: var(--a-encre); border-color: var(--a-bordure); }
.btn-secondaire:hover { border-color: #CBD2DC; background: #FAFBFC; }
.btn-danger { background: var(--a-rouge-pale); color: var(--a-rouge); border-color: #F0CFC9; }
.btn-danger:hover { background: #F6DCD7; }
.btn-petit { min-height: 34px; padding: 6px 12px; font-size: .85rem; border-radius: 9px; }
.btn[disabled] { opacity: .5; pointer-events: none; }

.groupe-boutons { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- Formulaires ---------- */

.champ { margin-bottom: 18px; }
.champ:last-child { margin-bottom: 0; }
.champ label {
    display: block;
    font-weight: 600;
    font-size: .88rem;
    color: var(--a-encre);
    margin-bottom: 6px;
}
.champ .aide { font-size: .82rem; color: var(--a-dim); margin: 6px 0 0; }

input[type="text"], input[type="email"], input[type="password"], input[type="url"],
input[type="date"], input[type="time"], input[type="number"], select, textarea {
    width: 100%;
    padding: 11px 13px;
    border: 1px solid var(--a-bordure);
    border-radius: 10px;
    background: var(--a-blanc);
    color: var(--a-texte);
    font: inherit;
    font-size: .94rem;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--a-bleu);
    box-shadow: 0 0 0 3px rgba(31, 107, 112, .14);
}
textarea { min-height: 130px; resize: vertical; line-height: 1.6; }
textarea.grand { min-height: 260px; font-family: ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace; font-size: .88rem; }

input[type="file"] {
    width: 100%;
    padding: 14px;
    border: 1px dashed #C6CCD6;
    border-radius: 10px;
    background: #FAFBFC;
    font-size: .9rem;
}

.ligne-champs {
    display: grid;
    gap: 18px;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr));
}

.case {
    display: flex;
    gap: 11px;
    align-items: flex-start;
    padding: 13px 15px;
    border: 1px solid var(--a-bordure);
    border-radius: 10px;
    background: #FAFBFC;
    cursor: pointer;
}
.case input { margin: 3px 0 0; width: 18px; height: 18px; flex: 0 0 18px; accent-color: var(--a-bleu); }
.case span { font-size: .9rem; }
.case strong { display: block; color: var(--a-encre); }

.pied-formulaire {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-top: 1px solid var(--a-bordure);
    background: #FAFBFC;
}

.apercu-image {
    display: flex;
    gap: 14px;
    align-items: center;
    padding: 12px;
    border: 1px solid var(--a-bordure);
    border-radius: 10px;
    background: #FAFBFC;
    margin-bottom: 12px;
}
.apercu-image img { width: 92px; height: 68px; object-fit: cover; border-radius: 8px; }

/* ---------- Messages et badges ---------- */

.message {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 13px 16px;
    margin-bottom: 18px;
    border-radius: 12px;
    border: 1px solid;
    font-size: .92rem;
}
.message-success { background: var(--a-vert-pale); border-color: #BCE3D4; color: #0A6B4B; }
.message-error   { background: var(--a-rouge-pale); border-color: #F0CFC9; color: #9A2E1C; }
.message-info    { background: var(--a-bleu-pale); border-color: #C9D8F0; color: var(--a-bleu); }

.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: .76rem;
    font-weight: 600;
    background: var(--a-fond);
    color: var(--a-texte);
}
.badge-vert { background: var(--a-vert-pale); color: var(--a-vert); }
.badge-or   { background: var(--a-or-pale); color: var(--a-or); }
.badge-bleu { background: var(--a-bleu-pale); color: var(--a-bleu); }

/* ---------- Tuiles du tableau de bord ---------- */

.tuiles {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 210px), 1fr));
    margin-bottom: 22px;
}
.tuile {
    position: relative;
    overflow: hidden;
    padding: 18px 20px;
    background: var(--a-blanc) var(--a-tex);
    border: 1px solid var(--a-bordure);
    border-radius: 16px;
    box-shadow: var(--a-ombre);
    text-decoration: none;
    color: inherit;
    display: block;
}
.tuile:hover { border-color: #CBD2DC; }
.tuile::after {
    content: "";
    position: absolute;
    right: -50px; bottom: -70px;
    width: 170px; height: 170px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(31, 107, 112, .15), transparent 70%);
    filter: blur(10px);
}
.tuile > * { position: relative; z-index: 1; }
.tuile-icone {
    display: grid; place-items: center;
    width: 38px; height: 38px;
    border-radius: 11px;
    background: var(--a-bleu-pale);
    color: var(--a-bleu);
    margin-bottom: 12px;
}
.tuile-valeur { font-size: 1.7rem; font-weight: 800; color: var(--a-encre); line-height: 1.1; }
.tuile-label { font-size: .87rem; color: var(--a-dim); margin-top: 3px; }

/* ---------- État vide ---------- */

.vide {
    display: grid;
    justify-items: center;
    gap: 12px;
    text-align: center;
    padding: 44px 22px;
    color: var(--a-dim);
}
.vide-medaillon {
    display: grid; place-items: center;
    width: 66px; height: 66px;
    border-radius: 50%;
    background: var(--a-fond) var(--a-tex);
    border: 2px dashed #D3D8E0;
    color: var(--a-bleu);
}
.vide h3 { margin: 0; }
.vide p { margin: 0; max-width: 44ch; }

/* ---------- Grille de photos ---------- */

.photos-admin {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 190px), 1fr));
}
.photo-admin {
    border: 1px solid var(--a-bordure);
    border-radius: 13px;
    overflow: hidden;
    background: var(--a-blanc);
}
.photo-admin img { width: 100%; aspect-ratio: 4/3; object-fit: cover; }
.photo-admin-corps { padding: 11px; display: grid; gap: 9px; }
.photo-admin input[type="text"] { padding: 8px 10px; font-size: .86rem; }

/* ---------- Page de connexion ---------- */

.connexion {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 26px;
    background:
        var(--a-tex),
        radial-gradient(60% 90% at 20% 0%, #23757B 0%, #175C62 50%, #0F444A 100%);
}
.connexion-carte {
    width: 100%;
    max-width: 430px;
    background: var(--a-blanc);
    border-radius: 20px;
    padding: clamp(26px, 5vw, 38px);
    box-shadow: 0 24px 60px -24px rgba(0, 0, 0, .5);
}
.connexion-marque {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
}
.connexion-carte h1 { font-size: 1.32rem; margin-bottom: .3em; }
.connexion-carte .intro { color: var(--a-dim); font-size: .92rem; margin: 0 0 24px; }
.connexion-retour { display: block; text-align: center; margin-top: 20px; font-size: .88rem; }

/* ---------- Responsive ---------- */

@media (max-width: 860px) {
    .admin { flex-direction: column; }
    .laterale {
        position: static;
        width: 100%;
        flex: none;
        height: auto;
        border-right: 0;
        border-bottom: 1px solid var(--a-bordure);
    }
    .menu { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
    .menu-titre { grid-column: 1 / -1; }
    .laterale-bas { margin-top: 8px; }
    th, td { padding: 11px 14px; }
}

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