:root {
    --bg-light: #f4f7f9;
    --sidebar-dark: #1e293b;
    --card-bg: #ffffff;
    --accent: #4f46e5;
    --text-main: #334155;
    --text-muted: #64748b;
    --danger: #ef4444;
    --success: #10b981;
}

* { 
    box-sizing: border-box; 
    margin: 0;
    padding: 0;
}

body { 
    font-family: 'Inter', sans-serif; 
    background-color: var(--bg-light);
    color: var(--text-main);
    height: 100vh;
    overflow: hidden;
}

/* Dashboard Container */
.dashboard-container { 
    display: flex; 
    height: 100vh; 
}


#profile-radar {
     width: 100%;
    height: 450px !important; /* Force une hauteur fixe */
    min-height: 450px;
    flex: 1;

}

body {
    position: relative;
}

/* Éviter que d'autres éléments ne cachent le tooltip */
.dashboard-container,
.main-content,
.chart-card {
    position: static; /* Important pour les positions absolues */
}
#cluster-heatmap {
    width: 550px;
    height: 550px !important;
    min-height: 550px;
    margin-top: 20px;
    padding-bottom: 20px;
}



/* Sidebar */
.sidebar {
width: 200px !important;
    background: var(--sidebar-dark);
    color: white;
    display: flex;
    flex-direction: column;
    padding: 1rem !important;
    flex-shrink: 0;
    overflow-y: auto;
}

.brand { 
    display: flex; 
    align-items: center; 
    gap: 8px; 
    margin-bottom: 20px !important; 
}

.logo-icon { 
    background: var(--accent); 
    padding: 5px 8px !important; 
    border-radius: 4px; 
    font-weight: bold;
    font-size: 0.9rem !important;
}

.sidebar h2 {
    font-size: 1rem !important;
}

.menu {
    display: flex;
    flex-direction: column;
    gap: 2px !important;
    margin-bottom: 20px !important;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 10px !important;
    border-radius: 4px;
    text-decoration: none;
    color: rgba(255, 255, 255, 0.7);
    transition: all 0.3s ease;
    cursor: pointer;
    font-size: 0.8rem !important;
}

.menu-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: white;
    opacity: 1;
}

.menu-item.active {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    opacity: 1;
}

.filters-section h3 {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    margin-bottom: 15px;
    letter-spacing: 1px;
}

.filter-group {
    margin-bottom: 20px;
}

.filter-group label {
    display: block;
    font-size: 0.85rem;
    margin-bottom: 8px;
    color: rgba(255, 255, 255, 0.8);
}

.filter-group select {
    width: 100%;
    padding: 10px 12px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
}

.filter-group select option {
    background: var(--sidebar-dark);
    color: white;
}

/* Main Content Area */
.main-content {
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
    background-color: var(--bg-light);
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e2e8f0;
}

.header h1 {
    font-size: 1.8rem;
    font-weight: 400;
    color: var(--text-main);
}

.user-info {
    font-size: 0.9rem;
    color: var(--text-muted);
    background: #e2e8f0;
    padding: 6px 12px;
    border-radius: 6px;
}

/* KPI Cards */
.kpi-row.compact {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px !important;
    margin-bottom: 1rem !important;
}
.kpi-row {
    display: flex;
    justify-content:衔接;
    gap: 15px;
    margin-bottom: 20px;
    width: 100%;
}

.kpi-card {
    flex: 1; 
    background: white;
    padding: 1rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    border-left: 4px solid var(--accent); /* petite barre de couleur à gauche */
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0; /* Évite que le contenu ne fasse déborder la carte */
}

.kpi-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 5px;
}

.kpi-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--sidebar-dark);
}

.kpi-subtext {
    font-size: 0.7rem;
    color: #94a3b8;
    margin-top: 4px;
}
/* Charts Grid for Overview Page */
.charts-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 20px;
}

.chart-card {
     background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
    position: relative; /* Ajoutez cette ligne */
    overflow: hidden; /* Empêche le débordement */
}

.card-header {
    font-weight: 600;
    font-size: 1.1rem;
    margin-bottom: 20px;
    border-bottom: 1px solid #f1f5f9;
    padding-bottom: 10px;
    color: #1e293b;
}
#cluster-map {
    height: 500px !important;
    min-height: 450px;
}
.chart-container {
  width: 100%;
    height: 400px !important; /* Hauteur fixe */
    min-height: 400px;
    flex: 1;
    position: relative;
}

/* Charts in Chart Container */
.chart-container svg {
    width: 100%;
    height: 100%;
}

/* Profiles Page Specific Styles */
.profiles-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
    min-height: 600px;
}

.profiles-grid .chart-card {
    min-height: 600px;
    height: auto;
    display: flex;
    flex-direction: column;
}

/* Card Header with Controls */
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    border-bottom: 1px solid #f1f5f9;
    padding-bottom: 10px;
}

.card-header h3 {
    margin: 0;
    font-size: 1rem;
    color: #1e293b;
    font-weight: 600;
}

.chart-controls select {
    padding: 6px 10px;
    border-radius: 6px;
    border: 1px solid #cbd5e1;
    background-color: #f8fafc;
    font-size: 0.85rem;
    font-family: 'Inter', sans-serif;
}

/* Export Buttons */
.chart-footer {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 15px;
    border-top: 1px solid #f1f5f9;
    padding-top: 15px;
}

.export-btn {
    background-color: #6366f1;
    color: white;
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    transition: background-color 0.2s ease;
}

.export-btn:hover {
    background-color: #4f46e5;
}

/* Cluster Details */
#cluster-details {
    padding: 20px;
    font-size: 0.9rem;
    color: #334155;
    min-height: 200px;
}

#cluster-details h4 {
    margin-bottom: 15px;
    color: #1e293b;
}

#cluster-details ul {
    list-style: none;
    padding: 0;
    margin-top: 15px;
}

#cluster-details li {
    margin-bottom: 8px;
    padding-left: 20px;
    position: relative;
}

#cluster-details li:before {
    content: "•";
    position: absolute;
    left: 0;
    color: #6366f1;
}

#cluster-details strong {
    color: #1e293b;
}

/* Responsive Design */
@media (max-width: 1400px) {
    .sidebar {
        width: 180px !important;
        padding: 0.75rem !important;
    }
    
    .main-content {
        padding: 0.75rem !important;
    }
    
    .kpi-row.compact {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .charts-grid.triple {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    
    .charts-grid.triple .chart-card.compact:last-child {
        grid-column: 1 / -1;
    }
    
    .chart-container.small {
        height: 180px !important;
        min-height: 160px !important;
    }
    
    .insights-container.compact {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

@media (max-width: 1200px) {
    .charts-grid.triple,
    .charts-grid.double {
        grid-template-columns: 1fr !important;
    }
    
    .kpi-row.compact {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .chart-container.small {
        height: 160px !important;
        min-height: 140px !important;
    }
    
    .insights-container.compact {
        grid-template-columns: 1fr !important;
    }
}

@media (max-width: 992px) {
    .dashboard-container {
        flex-direction: column;
        height: auto;
    }
    
    .sidebar {
        width: 100% !important;
        padding: 0.75rem !important;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 15px;
        max-height: 250px;
    }
    
    .brand {
        flex: 0 0 auto;
    }
    
    .menu {
        flex: 0 0 auto;
        flex-direction: row;
        margin-bottom: 0;
    }
    
    .filters-section {
        flex: 1;
        min-width: 250px;
    }
    
    .sidebar-stats {
        flex: 0 0 100%;
        display: flex;
        gap: 20px;
        justify-content: center;
    }
    
    .main-content {
        padding: 0.75rem !important;
    }
    
    .chart-container.small {
        height: 140px !important;
        min-height: 120px !important;
    }
}

@media (max-width: 768px) {
    .kpi-row.compact {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    
    .kpi-card {
        padding: 0.5rem !important;
    }
    
    .kpi-value {
        font-size: 1rem !important;
    }
    
    .chart-container.small {
        height: 120px !important;
        min-height: 100px !important;
    }
    
    .chart-card.compact {
        padding: 0.5rem !important;
        min-height: 200px !important;
        max-height: 220px !important;
    }
    
    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
    
    .chart-controls {
        width: 100%;
        justify-content: flex-start;
    }
    
    /* Simplifier les tableaux sur mobile */
    #city-table th:nth-child(4),
    #city-table td:nth-child(4),
    #city-table th:nth-child(5),
    #city-table td:nth-child(5) {
        display: none;
    }
    
    #city-table th:nth-child(1),
    #city-table td:nth-child(1) { width: 40% !important; }
    #city-table th:nth-child(2),
    #city-table td:nth-child(2) { width: 30% !important; }
    #city-table th:nth-child(3),
    #city-table td:nth-child(3) { width: 30% !important; }
    
    .export-options.compact {
        flex-direction: column;
    }
    
    .action-btn.small {
        width: 100%;
        min-width: auto;
    }
    
    /* Cacher les légendes sur mobile */
    .compact-legend {
        font-size: 0.5rem !important;
    }
}

