/* Dashboard FFB - Analyse des licenciés */

/* 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;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.header p {
    font-size: 1rem;
    opacity: 0.9;
}

/* 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: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
    height: fit-content;
    position: sticky;
    top: 2rem;
    max-height: calc(100vh - 4rem);
    overflow-y: auto;
}

.sidebar h3 {
    color: #2c5282;
    margin-bottom: 1.5rem;
    font-size: 1.2rem;
    border-bottom: 3px solid #e2e8f0;
    padding-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

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

.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.8rem 1rem;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    background: white;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    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 1rem 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);
}

.analyze-btn {
    width: 100%;
    padding: 1rem;
    background: linear-gradient(135deg, #2c5282 0%, #3182ce 100%);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.3s ease;
    margin-top: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.analyze-btn:hover {
    background: linear-gradient(135deg, #1a365d 0%, #2c5282 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(44, 82, 130, 0.3);
}

.analyze-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Contenu principal */
.main-content {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
    overflow: hidden;
}

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

.content-header h2 {
    font-size: 1.4rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.content-body {
    padding: 2rem;
}

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

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

.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-icon {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.stat-card.non-inscrits .stat-icon { color: #e53e3e; }
.stat-card.non-competiteurs .stat-icon { color: #dd6b20; }
.stat-card.competiteurs .stat-icon { color: #38a169; }

.stat-number {
    font-size: 2.5rem;
    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: 600;
    margin-bottom: 0.3rem;
}

.stat-percent {
    font-size: 0.8rem;
    color: #718096;
    font-weight: 500;
}

/* Graphiques */
.charts-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

.chart-container {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    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;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Tableaux triables */
.data-table th[data-sort] {
    cursor: pointer;
    user-select: none;
    position: relative;
    transition: background-color 0.2s ease;
}

.data-table th[data-sort]:hover {
    background: linear-gradient(135deg, #1a365d 0%, #1a202c 100%);
}

.data-table th[data-sort]:after {
    content: '';
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-bottom: 4px solid rgba(255, 255, 255, 0.5);
    opacity: 0.5;
}

.data-table th[data-sort].sortable-asc:after {
    border-bottom: none;
    border-top: 4px solid white;
    opacity: 1;
}

.data-table th[data-sort].sortable-desc:after {
    border-bottom: 4px solid white;
    opacity: 1;
}

.data-table th[data-sort].sortable-desc {
    background: linear-gradient(135deg, #1a365d 0%, #1a202c 100%);
}

.data-table th[data-sort].sortable-asc {
    background: linear-gradient(135deg, #1a365d 0%, #1a202c 100%);
}

/* Liens cliquables dans les tableaux */
.clickable-number {
    color: #2c5282;
    text-decoration: none;
    font-weight: 600;
    padding: 0.3rem 0.5rem;
    border-radius: 4px;
    transition: all 0.2s ease;
    display: inline-block;
}

.clickable-number:hover {
    background: #e2e8f0;
    color: #1a365d;
    text-decoration: none;
    transform: scale(1.05);
}

.table-section h3 {
    color: #2c5282;
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 3px solid #e2e8f0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.table-container {
    overflow-x: auto;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
    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: 800px;
    border-collapse: collapse;
    font-size: 0.9rem;
    background: white;
}

.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.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: none;
}

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

.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;
}

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

.data-table .text-center { text-align: center; }
.data-table .font-semibold { font-weight: 600; }

/* Loading */
.loading {
    text-align: center;
    padding: 4rem 2rem;
    color: #666;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 3px solid #e2e8f0;
    border-top: 3px solid #2c5282;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-text {
    font-size: 1.1rem;
    font-weight: 500;
    color: #4a5568;
}

/* États vides */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: #718096;
}

.empty-state-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state-text {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.detail-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    display: block; /* Pas de grille pour les détails */
}

.empty-state-subtext {
    font-size: 0.9rem;
    opacity: 0.8;
}

/* Responsive */
@media (max-width: 1200px) {
    .charts-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 900px) {
    .container {
        grid-template-columns: 1fr;
        padding: 1rem;
        gap: 1rem;
    }
    
    .sidebar {
        position: relative;
        max-height: none;
    }
    
    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
        gap: 1rem;
    }
    
    .data-table {
        font-size: 0.8rem;
        min-width: 700px;
    }
    
    .data-table th,
    .data-table td {
        padding: 0.6rem 0.4rem;
    }
}

@media (max-width: 768px) {
    .header {
        padding: 1rem;
    }
    
    .header h1 {
        font-size: 1.5rem;
    }
    
    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }
    
    .stat-card {
        padding: 1.5rem 1rem;
    }
    
    .stat-number {
        font-size: 2rem;
    }
    
    .stat-icon {
        font-size: 2rem;
    }
    
    .content-header,
    .content-body {
        padding: 1.5rem;
    }
    
    .chart-container {
        padding: 1rem;
    }
}

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

