* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    height: 100vh;
    overflow: hidden;
}

body {
    font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #0f0f23 0%, #1a1a3e 50%, #0f0f23 100%);
    color: #fff;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: clamp(10px, 1.8vw, 16px) clamp(14px, 3vw, 28px);
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.65) 0%, rgba(0, 0, 0, 0.35) 100%);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    position: relative;
    z-index: 200000;
}

.header-brand {
    flex: 1;
    text-align: center;
    min-width: 0;
}

header h1 {
    font-size: clamp(1rem, 2.8vw, 1.75rem);
    margin: 0 0 1px;
    background: linear-gradient(135deg, #fff 0%, #a8d8ff 50%, #fff 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: none;
    font-weight: 700;
    letter-spacing: 1px;
    white-space: nowrap;
}

header h5 {
    font-size: clamp(0.5rem, 1.1vw, 0.65rem);
    color: rgba(255, 255, 255, 0.45);
    font-weight: 300;
    margin: 0;
    letter-spacing: 0.8px;
    text-transform: uppercase;
}

header .subtitle {
    font-size: clamp(0.52rem, 1.2vw, 0.68rem);
    color: rgba(255, 255, 255, 0.5);
    font-weight: 300;
    margin: 2px 0 0;
}

/* Header nav (botões) */
.top-nav {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
    flex-shrink: 0;
    max-width: 56vw;
}

.top-nav a {
    color: #64b5f6;
    text-decoration: none;
    font-size: 0.9rem;
    padding: 6px 10px;
    border-radius: 10px;
    border: 1px solid rgba(100, 181, 246, 0.25);
    background: rgba(15, 15, 35, 0.12);
    transition: box-shadow 0.2s ease, transform 0.2s ease, background 0.2s ease, border-color 0.2s ease;
    white-space: nowrap;
}

.top-nav a:hover {
    background: rgba(100, 181, 246, 0.14);
    border-color: rgba(100, 181, 246, 0.55);
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.35);
    transform: translateY(-1px);
}

.top-nav a:focus-visible {
    outline: 2px solid rgba(100, 181, 246, 0.65);
    outline-offset: 2px;
}

.top-nav a.nav-loja {
    color: #fff;
    background: rgba(220, 53, 69, 0.75);
    border-color: rgba(220, 53, 69, 0.8);
    font-weight: 600;
}

.top-nav a.nav-loja:hover {
    background: rgba(220, 53, 69, 0.95);
    border-color: #dc3545;
    box-shadow: 0 10px 26px rgba(220, 53, 69, 0.35);
}

/* ── Seletor de idioma ── */
.lang-selector {
    position: relative;
    flex-shrink: 0;
    z-index: 200;
}

.lang-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    background: rgba(15, 15, 35, 0.55);
    border: 1px solid rgba(100, 181, 246, 0.3);
    border-radius: 10px;
    color: #a8d8ff;
    font-size: 0.78rem;
    font-weight: 600;
    padding: 5px 9px;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
    letter-spacing: 0.5px;
    white-space: nowrap;
    font-family: inherit;
}

.lang-btn:hover {
    background: rgba(100, 181, 246, 0.15);
    border-color: rgba(100, 181, 246, 0.6);
}

.lang-dropdown {
    display: none;
    flex-direction: column;
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    background: rgba(15, 15, 35, 0.96);
    border: 1px solid rgba(100, 181, 246, 0.25);
    border-radius: 10px;
    overflow: hidden;
    min-width: 130px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.5);
    z-index: 300;
}

.lang-dropdown.open {
    display: flex;
}

.lang-option {
    background: none;
    border: none;
    color: rgba(255,255,255,0.8);
    font-size: 0.82rem;
    font-family: inherit;
    padding: 9px 14px;
    text-align: left;
    cursor: pointer;
    transition: background 0.15s;
    display: flex;
    align-items: center;
    gap: 7px;
}

.lang-option:hover {
    background: rgba(100, 181, 246, 0.12);
    color: #fff;
}

.lang-option.active {
    color: #64b5f6;
    font-weight: 600;
}

.lang-flag {
    width: 18px;
    height: 13px;
    object-fit: cover;
    border-radius: 2px;
    vertical-align: middle;
    display: inline-block;
    flex-shrink: 0;
}

@media (max-width: 700px) {
    header {
        flex-wrap: wrap;
        gap: 8px;
        padding: 10px 14px;
    }

    .header-brand {
        order: -1;
        flex: 0 0 100%;
    }

    .lang-selector {
        order: 0;
        flex-shrink: 0;
    }

    .top-nav {
        order: 1;
        max-width: 100%;
        justify-content: center;
    }
}

main {
    display: flex;
    flex-direction: column;
    flex: 1;
    position: relative;
    overflow: hidden;
}

#map {
    width: 100%;
    flex: 1;
    background: linear-gradient(180deg, #0a0a1a 0%, #151530 100%);
    position: relative;
}

.bottom-left-stack {
    position: absolute;
    left: 14px;
    bottom: calc(40px + 3px);
    z-index: 100000;
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: flex-start;
}

.legend {
    background: rgba(15, 15, 35, 0.95);
    padding: 11px 14px;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px);
    color: #fff;
    min-width: 160px;
    z-index: 100000;
}

.legend h3 {
    margin-bottom: 8px;
    font-size: 0.76rem;
    color: #fff;
    border-bottom: 2px solid rgba(255, 255, 255, 0.2);
    padding-bottom: 6px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.legend-item {
    display: flex;
    align-items: center;
    margin: 6px 0;
    font-size: 0.68rem;
    color: rgba(255, 255, 255, 0.9);
}

.legend-color {
    width: 22px;
    height: 22px;
    border-radius: 8px;
    margin-right: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.legend-color.green {
    background: linear-gradient(135deg, #27ae60 0%, #2ecc71 100%);
}

.legend-color.red {
    background: linear-gradient(135deg, #c0392b 0%, #e74c3c 100%);
}

.legend-color.blue {
    background: linear-gradient(135deg, #2980b9 0%, #3498db 100%);
}

.legend-color.yellow {
    background: linear-gradient(135deg, #e67e22 0%, #f39c12 100%);
}

.info-panel {
    position: absolute;
    top: 255px;
    right: 20px;
    width: 400px;
    max-height: calc(100vh - 290px);
    background: rgba(15, 15, 35, 0.98);
    border-radius: 20px;
    z-index: 1000;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px);
    color: #fff;
    overflow-y: auto;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.info-panel::-webkit-scrollbar {
    width: 8px;
}

.info-panel::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}

.info-panel::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

.info-panel::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

.info-panel.hidden {
    transform: translateX(450px);
    opacity: 0;
    pointer-events: none;
}

.close-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    color: white;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 1.4rem;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.4);
}

.close-btn:hover {
    transform: scale(1.1) rotate(90deg);
    box-shadow: 0 6px 20px rgba(231, 76, 60, 0.6);
}

#panel-content {
    padding: 25px;
}

.country-header {
    text-align: center;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 20px;
}

.country-header h2 {
    font-size: 1.6rem;
    color: #fff;
    margin-bottom: 5px;
    font-weight: 600;
}

.country-flag-large {
    width: 140px;
    height: auto;
    border-radius: 10px;
    margin: 15px auto;
    display: block;
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.5);
    border: 3px solid rgba(255, 255, 255, 0.15);
}

.country-header .flag-emoji {
    font-size: 5rem;
    margin-bottom: 15px;
    display: block;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
}

.orientation-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 25px;
    font-size: 0.95rem;
    font-weight: 600;
    color: white;
    margin-top: 12px;
}

.orientation-badge.right {
    background: linear-gradient(135deg, #27ae60 0%, #2ecc71 100%);
    box-shadow: 0 4px 15px rgba(46, 204, 113, 0.4);
}

.orientation-badge.left {
    background: linear-gradient(135deg, #c0392b 0%, #e74c3c 100%);
    box-shadow: 0 4px 15px rgba(231, 76, 60, 0.4);
}

/* Barra de pesquisa (buscar país) */
.search-widget {
    position: relative;
    width: min(100%, 400px);
    background: rgba(15, 15, 35, 0.95);
    border-radius: 16px;
    padding: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px);
}

.search-widget {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
    align-items: center;
}

.search-input {
    width: 100%;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
    outline: none;
    font-size: 0.9rem;
}

.search-input::-webkit-calendar-picker-indicator {
    filter: invert(1);
}

.search-input::placeholder {
    color: rgba(255, 255, 255, 0.55);
}

.search-input:focus {
    border-color: rgba(52, 152, 219, 0.6);
    box-shadow: 0 0 0 4px rgba(52, 152, 219, 0.18);
}

.search-btn {
    padding: 12px 16px;
    border-radius: 12px;
    border: 1px solid rgba(52, 152, 219, 0.35);
    background: rgba(52, 152, 219, 0.25);
    color: #fff;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
}

.search-btn:hover {
    transform: translateY(-1px);
    background: rgba(52, 152, 219, 0.33);
    border-color: rgba(52, 152, 219, 0.55);
}

.search-hint {
    grid-column: 1 / -1;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.65);
    min-height: 1.1em;
    display: none;
}

.orientation-badge.transition {
    background: linear-gradient(135deg, #2980b9 0%, #3498db 100%);
    box-shadow: 0 4px 15px rgba(52, 152, 219, 0.4);
}

.section {
    margin: 25px 0;
}

.section h3 {
    font-size: 1.15rem;
    color: #fff;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
}

.section h3 .icon {
    font-size: 1.4rem;
}

.info-grid {
    display: grid;
    gap: 10px;
}

.info-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.info-item:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.1);
}

.info-item .label {
    color: rgba(255, 255, 255, 0.6);
    font-weight: 500;
}

.info-item .value {
    color: #fff;
    font-weight: 600;
    text-align: right;
    max-width: 55%;
}

.president-card {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0.03) 100%);
    border-radius: 16px;
    padding: 25px;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 15px;
}

.president-photo {
    width: 130px;
    height: 130px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid rgba(255, 255, 255, 0.2);
    margin: 0 auto 15px;
    display: block;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
    background: rgba(255, 255, 255, 0.1);
}

.president-name {
    font-size: 1.25rem;
    font-weight: 600;
    color: #fff;
    margin-bottom: 5px;
}

.president-party {
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.6);
}

/* Seção de Eleições */
.election-section {
    background: linear-gradient(135deg, rgba(52, 152, 219, 0.2) 0%, rgba(41, 128, 185, 0.1) 100%);
    border-radius: 16px;
    padding: 20px;
    margin: 20px 0;
    border: 1px solid rgba(52, 152, 219, 0.3);
}

.election-section.pending {
    background: linear-gradient(135deg, rgba(241, 196, 15, 0.2) 0%, rgba(243, 156, 18, 0.1) 100%);
    border-color: rgba(241, 196, 15, 0.3);
}

.election-section h3 {
    color: #3498db;
    margin-bottom: 15px;
}

.election-section.pending h3 {
    color: #f1c40f;
}

.election-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
}

.clock-icon {
    font-size: 1.5rem;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.8; }
}

.winner-card {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 15px;
    display: flex;
    align-items: center;
    gap: 15px;
    margin-top: 15px;
}

.winner-photo {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid rgba(255, 255, 255, 0.2);
}

.winner-info {
    flex: 1;
}

.winner-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: #fff;
}

.winner-party {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.6);
    margin-top: 3px;
}

.winner-orientation {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: 600;
    margin-top: 8px;
}

.winner-orientation.right {
    background: linear-gradient(135deg, #27ae60, #2ecc71);
    color: white;
}

.winner-orientation.left {
    background: linear-gradient(135deg, #c0392b, #e74c3c);
    color: white;
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.modal.hidden {
    opacity: 0;
    pointer-events: none;
}

.modal-content {
    background: linear-gradient(135deg, #1a1a3e 0%, #0f0f23 100%);
    border-radius: 24px;
    max-width: 900px;
    width: 95%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    color: #fff;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.1);
}

#modal-body {
    padding: 35px;
}

.modal-header {
    text-align: center;
    margin-bottom: 30px;
}

.modal-header h2 {
    font-size: 2.2rem;
    color: #fff;
}

.modal-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 35px;
}

/* Estatísticas no topo */
.stats-bar {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: clamp(10px, 2vw, 16px);
    padding: clamp(6px, 1vw, 10px) clamp(12px, 5vw, 30px);
    background: rgba(0, 0, 0, 0.4);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
    overflow: hidden;
}

.flags-carousel {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    pointer-events: none;
    z-index: 0;
    display: flex;
    align-items: center;
}

.flags-track {
    display: flex;
    gap: 30px;
    animation: scroll-flags 60s linear infinite;
    position: absolute;
    white-space: nowrap;
    align-items: center;
}

.flag-emoji {
    font-size: 2rem;
    opacity: 0.15;
    display: inline-block;
}

.flag-svg {
    height: 35px;
    width: auto;
    opacity: 0.15;
    display: inline-block;
    border-radius: 3px;
}

@keyframes scroll-flags {
    0% {
        transform: translateX(0);
    }
    100% {
        transform: translateX(-50%);
    }
}

.stats-group,
.search-container {
    position: relative;
    z-index: 1;
}

.stats-group {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: clamp(16px, 5vw, 32px);
    flex-wrap: wrap;
    grid-column: 2;
}

.stats-title {
    width: 100%;
    text-align: center;
    font-size: clamp(1.4rem, 4vw, 1.7rem);
    font-weight: 600;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 0;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.search-container {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
    align-items: center;
    grid-column: 3;
    justify-self: end;
    max-width: 400px;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: clamp(0.75rem, 2.5vw, 0.95rem);
}

.stat-color {
    width: 16px;
    height: 16px;
    border-radius: 5px;
}

.stat-color.green { background: linear-gradient(135deg, #27ae60, #2ecc71); }
.stat-color.red { background: linear-gradient(135deg, #c0392b, #e74c3c); }
.stat-color.blue { background: linear-gradient(135deg, #2980b9, #3498db); }

.stat-count {
    font-weight: 700;
    font-size: 1.2rem;
    color: #fff;
}

@media (max-width: 768px) {
    .modal-grid {
        grid-template-columns: 1fr;
    }
    
    header h1 {
        font-size: 1.2rem;
    }
    
    .info-panel {
        width: calc(100% - 20px);
        right: 10px;
        left: 10px;
        top: auto;
        bottom: 75px;
        max-height: 40vh;
        border-radius: 16px;
    }
    
    .info-panel.hidden {
        display: none;
    }
    
    .bottom-left-stack {
        left: 10px;
        right: auto;
        bottom: calc(16px + env(safe-area-inset-bottom));
        width: auto;
        max-width: calc(100vw - 20px);
        z-index: 999;
    }

    .legend {
        width: auto;
        max-width: min(360px, calc(100vw - 20px));
        padding: 12px 14px;
        font-size: 0.78rem;
        min-width: unset;
        max-height: 50vh;
        overflow-y: auto;
    }

    .legend h3 {
        font-size: 0.9rem;
        margin-bottom: 8px;
    }

    .legend-item {
        margin: 6px 0;
        font-size: 0.73rem;
    }

    .legend-color {
        width: 18px;
        height: 18px;
        margin-right: 8px;
    }

    /* No mobile, o attribution do Leaflet vira “footer” e colide com a UI */
    .leaflet-control-attribution {
        display: none !important;
    }

    .search-widget {
        position: fixed;
        bottom: 65px;
        left: 10px;
        right: 10px;
        top: auto;
        transform: none;
        width: auto;
        padding: 8px;
        gap: 6px;
        z-index: 1001;
    }

    .search-input {
        padding: 8px 10px;
        font-size: 0.9rem;
    }

    .search-btn {
        padding: 8px 12px;
        font-size: 0.8rem;
    }
    
    .stats-bar {
        flex-wrap: wrap;
        gap: 12px;
        padding: 10px 10px;
        justify-content: space-around;
    }

    .stats-group {
        width: 100%;
        justify-content: center;
        gap: 16px;
        order: 1;
    }

    .stat-item {
        font-size: 0.75rem;
        gap: 6px;
    }

    .stats-actions {
        width: 100%;
        justify-content: center;
        flex: 1 1 100%;
        order: 2;
    }

    .reset-btn {
        padding: 8px 12px;
        font-size: 0.75rem;
        width: auto;
    }
}

@media (max-width: 1024px) {
        .stats-group {
            gap: 28px;
        }

        .stats-actions {
            flex: 0 1 360px;
        }
    /* Em telas médias, evita colisão de widgets no topo */
    .bottom-left-stack {
        left: 10px;
        bottom: 20px;
    }

    .search-widget {
        left: 10px;
        right: 10px;
        transform: none;
        width: auto;
    }

    .info-panel {
        width: 360px;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 1.15rem;
    }

    header .subtitle {
        font-size: 0.65rem;
    }

    .stats-bar {
        padding: 8px 8px;
        gap: 8px;
    }

    .stat-item {
        font-size: 0.65rem;
        gap: 5px;
    }

    .stat-color {
        width: 14px;
        height: 14px;
    }

    .search-widget {
        padding: 6px;
        gap: 5px;
    }

    .search-input {
        padding: 7px 9px;
        font-size: 0.8rem;
    }

    .search-btn {
        padding: 7px 10px;
        font-size: 0.7rem;
    }

    .info-panel {
        max-height: 35vh;
        bottom: 65px;
    }

    .legend {
        padding: 10px 12px;
        font-size: 0.68rem;
        max-height: 35vh;
    }

    .legend-color {
        width: 16px;
        height: 16px;
        margin-right: 6px;
    }

    .reset-btn {
        padding: 7px 10px;
        font-size: 0.65rem;
    }
}

/* Mobile extra pequeno */
@media (max-width: 360px) {
    header h1 {
        font-size: 1.05rem;
        margin-bottom: 2px;
    }

    header .subtitle {
        font-size: 0.6rem;
    }

    .stats-bar {
        padding: 6px 6px;
        gap: 6px;
    }

    .stat-item {
        font-size: 0.6rem;
        gap: 4px;
    }

    .stat-color {
        width: 12px;
        height: 12px;
    }

    .search-widget {
        padding: 5px;
        gap: 4px;
        bottom: 60px;
    }

    .search-input {
        padding: 6px 8px;
        font-size: 0.75rem;
    }

    .search-btn {
        padding: 6px 8px;
        font-size: 0.65rem;
    }

    .bottom-left-stack {
        /* Mantém a legenda sempre acima do “rodapé” do mapa (attribution) no mobile */
        bottom: calc(16px + env(safe-area-inset-bottom));
        left: 6px;
        right: auto;
        max-width: calc(100vw - 12px);
    }

    .legend {
        padding: 8px 10px;
        font-size: 0.65rem;
        max-height: 30vh;
    }

    .legend h3 {
        font-size: 0.75rem;
        margin-bottom: 5px;
    }

    .legend-item {
        margin: 3px 0;
    }

    .legend-color {
        width: 14px;
        height: 14px;
        margin-right: 5px;
    }

    .reset-btn {
        padding: 6px 8px;
        font-size: 0.6rem;
    }

    .info-panel {
        max-height: 30vh;
        bottom: 60px;
        right: 6px;
        left: 6px;
        width: auto;
    }
}

/* Estilo do mapa */
.leaflet-container {
    background: linear-gradient(180deg, #0a0a1a 0%, #151530 100%);
}

.country-tooltip {
    background: rgba(15, 15, 35, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    padding: 12px 18px;
    color: white;
    font-weight: 600;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
    font-size: 0.95rem;
}

.country-tooltip::before {
    border-top-color: rgba(15, 15, 35, 0.95);
}

/* Loading animation */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 200px;
}

.loading::after {
    content: "";
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top: 4px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Hover effects no mapa */
.leaflet-interactive:hover {
    filter: brightness(1.3);
    cursor: pointer;
}

/* Indicator badge para países com eleição próxima */
.ending-soon-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: linear-gradient(135deg, #f39c12 0%, #e67e22 100%);
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    color: white;
    margin-top: 12px;
    animation: glow 2s infinite;
}

@keyframes glow {
    0%, 100% { box-shadow: 0 0 5px rgba(243, 156, 18, 0.5); }
    50% { box-shadow: 0 0 20px rgba(243, 156, 18, 0.8); }
}

/* Botão de reset do mapa */
.reset-btn {
    background: rgba(15, 15, 35, 0.95);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 12px 20px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.zoom-reset-btn {
    position: absolute;
    top: 241px;
    left: 9px;
    width: 34px;
    height: 34px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    z-index: 1000;
}

.reset-btn:hover {
    background: rgba(52, 152, 219, 0.3);
    border-color: rgba(52, 152, 219, 0.5);
    transform: translateY(-2px);
}

/* Photo placeholder */
.photo-placeholder,
.president-photo-placeholder {
    width: 130px;
    height: 130px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.05) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3.5rem;
    margin: 0 auto 15px;
    border: 4px solid rgba(255, 255, 255, 0.1);
}

.winner-photo-placeholder {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    border: 3px solid rgba(255, 255, 255, 0.2);
    flex-shrink: 0;
}

/* Footer */
.footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    background: rgba(15, 15, 35, 1);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding: 6px 16px;
    z-index: 999999;
    backdrop-filter: blur(10px);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.footer-attribution {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex-shrink: 0;
}

.leaflet-control-attribution {
    background: transparent !important;
    padding: 0 !important;
    font-size: 0.65rem;
    color: rgba(255, 255, 255, 0.6);
    line-height: 1.2;
    white-space: nowrap;
}

.leaflet-control-attribution a {
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    transition: color 0.3s ease;
    font-size: 0.65rem;
}

.leaflet-control-attribution a:hover {
    color: #3498db;
    text-decoration: underline;
}

.leaflet-attribution-flag {
    width: 10px;
    height: 7px;
    margin-right: 3px;
    vertical-align: middle;
    display: inline;
}

.footer-content {
    max-width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    margin: 0;
    flex: 1;
}

.footer p {
    margin: 0;
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.6);
}

.footer-link {
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    font-size: 0.7rem;
    font-weight: 500;
    transition: color 0.3s ease;
}

.footer-link:hover {
    color: #3498db;
}

/* Ajuste do mapa para não sobrepor footer */
#map {
    margin-bottom: 0;
}

@media (max-width: 600px) {
    .bottom-left-stack {
        bottom: calc(60px + 3px - 10px);
    }

    .legend {
        padding: 8px 10px;
        min-width: auto;
        font-size: 0.65rem;
    }

    .legend h3 {
        font-size: 0.65rem;
        margin-bottom: 6px;
        padding-bottom: 4px;
    }

    .legend-item {
        font-size: 0.65rem;
        margin: 4px 0;
    }

    .legend-color {
        width: 8px;
        height: 8px;
        margin-right: 5px;
    }

    .footer {
        padding: 8px 10px 6px 10px;
        gap: 6px;
        flex-direction: column;
        justify-content: flex-start;
        align-items: flex-start;
        min-height: 45px;
    }

    .footer-attribution {
        justify-content: flex-end;
        gap: 6px;
        width: 100%;
    }

    .leaflet-control-attribution {
        font-size: 0.6rem;
        line-height: 1.1;
        white-space: normal;
    }

    .leaflet-control-attribution a {
        font-size: 0.6rem;
    }

    .footer-content {
        gap: 10px;
        width: 100%;
        justify-content: center;
    }

    .footer p,
    .footer-link {
        font-size: 0.65rem;
    }

    #map {
        margin-bottom: 50px;
    }
}


.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}
