/* Admin — Formations & Avis */
:root {
    --primary: #a8905f;
    --secondary: #8a9070;
    --bg: #f5f2ed;
    --text: #2d2d2d;
    --border: #ddd;
    --danger: #c44;
    --ok: #4a8;
    --select-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23a8905f' stroke-width='2.25' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
}

.admin-header {
    background: #fff;
    border-bottom: 1px solid var(--border);
    padding: 12px 24px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.admin-brand strong { color: var(--primary); }
.admin-sub { font-size: .85rem; color: #888; margin-left: 8px; }

.admin-nav { display: flex; flex-wrap: wrap; gap: 8px; }
.admin-nav a {
    text-decoration: none;
    color: var(--text);
    padding: 6px 12px;
    border-radius: 4px;
    font-size: .9rem;
}
.admin-nav a:hover { background: var(--bg); }
.nav-logout { color: var(--danger) !important; }

.admin-main { max-width: 1100px; margin: 0 auto; padding: 24px; }
.admin-footer { text-align: center; padding: 24px; color: #888; font-size: .85rem; }

h1 { font-family: Georgia, serif; margin-bottom: 20px; color: var(--secondary); }
h2 { font-size: 1.1rem; margin: 20px 0 12px; }

.alert {
    max-width: 1100px;
    margin: 12px auto;
    padding: 12px 24px;
    border-radius: 4px;
}
.alert-success { background: #e8f5e9; color: #2e7d32; }
.alert-error { background: #ffebee; color: #c62828; }
.alert-warn { background: #fff8e1; color: #f57f17; }

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}

.stat-card {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    text-align: center;
}

.stat-num { display: block; font-size: 2rem; font-weight: 700; color: var(--primary); }
.stat-label { font-size: .85rem; color: #888; }

.table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 24px;
    font-size: .9rem;
}

.table th, .table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: top;
}

.table th { background: var(--bg); font-weight: 600; }
.comment-cell { max-width: 280px; }

.btn {
    display: inline-block;
    padding: 8px 16px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text);
    text-decoration: none;
    font-size: .9rem;
    cursor: pointer;
    font-family: inherit;
}

.btn:hover { background: var(--bg); }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { opacity: .9; background: var(--primary); }
.btn-danger { color: var(--danger); border-color: var(--danger); }
.btn-sm { padding: 4px 10px; font-size: .8rem; }

.form { display: flex; flex-direction: column; gap: 14px; }
.form label { display: flex; flex-direction: column; gap: 6px; font-size: .9rem; }
.form input, .form textarea {
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-family: inherit;
    font-size: .95rem;
    background: #fff;
    transition: border-color .15s, box-shadow .15s;
}
.form input:focus, .form textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(168, 144, 95, .22);
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.checkbox { flex-direction: row !important; align-items: center; gap: 8px !important; }
.form-actions { display: flex; gap: 8px; margin-top: 8px; }

/* ——— Listes déroulantes (admin + MF) ——— */
select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    display: block;
    width: 100%;
    max-width: 100%;
    min-height: 42px;
    padding: 10px 2.5rem 10px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background-color: #fff;
    background-image: var(--select-chevron);
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    font-family: inherit;
    font-size: .95rem;
    line-height: 1.35;
    color: var(--text);
    cursor: pointer;
    transition: border-color .15s, box-shadow .15s, background-color .15s;
}

select:hover:not(:disabled) {
    border-color: #c4b89a;
    background-color: #fffdf8;
}

select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(168, 144, 95, .22);
}

select:disabled {
    background-color: #f5f3ef;
    color: #888;
    cursor: not-allowed;
    opacity: .9;
}

select option {
    color: var(--text);
    background: #fff;
}

label:has(> select) {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: .9rem;
}

.inline-form select,
.mf-filters select,
.mf-date-row select,
.table select,
.actions-cell select {
    width: auto;
    min-width: 9rem;
}

.table select {
    min-height: 36px;
    padding: 6px 2rem 6px 10px;
    font-size: .88rem;
}

.mf-filters label select {
    width: 100%;
}

.mf-filters label input[type="number"],
.mf-filters label input[type="text"],
.mf-filters label input[type="date"] {
    display: block;
    width: 100%;
    min-height: 42px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: #fff;
    font-family: inherit;
    font-size: .95rem;
    line-height: 1.35;
    color: var(--text);
    transition: border-color .15s, box-shadow .15s;
}

.mf-filters label input[type="number"]:focus,
.mf-filters label input[type="text"]:focus,
.mf-filters label input[type="date"]:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(168, 144, 95, .22);
}

/* Filtres barre d'outils — champs compacts côte à côte */
.mf-filters label {
    flex: 1 1 160px;
    min-width: 140px;
    max-width: 280px;
}

.card {
    background: #fff;
    padding: 24px;
    border-radius: 8px;
    margin-bottom: 24px;
}

.login-box {
    max-width: 400px;
    margin: 60px auto;
    background: #fff;
    padding: 32px;
    border-radius: 8px;
}

.inline-form { display: inline; }
.actions-cell { white-space: nowrap; }
.actions-cell form { display: inline; }
.actions-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: .75rem;
    background: #eee;
}
.badge-ok { background: #e8f5e9; color: #2e7d32; }
.badge-warn { background: #fff8e1; color: #f57f17; }

.code-block {
    width: 100%;
    font-family: monospace;
    font-size: .85rem;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 4px;
    margin: 12px 0;
    background: #fafafa;
}

.hint { color: #888; font-size: .9rem; margin-bottom: 16px; }
.summary p { margin-bottom: 6px; }

.table tr.row-active { background: #faf6f0; }
.table tr.row-active td { border-bottom-color: var(--primary); }

@media (max-width: 600px) {
    .form-row { grid-template-columns: 1fr; }
    .admin-nav { width: 100%; }
}

.admin-body--error {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
}
.admin-error {
    text-align: center;
    max-width: 28rem;
    padding: 2.5rem 1.5rem;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.06);
}
.admin-error__code {
    font-size: 4.5rem;
    line-height: 1;
    margin: 0 0 0.35rem;
    color: color-mix(in srgb, var(--primary) 40%, #ddd);
    font-weight: 700;
}
.admin-error h1 { margin: 0 0 0.65rem; color: var(--text); font-size: 1.5rem; }
.admin-error__lead { color: #666; margin: 0 0 1.5rem; line-height: 1.55; }
.admin-error__actions { display: flex; flex-wrap: wrap; gap: 0.5rem; justify-content: center; }
