/* public/assets/css/statistiques.css */

:root {
    --primary: #1A5C35;
    --primary-dark: #0A2E18;
    --primary-mid: #2E7D4A;
    --accent: #C1272D;
    --gold: #D4921A;
    --white: #ffffff;
    --gray-xlight: #F7FAFC;
    --gray-light: #E2E8F0;
    --gray-mid: #94A3B8;
    --gray-dark: #4A5568;
    --dark: #1A202C;
}

.layout-split {
    display: flex;
    gap: 2rem;
    align-items: flex-start;
    margin-top: 2rem;
}

.layout-content-left {
    flex: 1;
    min-width: 0;
}

.layout-sidebar-right {
    width: 330px;
    flex-shrink: 0;
    position: sticky;
    top: 120px; 
    height: fit-content;
    align-self: flex-start; 
}

.sidebar-card {
    background: var(--white);
    border-radius: 12px;
    border: 1px solid var(--gray-light);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    overflow: hidden;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
}

.sidebar-nav-item {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1.25rem 1.5rem;
    cursor: pointer;
    border-left: 4px solid transparent;
    transition: all 0.2s ease;
    background: none;
    border-top: none;
    border-right: none;
    border-bottom: 1px solid var(--gray-light);
    text-align: left;
    width: 100%;
}

.sidebar-nav-item:first-child {
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
}

.sidebar-nav-item:last-child {
    border-bottom: none;
    border-bottom-left-radius: 12px;
    border-bottom-right-radius: 12px;
}

.sidebar-nav-item:hover {
    background-color: var(--gray-xlight);
}

.sidebar-nav-item.active {
    background-color: #f0fdf4;
    border-left-color: var(--primary);
}

.sidebar-nav-item.active .nav-num {
    background-color: var(--accent);
    color: var(--white);
}

.sidebar-nav-item.active .nav-title {
    color: var(--primary);
}

.nav-num {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background-color: var(--gray-light);
    color: var(--gray-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.nav-title {
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 0.25rem;
    font-size: 1rem;
    transition: color 0.2s ease;
}

.nav-desc {
    font-size: 0.85rem;
    color: var(--gray-mid);
}

.sidebar-nav-item.disabled {
    pointer-events: none;
    cursor: not-allowed;
    opacity: 0.6;
    background-color: var(--gray-xlight);
}

.sidebar-nav-item.disabled .nav-title,
.sidebar-nav-item.disabled .nav-desc {
    color: var(--gray-mid);
}

.sidebar-nav-item.disabled .nav-num {
    background-color: var(--gray-light);
    color: var(--gray-mid);
}

.sidebar-nav-item.disabled:hover {
    background-color: var(--gray-xlight);
    border-left-color: transparent;
}

.tab-pane {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-pane.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

.filter-container {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
    background-color: var(--gray-xlight);
    padding: 1.25rem;
    border-radius: 8px;
    border: 1px solid var(--gray-light);
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
    min-width: 200px;
}

.filter-label {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--gray-dark);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.filter-select {
    padding: 0.75rem 1rem;
    border-radius: 6px;
    border: 1px solid var(--gray-mid);
    background-color: var(--white);
    color: var(--dark);
    font-size: 1rem;
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.filter-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26, 92, 53, 0.15);
}

.filter-select:disabled {
    background-color: var(--gray-light);
    cursor: not-allowed;
    opacity: 0.7;
}

/* Colonnes / cellules masquées par le filtre */
.hidden-col,
.stats-table [hidden] {
    display: none !important;
}

.stats-card {
    background: var(--white);
    border-radius: 12px;
    border: 1px solid var(--gray-light);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    padding: 1.5rem 1.25rem;
    overflow-x: auto;
}

.stats-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-dark);
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--primary);
    padding-bottom: 0.5rem;
}

.stats-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.stats-table th, 
.stats-table td {
    border: 1px solid var(--gray-light);
    padding: 0.75rem;
    text-align: center;
    vertical-align: middle;
}

.stats-table thead tr:first-child th {
    background-color: var(--primary);
    color: var(--white);
    font-weight: 600;
}

.stats-table thead tr:nth-child(2) th {
    background-color: var(--primary-mid);
    color: var(--white);
    font-weight: 500;
    font-size: 0.85rem;
}

.stats-table tbody th {
    background-color: var(--gray-xlight);
    text-align: left;
    font-weight: 600;
    color: var(--gray-dark);
    min-width: 200px;
}

.stats-table tbody tr:hover {
    background-color: #f8fafc;
}

/* Cellules de libellé (Région, Métier) alignées à gauche */
.stats-table .cell-label {
    text-align: left;
    font-weight: 600;
    color: var(--gray-dark);
}

/* Colonne "Total" calculée */
.stats-table .col-total {
    font-weight: 700;
    background-color: var(--gray-xlight);
}

/* Ligne TOTAL en bas des tableaux */
.stats-table tfoot th,
.stats-table tfoot td {
    background-color: var(--primary-dark);
    color: var(--white);
    font-weight: 700;
    text-align: center;
}

.stats-table tfoot th {
    text-align: left;
}

/* Ligne dont la somme des résultats ne correspond pas au nombre de candidats */
.stats-table tr.row-warning td {
    background-color: #FEF3C7;
}

/* ---------------------------------------------------------------
   Tableau "Résultats de la VAE" : tient dans la carte, sans scroll horizontal
   --------------------------------------------------------------- */
.stats-table-fit {
    table-layout: fixed;
    width: 100%;
    font-size: 0.85rem;
}

.stats-table-fit th,
.stats-table-fit td {
    padding: 0.55rem 0.35rem;
    overflow-wrap: break-word;
    word-break: normal;
}

.stats-table-fit thead th {
    font-size: 0.75rem;
    line-height: 1.25;
}

.stats-table-fit .w-region    { width: 17%; }
.stats-table-fit .w-metier    { width: 21%; }
.stats-table-fit .w-cand      { width: 10%; }
.stats-table-fit .w-totale    { width: 11%; }
.stats-table-fit .w-partielle { width: 11%; }
.stats-table-fit .w-ajourne   { width: 10%; }
.stats-table-fit .w-absent    { width: 8%; }
.stats-table-fit .w-abandon   { width: 12%; }

@media (max-width: 700px) {
    .stats-card {
        padding: 1rem 0.75rem;
    }
    .stats-table-fit {
        font-size: 0.7rem;
    }
    .stats-table-fit th,
    .stats-table-fit td {
        padding: 0.4rem 0.15rem;
    }
    .stats-table-fit thead th {
        font-size: 0.6rem;
        overflow-wrap: anywhere;
    }
}

@media (max-width: 1200px) {
    .layout-split {
        flex-direction: column;
    }
    .layout-sidebar-right {
        width: 100%;
        order: -1;
        position: static;
    }
    .sidebar-nav {
        flex-direction: row;
        flex-wrap: wrap;
    }
    .sidebar-nav-item {
        border-bottom: none;
        border-left: none;
        border-bottom: 2px solid transparent;
        width: 50%;
    }
    .sidebar-nav-item.active {
        border-left-color: transparent;
        border-bottom-color: var(--primary);
    }
}