/* omzet-chart.css - Styles untuk grafik kenaikan omzet */

.omzet-chart-container {
    padding: 8px;
    background: white;
    border-radius: 8px;
    height: auto; /* Ubah menjadi auto */
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.omzet-chart-header {
    text-align: center;
    margin-bottom: 5px;
}

.omzet-chart-header h3 {
    font-size: 0.9rem;
    font-weight: 700;
    color: #2c3e50;
    line-height: 1.3;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.omzet-chart-wrapper {
    display: flex;
    gap: 3px;
    align-items: flex-end;
    height: 180px; /* Tinggi statis */
    flex-shrink: 0; /* Tidak akan menyusut */
}

.chart-y-axis {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
    text-align: right;
    padding-bottom: 20px;
    width: 35px;
}

.y-label {
    font-size: 0.65rem;
    font-weight: 600;
    color: #666;
    line-height: 1;
}

.y-labels {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
    position: relative;
}

.y-label {
    font-size: 0.65rem;
    font-weight: 600;
    color: #666;
    line-height: 1;
}

.chart-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.chart-bars {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    height: 140px; /* Tinggi statis yang sesuai dengan wrapper */
    padding: 0 1px;
    position: relative;
    /* Tambahkan baseline untuk memastikan bars mulai dari bawah */
    border-bottom: 2px solid #ddd;
    /* Pastikan bar tidak melayang */
    overflow: hidden;
}

/* Garis grid horizontal - REMOVED */
/*.chart-bars::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        linear-gradient(to bottom, transparent 0%, transparent 19%, #f0f0f0 20%, transparent 21%, transparent 39%, #f0f0f0 40%, transparent 41%, transparent 59%, #f0f0f0 60%, transparent 61%, transparent 79%, #f0f0f0 80%, transparent 81%);
    pointer-events: none;
}*/

.bar {
    flex: 1;
    margin: 0 2px;
    position: relative;
    transition: all 0.3s ease;
    cursor: pointer;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

.bar-inner {
    background: linear-gradient(to top, #3498db, #2980b9);
    border-radius: 4px 4px 0 0;
    width: 100%;
    position: relative;
    min-height: 3px;
    transition: all 0.3s ease;
    /* Pastikan bar tumbuh dari bawah */
    transform-origin: bottom;
}

.bar:hover .bar-inner {
    background: linear-gradient(to top, #2980b9, #1f6396);
    transform: scaleY(1.05);
}

.bar-value {
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.65rem;
    font-weight: 700;
    color: #2c3e50;
    background: rgba(255, 255, 255, 0.9);
    padding: 2px 4px;
    border-radius: 3px;
    white-space: nowrap;
    opacity: 1; /* Tampilkan selalu untuk sementara */
    transition: opacity 0.3s ease;
}

.bar:hover .bar-value {
    opacity: 1;
}

.chart-x-axis {
    display: flex;
    justify-content: space-between;
    padding: 1px 1px 1px 1px;
    position: relative;
}

.x-label {
    flex: 1;
    text-align: center;
    font-size: 0.65rem;
    font-weight: 600;
    color: #666;
}

.omzet-stats {
    display: grid;
    grid-template-columns: 1fr;
    gap: 6px;
    margin-top: 8px;
}

.stat-item {
    background: #f8f9fa;
    padding: 10px;
    border-radius: 6px;
    text-align: center;
    border-left: 4px solid #3498db;
}

.stat-item.total {
    grid-column: 1;
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
}

.stat-item.total .stat-value,
.stat-item.total .stat-label {
    color: white;
}

.stat-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: #2c3e50;
    line-height: 1;
    margin-bottom: 4px;
}

.stat-label {
    font-size: 0.65rem;
    color: #666;
    font-weight: 500;
    line-height: 1.2;
}

/* Warna berbeda untuk setiap stat item */
.stat-item:nth-child(1) { border-left-color: #e74c3c; } /* Rata-rata */
.stat-item:nth-child(2) { border-left-color: #2ecc71; } /* Tertinggi */
.stat-item:nth-child(3) { border-left-color: #f39c12; } /* Terendah */
.stat-item.total { border-left-color: #3498db; } /* Total */

/* Responsive Design */
@media (max-width: 768px) {
    .omzet-chart-container {
        padding: 12px;
        gap: 12px;
    }
    
    .omzet-chart-wrapper {
        min-height: 160px;
    }
    
    .chart-y-axis {
        height: 150px;
        padding-bottom: 20px;
    }
    
    .chart-bars {
        height: 150px;
    }
    
    .y-label, .x-label {
        font-size: 0.65rem;
    }
    
    .stat-value {
        font-size: 1.1rem;
    }
    
    .stat-label {
        font-size: 0.65rem;
    }
    
    .omzet-stats {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    
    .stat-item.total {
        grid-column: 1;
    }
}

@media (max-width: 480px) {
    .omzet-chart-container {
        padding: 10px;
        gap: 10px;
    }
    
    .omzet-chart-wrapper {
        min-height: 140px;
    }
    
    .chart-y-axis {
        height: 130px;
        padding-bottom: 20px;
    }
    
    .chart-bars {
        height: 130px;
    }
    
    .bar-value {
        font-size: 0.6rem;
        top: -18px;
    }
    
    .omzet-stats {
        grid-template-columns: 1fr;
    }
}

/* Animations */
@keyframes barGrowth {
    from {
        height: 0;
        opacity: 0;
        transform: scaleY(0);
    }
    to {
        height: var(--bar-height);
        opacity: 1;
        transform: scaleY(1);
    }
}

@keyframes bounceIn {
    0% {
        height: 0;
        opacity: 0;
        transform: scaleY(0);
    }
    50% {
        transform: scaleY(1.1);
    }
    80% {
        transform: scaleY(0.95);
    }
    100% {
        height: var(--bar-height);
        opacity: 1;
        transform: scaleY(1);
    }
}

.bar-inner {
    transform-origin: bottom;
    animation: bounceIn 0.8s ease-out forwards;
}

.bar:nth-child(1) .bar-inner { animation-delay: 0.1s; }
.bar:nth-child(2) .bar-inner { animation-delay: 0.2s; }
.bar:nth-child(3) .bar-inner { animation-delay: 0.3s; }
.bar:nth-child(4) .bar-inner { animation-delay: 0.4s; }
.bar:nth-child(5) .bar-inner { animation-delay: 0.5s; }
.bar:nth-child(6) .bar-inner { animation-delay: 0.6s; }
.bar:nth-child(7) .bar-inner { animation-delay: 0.7s; }
.bar:nth-child(8) .bar-inner { animation-delay: 0.8s; }
.bar:nth-child(9) .bar-inner { animation-delay: 0.9s; }

/* Tooltip Styles */
.bar-tooltip {
    position: absolute;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 0.75rem;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 1000;
    max-width: 200px;
    word-wrap: break-word;
}

.bar-tooltip.show {
    opacity: 1;
}

.bar-tooltip::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 4px solid rgba(0, 0, 0, 0.8);
}