/* ============================================================
   Styles personnalisés — Tableau de bord COP Régionales
   Complément au DSFR
   ============================================================ */

/* ------- Forcer le thème clair ------- */
:root, [data-fr-scheme="light"] {
    --background-default-grey: #fff !important;
    --text-default-grey: #161616 !important;
    --background-contrast-grey: #f5f5f5 !important;
    --text-title-grey: #161616 !important;
    --background-alt-grey: #f6f6f6 !important;
    --text-action-high-blue-france: #000091 !important;
    color-scheme: light !important;
}
body {
    background: #fff !important;
    color: #161616 !important;
}

/* ------- Variables ------- */
:root {
    --region-grand-est: #000091;
    --region-occitanie: #CE614A;
    --region-aura: #009081;
    --region-normandie: #5770BE;
    --green-compare: #18753C;
    --orange-partial: #E4794A;
    --grey-na: #929292;
}

/* ------- Badges régionaux ------- */
.region-badge {
    display: inline-block;
    padding: 0.15rem 0.6rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 700;
    color: #fff;
}
.region-grand-est { background-color: var(--region-grand-est); }
.region-occitanie { background-color: var(--region-occitanie); }
.region-aura { background-color: var(--region-aura); }
.region-normandie { background-color: var(--region-normandie); }

/* ------- Tuiles de synthèse ------- */
.tile-category {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 1rem 1.2rem;
    cursor: pointer;
    transition: box-shadow 0.2s, transform 0.15s;
    text-align: center;
    min-height: 140px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.tile-category:hover,
.tile-category:focus {
    box-shadow: 0 4px 16px rgba(0, 0, 145, 0.15);
    transform: translateY(-2px);
}
.tile-category__icon {
    font-size: 2rem;
    margin-bottom: 0.3rem;
}
.tile-category__title {
    font-weight: 700;
    font-size: 0.95rem;
    color: #161616;
    margin-bottom: 0.3rem;
}
.tile-category__count {
    font-size: 0.8rem;
    color: #666;
    margin-bottom: 0.4rem;
}
.tile-category__bar {
    height: 6px;
    background: #e5e5e5;
    border-radius: 3px;
    overflow: hidden;
}
.bar-fill--green {
    height: 100%;
    background: var(--green-compare);
    border-radius: 3px;
    transition: width 0.4s ease;
}

/* ------- Tableau ------- */
.table-wrapper {
    overflow-x: auto;
}

#kpi-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

#kpi-table thead th {
    background-color: #000091;
    color: #fff;
    position: sticky;
    top: 0;
    z-index: 2;
    padding: 0.75rem 0.6rem;
    text-align: left;
    white-space: nowrap;
}

#kpi-table tbody td {
    padding: 0.6rem;
    vertical-align: top;
    border-bottom: 1px solid #eee;
}

#kpi-table tbody tr:hover {
    background-color: #f0f0ff;
}

/* Colonnes */
.col-indicateur { min-width: 170px; width: 170px; }
.col-region { min-width: 190px; }
.col-comparable { min-width: 85px; width: 85px; text-align: center !important; }

/* Ligne catégorie */
.category-row td {
    background-color: #E3E3FD !important;
    font-weight: 700;
    font-size: 0.95rem;
    color: #000091;
    padding: 0.5rem 0.6rem !important;
}

/* N/D */
.value-na {
    color: var(--grey-na);
    font-style: italic;
    font-size: 0.85rem;
}

/* ------- Tags comparables ------- */
.tag-comparable {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
    cursor: help;
}
.tag-comparable--yes {
    background: #B8FEC9;
    color: #18753C;
}
.tag-comparable--partial {
    background: #FEE7B8;
    color: #A05A2C;
}
.tag-comparable--no {
    background: #eee;
    color: #929292;
}

/* ------- Liens source (p.XX) ------- */
.source-link {
    display: inline-block;
    font-size: 0.7rem;
    color: #000091;
    background: #E3E3FD;
    padding: 0.05rem 0.35rem;
    border-radius: 3px;
    text-decoration: none;
    margin-left: 0.2rem;
    font-weight: 600;
    vertical-align: middle;
    transition: background 0.15s;
}
.source-link:hover {
    background: #000091;
    color: #fff;
}

/* ------- Filtres ------- */
.filters-bar {
    background: #f9f9f9;
    border-radius: 8px;
    padding: 1rem;
    border: 1px solid #e5e5e5;
}

/* ------- Responsive ------- */
@media (max-width: 768px) {
    .col-indicateur { min-width: 140px; }
    .col-region { min-width: 150px; }
    .tile-category { min-height: 110px; }
}
