/* Dashboard FFB - Version optimisée et complète */

/* Reset et base */
* { 
    box-sizing: border-box; 
    margin: 0; 
    padding: 0; 
}

body { 
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; 
    background: #f8f9fa; 
    color: #333;
    line-height: 1.6;
}

/* Header */
.header {
    background: linear-gradient(135deg, #2c5282 0%, #2d3748 100%);
    color: white;
    padding: 1rem 2rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.header h1 { 
    font-size: 1.8rem; 
    margin-bottom: 0.5rem; 
}

/* Breadcrumb */
.breadcrumb {
    background: white;
    padding: 1rem 2rem;
    border-bottom: 1px solid #e2e8f0;
    font-size: 0.9rem;
}

.breadcrumb a {
    color: #2c5282;
    text-decoration: none;
    margin-right: 0.5rem;
}

.breadcrumb a:hover { 
    text-decoration: underline; 
}

.breadcrumb .separator { 
    margin: 0 0.5rem; 
    color: #666; 
}

/* Layout principal */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 2rem;
}

/* Sidebar */
.sidebar {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    height: fit-content;
    position: sticky;
    top: 2rem;
    max-height: calc(100vh - 4rem);
    overflow-y: auto;
}

.sidebar h3 {
    color: #2c5282;
    margin-bottom: 1rem;
    font-size: 1.1rem;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 0.5rem;
}

/* Filtres sidebar */
.filter-section {
    margin-bottom: 1.5rem;
    border-bottom: 1px solid #f0f0f0;
    padding-bottom: 1rem;
}

.filter-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.filter-title {
    font-weight: 600;
    color: #4a5568;
    margin-bottom: 0.8rem;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.filter-dropdown {
    width: 100%;
    padding: 0.6rem 0.8rem;
    border: 2px solid #e2e8f0;
    border-radius: 6px;
    background: white;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=US-ASCII,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'><path fill='%234a5568' d='M6 8L2 4h8z'/></svg>");
    background-repeat: no-repeat;
    background-position: right 0.8rem center;
    background-size: 12px;
}

.filter-dropdown:hover {
    border-color: #2c5282;
    box-shadow: 0 0 0 3px rgba(44, 82, 130, 0.1);
}

.filter-dropdown:focus {
    outline: none;
    border-color: #2c5282;
    box-shadow: 0 0 0 3px rgba(44, 82, 130, 0.2);
}

.filter-dropdown.active {
    background-color: #edf2f7;
    border-color: #2c5282;
    font-weight: 500;
}

.clear-filters {
    width: 100%;
    padding: 0.8rem;
    background: #e53e3e;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s;
    margin-bottom: 1rem;
    text-align: center;
}

.clear-filters:hover {
    background: #c53030;
    transform: translateY(-1px);
}

.active-filters {
    background: #e6fffa;
    border: 1px solid #38b2ac;
    border-radius: 6px;
    padding: 0.8rem;
    margin-bottom: 1rem;
    font-size: 0.85rem;
}

.active-filters h4 {
    color: #234e52;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.filter-tag {
    display: inline-block;
    background: #38b2ac;
    color: white;
    padding: 0.3rem 0.8rem;
    border-radius: 15px;
    font-size: 0.8rem;
    margin: 0.2rem;
    cursor: pointer;
    transition: all 0.2s;
}

.filter-tag:hover {
    background: #319795;
    transform: scale(0.95);
}

.filter-tag::after {
    content: " ×";
    margin-left: 0.5rem;
    font-weight: bold;
}

/* Navigation sidebar */
.navigation-item {
    margin-bottom: 1rem;
}

/* Navigation entre pages */
.page-navigation {
    margin-bottom: 1.5rem;
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 1rem;
}

.nav-links {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nav-link {
    display: block;
    padding: 0.8rem 1rem;
    text-decoration: none;
    color: #2c5282;
    background: #f7fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s;
    text-align: center;
}

.nav-link:hover {
    background: #edf2f7;
    border-color: #2c5282;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(44, 82, 130, 0.15);
}

.nav-link.active {
    background: #2c5282;
    color: white;
    border-color: #2c5282;
    cursor: default;
}

.nav-link.active:hover {
    transform: none;
    box-shadow: none;
}

.nav-button {
    width: 100%;
    padding: 0.8rem;
    background: #f7fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    cursor: pointer;
    text-align: left;
    font-size: 0.9rem;
    transition: all 0.3s;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    text-decoration: none;
    color: inherit;
}

.nav-button:hover {
    background: #edf2f7;
    border-color: #2c5282;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(44, 82, 130, 0.2);
}

.nav-button.active {
    background: #ff6b35;
    color: white;
    border-color: #2c5282;
}

.badge {
    background: #e2e8f0;
    color: #4a5568;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 500;
}

.nav-button.active .badge {
    background: rgba(255,255,255,0.2);
    color: white;
}

/* Contenu principal */
.main-content {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    overflow: hidden;
}

.content-header {
    background: linear-gradient(90deg, #2c5282 0%, #2d3748 100%);
    color: white;
    padding: 1.5rem 2rem;
}

.content-body {
    padding: 2rem;
}

/* Footer exécution */
.page-footer {
    max-width: 1400px;
    margin: 0 auto 1rem auto;
    padding: 0.75rem 2rem;
    color: #4a5568;
    font-size: 0.85rem;
    text-align: right;
}

.time-chip {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    background: #edf2f7;
    color: #2c5282;
    border: 1px solid #e2e8f0;
    font-weight: 600;
}

/* Stats cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: linear-gradient(135deg, #f7fafc 0%, #edf2f7 100%);
    padding: 1.5rem;
    border-radius: 12px;
    border-left: 5px solid #2c5282;
    text-align: center;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.stat-card:before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #2c5282, #4299e1);
}

.stat-number {
    font-size: 2.2rem;
    font-weight: 800;
    color: #2c5282;
    margin-bottom: 0.5rem;
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.stat-label {
    color: #4a5568;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    font-weight: 500;
}

/* Tableaux */
.table-container {
    overflow-x: auto;
    margin-top: 1rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    /* Scroll personnalisé */
    scrollbar-width: thin;
    scrollbar-color: #2c5282 #f1f5f9;
}

.table-container::-webkit-scrollbar {
    height: 8px;
}

.table-container::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 4px;
}

.table-container::-webkit-scrollbar-thumb {
    background: #2c5282;
    border-radius: 4px;
}

.table-container::-webkit-scrollbar-thumb:hover {
    background: #1a365d;
}

.data-table {
    width: 100%;
    min-width: 600px; /* Largeur minimum pour éviter l'écrasement */
    border-collapse: collapse;
    margin-top: 0;
    font-size: 0.9rem;
    background: white;
    border-radius: 8px;
    overflow: hidden;
}

.data-table th {
    background: linear-gradient(135deg, #2c5282 0%, #2d3748 100%);
    color: white;
    padding: 1rem 0.8rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: none;
}

.data-table th:first-child {
    border-top-left-radius: 8px;
}

.data-table th:last-child {
    border-top-right-radius: 8px;
}

.data-table td {
    padding: 0.8rem;
    border-bottom: 1px solid #e2e8f0;
    transition: all 0.2s;
    vertical-align: middle;
}

.data-table tbody tr:hover td {
    background-color: #f7fafc;
    transform: scale(1.001);
}

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

.data-table .clickable {
    color: #2c5282;
    font-weight: 600;
    cursor: pointer;
    position: relative;
}

.data-table .clickable:hover {
    color: #1a365d;
    text-decoration: underline;
    text-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.data-table .clickable {
    color: #2c5282;
    font-weight: 600;
    cursor: pointer;
    position: relative;
    transition: all 0.2s ease;
    text-decoration: none;
}

.data-table .clickable:after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: -2px;
    left: 0;
    background-color: #2c5282;
    transition: width 0.3s ease;
}

.data-table .clickable:hover {
    color: #1a365d;
    text-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.data-table .clickable:hover:after {
    width: 100%;
}

/* Titres des sections */
.content-body h3 {
    color: #2c5282;
    font-size: 1.2rem;
    font-weight: 600;
    margin: 2rem 0 1rem 0;
    padding-bottom: 0.5rem;
    border-bottom: 3px solid #e2e8f0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.content-body h3:first-child {
    margin-top: 0;
}

/* Graphiques */
.chart-section {
    margin: 2rem 0;
}

.chart-container {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    margin-bottom: 2rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    position: relative;
    overflow: hidden;
}

.chart-container:before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #2c5282, #4299e1);
}

.chart-container h3 {
    color: #2c5282;
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: none;
    margin-top: 0;
    padding-bottom: 0;
}

.chart-container:last-child {
    max-width: 400px;
    margin: 1rem auto;
}

.chart-container:last-child canvas {
    max-height: 250px !important;
}

/* Loading */
.loading {
    text-align: center;
    padding: 3rem;
    color: #666;
    font-style: italic;
}

.loading:before {
    content: '⏳ ';
    animation: spin 2s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Scrollbar personnalisée */
.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb {
    background: #2c5282;
    border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: #1a365d;
}

/* Menu burger mobile */
.burger-menu {
    display: none;
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 1000;
    background: #ff6b35;
    color: white;
    border: none;
    border-radius: 8px;
    width: 50px;
    height: 50px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(255, 107, 53, 0.3);
    transition: all 0.3s;
}

.burger-menu:hover {
    background: #e55a2b;
    box-shadow: 0 6px 20px rgba(255, 107, 53, 0.4);
}

.burger-menu span {
    display: block;
    width: 20px;
    height: 2px;
    background: white;
    margin: 4px auto;
    transition: 0.3s;
    border-radius: 1px;
}

.burger-menu.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.burger-menu.active span:nth-child(2) {
    opacity: 0;
}

.burger-menu.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -6px);
}

.mobile-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 998;
}

.mobile-overlay.active {
    display: block;
}

/* Responsive */
@media (max-width: 900px) {
    .burger-menu {
        display: block;
    }
    
    .container {
        grid-template-columns: 1fr;
        padding: 1rem;
        gap: 1rem;
    }
    
    .sidebar {
        position: fixed;
        top: 0;
        left: -100%;
        width: 280px;
        height: 100vh;
        max-height: 100vh;
        z-index: 999;
        transition: left 0.3s ease;
        border-radius: 0;
        padding-top: 4rem;
    }
    
    .sidebar.mobile-open {
        left: 0;
    }
    
    /* Mode paysage mobile - menu plus étroit */
    .sidebar {
        width: 220px;
    }
    
    .sidebar h3 {
        font-size: 1rem;
    }
    
    .nav-button, .filter-dropdown {
        padding: 0.6rem;
        font-size: 0.85rem;
    }
    
    .clear-filters {
        padding: 0.6rem;
        font-size: 0.85rem;
    }
}

/* Mode paysage mobile spécifique */
@media (max-width: 900px) and (max-height: 500px) {
    .sidebar {
        width: 200px;
    }
}

@media (max-width: 768px) {
    
    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 1rem;
    }
    
    .data-table {
        font-size: 0.8rem;
    }
    
    .data-table th,
    .data-table td {
        padding: 0.6rem 0.4rem;
    }
    
    .stat-card {
        padding: 1rem;
    }
    
    .stat-number {
        font-size: 1.8rem;
    }
    
    .chart-container {
        padding: 1rem;
    }
    
    .header h1 {
        font-size: 1.5rem;
    }
    
    .content-header h2 {
        font-size: 1.3rem;
    }
}

@media (max-width: 480px) {
    .data-table th,
    .data-table td {
        padding: 0.5rem 0.3rem;
        font-size: 0.8rem;
    }
    
    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }
    
    .header, .breadcrumb {
        padding: 1rem;
    }
    
    .content-header, .content-body {
        padding: 1rem;
    }
}

