/* =============================================================================
   CHARTS.CSS - Pie Charts, Comparison Bars, Progress Bars
   =============================================================================
   Contains: Pie Chart Styles, Dual/Triple Pie Containers, Comparison Bars,
             Three-Stage Bars, Element Gradient Backgrounds
   ============================================================================= */

/* =============================================================================
   PIE CHART STYLES - Shared Component
   ============================================================================= */

.pie-chart-section {
    margin-top: 30px;
    padding: 20px;
    background: linear-gradient(135deg, rgba(13, 13, 20, 0.9) 0%, rgba(20, 15, 25, 0.9) 100%);
    border-radius: 12px;
    border: 1px solid rgba(212, 175, 55, 0.2);
}

.pie-chart-section h5 {
    text-align: center;
    color: var(--accent-gold);
    margin-bottom: 25px;
    font-size: 1.2rem;
}

.pie-chart-container {
    position: relative;
    width: 220px;
    height: 220px;
    margin: 0 auto 25px;
}

.pie-chart {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5), inset 0 0 30px rgba(255, 255, 255, 0.05);
    animation: pieRotate 1s ease-out;
}

@keyframes pieRotate {
    from {
        transform: rotate(-90deg);
        opacity: 0;
    }

    to {
        transform: rotate(0deg);
        opacity: 1;
    }
}

.pie-chart-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 120px;
    height: 120px;
    background: linear-gradient(135deg, #1a1a24 0%, #13131a 100%);
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.5);
}

.pie-total {
    font-size: 1.8rem;
    font-weight: bold;
    color: var(--accent-gold);
    /* Refined: Reduced glow for premium consistency */
    text-shadow: 0 0 8px rgba(212, 175, 55, 0.2);
}

.pie-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.pie-legend {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px;
    max-width: 500px;
    margin: 0 auto;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 15px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 20px;
    transition: all 0.3s ease;
}

.legend-item:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateY(-2px);
}

.legend-color {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.legend-text {
    font-size: 0.9rem;
    font-weight: 500;
}

/* =============================================================================
   DUAL/TRIPLE PIE CHART CONTAINERS - Shared
   ============================================================================= */

.dual-pie-container,
.triple-pie-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
    margin: 20px 0;
}

.pie-column {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.pie-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--accent-gold);
    text-align: center;
}

.pie-arrow {
    font-size: 2rem;
    color: var(--accent-gold);
    opacity: 0.7;
}

/* Small pie chart variant for comparison views */
.pie-chart-container.small {
    width: 140px;
    height: 140px;
}

.pie-chart-center.small {
    width: 80px;
    height: 80px;
}

.pie-chart-center.small .pie-total {
    font-size: 1.2rem;
}

.pie-legend.compact {
    gap: 10px;
    margin-top: 15px;
}

.pie-legend.compact .legend-item {
    padding: 5px 10px;
    font-size: 0.8rem;
}

/* =============================================================================
   COMPARISON BAR STYLES - Shared
   ============================================================================= */

.comparison-table th,
.comparison-table td {
    padding: 10px 12px;
}

.comparison-bar {
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 100%;
    min-width: 120px;
}

.bar-before,
.bar-after {
    height: 8px;
    border-radius: 4px;
    opacity: 0.7;
    transition: width 0.5s ease;
}

.bar-before {
    opacity: 0.4;
}

.bar-after {
    opacity: 1;
}

.change-arrow {
    font-size: 0.85rem;
    margin-left: 4px;
}

/* Progress stages for 3-way comparison */
.progress-bar-container {
    display: flex;
    flex-direction: column;
    gap: 3px;
    width: 100%;
    min-width: 100px;
}

.progress-stage {
    height: 6px;
    border-radius: 3px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.1);
}

.progress-fill {
    height: 100%;
    border-radius: 3px;
}

.progress-fill.base {
    opacity: 0.4;
}

.progress-fill.luck {
    opacity: 0.7;
}

.progress-fill.final {
    opacity: 1;
}

/* Element background colors for bars */
.bar-before.element-Kim,
.bar-after.element-Kim,
.progress-fill.element-Kim {
    background: linear-gradient(90deg, #9E9E9E, #E0E0E0);
}

.bar-before.element-Mộc,
.bar-after.element-Mộc,
.progress-fill.element-Mộc {
    background: linear-gradient(90deg, #388E3C, #66BB6A);
}

.bar-before.element-Thủy,
.bar-after.element-Thủy,
.progress-fill.element-Thủy {
    background: linear-gradient(90deg, #1565C0, #42A5F5);
}

.bar-before.element-Hỏa,
.bar-after.element-Hỏa,
.progress-fill.element-Hỏa {
    background: linear-gradient(90deg, #C62828, #EF5350);
}

.bar-before.element-Thổ,
.bar-after.element-Thổ,
.progress-fill.element-Thổ {
    background: linear-gradient(90deg, #F57F17, #FFCA28);
}

/* Three-way table styling */
.comparison-table.three-way th,
.comparison-table.three-way td {
    padding: 8px 10px;
    font-size: 0.9rem;
}

/* =============================================================================
   THREE-STAGE BAR VISUALIZATION - Shared
   ============================================================================= */

.three-stage-bars {
    display: flex;
    flex-direction: column;
    gap: 3px;
    width: 100%;
    min-width: 130px;
}

.stage-bar-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.bar-label {
    font-size: 0.7rem;
    color: var(--text-secondary);
    width: 22px;
    text-align: right;
    font-weight: 600;
}

/* Extend progress-stage for better display in three-stage bars */
.three-stage-bars .progress-stage {
    flex: 1;
    height: 6px;
    border-radius: 3px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.08);
}

.three-stage-bars .progress-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.5s ease;
}