﻿/* ==========================================================================
   Production tables – styles isolés via le préfixe `production-…`
   ========================================================================== */

:root {
    /* Couleurs & tokens */
    --production-border: #e6e9f0;
    --production-border-strong: #d9dde6;
    --production-bg: #ffffff;
    --production-header-bg: #f6f8fc;
    --production-header-text: #0f172a;
    --production-section-bg: #f3f4f6;
    --production-summary-bg: #eaf3ff;
    --production-text: #111827;
    --production-ok: #137333;
    --production-ko: #c62828;
    --production-radius: 12px;
    --production-shadow: 0 8px 24px rgba(16, 24, 40, 0.08);
    /* Palette % (déjà utilisée ailleurs) */
    --pct-red: #e53935;
    --pct-orange: #fb8c00;
    --pct-yellow: #fbc02d;
    --pct-green: #2e7d32;
    --pct-green-plus: #1b5e20;
    /* Couleurs par mode (second tableau) */
    --mode-nc: #2563eb; /* bleu */
    --mode-nl: #7c3aed; /* violet */
    --mode-itc: #dc2626; /* rouge */
    /* Vue détaillée (parent qui scrolle) */
    --production-section-max-h: 55vh;
    /* Largeur fixe 1re colonne (ProductionAnnee) */
    --production-leftcol-w: 360px;
}

/* ==========================================================================
   0) Title discret (hors tableau) – Vue générale
   ========================================================================== */

.production-title {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 8px;
    margin: 6px 4px 10px 4px;
}

.production-title__label {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--production-header-text);
    opacity: .85;
}

.production-title__sep {
    opacity: .35;
}

.production-title__range {
    font-weight: 700;
    font-size: 1rem;
    color: var(--production-text);
}

/* ==========================================================================
   1) Containers & stacks
   ========================================================================== */

.production-section-scroll {
    overflow: auto;
    padding-right: 4px;
}

.production-table-stack {
    display: grid;
    gap: 16px;
}

.production-scroll {
    width: 100%;
    max-width: 100%;
    height: auto;
    overflow: auto;
    padding: 8px;
    box-sizing: border-box;
    position: relative;
    background: transparent;
}


.production-table-wrapper {
    display: inline-block;
    min-width: 100%;
    margin-bottom: 16px;
}

/* ==========================================================================
   2) Table – style générique
   ========================================================================== */

.production-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: var(--production-bg);
    color: var(--production-text);
    border: 1px solid var(--production-border);
    box-shadow: var(--production-shadow);
    table-layout: fixed;
}

.production-text-center {
    text-align: center;
}

.production-table thead th {
    font-weight: 600;
}

.production-header-row th,
.production-header-row td {
    background: var(--production-header-bg);
    color: var(--production-header-text);
    border-bottom: 1px solid var(--production-border-strong);
    border-top: 1px solid var(--production-border-strong);
    padding: 10px 12px;
    position: relative;
    z-index: 1;
}

.production-meta-row th,
.production-meta-row td {
    background: #fff;
    color: var(--production-header-text);
    border-bottom: 1px solid var(--production-border);
    padding: 10px 12px;
}

.production-table tbody td,
.production-table tbody th {
    padding: 8px 10px;
    border-bottom: 1px solid var(--production-border);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: top;
}

/* Valeur principale + % */
.production-main {
    font-weight: 700;
    font-size: 1rem;
    color: inherit;
    margin-right: 6px;
}

.production-table td small {
    opacity: .7;
    font-weight: 500;
}

/* Icône au-dessus de l’objectif */
.production-over-icon {
    margin-left: 6px;
    font-size: .9rem;
    color: var(--pct-green-plus);
}

/* Section & résumé */
.production-section-row td {
    background: var(--production-section-bg);
    font-weight: 600;
}

.production-summary-row td {
    background: var(--production-summary-bg);
    font-weight: 600;
}

.production-strong {
    font-weight: 700;
}

/* ==========================================================================
   3) Sticky + Première colonne fixe (ProductionAnnee)
   ========================================================================== */

.production-sticky-left {
    position: sticky;
    left: 0;
    z-index: 2;
    background: var(--production-bg);
    box-shadow: 3px 0 0 0 var(--production-border);
}

.production-sticky-header th {
    position: sticky;
    top: 0;
    z-index: 3;
}

.production-left-col-fixed {
    width: var(--production-leftcol-w) !important;
    min-width: var(--production-leftcol-w) !important;
    max-width: var(--production-leftcol-w) !important;
}

.production-left-col-header, .production-left-col-cell {
    text-align: left;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.production-left-col-strong {
    font-weight: 700;
}

.production-align-middle {
    vertical-align: middle !important;
}

/* ==========================================================================
   4) Palette texte OK/KO + % (déjà utilisée ailleurs)
   ========================================================================== */

.production-ok {
    color: var(--pct-green);
    font-weight: 600;
}

.production-ko {
    color: var(--pct-red);
    font-weight: 600;
}

.production-pct-0 {
    color: var(--pct-red);
    font-weight: 700;
}

.production-pct-50 {
    color: var(--pct-orange);
    font-weight: 700;
}

.production-pct-75 {
    color: var(--pct-yellow);
    font-weight: 700;
}

.production-pct-100 {
    color: var(--pct-green);
    font-weight: 700;
}

.production-pct-gt100 {
    color: var(--pct-green-plus);
    font-weight: 800;
}

.production-pct-na {
    color: var(--production-text);
    font-weight: 600;
    opacity: .8;
}

/* ==========================================================================
   5) Tableau secondaire (vue détaillée) – héritage de base
   ========================================================================== */

.production-polish table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: #fff;
    color: #111827;
    border: 1px solid #e6e9f0;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(16, 24, 40, 0.08);
    table-layout: auto;
}

.production-polish thead th {
    background: #f6f8fc;
    color: #0f172a;
    font-weight: 600;
    padding: 10px 12px;
    border-bottom: 1px solid #d9dde6;
    text-align: center;
    position: relative;
    z-index: 1;
}

.production-polish tbody td {
    padding: 8px 10px;
    border-bottom: 1px solid #e6e9f0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.production-polish tbody tr:nth-child(even) td {
    background: #fafbff;
}

.production-polish thead tr:first-child th:first-child {
    border-top-left-radius: 12px;
}

.production-polish thead tr:first-child th:last-child {
    border-top-right-radius: 12px;
}

.production-polish tbody tr:last-child td:first-child {
    border-bottom-left-radius: 12px;
}

.production-polish tbody tr:last-child td:last-child {
    border-bottom-right-radius: 12px;
}

.production-polish tbody tr:last-child td {
    border-bottom: 0;
}

/* ==========================================================================
   6) Skin spécifique “Vue générale” (ProductionGlobale)
   ========================================================================== */

.production-global thead .production-header-row th,
.production-global thead .production-header-row td {
    font-weight: 700;
    font-size: 1rem;
    border-right: 1px solid var(--production-border);
}

    .production-global thead .production-header-row th:last-child,
    .production-global thead .production-header-row td:last-child {
        border-right: 0;
    }

.production-global__typecol {
    background: var(--production-section-bg);
    text-align: left;
    font-weight: 600;
}

.production-global tbody td:not(.production-global__typecol) {
    background: #fff;
}

.production-global tbody td,
.production-global thead th,
.production-global thead td {
    border-right: 1px solid var(--production-border);
}

.production-global tbody tr td {
    border-bottom-width: 2px;
}

.production-global .production-global__cell {
    text-align: center;
    border-right: 1px solid var(--production-border);
}

/* ==========================================================================
   7) Scrollbars
   ========================================================================== */

.production-section-scroll::-webkit-scrollbar,
.production-scroll::-webkit-scrollbar {
    height: 10px;
    width: 10px;
}

.production-section-scroll::-webkit-scrollbar-track,
.production-scroll::-webkit-scrollbar-track {
    background: transparent;
}

.production-section-scroll::-webkit-scrollbar-thumb,
.production-scroll::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.18);
    border-radius: 8px;
}

    .production-section-scroll::-webkit-scrollbar-thumb:hover,
    .production-scroll::-webkit-scrollbar-thumb:hover {
        background: rgba(0, 0, 0, 0.28);
    }

.production-section-scroll, .production-scroll {
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 0, 0, 0.28) transparent;
}

/* ==========================================================================
   8) Progress bars (compact, sous la valeur, centrée)
   ========================================================================== */

.production-progress.production-progress--compact {
    display: block;
    width: 96px;
    height: 6px;
    margin: 6px auto 0; /* centré */
    background: #eef1f6;
    border: 1px solid var(--production-border-strong);
    border-radius: 999px;
    overflow: hidden;
}

.production-section-row .production-progress--compact {
    border-color: #cbd5e1;
    background: #e9eef7;
}

.production-progress--hidden .production-progress__bar {
    display: none;
}

.production-progress__bar {
    display: block;
    height: 100%;
    width: 0;
    border-radius: inherit;
    transition: width .25s ease-in-out;
}

    .production-progress__bar.production-pct-0 {
        background: var(--pct-red);
    }

    .production-progress__bar.production-pct-50 {
        background: var(--pct-orange);
    }

    .production-progress__bar.production-pct-75 {
        background: var(--pct-yellow);
    }

    .production-progress__bar.production-pct-100 {
        background: var(--pct-green);
    }

    .production-progress__bar.production-pct-gt100 {
        background: repeating-linear-gradient(45deg, var(--pct-green-plus) 0, var(--pct-green-plus) 6px, #1f7a1f 6px, #1f7a1f 10px);
    }

/* ==========================================================================
   9) Responsive léger
   ========================================================================== */

@media (max-width: 1100px) {
    :root {
        --production-leftcol-w: 320px;
        --production-section-max-h: 62vh;
    }
}

/* ==========================================================================
   10) Second tableau (vue détaillée) – “Modes par année”
   ========================================================================== */

.production-modes thead th {
    font-weight: 700;
    font-size: 0.95rem;
    text-align: center;
}

.production-modes__typecol {
    text-align: left;
    font-weight: 600;
    background: #f7f8fb;
}

.production-modes__typecol--head {
    background: var(--production-header-bg);
}

/* Cellules (body) – séparateurs fins par défaut */
.production-modes__cell {
    border-left: 1px solid var(--production-border);
}

    .production-modes__cell:first-child {
        border-left: 0;
    }

/* En-têtes “Année” (groupe) */
.production-modes__year {
    border-left: 0;
    border-right: 0;
    font-size: 1rem;
    background: var(--production-header-bg);
    color: var(--production-header-text);
    border-bottom: 2px solid var(--production-border-strong);
}

/* En-têtes “Mode” (sous-colonnes) */
.production-modes__mode {
    border-left: 1px solid var(--production-border);
    border-right: 0;
}

    .production-modes__mode:first-child {
        border-left: 0;
    }

    /* Séparateurs épais entre blocs Année */
    .production-modes__cell--group-start,
    .production-modes__mode.production-modes__cell--group-start {
        border-left: 3px solid var(--production-border-strong);
    }

    .production-modes__cell--group-end,
    .production-modes__mode.production-modes__cell--group-end {
        border-right: 3px solid var(--production-border-strong);
    }

/* Harmonisation zebra léger (lisibilité) */
.production-modes tbody tr:nth-child(odd) td:not(.production-modes__typecol) {
    background: #fbfcff;
}

/* ==========================================================================
   11) Chips (pastilles de valeur) – par mode
   ========================================================================== */

.production-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 24px;
    padding: 0 8px;
    font-weight: 700;
    font-size: 0.95rem;
    border-radius: 999px;
    border: 1px solid transparent;
    background: #f1f5f9; /* fallback */
    color: #0f172a;
}

.production-chip--zero {
    opacity: .45; /* valeurs nulles visuellement atténuées */
}

.production-chip--nc {
    background: rgba(37, 99, 235, 0.10);
    color: #1d4ed8;
    border-color: rgba(37, 99, 235, 0.25);
}

.production-chip--nl {
    background: rgba(124, 58, 237, 0.10);
    color: #6d28d9;
    border-color: rgba(124, 58, 237, 0.25);
}

.production-chip--itc {
    background: rgba(220, 38, 38, 0.10);
    color: #b91c1c;
    border-color: rgba(220, 38, 38, 0.25);
}
