/* ========== Kandidáti - Akordeon ========== */

.sg-candidates-interactive .sg-section-title {
    font-family: 'Oswald', sans-serif;
    font-size: 1.8rem;
    text-transform: uppercase;
    text-align: center;
    margin: 0 0 20px 0;
    color: #333;
}

.sg-candidates-interactive {
    background-color: transparent;
    padding: 0;
    margin: 0;
    border-radius: 0;
    box-sizing: border-box;
}

.sg-candidates-interactive .sg-section-subtitle {
    text-align: center;
    color: #666;
    margin-top: -15px;
    margin-bottom: 30px;
}

.sg-party-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 25px;
    padding-bottom: 20px; /* Přidáno odsazení, aby se neschovával stín u spodních dlaždic */
}

.sg-party-item {
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
    position: relative; /* For z-index */
    padding: 10px;
    border-radius: 8px;
}

.sg-party-item:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 16px rgba(0,0,0,0.1);
    z-index: 10;
    background-color: #fdf0ef;
}

.sg-party-item__clickable {
    display: flex;
    align-items: center;
    gap: 15px;
}

.sg-party-item__logo-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 120px; /* Match logo max-width */
}

.sg-party-item__cta-text {
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    transition: opacity 0.2s ease, max-height 0.3s ease, margin-top 0.3s ease;
    font-size: 0.8rem;
    color: #d42e25;
    font-family: 'Oswald', sans-serif;
    font-weight: 700;
    text-transform: uppercase;
    white-space: nowrap;
    margin-top: 0;
}

.sg-accordion-indicator {
    display: none;
}

.sg-party-item__leader-photo {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #e0e0e0;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    display: block;
    flex-shrink: 0;
}

.sg-party-item__logo {
    max-width: 120px;
    max-height: 60px;
    object-fit: contain;
}

/* Modal Styles (Desktop) */
.sg-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10200; /* Higher than nav */
    display: none;
    align-items: center;
    justify-content: center;
}

.sg-modal--visible {
    display: flex;
}

.sg-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    cursor: pointer;
}

.sg-modal-content {
    position: relative;
    background-color: #fff;
    border-radius: 8px;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
    /* Původně bylo padding: 10px 10px; Zvětšujeme pro lepší čitelnost na desktopu: */
    padding: 30px 40px !important; 
    animation: sg-fadeIn 0.3s ease;
}

@keyframes sg-fadeIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.sg-modal-close {
    position: absolute;
    /* Původně top: 10px; right: 15px; Posouváme mírně do středu s ohledem na nový padding: */
    top: 15px !important;
    right: 25px !important;
    background: none;
    border: none;
    font-size: 2.5rem;
    color: #aaa;
    cursor: pointer;
    line-height: 1;
    padding: 0;
}
.sg-modal-close:hover {
    color: #333;
}

.sg-modal-header {
    display: flex;
    align-items: center;
    gap: 20px;
    border-bottom: 1px solid #eee;
    padding-bottom: 15px;
    margin-bottom: 20px;
}

.sg-modal-header__logo {
    max-height: 40px;
    max-width: 120px;
}

.sg-modal-header__title {
    font-family: 'Oswald', sans-serif;
    font-size: 1.8rem;
    margin: 0;
}

.sg-modal-header__subtitle {
    font-size: 0.9rem;
    color: #666;
    margin: 0;
    font-style: italic;
}

.sg-candidate-list {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
}

.sg-candidate-detail {
    display: flex;
    align-items: center;
    gap: 15px;
    width: calc(50% - 12px); /* Adjusted for better fit on desktop to prevent overflow */
    text-decoration: none;
    color: inherit;
    padding: 10px;
    box-sizing: border-box;
    border: 1px solid #eee;
    border-radius: 6px;
}

.sg-candidate-detail:hover .sg-candidate-name {
    text-decoration: underline;
    color: #d42e25;
}

.sg-candidate-detail--leader {
    background-color: #e8f4f8;
    border-radius: 6px;
    padding: 10px;
    width: 100%;
    margin-bottom: 20px;
}

.sg-candidate-photo {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.sg-candidate-info {
    display: flex;
    flex-direction: column;
}

.sg-candidate-name {
    display: flex;
    align-items: baseline;
    font-weight: 700;
    font-size: 1rem;
}

.sg-candidate-position {
    color: #d42e25;
    font-weight: 700;
    font-size: 1rem;
    margin-right: 8px;
    min-width: 20px;
    text-align: right;
}

.sg-candidate-function {
    font-size: 0.85rem;
    color: #777;
}

.sg-candidate-age {
    font-size: 0.85rem;
    color: #777;
}

.sg-no-candidates {
    padding: 20px;
    text-align: center;
    color: #777;
    width: 100%;
}

/* Mobile Accordion Styles */
.sg-mobile-accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.5s ease-in-out;
    padding: 0 0 15px 0; /* Odsazení pro rozbalený obsah, bez mezer po stranách */
}

@media (min-width: 769px) {
    .sg-party-item:hover .sg-party-item__cta-text {
        opacity: 1;
        max-height: 2em; /* Dostatečná výška pro zobrazení celého textu */
        margin-top: 8px;
    }
}

@media (max-width: 768px) {
    .sg-party-grid {
        flex-direction: column;
        gap: 10px;
    }
    .sg-party-item {
        background-color: #fff;
        border-radius: 8px;
        border: 1px solid #eee;
        transition: background-color 0.3s ease;
    }
    .sg-party-item__clickable {
        position: relative;
        padding: 10px; /* Odsazení pro klikatelnou hlavičku */
    }
    .sg-party-item.active {
        background-color: #fdf0ef;
    }

    /* OPRAVA: Zrušení vizuálního zvětšování karty na mobilu, které při vysokém obsahu způsobovalo překryv */
    .sg-party-item:hover,
    .sg-party-item.active {
        transform: none !important;
    }

    .sg-party-item.active .sg-accordion-indicator {
        transform: translateY(-50%) rotate(-135deg); /* Arrow points up */
    }

    .sg-accordion-indicator {
        display: block;
        position: absolute;
        right: 25px;
        top: 50%;
        width: 12px;
        height: 12px;
        border-bottom: 3px solid #d42e25;
        border-right: 3px solid #d42e25;
        transform: translateY(-50%) rotate(45deg); /* Arrow points down */
        transition: transform 0.3s ease;
    }

    .sg-party-item__leader-photo {
        width: 80px;
        height: 80px;
    }
    .sg-mobile-accordion-content .sg-candidate-list {
        padding-top: 20px;
        margin-top: 10px;
        border-top: 1px solid #eee;
    }
    .sg-mobile-accordion-content .sg-candidate-detail {
        width: 100%;
    }
    .sg-mobile-accordion-content .sg-modal-header {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 8px;
        padding-bottom: 15px;
        margin-bottom: 0;
    }
    .sg-mobile-accordion-content .sg-modal-header__logo {
        max-height: 35px;
        display: none; /* Skryje duplicitní logo v mobilním akordeonu */
    }
    .sg-mobile-accordion-content .sg-modal-header__subtitle {
        font-size: 0.8rem;
        text-align: center;
    }

    /* Oprava pro seznam zvolených zastupitelů na mobilu (1 sloupec) */
    #volby-view-zastupitele .sg-candidate-detail {
        width: 100%;
    }

    /* OPRAVA: Odlepení loga strany od kraje obrazovky v sekci Zvolení zastupitelé */
    .sg-elected-party-logo {
        margin-left: 15px;
    }


    /* OPRAVA 1: Zrušení nevyužitého místa vlevo u boxů s kandidáty */
    .sg-mobile-accordion-content .sg-candidate-list {
        padding-left: 0 !important;
        padding-right: 0 !important;
        justify-content: flex-start;
    }

    .sg-mobile-accordion-content .sg-candidate-detail {
        width: 100% !important;
        margin-left: 0;
        margin-right: 0;
        gap: 10px; /* Zmenší mezeru mezi fotkou a textem uvnitř karty na mobilu */
    }

    /* OPRAVA 1: Odstranění zbytečných vnitřních okrajů hlavního obalu na mobilu */
    .special-gastronomie {
        padding-left: 0 !important;
        padding-right: 0 !important;
    }

    /* OPRAVA 2: Roztažení šedého boxu s kandidáty od kraje ke kraji */
    .sg-candidates-interactive {
        /* Překonání 15px paddingu z nadřazené třídy .pos-rel */
        margin-left: -15px !important;
        margin-right: -15px !important;
        width: calc(100% + 30px) !important;
        border-radius: 0 !important; /* Na plnou šířku vypadá lépe bez zakulacených rohů */
        
        /* Nastavení rozumného vnitřního okraje, aby text nezačínal přesně na hraně telefonu */
        padding-left: 15px !important;
        padding-right: 15px !important;
    }

    /* OPRAVA 3: Zrušení předchozího chybného negativního marginu u seznamu kandidátů (aby se neusekával text zleva) */
    .sg-other-candidates-container {
        margin-left: 0 !important;
        margin-right: 0 !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
    }
    .sg-other-candidates-toggle {
        width: 100% !important;
    }

    /* OPRAVA 1: Donutíme samotnou kartu strany, aby se roztáhla na celou šířku displeje */
    .sg-party-grid {
        align-items: stretch !important;
    }

    .sg-party-item {
        width: 100% !important;
        box-sizing: border-box !important;
    }

    /* OPRAVA 2: Flexibilní tabulka bez ošklivého dělení slov */
    .sg-other-candidates-table {
        table-layout: auto !important; /* Prohlížeč sám optimálně rozdělí šířku podle textu */
        width: 100% !important;
    }

    .sg-other-candidates-table td {
        padding: 8px 4px !important;
        word-wrap: normal !important;
        overflow-wrap: normal !important;
        hyphens: none !important; /* Vypneme sekání slov z předchozí opravy */
        vertical-align: middle;
    }

    /* Technické sloupce (číslo, fotka, věk) zaberou jen absolutní nutné minimum */
    .sg-candidate-position-cell,
    .sg-candidate-mini-photo-cell,
    .sg-candidate-age-cell {
        width: 1% !important;
        white-space: nowrap !important; /* Zabrání zalomení např. "56 let" na dva řádky */
    }

    .sg-candidate-mini-photo-cell {
        padding-right: 8px !important;
    }

    /* Jméno a profese si plynule rozdělí všechen zbývající široký prostor */
    .sg-candidate-name-cell {
        width: 40% !important;
        padding-right: 10px !important;
    }

    /* OPRAVA: Roztažení hlavního modrého obalu přes okraje .pos-rel */
    .sg-volby-views-wrapper {
        margin-left: -15px !important;
        margin-right: -15px !important;
        width: calc(100% + 30px) !important;
        border-radius: 0 !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
    }

    /* Zrušení vnitřního odsazení u kontejneru kandidátů */
    .sg-candidates-interactive {
        padding-left: 0 !important;
        padding-right: 0 !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        width: 100% !important;
        border-radius: 0 !important;
    }

    /* Zarovnání karty samotné politické strany (narůžovělý box) na hrany obrazovky */
    .sg-party-item {
        border-radius: 0 !important;
        border-left: none !important;
        border-right: none !important;
        /* Lehké odsazení obsahu uvnitř karty, aby text nebyl nalepený úplně na displeji */
        padding-left: 15px !important;
        padding-right: 15px !important;
    }

    /* Odlepení přepínacích tlačítek a nadpisů od okrajů displeje na mobilu */
    .sg-volby-toggle-container {
        padding-left: 15px !important;
        padding-right: 15px !important;
    }

    .sg-candidates-interactive .sg-section-title,
    .sg-candidates-interactive .sg-section-subtitle,
    .sg-results-interactive .sg-section-title,
    .sg-results-interactive .sg-section-subtitle,
    .sg-coalitions-interactive .sg-section-title,
    .sg-coalitions-interactive .sg-section-subtitle {
        padding-left: 15px;
        padding-right: 15px;
    }
}

/* ========== Volební výsledky ========== */

.sg-volby-toggle-container {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin: 0 0 30px 0;
    padding-bottom: 20px;
    border-bottom: 1px solid #d0e0e8;
    text-align: center;
}

.sg-volby-toggle-btn {
    background-color: transparent;
    border: 2px solid #002D62; /* Tmavě modrá */
    color: #002D62;
    padding: 8px 20px;
    font-family: 'Oswald', sans-serif;
    font-size: 1rem;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.3s ease;
    border-radius: 5px;
    font-weight: 400;
    margin: 0;
}

.sg-volby-toggle-btn:hover,
.sg-volby-toggle-btn.active {
    background-color: #002D62;
    color: #fff;
    border-color: #002D62;
}

.sg-volby-view {
    display: none;
}

.sg-volby-view.active {
    display: block;
}

.sg-results-interactive {
    background-color: transparent;
    padding: 0;
    margin: 0;
    border-radius: 0;
    box-sizing: border-box;
}

.sg-results-interactive .sg-section-title {
    margin-top: 0;
}

.sg-results-container {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 40px;
    align-items: start;
}

/* Bar chart styles */
.sg-results-barchart {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.sg-barchart-item {
    display: grid;
    grid-template-columns: 60px 1fr 60px;
    align-items: center;
    gap: 15px;
}

.sg-barchart-logo {
    width: 50px;
    height: 50px;
    object-fit: contain;
    justify-self: center;
}

.sg-barchart-bar-wrapper {
    background-color: #e0e0e0;
    border-radius: 4px;
    height: 30px;
    width: 100%;
    overflow: hidden;
}

.sg-barchart-bar {
    height: 100%;
    border-radius: 4px;
    background-color: #d42e25; /* Default color, will be overridden */
    transition: width 1s ease-out;
}

.sg-barchart-percentage {
    font-family: 'Oswald', sans-serif;
    font-size: 1.2rem;
    font-weight: 700;
    color: #333;
    justify-self: end;
}

/* Infographic styles */
.sg-results-infographic {
    background-color: #fff;
    padding: 20px;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
}

.sg-infographic-title {
    font-family: 'Oswald', sans-serif;
    font-size: 1.1rem;
    text-align: center;
    margin: 0 0 20px 0;
    color: #555;
    text-transform: uppercase;
}

.sg-council-grid {
    display: grid;
    grid-template-columns: repeat(9, 1fr);
    gap: 8px;
    max-width: 300px;
    margin: 0 auto;
}

.sg-council-figure {
    width: 100%;
    aspect-ratio: 1 / 1.5;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z" fill="%23FFF"/></svg>');
    background-repeat: no-repeat;
    background-position: center;
    background-size: 80%;
    border-radius: 4px;
}

.sg-council-legend {
    margin-top: 25px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px;
}

.sg-legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.sg-legend-color {
    width: 15px;
    height: 15px;
    border-radius: 3px;
}

.sg-legend-label {
    font-size: 0.85rem;
    font-weight: 700;
}

.sg-legend-label span {
    font-weight: 400;
    color: #555;
    margin-left: 4px;
}

@media (max-width: 900px) {
    .sg-results-container {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .sg-barchart-item {
        /* Původně: grid-template-columns: 50px 1fr 50px; */
        grid-template-columns: 50px 1fr auto !important;
        gap: 10px;
    }
    .sg-barchart-logo {
        width: 40px;
        height: 40px;
    }

    /* OPRAVA: Odsazení procent od kraje obrazovky na mobilu */
    .sg-barchart-percentage {
        padding-right: 15px;
    }

    /* OPRAVA: Odsazení grafu s výsledky od okrajů obrazovky */
    .sg-results-barchart {
        padding-left: 15px;
        padding-right: 15px;
    }
}

/* ========== Interaktivní koalice ========== */

.sg-coalitions-interactive {
    background-color: transparent;
    padding: 0;
    margin: 0;
    border-radius: 0;
    box-sizing: border-box;
}

.sg-coalitions-interactive .sg-section-title {
    margin-top: 0;
}

.sg-coalitions-interactive .sg-section-subtitle {
    text-align: center;
    color: #666;
    margin-top: -15px;
    margin-bottom: 30px;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.sg-coalition-builder-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    align-items: start;
}

.sg-coalition-party-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #fff;
    padding: 20px;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
}

.sg-coalition-party-selector {
    display: grid;
    grid-template-columns: 30px 50px 1fr 40px;
    align-items: center;
    gap: 15px;
    padding: 10px;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    border: 1px solid #f0f0f0;
}

.sg-coalition-party-selector:hover {
    background-color: #f9f9f9;
}

.sg-coalition-party-logo {
    height: 40px;
    object-fit: contain;
    justify-self: center;
}

.sg-coalition-party-name {
    font-weight: 700;
}

.sg-coalition-party-mandates {
    font-family: 'Oswald', sans-serif;
    font-size: 1.4rem;
    font-weight: 700;
    color: #333;
    justify-self: end;
}

/* Custom Checkbox */
.sg-coalition-checkbox {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.sg-coalition-checkmark {
    height: 22px;
    width: 22px;
    background-color: #eee;
    border: 1px solid #ccc;
    border-radius: 4px;
    transition: all 0.2s;
}

.sg-coalition-party-selector:hover .sg-coalition-checkmark {
    background-color: #ddd;
}

.sg-coalition-checkbox:checked ~ .sg-coalition-checkmark {
    background-color: #d42e25;
    border-color: #d42e25;
}

.sg-coalition-checkmark:after {
    content: "";
    position: relative;
    display: none;
    left: 7px;
    top: 3px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 3px 3px 0;
    transform: rotate(45deg);
}

.sg-coalition-checkbox:checked ~ .sg-coalition-checkmark:after {
    display: block;
}

/* Right side infographic */
.sg-coalition-infographic {
    background-color: #fff;
    padding: 20px;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
}

.sg-coalition-summary {
    text-align: center;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
}

.sg-coalition-summary__mandates {
    font-family: 'Oswald', sans-serif;
    font-size: 4rem;
    font-weight: 700;
    color: #888;
    line-height: 1;
    transition: color 0.3s ease;
}

.sg-coalition-summary__mandates.has-majority {
    color: #4CAF50; /* Green for majority */
}

.sg-coalition-summary__mandates span {
    font-family: 'Open Sans', sans-serif;
    font-size: 1.2rem;
    color: #555;
    font-weight: 400;
    display: block;
}

.sg-coalition-summary__status {
    font-family: 'Oswald', sans-serif;
    font-size: 1.2rem;
    text-transform: uppercase;
    margin-top: 10px;
    color: #d42e25;
    transition: color 0.3s ease;
}

.sg-coalition-summary__status.has-majority {
    color: #4CAF50;
}

.sg-coalition-infographic .sg-council-grid {
    max-width: 300px;
    margin: 0 auto;
}

.sg-coalition-infographic .sg-council-legend {
    margin-top: 25px;
    justify-content: center;
}

@media (max-width: 900px) {
    .sg-coalition-builder-container {
        grid-template-columns: 1fr;
    }
    .sg-coalition-party-list {
        order: 2;
    }
    .sg-coalition-infographic {
        order: 1;
    }
}

@media (max-width: 600px) {
    .sg-volby-toggle-container {
        flex-wrap: wrap;
    }

    .sg-volby-toggle-btn {
        font-size: 0.8rem;
        padding: 8px 10px;
        margin: 0;
        flex-basis: calc(50% - 5px); /* Vytvoří 2 sloupce s mezerou 10px */
    }

    .sg-coalitions-interactive .sg-section-subtitle {
        margin-top: 10px;
        margin-bottom: 20px;
    }
    .sg-coalition-summary__mandates {
        font-size: 3rem;
    }
    .sg-coalition-summary__mandates span {
        font-size: 1rem;
    }
    .sg-coalition-summary__status {
        font-size: 1rem;
    }

    .sg-volby-views-wrapper {
        margin: 20px 0;
    }

    .sg-results-infographic,
    .sg-coalition-party-list,
    .sg-coalition-infographic {
        padding: 15px;
    }
}

.sg-volby-views-wrapper {
    background-color: #e8f4f8;
    padding: 30px 10px;
    border-radius: 8px;
    margin: 40px 0;
}

.sg-volby-info-box {
    background-color: #e8f4f8; /* Fallback */
    background-image: linear-gradient(rgba(232, 244, 248, 0.85), rgba(232, 244, 248, 0.85)), url('/specialy/volby/images/infobox_bg.jpg');
    background-size: cover;
    background-position: center;
    border-radius: 8px;
    padding: 25px;
    height: 100%;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    font-size: 0.95rem;
    line-height: 1.6;
}

.sg-volby-info-box h3 {
    font-family: 'Oswald', sans-serif;
    font-size: 1.2rem;
    color: #002D62;
    margin: 0 0 15px 0;
    text-transform: uppercase;
}

.sg-volby-info-box h3:nth-of-type(2) {
    margin-top: 15px;
}

.sg-volby-info-box p {
    margin-bottom: 8px;
}

.sg-volby-info-box hr {
    border: 0;
    border-top: 1px solid #d0e0e8;
    margin: 10px 0;
}

.sg-volby-info-box ul {
    list-style-type: '– ';
    padding-left: 20px;
    margin: 5px 0 0 0;
}

.sg-volby-info-box ul li {
    padding-left: 8px;
    margin-bottom: 5px;
}

/* ========== Zbytek kandidátky (od 6. místa dál) ========== */
/* Globální oprava pro oříznutý konec seznamu ve scrollovacím okně */
.sg-other-candidates-container {
    width: 100%;
    margin-top: 20px;
    padding-top: 20px;
    padding-bottom: 40px; /* Tento řádek přidá bezpečný prostor pod tabulku */
    border-top: 1px solid #eee;
}
.sg-other-candidates-toggle {
    display: block;
    width: 100%;
    padding: 10px 15px;
    background-color: #f0f0f0;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-family: 'Oswald', sans-serif;
    font-size: 0.9rem;
    text-transform: uppercase;
    color: #333;
    cursor: pointer;
    text-align: center;
    transition: background-color 0.2s, color 0.2s, border-color 0.2s;
}
.sg-other-candidates-toggle:hover {
    background-color: #e0e0e0;
}
.sg-other-candidates-toggle.active {
    background-color: #d42e25;
    color: #fff;
    border-color: #d42e25;
}
.sg-other-candidates-collapsible {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease-in-out;
}
.sg-other-candidates-title {
    font-family: 'Oswald', sans-serif;
    font-size: 1.2rem;
    margin: 15px 0 15px 0;
    color: #333;
}
.sg-other-candidates-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    text-align: left;
}
.sg-other-candidates-table td {
    padding: 8px 5px;
    border-bottom: 1px solid #ddd; /* Zvýrazněná linka */
}
.sg-candidate-position-cell {
    font-weight: 700;
    color: #d42e25;
    width: 30px;
}
.sg-candidate-name-cell {
    font-weight: 700;
    color: #333;
}
.sg-candidate-age-cell {
    color: #666;
    width: 40px;
    text-align: center;
}
.sg-candidate-info-cell {
    color: #666;
}

/* ========== Zvolení zastupitelé v sekci Výsledky ========== */
.sg-barchart-party-block {
    margin-bottom: 25px;
}
.sg-elected-candidates-list {
    list-style-type: none;
    padding: 0;
    margin: 10px 0 0 75px; /* Odsazení, aby text lícoval s barem, ne s logem */
    font-size: 0.85rem;
    color: #555;
    display: flex;
    flex-wrap: wrap;
    gap: 5px 15px;
}
.sg-elected-candidates-list li {
    background-color: #f0f0f0;
    padding: 2px 8px;
    border-radius: 4px;
}

/* ========== Zvolení zastupitelé - sekce ========== */
.sg-elected-party-logo {
    max-height: 40px;
    max-width: 150px;
    margin-bottom: 15px;
}

#volby-view-zastupitele .sg-candidate-list {
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
}

/* Oprava odsazení pro nadpis zvolených zastupitelů */
.sg-elected-interactive .sg-section-title {
    font-family: 'Oswald', sans-serif;
    font-size: 1.8rem;
    text-transform: uppercase;
    text-align: center;
    margin: 0 0 40px 0;
    color: #333;
}

/* Styly pro tabulku dalších kandidátů */
.sg-candidate-mini-photo-cell {
    width: 45px;
    text-align: center;
    vertical-align: middle;
    padding: 4px 0; /* Upravíme padding pro lepší zarovnání */
}

.sg-candidate-mini-photo {
    width: 40px;
    height: 40px;
    max-width: none; /* Zruší globální pravidlo max-width: 100%, které může způsobovat deformaci */
    border-radius: 50%;
    object-fit: cover;
    display: block; /* Zajišťuje, že margin auto funguje pro horizontální centrování */
    margin: 0 auto; /* Horizontální centrování obrázku */
    border: none; /* Zrušíme případné defaultní okraje */
}

.sg-candidate-name-link {
    color: #d42e25; /* Červená barva pro zvýraznění */
    text-decoration: none; /* Odstraní výchozí podtržení */
}

.sg-candidate-name-link:hover {
    text-decoration: underline; /* Podtržení při najetí myší */
}

/* OPRAVA: Zaseknutí hlavičky a křížku na desktopu při scrollování dlouhých kandidátek */
@media (min-width: 769px) {
    /* Zrušíme scrollování na vnějším obalu a vymažeme jeho vnitřní odsazení */
    .sg-modal-content {
        overflow-y: hidden !important;
        padding: 0 !important;
    }

    /* Scrollování přesuneme na vnitřní div a přidáme mu potřebné odsazení z vnějšího obalu */
    #modal-body-content {
        max-height: 90vh;
        overflow-y: auto;
        padding: 0 40px 30px 40px; 
    }

    /* Samotná hlavička se přilepí k hornímu okraji */
    .sg-modal-header {
        position: sticky;
        top: 0;
        background-color: #fff; /* Bílé pozadí překryje text, který pod ní zajíždí */
        z-index: 100;
        padding-top: 30px; /* Nahrazuje horní padding, který jsme sebrali rodiči */
        
        /* Natažení bílého pozadí hlavičky přes boční padding scrollovací oblasti */
        margin-left: -40px;
        margin-right: -40px;
        padding-left: 40px;
        padding-right: 40px;
    }

    /* Křížek má absolutní pozici vůči vnějšímu (nescrollovacímu) obalu, 
       takže tam přirozeně zůstane stát na místě. Stačí mu zvednout z-index, aby byl nad hlavičkou. */
    .sg-modal-close {
        z-index: 101 !important;
    }
}