/* ===================================
   DASHBOARD STATISTICS STYLES
   Prefix: dbs2- (dashboard stats 2)
   =================================== */

/* Container principal */
.dashboard_stat_container {
    position: relative;
    max-width: 1400px;
    margin: 0 auto;
    padding: 30px 20px;
    background: var(--bg-primary);
}
/* Titre principal du dashboard */
.dashboard_stat_container h2 {
    margin: 0 0 30px 0;
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--text-primary);
    padding-bottom: 12px;
    border-bottom: 2px solid var(--border-light);
}

/* Version mobile */
@media (max-width: 768px) {
    .dashboard_stat_container h2 {
        font-size: 1.5rem;
        margin-bottom: 20px;
    }
}

/* ===== CARTES STATISTIQUES ===== */
.dbs2-stats-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

.dbs2-stat-card {
    background: var(--white);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    padding: 24px;
    text-align: center;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-sm);
}

.dbs2-stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-color);
}

.dbs2-stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 8px;
    line-height: 1;
}

.dbs2-stat-label {
    font-size: 0.875rem;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Responsive - Mobile */
@media (max-width: 768px) {
    .dbs2-stats-cards {
        grid-template-columns: 1fr;
        gap: 15px;
    }
}
/* ===== BARRE DE FILTRES ===== */
.dbs2-filters-bar {
    background: var(--white);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
    box-shadow: var(--shadow-sm);
}

.dbs2-filters-left {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    flex: 1;
}

.dbs2-filters-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Style des selects */
.dbs2-filter {
    padding: 10px 14px;
    padding-right: 36px; /* Espace pour la flèche */
    border: 1px solid var(--primary-color);
    border-radius: 8px;
    font-size: 0.875rem;
    color: var(--primary-color);
    background: var(--white);
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 180px;
    height: 42px; /* Hauteur standard une ligne */
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%232260FF' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 10px center;
    background-repeat: no-repeat;
    background-size: 16px 12px;
}

.dbs2-filter:hover {
    border-color: var(--primary-hover);
    box-shadow: 0 2px 8px rgba(34, 96, 255, 0.15);
}

.dbs2-filter:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-focus);
}

/* Sélection multiple (organisations) - Plus grand, sans flèche */
#dbs2-filter-org {
    height: 120px; /* Plus haut pour voir plusieurs organisations */
    overflow-y: auto;
    background-image: none; /* Pas de flèche pour le multi-select */
    padding-right: 14px; /* Padding normal */
}

/* Range de dates personnalisé */
#dbs2-date-range {
    display: flex;
    gap: 8px;
    align-items: center;
}

#dbs2-date-range input[type="date"] {
    padding: 10px 14px;
    border: 1px solid var(--border-medium);
    border-radius: 8px;
    font-size: 0.875rem;
    color: var(--text-primary);
    background: var(--white);
    transition: all 0.3s ease;
}

#dbs2-date-range input[type="date"]:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-focus);
}

/* Badges de filtres actifs */
.dbs2-filters-badges {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.dbs2-filter-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--primary-light);
    color: var(--primary-color);
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.dbs2-filter-badge:hover {
    background: var(--primary-color);
    color: var(--white);
}

.dbs2-filter-badge-remove {
    cursor: pointer;
    font-weight: 700;
    margin-left: 2px;
}

/* Bouton reset */
.dbs2-btn-reset {
    padding: 10px 20px;
    background: var(--white);
    border: 1px solid var(--border-medium);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.dbs2-btn-reset:hover {
    background: var(--danger-color);
    color: var(--white);
    border-color: var(--danger-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.dbs2-btn-reset:active {
    transform: translateY(0);
}
/* ===== SECTION GRAPHIQUES ===== */
.dbs2-charts-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

.dbs2-chart-wrapper {
    background: var(--white);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    padding: 24px;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
}

.dbs2-chart-wrapper:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--border-medium);
}

.dbs2-chart-wrapper h3 {
    margin: 0 0 20px 0;
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    padding-bottom: 12px;
    border-bottom: 2px solid var(--primary-color);
}

/* Graphiques pleine largeur (ligne complète) */
.dbs2-chart-full {
    grid-column: 1 / -1;
}

/* Zone du graphique */
.dbs2-chart {
    min-height: 300px;
    width: 100%;
}

/* Graphiques pleine largeur plus hauts */
.dbs2-chart-full .dbs2-chart {
    min-height: 400px;
}
/* Responsive - Mobile pour les graphiques */
@media (max-width: 768px) {
    .dbs2-charts-container {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .dbs2-chart-full {
        grid-column: 1;
    }
    
    .dbs2-chart-wrapper {
        padding: 20px;
    }
    
    .dbs2-chart-wrapper h3 {
        font-size: 1rem;
        margin-bottom: 16px;
    }
    
    .dbs2-chart {
        min-height: 250px;
    }
    
    .dbs2-chart-full .dbs2-chart {
        min-height: 300px;
    }
}
/* ===== TABLEAU DÉTAILLÉ ===== */
.dbs2-table-container {
    background: var(--white);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 30px;
    box-shadow: var(--shadow-sm);
}

.dbs2-table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    gap: 20px;
    flex-wrap: wrap;
}

.dbs2-table-header h3 {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
}

#dbs2-table-search {
    padding: 10px 14px;
    border: 1px solid var(--border-medium);
    border-radius: 8px;
    font-size: 0.875rem;
    color: var(--text-primary);
    background: var(--white);
    min-width: 250px;
    transition: all 0.3s ease;
}

#dbs2-table-search:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-focus);
}

#dbs2-table-search::placeholder {
    color: var(--text-light);
}

/* Wrapper de la table (scroll horizontal sur mobile) */
.dbs2-table-wrapper {
    overflow-x: auto;
    margin: 0 -24px;
    padding: 0 24px;
}

/* Style de la table */
.dbs2-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.dbs2-table thead {
    background: var(--bg-secondary);
    border-bottom: 2px solid var(--primary-color);
}

.dbs2-table th {
    padding: 14px 12px;
    text-align: left;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.dbs2-table th:hover {
    background: var(--primary-light);
    color: var(--primary-color);
}

.dbs2-table th[data-sort]::after {
    content: ' ⇅';
    color: var(--text-light);
    font-size: 0.75rem;
    margin-left: 4px;
}

.dbs2-table tbody tr {
    border-bottom: 1px solid var(--border-light);
    transition: all 0.2s ease;
}

.dbs2-table tbody tr:hover {
    background: var(--bg-secondary);
}

.dbs2-table tbody tr:last-child {
    border-bottom: none;
}

.dbs2-table td {
    padding: 14px 12px;
    color: var(--text-primary);
}

/* Alignement des colonnes numériques */
.dbs2-table td:not(:first-child) {
    text-align: center;
}

.dbs2-table th:not(:first-child) {
    text-align: center;
}

/* ===== PAGINATION ===== */
.dbs2-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.dbs2-pagination button {
    padding: 8px 12px;
    border: 1px solid var(--border-medium);
    border-radius: 6px;
    background: var(--white);
    color: var(--text-primary);
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 40px;
}

.dbs2-pagination button:hover:not(:disabled) {
    background: var(--primary-color);
    color: var(--white);
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(34, 96, 255, 0.2);
}

.dbs2-pagination button.active {
    background: var(--primary-color);
    color: var(--white);
    border-color: var(--primary-color);
    font-weight: 600;
}

.dbs2-pagination button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Responsive - Mobile pour le tableau */
@media (max-width: 768px) {
    .dbs2-table-container {
        padding: 20px 16px;
    }
    
    .dbs2-table-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .dbs2-table-header h3 {
        font-size: 1rem;
    }
    
    #dbs2-table-search {
        width: 100%;
        min-width: auto;
    }
    
    .dbs2-table-wrapper {
        margin: 0 -16px;
        padding: 0 16px;
    }
    
    .dbs2-table {
        font-size: 0.75rem;
    }
    
    .dbs2-table th,
    .dbs2-table td {
        padding: 10px 8px;
    }
}
/* ===== LOADING OVERLAY ===== */
.dbs2-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    border-radius: 12px;
}

.dbs2-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border-light);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: dbs2-spin 0.8s linear infinite;
}

@keyframes dbs2-spin {
    to {
        transform: rotate(360deg);
    }
}