/* Election Widget - Exact React Design Match */
.election-widget-container {
    max-width: 400px;
    margin: 0 auto;
    padding: 0px;
}

.election-widget-exact {
    position: relative;
    width: 367px;
    height: 266px; /* Base height for 1 bar */
    background: #f5f5f5;
    border-radius: 8px;
    box-shadow: none;
    overflow: hidden;
    margin-top: 30px;
}

/* Dynamically adjust height based on number of bars */
.election-widget-exact:has(.bar-1):not(:has(.bar-2)) {
    /* 2 bars */
    height: 316px;
}

.election-widget-exact:has(.bar-2):not(:has(.bar-3)) {
    /* 3 bars (default) */
    height: 366px;
}

.election-widget-exact:has(.bar-3):not(:has(.bar-4)) {
    /* 4 bars */
    height: 416px;
}

.election-widget-exact:has(.bar-4):not(:has(.bar-5)) {
    /* 5 bars */
    height: 466px;
}

.election-widget-exact:has(.bar-5) {
    /* 6 bars */
    height: 516px;
}

/* ==================== INVERTED SEMICIRCLE CHART (BOTTOM) ==================== */
.semicircle-chart-wrapper {
    position: absolute;
    left: 1px;
    bottom: 25px; /* Always at bottom */
    width: 366px;
    height: 366px;
    transform: scaleY(-1); /* FLIP UPSIDE DOWN */
    z-index: 12;
}

ellipse{
    display: none;
}

.semicircle-chart-svg {
    display: block;
    width: 100%;
    height: 100%;
}

.chart-slice {
    transition: opacity 0.3s ease;
}

.chart-slice:hover {
    opacity: 0.9;
    cursor: pointer;
}

/* Chart Numbers on Slices */
.chart-number {
    font-family: 'Inter', 'Arial', sans-serif;
    font-weight: 700;
    font-size: 28px;
    fill: #ffffff;
    pointer-events: none;
    filter: drop-shadow(2px 2px 4px rgba(0, 0, 0, 0.5));
    opacity: 0; /* Hidden by default */
    transition: opacity 0.3s ease;
}

/* Show chart number on slice hover */
.chart-slice:hover ~ g .chart-number[data-party-index] {
    opacity: 1;
}

/* Alternative: Show specific number when hovering its corresponding slice */
.semicircle-chart-wrapper:hover .chart-number {
    opacity: 1;
}

/* ==================== ALLIANCE BARS (TOP) ==================== */
.alliance-bars {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 10;
}

.alliance-bar {
    position: absolute;
    left: 0;
    width: 367px;
    height: 48px;
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 15px;
    transition: all 0.3s ease;
}

.alliance-bar.bar-0 {
    top: 8px;
}

.alliance-bar.bar-1 {
    top: 58px;
}

.alliance-bar.bar-2 {
    top: 108px;
}

.alliance-bar.bar-3 {
    top: 158px;
}

.alliance-bar.bar-4 {
    top: 208px;
}

.alliance-bar.bar-5 {
    top: 258px;
}

.alliance-name {
    font-family: 'Inter', 'Arial', sans-serif;
    font-weight: 700;
    font-size: 20px;
    color: #ffffff;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
}

.alliance-seats {
    font-family: 'Inter', 'Arial', sans-serif;
    font-weight: 900;
    font-size: 30px;
    color: #ffffff;
    text-align: right;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.alliance-bar.highlighted {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    z-index: 11;
}

/* ==================== TARGET CIRCLE GROUP ==================== */
.target-group {
    position: absolute;
    left: 55%;
    bottom: 180px; /* Fixed position from bottom */
    transform: translateX(-50%);
    z-index: 15;
    width: 391px;
    height: 218px;
}

/* Beige ellipse (background) */
.target-ellipse-beige {
    position: absolute;
    left: 105px;
    top: 143px;
    width: 156px;
    height: 129px;
    background: #E8D9BE;
    border-radius: 50%;
    z-index: 5;
}

/* Red ellipse (foreground) */
.target-ellipse-red {
    position: absolute;
    left: 106px;
    top: 138px;
    width: 156px;
    height: 131px;
    background: #81000E;
    border-radius: 50%;
    border: 0.5px solid #E8D9BE;
    z-index: 6;
}

/* Throne/Chair image */
.throne-chair {
    position: absolute;
    left: 90px;
    top: 36px;
    width: 211px;
    height: 148px;
    z-index: 7;
    display: none;
}

.throne-chair img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: 50% 50%;
    pointer-events: none;
}

/* Bihar map image */
.bihar-map-image {
    position: absolute;
    left: 133px;
    top: 108px;
    width: 102px;
    height: 110px;
    z-index: 13;
}

.bihar-map-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: 50% 50%;
    pointer-events: none;
}

/* Target text */
.target-text {
    position: absolute;
    left: 158px;
    top: 206px;
    font-family: 'Inter', 'Arial', sans-serif;
    font-weight: 400;
    font-size: 14px;
    color: #ffffff;
    text-transform: uppercase;
    text-align: right;
    white-space: nowrap;
    z-index: 10;
}

/* Target number */
.target-number {
    position: absolute;
    left: 165px;
    top: 225px;
    font-family: 'Inter', 'Arial', sans-serif;
    font-weight: 900;
    font-size: 20px;
    color: #ffffff;
    text-transform: uppercase;
    text-align: right;
    white-space: nowrap;
    z-index: 10;
}

/* Dotted line connecting target to chart */
.target-line {
    position: absolute;
    left: 33%;
    top: 318px;
    width: 105px;
    height: 2px;
    transform: rotate(90deg);
    transform-origin: center;
    z-index: 8;
}

.target-line svg {
    display: block;
    width: 100%;
    height: 100%;
}

/* ==================== ANIMATIONS ==================== */
.updating .alliance-seats {
    animation: seatUpdate 0.5s ease;
}

@keyframes seatUpdate {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.2);
        color: #ffffcc;
    }
}

.updating .target-number {
    animation: targetUpdate 0.5s ease;
}

@keyframes targetUpdate {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.15);
    }
}

/* ==================== RESPONSIVE DESIGN ==================== */
@media (max-width: 768px) {
    .election-widget-container {
        padding: 15px;
    }
    
    .election-widget-exact {
        transform: scale(0.9);
        transform-origin: top center;
    }
}

@media (max-width: 480px) {
    .election-widget-container {
        padding: 10px;
    }
    
    .election-widget-exact {
        transform: scale(0.75);
        transform-origin: top center;
        margin: 0 auto;
    }
}

@media (max-width: 400px) {
    .election-widget-exact {
        transform: scale(0.65);
    }
}

/* ==================== LOADING STATE ==================== */
/* Loading animation completely hidden - refresh happens silently in background */
.election-widget-container.loading {
    /* No visual changes during refresh */
}

.election-widget-container.loading::after {
    /* No loading spinner */
    display: none;
}
/* ==================== PRINT STYLES ==================== */
@media print {
    .election-widget-exact {
        box-shadow: none;
        border: 1px solid #ddd;
    }
}
