/* statistics.css */

/* Contenedor principal de estadísticas */
.stats, 
.stats-detail {
    width: 100%;
    max-width: 100%;
    margin: 15px 0;
    padding: 15px;
    box-sizing: border-box;
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    opacity: 0;
    transform: translateY(50px);
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    visibility: hidden;
}

/* Animaciones para mostrar/ocultar */
.stats.show,
.stats-detail.show {
    opacity: 1;
    transform: translateY(0);
    visibility: visible;
}

.fade-out {
    animation: fadeOut 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* Contenedor de pirámides */
.social-pyramid-container {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.pyramid-title {
    text-align: center;
    color: #2c3e50;
    margin-bottom: 1.5rem;
    font-size: 1.4rem;
}

.pyramids-wrapper {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
}

/* Secciones de pirámide */
.pyramid-section {
    display: flex;
    flex-direction: column;
}

.pyramid-section h3 {
    text-align: center;
    color: #2c3e50;
    margin-bottom: 1.5rem;
    font-size: 1.2rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.pyramid {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-width: 400px;
    margin: 0 auto;
}

/* Niveles de pirámide */
.pyramid-level {
    position: relative;
    border-radius: 8px;
    padding: 1rem;
    transition: all 0.3s ease-out;
    margin: 0 auto;
    width: 100%;
    min-height: 3.5rem;
    display: flex;
    align-items: center;
    animation: levelEntrance 0.5s ease-out forwards;
    opacity: 0;
}

.pyramid-level:hover {
    transform: translateX(10px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

/* Estilos específicos por nivel */
.rich-level {
    width: 30%;
    background: linear-gradient(90deg, rgba(39, 174, 96, 0.1), rgba(39, 174, 96, 0.2));
    border-left: 4px solid #27ae60;
    animation-delay: 0.1s;
}

.middle-level {
    width: 60%;
    background: linear-gradient(90deg, rgba(52, 152, 219, 0.1), rgba(52, 152, 219, 0.2));
    border-left: 4px solid #3498db;
    animation-delay: 0.2s;
}

.poor-level {
    width: 90%;
    background: linear-gradient(90deg, rgba(231, 76, 60, 0.1), rgba(231, 76, 60, 0.2));
    border-left: 4px solid #e74c3c;
    animation-delay: 0.3s;
}

/* Pirámide invertida */
.wealth-pyramid.inverted .rich-level { 
    width: 90%;
}

.wealth-pyramid.inverted .middle-level { 
    width: 60%;
}

.wealth-pyramid.inverted .poor-level { 
    width: 30%;
}

/* Contenido de los niveles */
.level-content {
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 1;
    width: 100%;
    font-size: 1.1rem;
}

.level-percentage {
    font-weight: 700;
    color: #2c3e50;
    margin-right: 1rem;
}

.level-count {
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Botón de informe */
.report-button-container {
    display: flex;
    justify-content: center;
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(0,0,0,0.1);
}

.view-report-btn {
    background: linear-gradient(135deg, #1a237e 0%, #121858 100%);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 500;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(26,35,126,0.2);
}

.view-report-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(26,35,126,0.3);
    background: linear-gradient(135deg, #121858 0%, #0a1040 100%);
}

.btn-icon {
    font-size: 1.2rem;
}

/* Animaciones */
@keyframes fadeOut {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(-20px);
    }
}

@keyframes levelEntrance {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Media Queries */
@media (max-width: 768px) {
    .pyramids-wrapper {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .pyramid-level {
        padding: 0.5rem;
        min-height: 2.5rem;
    }

    .report-button-container {
        margin-top: 1.5rem;
    }
    
    .view-report-btn {
        width: 100%;
        justify-content: center;
        padding: 1rem;
    }

    .level-content {
        font-size: 0.9rem;
    }
}