/* =========================================================
   Alftopia — feuille de style
   ========================================================= */

:root {
    --forest-900: #0f201b;
    --forest-800: #16302a;
    --forest-700: #1d3d34;
    --amber: #f2a43a;
    --amber-dark: #d98b20;
    --amber-soft: #fbe3bb;
    --cream: #f6eedf;
    --cream-2: #efe4cf;
    --paper: #fffaf0;
    --ink: #1e2b24;
    --ink-soft: #4d564f;
    --line: #e1d4bb;
    --cream-text: #f6e7c8;
    --danger: #a5372b;
    --ok: #2f6b45;
    --radius: 14px;
    --shadow: 0 1px 2px rgba(40, 30, 10, .06), 0 8px 24px rgba(40, 30, 10, .08);
    --font-title: "Fraunces", Georgia, serif;
    --font-body: "Crimson Pro", Georgia, serif;
}

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

html { scroll-behavior: smooth; }

body {
    margin: 0;
    background: var(--cream);
    background-image: radial-gradient(rgba(120, 90, 40, .05) 1px, transparent 1px);
    background-size: 4px 4px;
    color: var(--ink);
    font-family: var(--font-body);
    font-size: 19px;
    line-height: 1.45;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

h1, h2, h3 { font-family: var(--font-title); font-weight: 700; line-height: 1.1; margin: 0; letter-spacing: -.01em; }
a { color: var(--forest-700); }
img { max-width: 100%; }

.icon { width: 1.1em; height: 1.1em; flex: none; vertical-align: -.15em; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

.container { width: 100%; max-width: 1400px; margin: 0 auto; padding: 0 16px; }
@media (min-width: 720px) { .container { padding: 0 40px; } }
.narrow { max-width: 520px; }
.site-main { flex: 1; }

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

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .5em;
    padding: .55em 1.2em; border-radius: 10px; border: 1.5px solid transparent;
    font: 600 1rem/1.2 var(--font-body); text-decoration: none; cursor: pointer;
    transition: background .15s, color .15s, border-color .15s, transform .15s;
    white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); }
.btn:focus-visible, .chip:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
    outline: 3px solid var(--amber); outline-offset: 2px;
}
.btn--sm { font-size: .92rem; padding: .5em 1em; }
.btn--lg { font-size: 1.1rem; padding: .75em 1.6em; border-radius: 999px; }
.btn--block { width: 100%; }
.btn--amber { background: var(--amber); color: #1b1206; }
.btn--amber:hover { background: #f6b252; }
.btn--forest { background: var(--forest-800); color: var(--cream-text); }
.btn--forest:hover { background: var(--forest-700); }
.btn--outline { background: transparent; border-color: var(--forest-800); color: var(--forest-800); }
.btn--outline:hover { background: var(--forest-800); color: var(--cream-text); }
.btn--outline-light { background: rgba(10, 20, 15, .35); border-color: var(--cream-text); color: var(--cream-text); }
.btn--outline-light:hover { background: rgba(10, 20, 15, .6); }
.btn--ghost { background: var(--cream-2); color: var(--ink-soft); }
.btn--danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn--danger:hover { background: var(--danger); color: #fff; }
.btn.is-disabled { cursor: default; transform: none; }
.inline-form { display: inline; margin: 0; }

/* ---------- En-tête ---------- */

.site-header { position: relative; z-index: 20; color: var(--cream-text); background: var(--forest-900); }
.has-hero .site-header { position: absolute; inset: 0 0 auto; background: linear-gradient(rgba(10, 20, 15, .75), rgba(10, 20, 15, 0)); }
.site-header__inner {
    max-width: 1400px; margin: 0 auto; padding: 10px 16px;
    display: flex; align-items: center; gap: 24px;
}
@media (min-width: 720px) { .site-header__inner { padding: 12px 40px; } }

.brand img { display: block; height: 58px; width: auto; }

.site-nav { display: flex; align-items: center; flex: 1; gap: 24px; }
.site-nav__main { display: flex; gap: 28px; flex: 1; padding-left: 40px; }
.site-nav__main a, .nav-link {
    color: var(--cream-text); text-decoration: none; font-size: 1.05rem;
    padding: 6px 2px; border-bottom: 2px solid transparent;
    display: inline-flex; align-items: center; gap: .45em;
}
.site-nav__main a:hover, .nav-link:hover { color: #fff; }
.site-nav__main a.is-active { color: var(--amber); border-bottom-color: var(--amber); }
.site-nav__account { display: flex; align-items: center; gap: 18px; }

.nav-toggle { display: none; margin-left: auto; background: none; border: 0; color: var(--cream-text); font-size: 1.6rem; cursor: pointer; padding: 6px; }

@media (max-width: 960px) {
    .nav-toggle { display: block; }
    .site-header__inner { flex-wrap: wrap; }
    .site-nav { display: none; flex-basis: 100%; flex-direction: column; align-items: stretch; gap: 12px; padding: 8px 0 16px; }
    .site-nav.is-open { display: flex; }
    .site-nav__main { flex-direction: column; gap: 4px; padding-left: 0; }
    .site-nav__account { flex-direction: column; align-items: stretch; }
    .has-hero .site-header { background: rgba(10, 20, 15, .92); }
    .brand img { height: 46px; }
}

/* ---------- Hero (accueil) ---------- */

.hero {
    position: relative; overflow: hidden; color: var(--cream-text);
    background:
        radial-gradient(circle at 18% 30%, rgba(255, 220, 150, .08), transparent 40%),
        radial-gradient(1px 1px at 12% 22%, #fff8 50%, transparent 51%),
        radial-gradient(1px 1px at 30% 12%, #fff6 50%, transparent 51%),
        radial-gradient(1.5px 1.5px at 8% 60%, #fff7 50%, transparent 51%),
        radial-gradient(1px 1px at 40% 70%, #fff5 50%, transparent 51%),
        var(--forest-900);
    min-height: 560px;
    display: flex; align-items: center;
}
.hero__art {
    position: absolute; inset: 0 0 0 30%;
    background: url("../img/hero-art.jpg") center / cover no-repeat;
}
.hero__art::before {
    content: ""; position: absolute; inset: 0;
    background: linear-gradient(90deg, var(--forest-900) 0%, rgba(15, 32, 27, .7) 18%, rgba(15, 32, 27, 0) 45%);
}
.hero__content { position: relative; padding-top: 120px; padding-bottom: 90px; }
.hero h1 {
    font-size: clamp(2.6rem, 6vw, 4.6rem); color: #fff8ea;
    text-shadow: 0 2px 18px rgba(0, 0, 0, .55);
}
.hero__lead { font-size: clamp(1.25rem, 2.2vw, 1.6rem); margin: 18px 0 30px; text-shadow: 0 1px 8px rgba(0, 0, 0, .7); }
.hero__actions { display: flex; flex-wrap: wrap; gap: 14px; }
.hero__note { display: flex; align-items: center; gap: .6em; margin: 28px 0 0; font-size: 1.05rem; text-shadow: 0 1px 6px rgba(0, 0, 0, .8); }
.hero__note .icon { color: var(--amber); width: 1.4em; height: 1.4em; }
.hero__wave { position: absolute; left: 0; right: 0; bottom: -1px; width: 100%; height: 50px; fill: var(--cream); }

@media (max-width: 900px) {
    .hero { min-height: 520px; align-items: flex-end; }
    .hero__art { inset: 0; }
    .hero__art::before { background: linear-gradient(0deg, var(--forest-900) 10%, rgba(15, 32, 27, .55) 60%, rgba(15, 32, 27, .2)); }
    .hero__content { padding-top: 180px; padding-bottom: 70px; }
}

/* ---------- Bandeau des pages intérieures ---------- */

.banner {
    position: relative; color: var(--cream-text);
    background: linear-gradient(90deg, rgba(15, 32, 27, .95) 30%, rgba(15, 32, 27, .55)), url("../img/hero-art.jpg") center 40% / cover;
}
.banner::after {
    content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 4px;
    background: linear-gradient(90deg, var(--amber), transparent 70%);
}
.banner__inner { max-width: 1400px; margin: 0 auto; padding: 34px 16px 30px; }
@media (min-width: 720px) { .banner__inner { padding: 44px 40px 40px; } }
.banner h1 { font-size: clamp(2rem, 4vw, 2.8rem); color: #fff8ea; }
.banner p { margin: 6px 0 0; font-size: 1.2rem; opacity: .9; }

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

.section { padding-top: 36px; padding-bottom: 56px; }
.section-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 26px; }
.section-head h2 { font-size: clamp(2.2rem, 4vw, 3rem); }
.section-head p { margin: 2px 0 0; font-size: 1.35rem; color: var(--ink-soft); }
.section-title { font-size: 1.8rem; margin: 44px 0 20px; }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; }
.search {
    display: flex; align-items: center; gap: 10px; min-width: 280px; flex: 1;
    background: var(--paper); border: 1px solid var(--line); border-radius: 999px; padding: 8px 18px; color: var(--ink-soft);
}
.search input { border: 0; background: none; font: inherit; color: var(--ink); width: 100%; padding: 2px 0; }
.search input:focus { outline: none; }
.search:focus-within { outline: 3px solid var(--amber); outline-offset: 2px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
    font: 500 1rem var(--font-body); padding: 7px 18px; border-radius: 999px; cursor: pointer;
    background: var(--paper); border: 1px solid var(--line); color: var(--ink);
}
.chip:hover { border-color: var(--forest-700); }
.chip.is-active { background: var(--forest-800); border-color: var(--forest-800); color: var(--cream-text); }

/* ---------- Cartes d'application ---------- */

.app-grid { display: grid; gap: 22px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.app-card {
    display: flex; flex-direction: column; background: var(--paper);
    border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
    transition: transform .2s, box-shadow .2s;
}
.app-card:hover { transform: translateY(-3px); box-shadow: 0 2px 4px rgba(40, 30, 10, .08), 0 16px 34px rgba(40, 30, 10, .14); }
.app-card__image { aspect-ratio: 2.15 / 1; background: var(--forest-800) center / cover no-repeat; }
.app-card__body { display: flex; gap: 14px; padding: 18px 18px 6px; flex: 1; }
.app-card__body h3 { font-size: 1.4rem; margin-bottom: 4px; }
.app-card__body p { margin: 0; color: var(--ink-soft); font-size: 1.02rem; }
.app-card__icon {
    flex: none; display: grid; place-items: center; width: 46px; height: 46px; border-radius: 50%;
    background: var(--cream-2); color: var(--forest-800); font-size: 1.35rem;
}
.app-card__footer { padding: 14px 18px 18px; }
.app-card__footer form { margin: 0; }

.admin-strip {
    display: flex; align-items: center; gap: 18px; margin-top: 28px; padding: 16px 22px;
    background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
}
.admin-strip > div { flex: 1; display: flex; flex-direction: column; }
.admin-strip strong { font-family: var(--font-title); font-size: 1.15rem; }
.admin-strip span { color: var(--ink-soft); font-size: .98rem; }
.admin-strip__icon { font-size: 1.8rem; color: var(--forest-800); display: flex; }
@media (max-width: 560px) { .admin-strip { flex-wrap: wrap; } .admin-strip .btn { width: 100%; } }

.empty { color: var(--ink-soft); font-size: 1.15rem; text-align: center; padding: 30px 0; }

/* ---------- Panneaux et formulaires ---------- */

.panel {
    background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
    box-shadow: var(--shadow); padding: 26px; margin-bottom: 22px;
}
.panel__title { display: flex; align-items: center; gap: .45em; font-size: 1.4rem; margin-bottom: 18px; }
.panel__title .icon { color: var(--amber-dark); }
.panel__actions { margin-top: 16px; display: flex; flex-wrap: wrap; gap: 10px; }
.empty-panel { text-align: center; }

.two-cols { display: grid; gap: 22px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.two-cols > .panel { margin-bottom: 0; }
.two-cols + .panel { margin-top: 22px; }

.form { display: flex; flex-direction: column; gap: 18px; }
.form--compact { gap: 10px; align-items: flex-start; }
.form--compact p { margin: 0; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field__row { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.field label { font-weight: 600; }
.field input, .field select, .field textarea {
    font: inherit; color: var(--ink); background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; width: 100%;
}
.field textarea { min-height: 96px; resize: vertical; font-family: ui-monospace, Consolas, monospace; font-size: .9rem; }
.field input:disabled { background: var(--cream-2); color: var(--ink-soft); }
.field__hint { margin: 0; font-size: .92rem; color: var(--ink-soft); }
.field__error { margin: 0; font-size: .95rem; color: var(--danger); font-weight: 600; }
.form-grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.check { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--forest-800); }
.form__alt { margin: 0; text-align: center; color: var(--ink-soft); }
.small-link { font-size: .95rem; }
.meta { color: var(--ink-soft); font-size: .98rem; margin: 0; }

.radio-cards { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.radio-card { display: flex; gap: 10px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; background: #fff; }
.radio-card:has(input:checked) { border-color: var(--forest-800); box-shadow: inset 0 0 0 1px var(--forest-800); }
.radio-card input { accent-color: var(--forest-800); margin-top: 4px; }
.radio-card span { display: flex; flex-direction: column; }
.radio-card small { color: var(--ink-soft); font-size: .92rem; }

.icon-picker { display: flex; flex-wrap: wrap; gap: 8px; }
.icon-picker label { cursor: pointer; }
.icon-picker input { position: absolute; opacity: 0; }
.icon-picker span {
    display: grid; place-items: center; width: 46px; height: 46px; border-radius: 50%;
    background: var(--cream-2); color: var(--forest-800); font-size: 1.3rem; border: 2px solid transparent;
}
.icon-picker input:checked + span { border-color: var(--forest-800); background: var(--amber-soft); }
.icon-picker input:focus-visible + span { outline: 3px solid var(--amber); }

.flashes { padding-top: 20px; }
.site-main { position: relative; }
.has-hero .flashes { position: absolute; top: 96px; left: 0; right: 0; z-index: 15; }
.flash { padding: 12px 16px; border-radius: 10px; margin-bottom: 10px; border: 1px solid; font-weight: 500; }
.flash--success { background: #e5f1e5; border-color: #b7d6b9; color: #1f4d2b; }
.flash--info { background: #f3ead6; border-color: var(--line); color: var(--ink); }
.flash--error { background: #f8e1dc; border-color: #e5b3a9; color: #7d2418; }

.message { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 40px 30px; }
.message p { margin: 0; font-size: 1.15rem; }
.message__icon {
    display: grid; place-items: center; width: 64px; height: 64px; border-radius: 50%;
    background: var(--amber-soft); color: var(--forest-800); font-size: 1.9rem;
}
.message__icon--error { background: #f8e1dc; color: var(--danger); }

.sso-notice { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; padding: 14px 18px; background: var(--amber-soft); border-radius: var(--radius); }
.sso-notice p { margin: 0; }

.secret-box {
    font-family: ui-monospace, Consolas, monospace; font-size: .95rem; word-break: break-all;
    background: var(--forest-900); color: var(--amber-soft); padding: 14px 16px; border-radius: 10px; margin: 8px 0;
}
code { font-family: ui-monospace, Consolas, monospace; font-size: .88em; background: var(--cream-2); padding: 1px 6px; border-radius: 5px; }

/* ---------- Tableaux et badges ---------- */

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 1rem; }
.table th { text-align: left; font-weight: 600; color: var(--ink-soft); border-bottom: 2px solid var(--line); padding: 10px 12px; white-space: nowrap; }
.table td { border-bottom: 1px solid var(--line); padding: 10px 12px; vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table td.actions { text-align: right; white-space: nowrap; }
.table .cell-app { display: flex; align-items: center; gap: 10px; }
.table select { font: inherit; padding: 6px 10px; border-radius: 8px; border: 1px solid var(--line); background: #fff; }

.badge { display: inline-block; font-size: .8rem; font-weight: 600; padding: 2px 10px; border-radius: 999px; background: var(--cream-2); color: var(--ink-soft); white-space: nowrap; margin-left: 6px; }
.badge--ok { background: #dcefdf; color: var(--ok); }
.badge--warn { background: var(--amber-soft); color: #8a5310; }
.badge--danger { background: #f8e1dc; color: var(--danger); }
.badge--admin { background: var(--forest-800); color: var(--cream-text); }

.pill-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 10px; }
.pill-list a { display: inline-flex; align-items: center; gap: .45em; padding: 6px 14px; border-radius: 999px; background: var(--cream-2); text-decoration: none; color: var(--forest-800); font-weight: 600; }

/* ---------- Administration ---------- */

.admin-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 24px; }
.admin-tabs a { display: inline-flex; align-items: center; gap: .45em; padding: 8px 18px; border-radius: 999px; text-decoration: none; background: var(--paper); border: 1px solid var(--line); color: var(--ink); }
.admin-tabs a.is-active { background: var(--forest-800); color: var(--cream-text); border-color: var(--forest-800); }

.stats { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); margin-bottom: 22px; }
.stat { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); text-decoration: none; color: inherit; }
.stat strong { display: block; font-family: var(--font-title); font-size: 2.2rem; color: var(--forest-800); }
.stat span { color: var(--ink-soft); }

.filters { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
.filters .search { min-width: 220px; max-width: 420px; }
.filters select { font: inherit; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--paper); }

.thumb { width: 72px; height: 40px; border-radius: 6px; background: var(--forest-800) center / cover; flex: none; }
.image-preview { width: 100%; max-width: 360px; aspect-ratio: 2.15 / 1; border-radius: 10px; background: var(--forest-800) center / cover; border: 1px solid var(--line); }

.danger-zone { border-color: #e5b3a9; }

/* ---------- Pied de page ---------- */

.site-footer { background: var(--forest-900); color: var(--cream-text); font-size: .95rem; margin-top: 30px; }
.site-footer__inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; padding-top: 18px; padding-bottom: 18px; opacity: .85; }
