/* pie-chart.css - Styles untuk diagram lingkaran dengan persentase di dalam */

.pie-chart-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    padding: 20px;
}

.pie-chart-wrapper {
    position: relative;
    width: 220px;
    height: 220px;
    margin: 0 auto;
}

.pie-chart {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    position: relative;
    background: #f0f0f0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Segments dengan persentase di dalam */
.pie-segment {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    pointer-events: auto;
}

/* Teks persentase di dalam pie chart */
.percentage-label {
    position: absolute;
    font-size: 0.7rem;
    font-weight: 700;
    color: white;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    z-index: 10;
    pointer-events: none;
    transform: translate(-50%, -50%);
}

/* Posisi untuk setiap persentase */
.percentage-1 { /* Kultner 11.8% */
    top: 25%;
    left: 75%;
}

.percentage-2 { /* Festikon 10.7% */
    top: 35%;
    left: 85%;
}

.percentage-3 { /* Jose 7.2% */
    top: 45%;
    left: 90%;
}

.percentage-4 { /* Ratali 60.6% */
    top: 70%;
    left: 40%;
}

.percentage-5 { /* Prozent 5.1% */
    top: 20%;
    left: 40%;
}

.percentage-6 { /* DistriotronSupplier 3.2% */
    top: 15%;
    left: 50%;
}

.percentage-7 { /* Kreatifikatvo 1.4% */
    top: 12%;
    left: 60%;
}

.pie-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 70px;
    height: 70px;
    background: white;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border: 2px solid #f8f9fa;
    z-index: 5;
}

.total-label {
    font-size: 0.65rem;
    font-weight: 600;
    color: #666;
    margin-bottom: 1px;
}

.total-value {
    font-size: 0.9rem;
    font-weight: 700;
    color: #2c3e50;
    line-height: 1;
}

.total-unit {
    font-size: 0.55rem;
    color: #888;
    margin-top: 1px;
}

.pie-legend {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 8px;
    width: 100%;
    max-width: 400px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px; /* Dikurangi dari 8px ke 6px */
    padding: 5px 8px; /* Dikurangi padding vertikal dari 6px ke 5px */
    background: #f8f9fa;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.legend-item:hover {
    background: #e9ecef;
    transform: translateX(2px);
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
    border: 2px solid white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    margin-right: 2px; /* Tambah margin kecil untuk memberi jarak */
}

.legend-info {
    display: flex;
    flex-direction: column;
    gap: 1px; /* Kurangi gap antara label dan stats */
    flex: 1;
}

.legend-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: #2c3e50;
    line-height: 1.2;
}

.legend-stats {
    font-size: 0.65rem; /* Diperkecil dari 0.75rem ke 0.65rem */
    font-weight: 400; /* Diperkecil weight dari 600 ke 400 */
    color: #6c757d; /* Warna lebih soft */
    line-height: 1.1;
    margin-top: 1px;
}

.legend-percentage {
    font-size: 0.75rem;
    font-weight: 600;
    color: #2c3e50;
    min-width: 40px;
    text-align: right;
}

/* Responsive Design untuk Pie Chart */
@media (max-width: 768px) {
    .pie-chart-container {
        gap: 15px;
        padding: 15px;
    }
    
    .pie-chart-wrapper {
        width: 200px;
        height: 200px;
    }
    
    .percentage-label {
        font-size: 0.65rem;
    }
    
    .pie-center {
        width: 60px;
        height: 60px;
    }
    
    .total-label {
        font-size: 0.6rem;
    }
    
    .total-value {
        font-size: 0.8rem;
    }
    
    .total-unit {
        font-size: 0.5rem;
    }
    
    /* Adjust posisi persentase untuk mobile */
    .percentage-1 {
        top: 25%;
        left: 70%;
    }
    
    .percentage-2 {
        top: 35%;
        left: 80%;
    }
    
    .percentage-4 {
        top: 65%;
        left: 35%;
    }
}

@media (max-width: 480px) {
    .pie-chart-wrapper {
        width: 180px;
        height: 180px;
    }
    
    .percentage-label {
        font-size: 0.6rem;
    }
    
    .pie-center {
        width: 50px;
        height: 50px;
    }
    
    .total-label {
        font-size: 0.55rem;
    }
    
    .total-value {
        font-size: 0.75rem;
    }
    
    .total-unit {
        font-size: 0.45rem;
    }
    
    .pie-legend {
        grid-template-columns: 1fr;
        max-width: 300px;
        gap: 6px;
    }
    
    .legend-item {
        padding: 4px 6px;
        gap: 4px;
    }

    .legend-color {
        width: 10px;
        height: 10px;
    }

    .legend-info {
        gap: 0px;
    }

    .legend-label {
        font-size: 0.7rem;
    }

    .legend-stats {
        font-size: 0.6rem; /* Lebih kecil lagi di mobile */
        margin-top: 0px;
    }

    .legend-percentage {
        font-size: 0.7rem;
        min-width: 35px;
    }
}

/* Animation untuk pie chart */
@keyframes pieGrowth {
    from {
        transform: scale(0.8);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.pie-chart {
    animation: pieGrowth 0.8s ease-out;
}

/* Animation untuk persentase label */
@keyframes fadeInPercentage {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.5);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

.percentage-label {
    animation: fadeInPercentage 0.6s ease-out 0.3s both;
}