/* Styles pour le tableau de bord analytique */
.analytics-section {
    padding: 100px 0;
    background-color: var(--light-gray);
}

.analytics-header {
    text-align: center;
    margin-bottom: 50px;
}

.analytics-header h2 {
    font-size: 2.5rem;
    color: var(--dark-color);
    margin-bottom: 15px;
}

.analytics-header p {
    color: var(--gray-color);
    max-width: 700px;
    margin: 0 auto;
    line-height: 1.6;
}

.analytics-container {
    display: grid;
    grid-template-columns: 1.6fr 1fr;
    gap: 40px;
    max-width: 1300px;
    margin: 0 auto;
    padding: 0 20px;
}

.analytics-chart {
    background-color: white;
    border-radius: 10px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.05);
    padding: 35px;
    height: 480px;
    margin-right: -20px; /* Décaler légèrement vers la droite */
}

.chart-header {
    text-align: center;
    margin-bottom: 15px;
}

.chart-title {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--dark-color);
    margin: 0;
}

.chart-filters {
    margin-bottom: 20px;
}

.chart-legend {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    font-size: 0.9rem;
    color: var(--gray-color);
    background: none;
    border: none;
    padding: 5px 10px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.legend-item:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.legend-item.inactive {
    opacity: 0.5;
}

.chart-tooltip {
    position: absolute;
    background-color: rgba(47, 49, 54, 0.95);
    color: white;
    padding: 0;
    border-radius: 6px;
    font-size: 0.9rem;
    pointer-events: none;
    z-index: 9999;
    display: none;
    min-width: 140px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.2);
    overflow: hidden;
    opacity: 0;
    transform: translateY(5px);
    transition: opacity 0.2s ease, transform 0.2s ease;
    text-align: center;
}

.tooltip-visible {
    opacity: 1 !important;
    transform: translateY(0) !important;
}

.tooltip-header {
    background-color: #5865F2;
    color: white;
    padding: 8px 12px;
    font-weight: 600;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.tooltip-content {
    padding: 10px 15px;
    line-height: 1.4;
}

.tooltip-type {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 5px;
}

.tooltip-value {
    font-size: 1.2rem;
    font-weight: 700;
    color: white;
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 5px;
}

.legend-messages {
    background-color: #5865F2;
}

.legend-reactions {
    background-color: #EB459E;
}

.legend-replies {
    background-color: #57F287;
}

.chart-container {
    height: 330px;
    position: relative;
    margin-top: 10px;
}

.chart-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.metrics-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 20px;
    height: 480px; /* Aligné avec la hauteur du graphique */
}

.metric-card {
    background-color: white;
    border-radius: 10px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.05);
    padding: 30px;
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 180px; /* Hauteur minimale fixe pour tous les encarts */
    width: 100%; /* S'assurer que tous les encarts ont la même largeur */
    box-sizing: border-box; /* Inclure padding et border dans la largeur/hauteur */
}

/* Style spécifique pour la carte du temps moyen d'activité */
.metric-card:last-child .metric-value {
    font-size: 2.2rem; /* Légèrement plus petit pour éviter les problèmes de mise en page */
}

.metric-title {
    font-size: 1rem;
    color: var(--gray-color);
    margin-bottom: 15px;
    height: 40px; /* Hauteur fixe pour tous les titres */
    display: flex;
    align-items: center;
    justify-content: center;
}

.metric-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 10px;
    min-height: 60px; /* Hauteur minimale fixe pour toutes les valeurs */
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    white-space: nowrap; /* Empêche le texte de passer à la ligne */
    width: 100%; /* Assure que la largeur est complète */
}

.metric-change {
    display: inline-flex;
    align-items: center;
    font-size: 0.9rem;
    padding: 5px 10px;
    border-radius: 20px;
}

.metric-change.positive {
    color: #57F287;
    background-color: rgba(87, 242, 135, 0.1);
}

.metric-change i {
    margin-right: 5px;
}

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

@media (max-width: 768px) {
    .metrics-grid {
        grid-template-columns: 1fr;
    }
}
