/* =========== POPULATION STATS MODERN =========== */
.population-stats-modern {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    padding: 60px 0;
    position: relative;
    overflow: hidden;
}

/* Background Pattern */
.population-stats-modern::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        radial-gradient(circle at 20% 80%, rgba(238, 164, 3, 0.03) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(87, 204, 153, 0.03) 0%, transparent 50%);
    pointer-events: none;
}

/* Header Stats */
.stats-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
    flex-wrap: wrap;
    gap: 20px;
}

.stats-header-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.stats-icon {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.8rem;
    box-shadow: 0 10px 20px rgba(8, 36, 48, 0.2);
    transform: rotate(-5deg);
    transition: var(--transition);
}

.stats-icon:hover {
    transform: rotate(0deg) scale(1.1);
}

.text-gradient {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stats-date {
    color: var(--gray);
    font-size: 0.95rem;
    margin-top: 5px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.stats-total {
    background: white;
    padding: 15px 30px;
    border-radius: 50px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    align-items: center;
    border: 1px solid rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(10px);
}

.total-badge {
    font-size: 0.8rem;
    color: var(--gray);
    text-transform: uppercase;
    letter-spacing: 2px;
}

.total-number {
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--primary);
    line-height: 1;
}

/* Modern Chart Card */
.modern-chart-card {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 24px;
    padding: 30px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.05);
    margin-bottom: 30px;
}

/* Chart Legend */
.chart-legend {
    display: flex;
    justify-content: center;
    gap: 30px;
    flex-wrap: wrap;
    margin-bottom: 40px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 4px;
    transform: rotate(45deg);
}

.legend-label {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--dark);
}

/* 3D Chart Container */
.chart-3d-container {
    position: relative;
    min-height: 300px;
    margin-bottom: 40px;
    padding: 20px 0;
}

/* Grid Lines */
.chart-grid {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    pointer-events: none;
}

.grid-line {
    width: 100%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(0,0,0,0.05), transparent);
}

/* Bars Container */
.bars-container {
    display: flex;
    justify-content: space-around;
    align-items: flex-end;
    height: 250px;
    position: relative;
    z-index: 2;
}

/* 3D Bar Item */
.bar-3d-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    width: 100%;
    max-width: 100px;
}

.bar-3d-wrapper {
    position: relative;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* 3D Bar Effect */
.bar-3d {
    width: 50px;
    border-radius: 12px 12px 4px 4px;
    position: relative;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 
        0 4px 0 rgba(0,0,0,0.1),
        0 8px 12px rgba(0,0,0,0.1);
    transform-origin: bottom;
    animation: floatIn 0.8s ease-out;
}

.bar-3d:hover {
    transform: scaleY(1.05) scaleX(1.02);
    box-shadow: 
        0 6px 0 rgba(0,0,0,0.1),
        0 12px 20px rgba(0,0,0,0.15);
}

/* Bar Gradients */
.bar-total {
    background: linear-gradient(135deg, #082430, #1a5f7a);
}
.bar-dewasa {
    background: linear-gradient(135deg, #57cc99, #38a169);
}
.bar-lansia {
    background: linear-gradient(135deg, #eea403, #fbbf24);
}
.bar-anak {
    background: linear-gradient(135deg, #6c757d, #495057);
}
.bar-bayi {
    background: linear-gradient(135deg, #ff6b6b, #dc2626);
}

/* Bar Glow Effect */
.bar-glow {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at 50% 0%, rgba(255,255,255,0.3), transparent);
    border-radius: inherit;
    pointer-events: none;
}

/* Bar Reflection */
.bar-reflection {
    position: absolute;
    top: 0;
    left: 10%;
    width: 30%;
    height: 30%;
    background: linear-gradient(135deg, rgba(255,255,255,0.4), transparent);
    border-radius: 50%;
    filter: blur(5px);
    pointer-events: none;
}

/* Bar Value */
.bar-value-3d {
    position: absolute;
    top: -30px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--dark);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
    opacity: 0;
    transition: all 0.3s ease;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

.bar-3d:hover .bar-value-3d {
    opacity: 1;
    top: -40px;
}

/* Bar Base */
.bar-base {
    width: 70px;
    height: 8px;
    background: linear-gradient(135deg, #e2e8f0, #cbd5e0);
    border-radius: 4px;
    margin-top: 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

/* Bar Label */
.bar-label-3d {
    margin-top: 15px;
    text-align: center;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--dark);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.bar-label-3d i {
    font-size: 1.1rem;
    color: var(--primary);
    background: white;
    padding: 8px;
    border-radius: 50%;
    box-shadow: 0 4px 8px rgba(0,0,0,0.05);
}

/* Modern Stat Cards */
.stats-cards-modern {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 30px;
}

.stat-card-modern {
    background: white;
    border-radius: 20px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: 0 10px 20px rgba(0,0,0,0.03);
    transition: all 0.3s ease;
    border: 1px solid rgba(0,0,0,0.03);
    position: relative;
    overflow: hidden;
}

.stat-card-modern::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--primary);
}

.stat-card-modern.total::before { background: var(--primary); }
.stat-card-modern.dewasa::before { background: var(--secondary); }
.stat-card-modern.lansia::before { background: var(--kuning-desa); }
.stat-card-modern.anak::before { background: var(--gray); }
.stat-card-modern.bayi::before { background: #ff6b6b; }

.stat-card-modern:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 30px rgba(0,0,0,0.05);
}

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    color: white;
}

.stat-card-modern.total .stat-icon { background: linear-gradient(135deg, #082430, #1a5f7a); }
.stat-card-modern.dewasa .stat-icon { background: linear-gradient(135deg, #57cc99, #38a169); }
.stat-card-modern.lansia .stat-icon { background: linear-gradient(135deg, #eea403, #fbbf24); }
.stat-card-modern.anak .stat-icon { background: linear-gradient(135deg, #6c757d, #495057); }
.stat-card-modern.bayi .stat-icon { background: linear-gradient(135deg, #ff6b6b, #dc2626); }

.stat-info {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--dark);
    line-height: 1;
}

.stat-label-modern {
    font-size: 0.8rem;
    color: var(--gray);
    margin-top: 5px;
}

.stat-trend {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.8rem;
    padding: 4px 8px;
    border-radius: 20px;
    background: rgba(0,0,0,0.03);
}

.stat-trend i {
    font-size: 0.7rem;
}

.stat-trend .fa-arrow-up { color: #10b981; }
.stat-trend .fa-arrow-down { color: #ef4444; }

/* Animations */
@keyframes floatIn {
    from {
        transform: scaleY(0) scaleX(0.8);
        opacity: 0;
    }
    to {
        transform: scaleY(1) scaleX(1);
        opacity: 1;
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive */
@media (max-width: 992px) {
    .bars-container {
        height: 200px;
    }
    
    .bar-3d {
        width: 40px;
    }
    
    .bar-base {
        width: 60px;
    }
}

@media (max-width: 768px) {
    .stats-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .bars-container {
        flex-wrap: wrap;
        height: auto;
        gap: 30px;
    }
    
    .bar-3d-item {
        max-width: 80px;
    }
    
    .chart-legend {
        gap: 15px;
    }
    
    .legend-item {
        flex: 0 0 calc(50% - 15px);
    }
}

@media (max-width: 576px) {
    .bars-container {
        flex-direction: column;
        align-items: center;
    }
    
    .bar-3d-item {
        max-width: 100%;
        width: 100%;
        flex-direction: row;
        gap: 20px;
    }
    
    .bar-3d-wrapper {
        width: 60%;
    }
    
    .bar-3d {
        width: 100%;
        height: 40px !important;
        border-radius: 8px;
    }
    
    .bar-base {
        display: none;
    }
    
    .bar-label-3d {
        flex-direction: row;
        margin-top: 0;
        width: 30%;
    }
    
    .bar-value-3d {
        position: relative;
        top: 0;
        left: 0;
        transform: none;
        opacity: 1;
        background: transparent;
        color: white;
        box-shadow: none;
        padding: 0 15px;
    }
    
    .bar-3d:hover .bar-value-3d {
        top: 0;
    }
}