/* ============================================================
   MEGA – recap.css
   Styles spécifiques à la page Récap (view/recap.php)
============================================================ */

:root {
    --stat-year:            #9e856a;
    --stat-total:           #c4ad82;
    --stat-month:           #b8a080;
    --stat-modal-bg:        #3d2e1a;
    --stat-modal-year:      #e8dcc8;
    --stat-modal-subtext:   #b8a88a;
}

/* ---- Toggle Par année / Par mois ---- */
#statViewToggle {
    display: flex;
    justify-content: center;
    gap: 0;
    padding: 12px 0 8px;
}

#statViewToggle button {
    background: rgba(0,0,0,0.12);
    border: 1px solid rgba(0,0,0,0.2);
    color: rgba(255,255,255,0.6);
    font-family: inherit;
    font-size: 0.82em;
    font-weight: bold;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 7px 20px;
    cursor: pointer;
    transition: background 0.18s, color 0.18s;
}

#statViewToggle button:first-child {
    border-radius: 6px 0 0 6px;
    border-right: none;
}

#statViewToggle button:last-child {
    border-radius: 0 6px 6px 0;
}

#statViewToggle button.active {
    background: var(--stat-year);
    color: white;
    border-color: var(--stat-year);
}

/* ---- Panels ---- */
.stat-panel { display: none; }
.stat-panel.active { display: block; }

.stat-tap-hint {
    font-size: 0.68em;
    color: rgba(255,255,255,0.35);
    text-align: center;
    margin: 0 0 10px 0;
    font-style: italic;
}

.stat-table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding: 0 2px;
}

/* ---- Tables ---- */
.stat-table {
    margin: 0 auto;
    border-collapse: collapse;
    font-size: 0.72em;
    table-layout: fixed;
    width: 100%;
}

.stat-table th,
.stat-table td {
    border: 1px solid rgba(0,0,0,0.12);
    padding: 2px 1px;
    text-align: center;
    color: white;
}

/* Headers */
.stat-table thead th {
    position: sticky;
    top: 0;
    z-index: 5;
    font-size: 0.75em;
    text-transform: uppercase;
    letter-spacing: 0;
    word-break: break-word;
    overflow-wrap: break-word;
    line-height: 3;
    filter: saturate(0.6) brightness(1.1);
}

.stat-table thead .demo-label {
    font-size: 0.72em;
    font-weight: normal;
    opacity: 0.78;
    text-transform: none;
}

/* ---- Couleurs colonnes header ---- */
.stat-col-year   { background: var(--stat-total); }
.stat-col-total  { background: var(--stat-total); }
.stat-col-month  { background: var(--stat-total); }
.stat-col-movie  { background: var(--color-movie); }
.stat-col-season { background: var(--color-season); }
.stat-col-vg     { background: var(--color-vg); }
.stat-col-vr     { background: var(--color-vr); }
.stat-col-comic  { background: var(--color-comic); }
.stat-col-book   { background: var(--color-book); }
.stat-col-mag    { background: var(--color-mag); }
.stat-col-spec   { background: var(--color-spec); }

/* ---- Lignes tbody ---- */
.stat-table tbody tr {
    cursor: pointer;
    transition: filter 0.15s;
}

.stat-table tbody tr:hover  { filter: brightness(1.15); }
.stat-table tbody tr:active { filter: brightness(1.35); }

/* Alternance fond uniquement */
.stat-table tbody tr.stat-row-alt td,
.stat-table tbody tr.stat-row-alt th {
    box-shadow: inset 0 0 0 1000px rgba(0,0,0,0.09);
}

/* ---- Cellules valeur ---- */
.stat-cell-year   { background: var(--stat-total) !important; font-weight: bold; }
.stat-cell-total  { background: var(--stat-total) !important; font-weight: bold; }
.stat-cell-month  { background: var(--stat-total) !important; }
.stat-cell-movie  { background: var(--color-movie); }
.stat-cell-season { background: var(--color-season); }
.stat-cell-vg     { background: var(--color-vg); }
.stat-cell-vr     { background: var(--color-vr); }
.stat-cell-comic  { background: var(--color-comic); }
.stat-cell-book   { background: var(--color-book); }
.stat-cell-mag    { background: var(--color-mag); }
.stat-cell-spec   { background: var(--color-spec); }

/* Zéro */
.stat-cell-zero {
    background: rgba(0,0,0,0.07) !important;
    color: rgba(255,255,255,0.2) !important;
}

/* Démo dans cellule */
.stat-demo-count {
    font-size: 0.82em;
    font-style: italic;
    opacity: 0.82;
}

/* Séparation changement d'année (table mois) */
.stat-table tr.stat-year-sep td,
.stat-table tr.stat-year-sep th {
    border-top: 2px solid rgba(255,255,255,0.25) !important;
}

/* ---- Modal détail ---- */
#statModal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 200;
    align-items: flex-end;
    justify-content: center;
}

#statModal.open { display: flex; }

#statModalBox {
    background: var(--stat-modal-bg);
    border-radius: 16px 16px 0 0;
    padding: 16px 16px 32px;
    width: 100%;
    max-width: 520px;
    max-height: 80vh;
    overflow-y: auto;
    transform: translateY(100%);
    transition: transform 0.28s cubic-bezier(.32,1,.5,1);
    position: relative;
    text-align: left;
}

#statModal.open #statModalBox { transform: translateY(0); }

#statModalHandle {
    width: 36px;
    height: 4px;
    background: var(--stat-modal-subtext);
    border-radius: 2px;
    margin: 0 auto 14px;
    opacity: 0.4;
}

#statModalClose {
    position: absolute;
    top: 12px;
    right: 16px;
    background: transparent;
    border: none;
    color: var(--stat-modal-subtext);
    font-size: 1.4em;
    cursor: pointer;
    line-height: 1;
}

#statModalNav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

#statModalNav button {
    background: rgba(255,255,255,0.07);
    border: 1px solid rgba(255,255,255,0.1);
    color: var(--stat-modal-subtext);
    border-radius: 6px;
    padding: 6px 12px;
    font-family: inherit;
    font-size: 0.85em;
    cursor: pointer;
    transition: background 0.15s;
}

#statModalNav button:hover    { background: rgba(255,255,255,0.12); }
#statModalNav button:disabled { opacity: 0.2; cursor: default; }

#statModalPeriod {
    font-size: 1.35em;
    font-weight: bold;
    color: var(--stat-modal-year);
    text-align: center;
}

#statModalTotalLine {
    font-size: 0.85em;
    text-align: center;
    color: var(--stat-modal-subtext);
    margin-top: 2px;
}

#statModalTotalLine span {
    color: var(--stat-modal-year);
    font-weight: bold;
    font-size: 1.15em;
}

/* ---- Toggle démos ---- */
#statModalDemoToggle {
    text-align: center;
    margin-top: 12px;
}

#btnDemoToggle {
    background: rgba(255,255,255,0.07);
    border: 1px solid rgba(255,255,255,0.15);
    color: var(--stat-modal-subtext);
    border-radius: 20px;
    padding: 4px 12px;
    font-family: inherit;
    font-size: 0.75em;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

#btnDemoToggle:hover  { background: rgba(255,255,255,0.12); }
#btnDemoToggle.active {
    background: var(--stat-year);
    color: white;
    border-color: var(--stat-year);
}

/* ---- Barres modal ---- */
.stat-bar-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 7px;
    padding-top: 4px;
    border-top: 1px solid rgba(255,255,255,0.04);
}

.stat-bar-row:first-child { border-top: none; }

.stat-bar-label {
    width: 56px;
    font-size: 0.72em;
    color: var(--stat-modal-subtext);
    text-align: right;
    flex-shrink: 0;
}

.stat-bar-track {
    flex: 1;
    background: rgba(255,255,255,0.06);
    border-radius: 5px;
    height: 22px;
    overflow: visible;
    position: relative;
}

.stat-bar-fill {
    height: 100%;
    border-radius: 5px;
    display: inline-flex;
    align-items: center;
    padding: 0 6px;
    font-size: 0.8em;
    font-weight: bold;
    color: white;
    width: 0;
    transition: width 0.4s cubic-bezier(.25,.8,.25,1);
    white-space: nowrap;
    overflow: visible;
    position: relative;
    box-sizing: border-box;
}

.stat-bar-count {
    width: 44px;
    text-align: left;
    font-size: 0.85em;
    font-weight: bold;
    flex-shrink: 0;
    color: var(--stat-modal-year);
    white-space: nowrap;
}

.stat-bar-count.zero { color: rgba(216,196,158,0.25); }

.stat-bar-demo {
    font-size: 0.82em;
    font-style: italic;
    opacity: 0.82;
}