/* Statistik Visual CSS */
:root {
    --chart-primary: #8a3ab9;
    --chart-secondary: #e95950;
    --chart-tertiary: #fccc63;
    --chart-background: rgba(255, 255, 255, 0.8);
    --chart-border: rgba(138, 58, 185, 0.2);
    --chart-shadow: rgba(94, 53, 177, 0.1);
    --donut-purple: #8a3ab9;
    --donut-orange: #e95950;
}

.stats-container {
    margin: 30px 0;
    padding: 20px;
    background-color: var(--chart-background);
    border-radius: var(--border-radius-sm);
    border: 1px solid var(--chart-border);
    box-shadow: 0 4px 15px var(--chart-shadow);
}

.stats-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.stats-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-color-dark);
}

.chart-types {
    display: flex;
    gap: 8px;
}

.chart-type-btn {
    background: none;
    border: 1px solid var(--chart-border);
    border-radius: 20px;
    padding: 5px 12px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: var(--text-color);
}

.chart-type-btn:hover {
    background-color: rgba(138, 58, 185, 0.1);
}

.chart-type-btn.active {
    background: linear-gradient(45deg, #8a3ab9, #bc2a8d);
    color: white;
    border-color: transparent;
    box-shadow: 0 2px 8px rgba(138, 58, 185, 0.3);
}

.chart-container {
    position: relative;
    height: 250px;
    width: 100%;
    margin-bottom: 15px;
}

/* Donut Chart Styles */
.donut-chart {
    position: relative;
    width: 200px;
    height: 200px;
    margin: 0 auto;
    border-radius: 50%;
    overflow: hidden;
}

.donut-chart-svg {
    transform: rotate(-90deg);
    width: 100%;
    height: 100%;
}

.donut-segment {
    transition: all 0.3s ease;
    animation: rotateDonut 2s ease-in-out forwards;
    transform-origin: center;
}

.donut-segment.purple {
    stroke: var(--donut-purple);
}

.donut-segment.orange {
    stroke: var(--donut-orange);
}

.unfollower-segment {
    stroke-dasharray: 0 999;
    animation: drawArc 1.5s ease-in-out forwards;
}

.follower-segment {
    stroke-dasharray: 0 999;
    animation: drawArc 1.5s ease-in-out 1.5s forwards;
    opacity: 0;
}

.donut-segment:hover {
    opacity: 0.8;
    transform: scale(1.02);
}

.donut-chart-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    background: var(--chart-background);
    border-radius: 50%;
    width: 70%;
    height: 70%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    box-shadow: 0 0 10px rgba(0,0,0,0.05) inset;
}

.donut-chart-count {
    font-size: 28px;
    font-weight: 700;
    color: var(--primary-color);
}

.donut-chart-label {
    font-size: 14px;
    color: var(--text-color-light);
}

/* Bar Chart Styles */
.bar-chart {
    display: flex;
    align-items: flex-end;
    height: 200px;
    padding: 0 20px;
    gap: 15px;
    justify-content: center;
}

.bar {
    flex: 0 0 auto;
    background: linear-gradient(to top, #8a3ab9, #bc2a8d);
    border-radius: 8px 8px 0 0;
    transition: all 0.5s ease;
    min-width: 40px;
    max-width: 60px;
    position: relative;
    margin: 0 auto;
    animation: growBar 0.8s ease;
}

.bar:hover {
    transform: scaleY(1.05);
    box-shadow: 0 0 10px rgba(138, 58, 185, 0.4);
}

.bar-label {
    position: absolute;
    top: -25px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 12px;
    font-weight: 500;
    color: var(--text-color);
    min-width: 100px;
    text-align: center;
}

.bar-value {
    position: absolute;
    bottom: -25px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 12px;
    color: var(--text-color-light);
}

/* Line Chart Styles */
.line-chart {
    position: relative;
    height: 200px;
    padding: 20px 20px 30px 20px;
}

.chart-line {
    fill: none;
    stroke: var(--chart-primary);
    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.chart-area {
    fill: url(#area-gradient);
    opacity: 0.2;
}

.chart-point {
    fill: white;
    stroke: var(--chart-primary);
    stroke-width: 2;
    r: 4;
    transition: all 0.3s ease;
}

.chart-point:hover {
    r: 6;
    stroke-width: 3;
    cursor: pointer;
}

.chart-x-axis, .chart-y-axis {
    stroke: var(--chart-border);
    stroke-width: 1;
}

.chart-x-label, .chart-y-label {
    font-size: 10px;
    fill: var(--text-color-light);
}

/* Legends */
.chart-legend {
    display: flex;
    justify-content: center;
    gap: 20px;
    font-size: 14px;
    margin-top: 20px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

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

.legend-followers {
    background: linear-gradient(45deg, #8a3ab9, #bc2a8d);
}

.legend-unfollowers {
    background: linear-gradient(45deg, #e95950, #fccc63);
}

/* Responsive Styles */
@media (max-width: 640px) {
    .stats-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .chart-container {
        height: 200px;
    }
    
    .donut-chart {
        width: 160px;
        height: 160px;
    }
    
    .donut-chart-count {
        font-size: 24px;
    }
    
    .donut-chart-label {
        font-size: 12px;
    }
    
    .bar {
        min-width: 20px;
    }
}

/* Animation for Charts */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes rotateDonut {
    0% { 
        stroke-dasharray: 0 100;
        opacity: 0.7;
    }
    50% {
        opacity: 0.85;
    }
    100% { 
        stroke-dasharray: var(--dash-value, 70) 100;
        opacity: 1;
    }
}

@keyframes drawArc {
    0% {
        stroke-dasharray: 0 999;
        opacity: 0.7;
    }
    100% {
        stroke-dasharray: var(--arc-length, 100) 999;
        opacity: 1;
    }
}

@keyframes pulseDonut {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.02);
    }
    100% {
        transform: scale(1);
    }
}

@keyframes growBar {
    from { 
        height: 0; 
        opacity: 0;
    }
    to { 
        opacity: 1;
    }
}

@keyframes drawLine {
    from { stroke-dashoffset: 1000; }
    to { stroke-dashoffset: 0; }
}

.chart-container {
    animation: fadeIn 0.8s ease;
}

.donut-segment {
    animation: rotateDonut 2s ease-in-out forwards;
}

.follower-segment, .unfollower-segment {
    /* Hapus pulseDonut animation */
}

.bar {
    animation: growBar 0.8s ease;
}

.chart-line {
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    animation: drawLine 2s ease-out forwards;
}

/* Loading skeleton styles untuk bar chart */
.bar-chart .skeleton-loading {
    min-width: 40px;
    max-width: 60px;
    position: relative;
    margin: 0 20px;
    animation: pulse 1.5s infinite;
}

/* Tooltip Styles */
.chart-tooltip {
    position: absolute;
    background: white;
    border-radius: 4px;
    padding: 8px 12px;
    font-size: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 100;
}

.chart-tooltip.visible {
    opacity: 1;
}

.stats-message {
    font-size: 14px;
    color: var(--text-color-light);
    text-align: center;
    padding: 30px 0;
    font-style: italic;
} 