
/* General root styles for all charts */
.energy-root {
    display: grid;
    grid-template-rows: auto 1fr auto;
    height: 100%;
}

.energy-root svg {
    width: 100%;
    height: 100%;
}

.gauge-subtitle, .mix-title, .pie-title {
    font-size: clamp(14px, 3cqw, 30px);
    font-weight: bold;
    margin-top: clamp(8px, 1cqw, 15px);
    margin-bottom: clamp(4px, 0.8cqw, 8px);
    color: #003366;
    align-self: center;
}
.pie-title{
    padding-inline: 10px;
}


/* Gauge chart specific */
.gauge-root {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.gauge-stage {
    width: 100%;
    height: 80%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gauge-svg {
    display: block;
}

/* Mix chart specific */
.mix-chart-wrapper {
    display: flex;
    flex-direction: row;
    align-items: flex-end;
    width: 100%;
    gap: clamp(3px, 6cqw, 60px);
    position: relative;
    flex: 1;
    height: 98%;
}

.mix-y-label {
    position: absolute;
    left: clamp(-40px, -25cqw, -100px);
    top: 40%;
    transform: rotate(-90deg) translate(-50%, 0);
    white-space: nowrap;
    font-size: clamp(10px, 3cqw, 12px);
    color:#003366;

}

.mix-y-axis {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    width: clamp(20px, 3cqw, 35px);
    text-align: right;
    color:#003366;
    font-size: clamp(10px, 1cqw, 12px);
    padding-right: clamp(3px, 0.5cqw, 6px);
    padding-bottom: 5px;
}

.mix-chart-div {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    flex: 1;
    padding-inline: clamp(5px, 1cqw, 10px);
    position: relative;
    height: 100%;
}

.mix-grid {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;

}

.mix-grid-line {
    position: absolute;
    width: 100%;
    height: 1px;
    background-color: #e0e0e0;
}

.mix-bar-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 0 0 auto;
    width: clamp(20px, 6cqw, 40px);

}

.mix-pct-label {
    font-size: clamp(9px, 2cqw, 12px);
    color: #003366;
    margin-bottom: clamp(2px, 0.5cqw, 5px);
    font-weight: bold;
}

.mix-bar {
    width: clamp(12px, 5cqw, 25px);
    background-color: inherit;
    border-radius: clamp(3px, 0.5cqw, 6px) clamp(3px, 0.5cqw, 6px) 0 0;
    opacity: 0.9;
    transition: all 0.3s ease;
    z-index: 1;
}

.mix-bar:hover {
    opacity: 1;
    transform: scale(1.05);
}

/* Palette for mix bars */
.mix-bar-carbune { background-color: #4B4B4B; }
.mix-bar-gaz { background-color: #2E8BC0; }
.mix-bar-apa { background-color: #6EC5E9; }
.mix-bar-nuclear { background-color: #5C6F7B; }
.mix-bar-eolian { background-color: #76D7C4; }
.mix-bar-fotovoltaic { background-color: #EECF6D; }
.mix-bar-biomasa { background-color: #3C9A5F; }
.mix-bar-baterie { background-color: #9BA9B4; }

/* Pie chart specific */
.pie-wrapper {
    width: 100%;
    height: 80%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: clamp(10px, 3cqw, 30px);
    gap: clamp(6px, 10cqw, 40px);

}

.pie-svg-container {
    width: 60%;
    height: 100%;
}

.pie-slice {
    opacity: 0.9;
    cursor: pointer;
    transition: opacity 0.3s, transform 0.3s;
}

.pie-slice:hover {
    opacity: 1;
    transform: scale(1.05);
}

/* Colors for pie slices */
.pie-slice-import { fill: #2E8BC0; }
.pie-slice-export { fill: #6EC5E9; }

.pie-color-import { background-color: #2E8BC0; }
.pie-color-export { background-color: #6EC5E9; }

/* Legend general */
.energy-legend {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: clamp(6px, 1cqw, 14px);
    width: 100%;
    box-sizing: border-box;
    padding: clamp(8px, 1.5cqw, 16px);
    margin-top: clamp(6px, 1cqw, 10px);
    font-size: clamp(11px, 3cqw, 14px);
    line-height: 1.2;
}

.energy-legend-item {
    display: flex;
    align-items: center;
    gap: clamp(5px, 1cqw, 8px);
    min-width: 0;
}

.energy-legend-color {
    width: clamp(10px, 1cqw, 14px);
    height: clamp(10px, 1cqw, 14px);
    border-radius: clamp(2px, 0.3cqw, 4px);
    flex: 0 0 auto;
}

.energy-legend-label {
    color: #003366;
    white-space: normal;
    word-break: break-word;
    overflow-wrap: anywhere;
    min-width: 0;
}

/* Specific legend adjustments */
.gauge-legend {
    display: flex;
    justify-content: center;
    width: 100%;
    gap: clamp(10px, 2cqw, 20px);
}

.mix-legend {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: space-between;
    gap: clamp(4px, 1cqw, 8px);
    overflow: visible;
}

.pie-legend {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: clamp(10px, 2cqw, 20px);
    color: #003366;
    width: auto;
    grid-template-columns: none;
}

.energy-root > *:not(.energy-legend) {
    flex: 1;
}