/* =====================================================================
   INTERFACE COMMUNE – boutons, cartes, badges, chiffres clés, barres de
   remplissage, listes, tableaux adaptés au mobile.
   Utilisée par le site public (avec site.css) et par le panel admin.
   ===================================================================== */

/* ---------- Icônes ---------- */
.a-ico { flex-shrink: 0; vertical-align: middle; }

/* ---------- En-tête de page ---------- */
.a-page-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem 1rem;
    margin-bottom: 1.25rem;
}
.a-page-head h1 { margin: 0; font-size: clamp(1.4rem, 4vw, 2rem); line-height: 1.2; }
.a-page-head .a-sub { color: #a3a3a3; font-size: 0.95rem; margin-top: 0.15rem; }
.a-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }

/* ---------- Boutons compacts ---------- */
.a-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.55rem 0.9rem;
    min-height: 40px;
    border-radius: var(--radius-md);
    border: 1px solid #333;
    background: #1c1c1c;
    color: #e5e5e5;
    font: inherit;
    font-weight: 600;
    font-size: 0.92rem;
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
}
.a-btn:hover { background: #262626; border-color: #4a4a4a; color: #fff; }
.a-btn-primary { background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%); border-color: var(--primary); color: #fff; }
.a-btn-primary:hover { background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary) 100%); border-color: var(--primary-light); }
.a-btn-danger { color: #fca5a5; border-color: rgba(220, 38, 38, 0.5); background: rgba(220, 38, 38, 0.08); }
.a-btn-danger:hover { background: rgba(220, 38, 38, 0.2); color: #fff; }
.a-btn-ok { color: #86efac; border-color: rgba(34, 197, 94, 0.45); background: rgba(34, 197, 94, 0.08); }
.a-btn-ok:hover { background: rgba(34, 197, 94, 0.18); color: #fff; }
.a-btn-sm { min-height: 34px; padding: 0.35rem 0.65rem; font-size: 0.85rem; }
.a-btn-icon { padding: 0.45rem; min-width: 40px; }
.a-btn-block { width: 100%; }
form.a-inline { display: inline; margin: 0; }

/* ---------- Cartes et grilles ---------- */
.a-card {
    background: linear-gradient(135deg, #1a1a1a 0%, #111 100%);
    border: 1px solid #2a2a2a;
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.35);
    min-width: 0;
}
.a-card + .a-card { margin-top: 1rem; }
.a-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.9rem;
}
.a-card-head h2 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 800;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.a-card-head h2 .a-ico { color: var(--primary-light); }
.a-link { color: var(--primary-light); text-decoration: none; font-weight: 600; font-size: 0.92rem; white-space: nowrap; }
.a-link:hover { text-decoration: underline; }

.a-grid { display: grid; gap: 1rem; }
.a-grid-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); align-items: start; }
.a-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.a-grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.a-stack > * + * { margin-top: 1rem; }
@media (max-width: 1024px) { .a-grid-main { grid-template-columns: 1fr; } }
@media (max-width: 760px) { .a-grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .a-grid-2 { grid-template-columns: 1fr; } }

/* ---------- Chiffres clés ---------- */
.a-kpi {
    background: linear-gradient(135deg, #1a1a1a 0%, #121212 100%);
    border: 1px solid #2a2a2a;
    border-radius: var(--radius-lg);
    padding: 0.9rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    text-decoration: none;
    color: inherit;
    min-width: 0;
}
a.a-kpi:hover { border-color: rgba(220, 38, 38, 0.5); }
.a-kpi-label { color: #a3a3a3; font-size: 0.82rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.8px; display: flex; align-items: center; gap: 0.4rem; }
.a-kpi-value { font-family: 'Orbitron', sans-serif; font-size: clamp(1.25rem, 3.5vw, 1.7rem); font-weight: 800; color: #fff; line-height: 1.2; }
.a-kpi-hint { color: #737373; font-size: 0.82rem; }

/* ---------- Badges de statut ---------- */
.a-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.4px;
    border: 1px solid;
    white-space: nowrap;
}
.st-ok     { color: #4ade80; background: rgba(34, 197, 94, 0.12); border-color: rgba(34, 197, 94, 0.4); }
.st-warn   { color: #fbbf24; background: rgba(245, 158, 11, 0.12); border-color: rgba(245, 158, 11, 0.4); }
.st-danger { color: #f87171; background: rgba(220, 38, 38, 0.12); border-color: rgba(220, 38, 38, 0.45); }
.st-info   { color: #67e8f9; background: rgba(6, 182, 212, 0.12); border-color: rgba(6, 182, 212, 0.4); }
.st-muted  { color: #a3a3a3; background: rgba(163, 163, 163, 0.08); border-color: #3a3a3a; }

/* ---------- Barre de remplissage ---------- */
.a-progress { height: 8px; background: #262626; border-radius: 999px; overflow: hidden; min-width: 80px; }
.a-progress-bar { height: 100%; background: linear-gradient(90deg, var(--primary-dark), var(--primary-light)); border-radius: 999px; }
.a-progress.is-high .a-progress-bar { background: linear-gradient(90deg, #d97706, #fbbf24); }
.a-progress.is-full .a-progress-bar { background: linear-gradient(90deg, #15803d, #4ade80); }
.a-fill { display: flex; flex-direction: column; gap: 0.3rem; min-width: 110px; }
.a-fill-text { font-size: 0.85rem; color: #d4d4d4; }
.a-fill-text strong { color: #fff; }

/* ---------- Points à traiter ---------- */
.a-alerts { display: grid; gap: 0.5rem; margin-bottom: 1rem; }
.a-alert {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 0.9rem;
    border-radius: var(--radius-md);
    border: 1px solid;
    text-decoration: none;
    color: #e5e5e5;
    font-weight: 600;
}
.a-alert .a-ico:first-child { flex-shrink: 0; }
.a-alert span { flex: 1; min-width: 0; }
.a-alert.st-warn { border-color: rgba(245, 158, 11, 0.4); background: rgba(245, 158, 11, 0.08); }
.a-alert.st-warn .a-ico:first-child { color: #fbbf24; }
.a-alert.st-danger { border-color: rgba(220, 38, 38, 0.45); background: rgba(220, 38, 38, 0.1); }
.a-alert.st-danger .a-ico:first-child { color: #f87171; }
.a-alert.st-info { border-color: rgba(6, 182, 212, 0.35); background: rgba(6, 182, 212, 0.07); }
.a-alert.st-info .a-ico:first-child { color: #67e8f9; }
a.a-alert:hover { filter: brightness(1.15); }

/* ---------- Prochaine partie ---------- */
.a-next { position: relative; overflow: hidden; border-color: rgba(220, 38, 38, 0.45); }
.a-next::before {
    content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
    background: linear-gradient(90deg, var(--primary), transparent);
}
.a-next-title { font-size: clamp(1.3rem, 4vw, 1.8rem); font-weight: 800; color: #fff; line-height: 1.2; margin: 0.25rem 0 0.4rem; }
.a-next-when { display: inline-flex; align-items: center; gap: 0.4rem; color: var(--primary-light); font-weight: 700; text-transform: uppercase; letter-spacing: 1px; font-size: 0.85rem; }
.a-meta { display: flex; flex-wrap: wrap; gap: 0.35rem 1.1rem; color: #a3a3a3; font-size: 0.95rem; }
.a-meta span { display: inline-flex; align-items: center; gap: 0.35rem; }
.a-next-fill { margin: 1rem 0 0.75rem; }
.a-next-fill .a-progress { height: 12px; }
.a-teams { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0.5rem 1rem; margin-bottom: 1rem; }
.a-team { font-size: 0.85rem; color: #d4d4d4; display: flex; flex-direction: column; gap: 0.25rem; }
.a-team-name { display: flex; justify-content: space-between; gap: 0.5rem; }
.a-next-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0.5rem; }

/* ---------- Tuiles d'actions rapides ---------- */
.a-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 0.6rem; }
.a-tile {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.45rem;
    padding: 1rem 0.5rem; min-height: 92px;
    background: #171717; border: 1px solid #2a2a2a; border-radius: var(--radius-lg);
    color: #e5e5e5; text-decoration: none; font-weight: 700; font-size: 0.9rem; text-align: center;
    transition: border-color 0.2s, background 0.2s, transform 0.15s;
}
.a-tile .a-ico { color: var(--primary-light); }
.a-tile:hover { border-color: rgba(220, 38, 38, 0.55); background: #1d1d1d; transform: translateY(-1px); }
.a-tile-primary { background: linear-gradient(135deg, rgba(220, 38, 38, 0.25), rgba(153, 27, 27, 0.25)); border-color: rgba(220, 38, 38, 0.55); }
@media (max-width: 760px) { .a-tiles { grid-template-columns: repeat(3, 1fr); } .a-tile { min-height: 80px; font-size: 0.82rem; } }

/* ---------- Listes (parties, réservations) ---------- */
.a-list { display: flex; flex-direction: column; }
.a-row {
    display: flex; align-items: center; gap: 0.75rem 1rem; flex-wrap: wrap;
    padding: 0.8rem 0; border-top: 1px solid #242424;
}
.a-row:first-child { border-top: 0; padding-top: 0; }
.a-row-main { flex: 1 1 220px; min-width: 0; }
.a-row-title { color: #fff; font-weight: 700; text-decoration: none; display: block; overflow: hidden; text-overflow: ellipsis; }
a.a-row-title:hover { color: var(--primary-light); }
.a-row-sub { color: #a3a3a3; font-size: 0.85rem; }
.a-row-side { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
.a-amount { font-family: 'Orbitron', sans-serif; font-weight: 700; color: #fff; font-size: 0.95rem; white-space: nowrap; }
.a-empty { color: #737373; padding: 1rem 0; text-align: center; }

/* ---------- Onglets + recherche ---------- */
.a-toolbar { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.a-tabs { display: flex; gap: 0.35rem; overflow-x: auto; scrollbar-width: none; max-width: 100%; }
.a-tabs::-webkit-scrollbar { display: none; }
.a-tab {
    padding: 0.5rem 0.9rem; border-radius: 999px; border: 1px solid #333; color: #a3a3a3;
    text-decoration: none; font-weight: 700; font-size: 0.88rem; white-space: nowrap; background: #151515;
}
.a-tab .a-count { color: #737373; margin-left: 0.25rem; }
.a-tab.is-active { color: #fff; border-color: var(--primary); background: rgba(220, 38, 38, 0.15); }
.a-tab.is-active .a-count { color: #fca5a5; }
.a-search { display: flex; gap: 0.4rem; flex: 1 1 260px; max-width: 420px; }
.a-search input, .a-search select, .a-filter select {
    flex: 1; min-width: 0; min-height: 40px; padding: 0.5rem 0.75rem;
    background: #111; color: #e5e5e5; border: 1px solid #333; border-radius: var(--radius-md); font: inherit;
}
.a-search input:focus, .a-filter select:focus { outline: none; border-color: var(--primary); }
.a-filter { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin-bottom: 1rem; }
.a-filter select { flex: 0 1 auto; }

/* ---------- Tableau → cartes sur mobile ---------- */
.rtable { width: 100%; border-collapse: collapse; font-size: 0.93rem; }
.rtable th {
    text-align: left; color: #a3a3a3; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.8px;
    padding: 0.6rem 0.75rem; border-bottom: 1px solid #333; white-space: nowrap; font-weight: 700;
}
.rtable td { padding: 0.75rem; border-bottom: 1px solid #222; vertical-align: middle; }
.rtable tbody tr:hover { background: rgba(255, 255, 255, 0.02); }
.rtable .t-actions { display: flex; gap: 0.35rem; justify-content: flex-end; flex-wrap: wrap; }
.rtable .t-title { color: #fff; font-weight: 700; text-decoration: none; }
.rtable a.t-title:hover { color: var(--primary-light); }
.rtable .t-sub { color: #8a8a8a; font-size: 0.83rem; display: block; }
.rtable .t-num { font-family: 'Orbitron', sans-serif; font-weight: 700; color: #fff; white-space: nowrap; }

@media (max-width: 860px) {
    .rtable thead { display: none; }
    .rtable, .rtable tbody, .rtable tr, .rtable td { display: block; width: 100%; }
    .rtable tr {
        background: #151515; border: 1px solid #2a2a2a; border-radius: var(--radius-lg);
        padding: 0.75rem 0.9rem; margin-bottom: 0.75rem;
    }
    .rtable td {
        border: 0; padding: 0.3rem 0; display: flex; justify-content: space-between; align-items: center; gap: 1rem;
        text-align: right;
    }
    .rtable td::before {
        content: attr(data-label); color: #8a8a8a; font-size: 0.78rem; text-transform: uppercase;
        letter-spacing: 0.6px; font-weight: 700; text-align: left; flex-shrink: 0;
    }
    .rtable td.t-head { display: block; text-align: left; padding-bottom: 0.4rem; border-bottom: 1px solid #262626; margin-bottom: 0.3rem; }
    .rtable td.t-head::before { display: none; }
    .rtable td.t-actions-cell { padding-top: 0.6rem; margin-top: 0.3rem; border-top: 1px solid #262626; }
    .rtable td.t-actions-cell::before { display: none; }
    .rtable .t-actions { justify-content: stretch; width: 100%; }
    .rtable .t-actions > * { flex: 1 1 auto; }
    .rtable .t-actions .a-btn { width: 100%; }
    .rtable td .a-fill { min-width: 140px; }
}

/* ---------- Divers ---------- */
.a-muted { color: #8a8a8a; }
.a-small { font-size: 0.85rem; }
details.a-collapse { background: #151515; border: 1px solid #2a2a2a; border-radius: var(--radius-lg); margin-bottom: 1rem; }
details.a-collapse > summary {
    cursor: pointer; padding: 0.9rem 1.1rem; font-weight: 700; color: #fff; list-style: none;
    display: flex; align-items: center; gap: 0.5rem;
}
details.a-collapse > summary::-webkit-details-marker { display: none; }
details.a-collapse > summary .a-ico { color: var(--primary-light); }
details.a-collapse[open] > summary { border-bottom: 1px solid #2a2a2a; }
details.a-collapse > .a-collapse-body { padding: 1.1rem; }
.a-flash { margin-bottom: 1rem; }

@media print {
    .admin-bar, .admin-tabbar, .site-header, .site-footer, .s-header, .s-footer, .a-actions, .t-actions, .a-toolbar, .a-filter { display: none !important; }
    body { padding: 0 !important; background: #fff !important; color: #000 !important; }
}

/* ---------- Avatars ---------- */
.a-avatar { width: 38px; height: 38px; border-radius: 50%; object-fit: cover; flex-shrink: 0; border: 1px solid #333; }
.a-avatar-empty {
    display: inline-flex; align-items: center; justify-content: center;
    background: #222; color: var(--primary-light); font-weight: 800; font-family: 'Orbitron', sans-serif;
}

/* ---------- Ajustements ---------- */
/* style.css ajoute 3rem sous chaque <section> : on gère les espacements nous-mêmes */
section.a-card, .a-grid > section, .a-stack > section { margin-bottom: 0; }

/* Bloc « À traiter » repliable */
details.a-todo { margin-bottom: 1rem; }
details.a-todo > summary .a-todo-count {
    margin-left: auto; background: var(--primary); color: #fff; border-radius: 999px;
    padding: 0.05rem 0.55rem; font-size: 0.8rem;
}
details.a-todo .a-alerts { margin: 0; padding: 0.75rem; }

@media (max-width: 860px) {
    /* Boutons d'action d'une ligne de tableau : tous sur une seule rangée */
    .rtable .t-actions { flex-wrap: nowrap; gap: 0.4rem; }
    .rtable .t-actions > * { flex: 1 1 0; min-width: 0; }
    .rtable .t-actions > .a-btn:not(.a-btn-icon),
    .rtable .t-actions > form:has(> .a-btn:not(.a-btn-icon)) { flex: 2.2 1 0; }
    .rtable .t-actions .a-btn, .rtable .t-actions label.a-btn { width: 100%; min-height: 42px; }

    /* Pas de « carte dans une carte » : chaque ligne devient sa propre carte */
    .a-card:has(> .rtable) { background: none; border: 0; box-shadow: none; padding: 0; }

    /* Boutons d'en-tête nombreux : grille de 3 */
    .a-actions-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); width: 100%; }
    .a-actions-grid .a-btn { padding-left: 0.4rem; padding-right: 0.4rem; font-size: 0.85rem; }
}
