/* ===================================
   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 - Style discret */
.dbs2-stats-cards {
    display: flex;
    gap: 15px;
    margin-bottom: 25px;
}

.dbs2-stat-card {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 15px 20px;
    min-width: 160px;
}

.dbs2-stat-value {
    font-size: 24px;
    font-weight: 600;
    color: #2260FF;
    line-height: 1;
}

.dbs2-stat-label {
    font-size: 12px;
    color: #6c757d;
    margin-top: 5px;
}

/* Responsive */
@media (max-width: 768px) {
    .dbs2-stats-cards {
        flex-direction: column;
    }
    
    .dbs2-stat-card {
        min-width: auto;
    }
}

/* ===== BARRE DE FILTRES ===== */
.dbs2-filters-bar {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 30px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 24px;
    flex-wrap: wrap;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
}

.dbs2-filters-left {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    flex: 1;
    align-items: flex-start;
}

.dbs2-filters-right {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding-top: 8px;
}

/* Style des selects - Base */
.dbs2-filter {
    padding: 12px 16px;
    padding-right: 40px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 0.9rem;
    color: #334155;
    background: #ffffff;
    cursor: pointer;
    transition: all 0.25s ease;
    min-width: 200px;
    height: 46px;
    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='2' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 12px center;
    background-repeat: no-repeat;
    background-size: 18px 14px;
    font-weight: 500;
}

.dbs2-filter:hover {
    border-color: #2260FF;
    background-color: #f8faff;
    box-shadow: 0 4px 12px rgba(34, 96, 255, 0.1);
}

.dbs2-filter:focus {
    outline: none;
    border-color: #2260FF;
    box-shadow: 0 0 0 4px rgba(34, 96, 255, 0.1);
}

/* Sélection multiple (organisations) - Plus grand et convivial */
#dbs2-filter-org {
    height: 180px;
    min-width: 480px;
    overflow-y: auto;
    background-image: none;
    padding: 8px;
    padding-right: 8px;
}

#dbs2-filter-org option {
    padding: 10px 12px;
    border-radius: 6px;
    margin-bottom: 2px;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

#dbs2-filter-org option:hover {
    background-color: #f0f5ff;
}

#dbs2-filter-org option:checked {
    background: linear-gradient(135deg, #2260FF 0%, #1a4fd6 100%);
    color: white;
    font-weight: 500;
}

/* Select mois */
#dbs2-filter-month {
    min-width: 180px;
}

/* 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: 8px 14px;
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    color: #2260FF;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    transition: all 0.2s ease;
    border: 1px solid #bfdbfe;
}

.dbs2-filter-badge:hover {
    background: linear-gradient(135deg, #2260FF 0%, #1a4fd6 100%);
    color: #ffffff;
    border-color: #2260FF;
}

.dbs2-filter-badge-remove {
    cursor: pointer;
    font-weight: 700;
    margin-left: 2px;
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

.dbs2-filter-badge-remove:hover {
    opacity: 1;
}

/* Bouton reset */
.dbs2-btn-reset {
    padding: 12px 24px;
    background: #ffffff;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    color: #64748b;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
    white-space: nowrap;
}

.dbs2-btn-reset:hover {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: #ffffff;
    border-color: #ef4444;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(239, 68, 68, 0.25);
}

.dbs2-btn-reset:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.25);
}

/* Responsive */
@media (max-width: 768px) {
    .dbs2-filters-bar {
        flex-direction: column;
        padding: 20px;
    }
    
    .dbs2-filters-left {
        width: 100%;
        flex-direction: column;
    }
    
    .dbs2-filter {
        width: 100%;
        min-width: auto;
    }
    
    #dbs2-filter-org {
        min-width: auto;
        width: 100%;
    }
    
    .dbs2-filters-right {
        width: 100%;
        justify-content: flex-end;
        padding-top: 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;
    margin-left: 30px;
    margin-right: 30px;
    margin-top: 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);
    }
}
/* Carte dynamique organisation */
.dbs2-org-highlight {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #2260FF 0%, #1a4fd6 100%);
    color: white;
    padding: 25px 35px;
    border-radius: 12px;
    margin-bottom: 25px;
    box-shadow: 0 4px 15px rgba(34, 96, 255, 0.3);
}

.dbs2-org-highlight-content {
    display: flex;
    flex-direction: column;
}

.dbs2-org-highlight-label {
    font-size: 14px;
    opacity: 0.85;
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.dbs2-org-highlight-name {
    font-size: 28px;
    font-weight: 700;
}

.dbs2-org-highlight-stats {
    text-align: right;
}

.dbs2-org-highlight-value {
    font-size: 48px;
    font-weight: 700;
    line-height: 1;
}

.dbs2-org-highlight-sublabel {
    font-size: 14px;
    opacity: 0.85;
    margin-top: 5px;
}

/* Responsive */
@media (max-width: 768px) {
    .dbs2-org-highlight {
        flex-direction: column;
        text-align: center;
        gap: 20px;
    }
    
    .dbs2-org-highlight-stats {
        text-align: center;
    }
    
    .dbs2-org-highlight-name {
        font-size: 22px;
    }
    
    .dbs2-org-highlight-value {
        font-size: 36px;
    }
}
.dbs2-org-highlight-month {
    font-size: 16px;
    opacity: 0.9;
    margin-top: 8px;
    font-style: italic;
}
.dbs2-value-month {
    color: #FFD700;
}

.dbs2-value-year {
    opacity: 0.7;
}