/* =============================================
   PAGE STATS - Styles spécifiques
   ============================================= */

#statContainer {
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
    padding: 0;
}

/* BARRE MÉDIAS */
.media-bar {
    margin: 10px 0 10px;
}

/* ONGLETS */
.stat-tabs {
    display: flex;
}

.stat-tab {
    flex: 1;
    padding: 12px 8px;
    background: #8a7a5a;
    border: none;
    border-top: 2px solid #6a5a3a;
    border-left: 1px solid #6a5a3a;
    border-right: 1px solid #6a5a3a;
    border-bottom: none;
    cursor: pointer;
    font-size: 0.85em;
    font-weight: bold;
    font-family: inherit;
    transition: all 0.2s;
    white-space: nowrap;
    min-width: 100px;
    border-radius: 8px 8px 0 0;
    position: relative;
}

.stat-tab:hover {
    background: #979088;
}

.stat-tab.active {
    background: transparent;
    color: #fff;
    border-top: 2px solid var(--theme-color, #998658ad);
    border-left: 1px solid #b99d65;
    border-right: 1px solid #b99d65;
    margin-bottom: -2px;
    z-index: 1;
}

/* CONTENU ONGLETS */
.stat-tab-content {
    display: none;
    padding: 15px 10px;
}

.stat-tab-content.active {
    display: block;
}

/* ===== CHIPS DE NAVIGATION ===== */
.chips-container {
    display: flex;
    gap: 10px;
    margin-bottom: 4px;
    flex-wrap: wrap;
    padding: 5px 0;
}

.chip {
    padding: 10px 20px;
    background: #e0e0e0;
    color: #5a5a5a;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    font-size: 0.9em;
    font-weight: 600;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    font-family: inherit;
}

.chip:hover {
    background: #d0d0d0;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.chip.active {
    background: var(--theme-color, #998658ad);
    color: white;
    box-shadow: 0 3px 6px rgba(0,0,0,0.2);
}

.chip i {
    font-size: 1.1em;
}

/* CARTES */
.stat-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
    margin-bottom: 20px;
}

.stat-card {
    background: var(--theme-color, #998658ad);
    color: white;
    padding: 15px;
    border-radius: 10px;
    text-align: center;
    box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.15);
}

.stat-card-value {
    font-size: 2em;
    font-weight: bold;
    margin-bottom: 5px;
}

.stat-card-label {
    font-size: 0.8em;
    opacity: 0.9;
}

/* SECTIONS (style formBlock) */
.stat-section {
    background-color: #b59e69ad;
    border-radius: 10px;
    padding: 4px;
    margin-bottom: 6px;
}

/* Sections gérées par chips : cachées par défaut */
#tab-rankings .stat-section,
#tab-search .stat-section,
#tab-collections .stat-section {
    display: none;
}

#tab-rankings .stat-section.active,
#tab-search .stat-section.active,
#tab-collections .stat-section.active {
    display: block;
}

.stat-section h3 {
    color: var(--theme-color, #3f2f1f);
    font-size: 1em;
    margin-bottom: 10px;
    padding-bottom: 5px;
    border-bottom: 2px solid var(--theme-color, #979088);
    margin-top: 0;
}

/* CONTRÔLES */
.stat-controls {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.stat-controls label {
    font-size: 0.85em;
    color: #3f2f1f;
}

.stat-controls select,
.stat-controls input[type="date"] {
    padding: 8px 12px;
    border: 2px solid #bdbdbd;
    border-radius: 8px;
    background: white;
    font-size: 0.9em;
    font-family: inherit;
}

.stat-btn {
    padding: 8px 16px;
    background: var(--theme-color, #998658ad);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85em;
    font-family: inherit;
    box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
    transition: all 0.2s;
}

.stat-btn:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
}

.stat-btn.active {
    filter: brightness(130%);
    font-weight: bold;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.3);
}

/* RÉSULTATS */
.stat-result {
    margin-top: 10px;
    font-weight: 600;
    color: #3f2f1f;
}

.stat-result-list {
    list-style: none;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    margin-top: 10px;
    text-align: left;
    padding: 0;
}

.stat-result-list li {
    padding: 10px 12px;
    border-bottom: 1px solid #f0f0f0;
    color: #333;
    font-size: 0.9em;
}

.stat-result-list li:last-child {
    border-bottom: none;
}

.stat-result-list li:nth-child(even) {
    background: #f9f9f9;
}

.stat-result-list .stat-empty {
    color: #999;
    font-style: italic;
    text-align: center;
}

/* NOTE BOX */
.stat-note {
    background: #fff3cd;
    padding: 4px;
    border-radius: 8px;
    font-size: 0.85em;
    color: #856404;
    margin-bottom: 4px;
    font-style: italic;
}

/* TABLEAU ÉVOLUTION */
.evolution-table {
    width: 100%;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    border-collapse: collapse;
    margin-top: 10px;
}

.evolution-table th {
    background: #a69263;
    color: white;
    padding: 10px;
    font-weight: bold;
    font-size: 0.9em;
}

.evolution-table td {
    padding: 10px;
    border-bottom: 1px solid #f0f0f0;
    font-size: 0.9em;
    color: #555;
}

.evolution-table td:first-child {
    color: #555;
}

.evolution-table td:nth-child(2),
.evolution-table td:nth-child(3),
.evolution-table td:nth-child(4),
.evolution-table td:nth-child(5) {
    text-align: center;
}

.evolution-table tr:last-child td {
    border-bottom: none;
}

.evolution-table tbody tr:hover {
    background: #f9f9f9;
}

.evolution-table th:nth-child(2),
.evolution-table th:nth-child(3),
.evolution-table th:nth-child(4),
.evolution-table th:nth-child(5) {
    text-align: center;
}

.evolution-loading,
.evolution-error,
.evolution-empty {
    text-align: center;
    color: #999;
}

#evolutionTableBody td {
    color: #6b5f47;
}

/* Sections gérées par chips dans tab-overview : cachées par défaut */
#tab-overview .stat-section {
    display: none;
}

#tab-overview .stat-section.active {
    display: block;
}

/* TABLEAU COLLECTIONS (DVD/VHS) */
.collection-table {
    table-layout: fixed;
    width: 100%;
    background: #fdfaf3;
    border-radius: 8px;
    overflow: hidden;
    border-collapse: collapse;
    margin-top: 10px;
}

.collection-table th {
    background: #a69263;
    color: white;
    padding: 10px 8px;
    font-weight: bold;
    font-size: 0.85em;
    text-align: left;
}

.collection-table td {
    padding: 4px;
    border-bottom: 1px solid #f0f0f0;
    font-size: 0.85em;
    color: #555;
    text-align: left;
}

.collection-table tr:last-child td {
    border-bottom: none;
}

.collection-table tbody tr:hover {
    background: #f9f9f9;
}

.collection-table tr {
    cursor: pointer;
}

.collection-table tr.expanded td {
    white-space: normal;
}

.collection-table tr.expanded .col-director {
    overflow: visible;
    text-overflow: unset;
}

/* Largeurs colonnes - Mobile first */
.col-number {
    width: 30px;
    text-align: center;
    font-size: 0.8em;
}

.col-title {
    width: auto;
    min-width: 100px;
}

.col-director {
    width: 30%;
    font-size: 0.75em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.col-year {
    width: 30px;
    text-align: center;
    font-size: 0.8em;
}

/* Desktop : plus d'espace */
@media (min-width: 601px) {
    .col-number {
        width: 80px;
        font-size: 0.85em;
    }
    
    .col-director {
        width: 35%;
        max-width: 200px;
        font-size: 0.85em;
    }
    
    .col-year {
        width: 70px;
        font-size: 0.85em;
    }
}

.collection-table td.col-number {
    text-align: center;
    font-weight: bold;
    color: #6b5f47;
}

.collection-table td.col-year {
    text-align: center;
    color: #888;
}

/* Header de section avec bouton print */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.section-header h3 {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
    flex: 1;
}

.print-icon-btn {
    padding: 6px 10px;
    background: #8a7a5a;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1em;
    transition: all 0.2s;
    box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.print-icon-btn:hover {
    background: #8a7a5a;
    transform: translateY(-1px);
}

.print-icon-btn:active {
    transform: translateY(1px);
}

/* RESPONSIVE */
@media (max-width: 600px) {
    .stat-tab {
        padding: 10px 6px;
        font-size: 0.8em;
        min-width: 80px;
    }

    .stat-tab-content {
        padding: 10px 5px;
    }

    .stat-controls {
        gap: 6px;
    }
    
    .chip {
        padding: 8px 8px;
        font-size: 0.85em;
    }
}
