/* ========================================
   DATA VISUALIZATION & ANIMATED CHARTS
   ======================================== */

/* Stats Cards with Animation */
.stats-showcase {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin: 40px 0;
    padding: 20px;
}

.stat-card {
    background: linear-gradient(135deg, #0055cc 0%, #408cf7 100%);
    border-radius: 16px;
    padding: 30px;
    color: white;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.stat-card:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.2);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    animation: pulse 3s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 0.5; }
    50% { transform: scale(1.1); opacity: 0.8; }
}

.stat-number {
    font-size: 3rem;
    font-weight: 700;
    margin: 10px 0;
    background: linear-gradient(45deg, #fff, #f0f0f0);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: countUp 2s ease-out;
}

@keyframes countUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.stat-label {
    font-size: 0.9rem;
    opacity: 0.9;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 500;
}

.stat-icon {
    font-size: 2rem;
    margin-bottom: 10px;
    opacity: 0.8;
}

/* Animated Progress Bars */
.progress-chart {
    margin: 30px 0;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 12px;
}

.progress-item {
    margin-bottom: 20px;
}

.progress-label {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
}

.progress-bar-container {
    height: 12px;
    background: #e0e0e0;
    border-radius: 10px;
    overflow: hidden;
    position: relative;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #0055cc 0%, #4892ec 100%);
    border-radius: 10px;
    width: 0;
    transition: width 2s cubic-bezier(0.65, 0, 0.35, 1);
    position: relative;
    overflow: hidden;
}

.progress-bar-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

.progress-bar-fill.animate {
    width: var(--progress-width);
}

/* Animated Pie Chart */
.pie-chart-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 40px;
    margin: 40px 0;
    flex-wrap: wrap;
}

.pie-chart {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: conic-gradient(
        #0055cc 0deg var(--angle1),
        #4892ec var(--angle1) var(--angle2),
        #408cf7 var(--angle2) 360deg
    );
    position: relative;
    animation: rotateIn 1.5s ease-out;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

@keyframes rotateIn {
    from { transform: rotate(-180deg) scale(0); opacity: 0; }
    to { transform: rotate(0deg) scale(1); opacity: 1; }
}

.pie-chart::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 120px;
    height: 120px;
    background: white;
    border-radius: 50%;
}

.pie-legend {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.95rem;
    animation: fadeInRight 0.6s ease-out backwards;
}

.legend-item:nth-child(1) { animation-delay: 0.2s; }
.legend-item:nth-child(2) { animation-delay: 0.4s; }
.legend-item:nth-child(3) { animation-delay: 0.6s; }

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

.legend-color {
    width: 20px;
    height: 20px;
    border-radius: 4px;
}

.legend-label {
    font-weight: 600;
    color: #333;
}

.legend-value {
    margin-left: auto;
    font-weight: 700;
    color: #0055cc;
}

/* Comparison Chart */
.comparison-chart {
    display: flex;
    gap: 20px;
    margin: 40px 0;
    padding: 30px;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    border-radius: 16px;
    flex-wrap: wrap;
    justify-content: space-around;
}

.comparison-bar {
    flex: 1;
    min-width: 150px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.bar-container {
    width: 60px;
    height: 250px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 10px;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: flex-end;
}

.bar-fill {
    width: 100%;
    height: 0;
    background: linear-gradient(180deg, #0055cc 0%, #4892ec 100%);
    border-radius: 10px 10px 0 0;
    transition: height 1.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    position: relative;
}

.bar-fill.animate {
    height: var(--bar-height);
}

.bar-value {
    position: absolute;
    top: -30px;
    left: 50%;
    transform: translateX(-50%);
    font-weight: 700;
    font-size: 1.2rem;
    color: #333;
    white-space: nowrap;
}

.bar-label {
    text-align: center;
    font-weight: 600;
    color: #333;
    font-size: 0.9rem;
}

/* Growth Arrow Indicator */
.growth-indicator {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    border-radius: 20px;
    font-weight: 700;
    font-size: 0.9rem;
    animation: bounce 2s ease-in-out infinite;
}

.growth-indicator.positive {
    background: linear-gradient(135deg, #0055cc 0%, #408cf7 100%);
    color: white;
}

.growth-indicator.negative {
    background: linear-gradient(135deg, #666666 0%, #999999 100%);
    color: white;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

.growth-arrow {
    font-size: 1.2rem;
}

/* Animated Counter */
.animated-counter {
    font-size: 3.5rem;
    font-weight: 800;
    color: #0055cc;
    text-align: center;
    margin: 20px 0;
    font-family: 'DM Sans', sans-serif;
}

/* Timeline Chart */
.timeline-chart {
    position: relative;
    padding: 40px 20px;
    margin: 40px 0;
}

.timeline-line {
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 4px;
    background: linear-gradient(180deg, #0055cc 0%, #4892ec 100%);
    transform: translateX(-50%);
}

.timeline-item {
    display: flex;
    align-items: center;
    margin-bottom: 40px;
    position: relative;
    opacity: 0;
    animation: slideIn 0.6s ease-out forwards;
}

.timeline-item:nth-child(odd) {
    flex-direction: row;
    animation-delay: 0.2s;
}

.timeline-item:nth-child(even) {
    flex-direction: row-reverse;
    animation-delay: 0.4s;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

.timeline-content {
    flex: 1;
    padding: 20px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
    max-width: 45%;
}

.timeline-dot {
    width: 20px;
    height: 20px;
    background: #0055cc;
    border-radius: 50%;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2;
    box-shadow: 0 0 0 5px white, 0 0 0 8px #0055cc;
    animation: dotPulse 2s ease-in-out infinite;
}

@keyframes dotPulse {
    0%, 100% { box-shadow: 0 0 0 5px white, 0 0 0 8px #0055cc; }
    50% { box-shadow: 0 0 0 5px white, 0 0 0 12px rgba(0, 85, 204, 0.3); }
}

/* Responsive Design */
@media (max-width: 768px) {
    .stats-showcase {
        grid-template-columns: 1fr;
    }

    .pie-chart-container {
        flex-direction: column;
    }

    .comparison-chart {
        flex-direction: column;
    }

    .bar-container {
        width: 100%;
        height: 60px;
    }

    .bar-fill {
        width: 0;
        height: 100%;
        border-radius: 0 10px 10px 0;
    }

    .bar-fill.animate {
        width: var(--bar-height);
        height: 100%;
    }

    .timeline-item:nth-child(odd),
    .timeline-item:nth-child(even) {
        flex-direction: column;
    }

    .timeline-content {
        max-width: 100%;
    }

    .timeline-line {
        left: 20px;
    }

    .timeline-dot {
        left: 20px;
    }
}

/* Loading Animation */
.data-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 60px;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid #0055cc;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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