/* ============================================================
   style.css — Feuille de style du site de gestion d'accès.
   La variable --primary est injectée depuis les réglages
   (voir header.php / login.php).
   ============================================================ */

:root {
    --primary: #b8860b;
    --bg: #15171c;
    --bg-card: #1d2027;
    --bg-elev: #232730;
    --border: #2c2f38;
    --text: #e6e6e6;
    --muted: #9aa0aa;
    --ok: #5fd17a;
    --warn: #f0b400;
    --bad: #ff6b6b;
    --radius: 10px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.2; }
code {
    background: var(--bg-elev);
    padding: .1em .4em;
    border-radius: 4px;
    font-size: .85em;
}
.muted { color: var(--muted); font-size: .9rem; }

/* ---------- Barre de navigation ---------- */
.topbar {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: .8rem 1.2rem;
    background: var(--bg-card);
    border-bottom: 2px solid var(--primary);
    flex-wrap: wrap;
}
.topbar .brand a { font-weight: 800; font-size: 1.1rem; color: var(--primary); }
.mainnav { display: flex; gap: .3rem; flex: 1; flex-wrap: wrap; }
.mainnav a {
    padding: .45rem .8rem;
    border-radius: 6px;
    color: var(--text);
}
.mainnav a:hover { background: var(--bg-elev); text-decoration: none; }
.mainnav a.active { background: var(--primary); color: #1a1a1a; font-weight: 700; }
.userbox { display: flex; align-items: center; gap: .8rem; }
.user-name { color: var(--muted); }
.btn-logout {
    padding: .4rem .8rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
}

/* ---------- Conteneur ---------- */
.container { max-width: 1100px; margin: 1.5rem auto; padding: 0 1rem; }
.sitefooter { text-align: center; color: var(--muted); padding: 2rem 1rem; font-size: .85rem; }

/* ---------- En-tête de page ---------- */
.page-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}
.page-head h1 { margin: 0; }

/* ---------- Boutons ---------- */
.btn {
    display: inline-block;
    padding: .5rem .9rem;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--bg-elev);
    color: var(--text);
    cursor: pointer;
    font-size: .92rem;
    text-decoration: none;
}
.btn:hover { text-decoration: none; filter: brightness(1.1); }
.btn-primary { background: var(--primary); color: #1a1a1a; border-color: var(--primary); font-weight: 700; }
.btn-ghost { background: transparent; }
.btn-danger { background: #5e2b2b; border-color: #7a3636; color: #ffd6d6; }
.btn-sm { padding: .3rem .6rem; font-size: .82rem; }

/* ---------- Alertes ---------- */
.alert { padding: .8rem 1rem; border-radius: 8px; margin: .6rem 0; }
.alert-error { background: #3a1d1d; border: 1px solid #5e2b2b; color: #ffb4b4; }
.alert-success { background: #1d3a24; border: 1px solid #2f5e3a; color: #b4ffc4; }
.alert-info { background: #1d2a3a; border: 1px solid #2f455e; color: #b4d6ff; }
.alert-warning { background: #3a341d; border: 1px solid #5e542b; color: #ffe9b4; }

/* ---------- Filtres ---------- */
.filters {
    display: flex;
    gap: .6rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
    background: var(--bg-card);
    padding: .8rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}
.filters input[type=text], .filters select { min-width: 150px; flex: 1; }

/* ---------- Tableaux ---------- */
.table-wrap { overflow-x: auto; }
.data-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-card);
    border-radius: var(--radius);
    overflow: hidden;
}
.data-table th, .data-table td {
    padding: .6rem .8rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
.data-table th { background: var(--bg-elev); font-size: .85rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
.data-table tr:last-child td { border-bottom: 0; }
.data-table .empty { text-align: center; color: var(--muted); padding: 1.5rem; }
.actions { display: flex; gap: .4rem; flex-wrap: wrap; }

/* ---------- Badges ---------- */
.badge {
    display: inline-block;
    padding: .2rem .55rem;
    border-radius: 999px;
    font-size: .8rem;
    font-weight: 700;
}
.badge-ok { background: rgba(95,209,122,.18); color: var(--ok); }
.badge-warn { background: rgba(240,180,0,.18); color: var(--warn); }
.badge-bad { background: rgba(255,107,107,.18); color: var(--bad); }
.badge-muted { background: rgba(154,160,170,.18); color: var(--muted); }

/* ---------- Vignettes ---------- */
.thumb {
    width: 46px; height: 46px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid var(--border);
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--bg-elev);
}
.thumb-empty { color: var(--muted); }
.thumb-lg { max-width: 220px; border-radius: 8px; border: 1px solid var(--border); display: block; margin-bottom: .5rem; }

/* ---------- Aperçu flottant de la photo (survol) ---------- */
.photo-float {
    position: fixed;
    z-index: 1000;
    pointer-events: none;
    background: var(--bg-card);
    border: 1px solid var(--primary);
    border-radius: 8px;
    padding: 4px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .6);
}
.photo-float img {
    display: block;
    max-width: 320px;
    max-height: 320px;
    border-radius: 5px;
}

/* ---------- Lightbox (clic) ---------- */
.lightbox {
    position: fixed;
    inset: 0;
    z-index: 1001;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, .85);
    padding: 2rem;
    cursor: zoom-out;
}
.lightbox figure { margin: 0; text-align: center; max-width: 95vw; max-height: 95vh; }
.lightbox img {
    max-width: 90vw;
    max-height: 85vh;
    border-radius: 8px;
    border: 1px solid var(--border);
    box-shadow: 0 10px 40px rgba(0, 0, 0, .7);
}
.lightbox figcaption { color: #fff; margin-top: .8rem; font-weight: 600; }
.lightbox-close {
    position: absolute;
    top: 1rem; right: 1.4rem;
    font-size: 2.4rem;
    line-height: 1;
    color: #fff;
    cursor: pointer;
    opacity: .8;
}
.lightbox-close:hover { opacity: 1; }

/* ---------- Formulaires ---------- */
.form-card, .danger-zone {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}
.danger-zone { border-color: #5e2b2b; }
.row { display: flex; gap: 1rem; flex-wrap: wrap; }
.row > .field { flex: 1; min-width: 220px; }
.field { margin-bottom: 1rem; }
label { display: block; margin-bottom: .3rem; font-weight: 600; }
input[type=text], input[type=password], input[type=number], input[type=email],
select, textarea {
    width: 100%;
    padding: .55rem .7rem;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: #12141a;
    color: var(--text);
    font-size: .95rem;
}
input[type=color] { width: 60px; height: 40px; padding: 2px; border-radius: 6px; border: 1px solid var(--border); background: #12141a; }
textarea { resize: vertical; }
.form-actions { display: flex; gap: .6rem; margin-top: 1rem; }
.inline-form { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; margin-bottom: 1.5rem; }
.inline-form select { min-width: 240px; }

.perms { border: 1px solid var(--border); border-radius: 8px; padding: 1rem; margin-bottom: 1rem; }
.perms legend { padding: 0 .5rem; font-weight: 700; }
.perm-item { display: block; font-weight: 400; margin: .35rem 0; }
.super-flag { background: rgba(255,107,107,.08); padding: .6rem; border-radius: 6px; }
.current-photo { margin-bottom: .6rem; }
.paste-zone {
    margin-top: .6rem;
    padding: .9rem 1rem;
    border: 2px dashed var(--border);
    border-radius: 8px;
    color: var(--muted);
    background: #12141a;
    cursor: pointer;
    text-align: center;
    font-size: .9rem;
    outline: none;
}
.paste-zone:hover, .paste-zone:focus { border-color: var(--primary); color: var(--text); }
.paste-zone.has-image { border-color: var(--ok); color: var(--ok); }

/* ---------- Page de connexion ---------- */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 1rem;
}
.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-top: 4px solid var(--primary);
    border-radius: var(--radius);
    padding: 2rem;
    width: 100%;
    max-width: 380px;
}
.login-card h1 { margin-top: 0; color: var(--primary); font-size: 1.3rem; }
.login-card button { width: 100%; margin-top: 1.2rem; padding: .7rem; }
.login-card button:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
    .topbar { flex-direction: column; align-items: stretch; }
    .userbox { justify-content: space-between; }
}
