@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@300;400;500;700&family=Poppins:wght@400;600;700&display=swap');

:root {
    --primary-gold: #D4AF37;
    --secondary-blue: #2255A3;
    --bg-dark: #050508;
    --text-white: #ffffff;
    --text-gray: #a0a0a0;
    --font-main: 'Montserrat', sans-serif;
    --font-titles: 'Poppins', sans-serif;
    --swiper-navigation-size: 20px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
    /* Remove blue touch highlight on mobile */
    outline: none;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

/* Specific fix for embedded SVGs and map containers */
#map-object,
#map-overlay,
#svg-wrapper,
.map-frame,
object,
embed,
svg {
    outline: none !important;
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0) !important;
    -webkit-user-select: none !important;
    user-select: none !important;
    -webkit-touch-callout: none !important;
}

/* Ensure no focus ring on any interactive element unless specified */
:focus {
    outline: none !important;
}

body {
    background-color: var(--bg-dark);
    font-family: var(--font-main);
    color: var(--text-white);
    min-height: 100vh;
    overflow: hidden;
    /* No scrollbars ever */
}

h1,
h2,
h3,
h4,
h5,
h6,
.welcome-title,
.popup-header h3,
.tab-text,
.user-name-text {
    font-family: var(--font-titles);
}

iframe {
    max-width: 100%;
}

.swiper {
    padding-right: 15px;
}

/* --- Layout Components (Login) --- */
.login-wrapper {
    width: 100%;
    max-width: 420px;
    padding: 20px;
    display: flex;
    justify-content: center;
    margin: 0 auto;
    min-height: 100vh;
    align-items: center;
}

.login-card {
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(28, 85, 166, 0.3);
    border-radius: 20px;
    padding: 40px 30px;
    width: 100%;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.login-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--secondary-blue), transparent);
}

.login-logo {
    width: 140px;
    height: auto;
    margin-bottom: 20px;
    filter: drop-shadow(0 0 15px rgba(28, 85, 166, 0.6));
    animation: pulseLogo 3s infinite ease-in-out;
}

.welcome-title {
    font-size: 1.5rem;
    letter-spacing: 4px;
    color: #fff;
    margin-bottom: 15px;
    text-transform: uppercase;
}

.welcome-subtitle {
    font-size: 0.9rem;
    color: var(--text-gray);
    margin-bottom: 10px;
}

#login-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group input {
    width: 100%;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 12px 15px;
    color: #fff;
    margin-top: 10px;
}

.btn-neon {
    width: 100%;
    padding: 14px;
    background: transparent;
    border: 1px solid var(--secondary-blue);
    color: var(--secondary-blue);
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.btn-neon:hover {
    background: var(--secondary-blue);
    color: #fff;
    box-shadow: 0 0 30px rgba(28, 85, 166, 0.6);
}

/* --- IMMERSIVE DASHBOARD LAYOUT (CENTRAL FRAME) --- */

.dashboard-wrapper {
    position: relative;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    /* Better mobile viewport support */
    background: radial-gradient(circle at center, #1b2838 0%, #000 90%);
    overflow: hidden;
}

/* 1. Floating UI Containers */
.floating-ui {
    position: absolute;
    z-index: 1;
    pointer-events: none;
}

.top-left {
    top: 30px;
    left: 40px;
}

.top-right {
    top: 30px;
    right: 40px;
}

.bottom-left {
    display: none;
    /* Stats hidden - user preference */
    bottom: 30px;
    left: 40px;
}

/* CTA Button (Déjanos tus datos) - Bottom Left Position */
.bottom-left-cta {
    left: 64%;
    bottom: 50px;
    pointer-events: auto;
}

.bottom-left-cta .cta-button {
    animation: pulse-cta 2s infinite;
}

@keyframes pulse-cta {

    0%,
    100% {
        box-shadow: 0 0 20px rgba(255, 234, 22, 0.3);
    }

    50% {
        box-shadow: 0 0 30px rgba(255, 234, 22, 0.6);
    }
}

.bottom-right {
    bottom: 30px;
    right: 40px;
}

.right-center {
    top: 35%;
    right: 40px;
    transform: translateY(-50%);
}

/* Logo */
.ui-logo {
    height: 45px;
    width: auto;
    filter: drop-shadow(0 0 10px rgba(28, 85, 166, 0.5));
    pointer-events: auto;
}

/* User Display (Simple Text) */
.header-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    pointer-events: auto;
}

.glass-icon-btn {
    background: rgba(28, 85, 166, 0.3);
    border: 1px solid rgba(28, 85, 166, 0.5);
    color: var(--secondary-blue);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    backdrop-filter: blur(5px);
    transition: 0.3s;
}

.glass-icon-btn:hover {
    background: var(--secondary-blue);
    color: #fff;
    box-shadow: 0 0 15px rgba(28, 85, 166, 0.5);
}

.user-display {
    padding: 10px 20px;
    pointer-events: auto;
    /* Optional: glass background for user name too */
    background: rgba(0, 0, 0, 0.4);
    border-radius: 30px;
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.user-name-text {
    color: #fff;
    font-size: 1rem;
    font-weight: 500;
    text-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
    letter-spacing: 1px;
}

/* Social Media Stack */
.left-center {
    top: 50%;
    left: 40px;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 15px;
    pointer-events: auto;
}

.social-stack {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.social-btn {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: 0.3s;
    backdrop-filter: blur(5px);
}

.social-btn:hover {
    transform: scale(1.1);
    border-color: var(--primary-gold);
    color: var(--primary-gold);
    box-shadow: 0 0 15px rgba(212, 175, 55, 0.3);
}

.social-btn.facebook:hover {
    background: #1877F2;
    border-color: #1877F2;
    color: #fff;
}

.social-btn.instagram:hover {
    background: #E4405F;
    border-color: #E4405F;
    color: #fff;
}

/* 2. Central Stage (The Map Frame) */
.central-stage {
    position: absolute;
    inset: 0;
    /* Fill screen */
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10;
    pointer-events: none;
    /* Allow clicks to pass through empty areas */
}

.map-frame {
    position: relative;
    width: 60vw;
    height: 80vh;
    border: 1px solid rgba(255, 255, 255, 0.05);
    /* Very subtle border */
    display: flex;
    justify-content: center;
    align-items: center;
    pointer-events: auto;
    /* Optional: Slight background to separate map from void */
    background: radial-gradient(circle, rgba(28, 85, 166, 0.05) 0%, transparent 60%);
    z-index: 500;
}

.map-container {
    width: 100%;
    height: 100%;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

#map-object {
    width: 100%;
    height: 100%;
    /* Ensure object fits container */
    display: block;
}

.map-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 20;
    pointer-events: none;
    transition: all 0.3s ease;
}


/* Corners */
.frame-corner {
    position: absolute;
    width: 30px;
    height: 30px;
    border: 2px solid var(--secondary-blue);
    box-shadow: 0 0 10px var(--secondary-blue);
    pointer-events: none;
}

.top-left-corner {
    top: -2px;
    left: -2px;
    border-right: 0;
    border-bottom: 0;
}

.top-right-corner {
    top: -2px;
    right: -2px;
    border-left: 0;
    border-bottom: 0;
}

.bottom-left-corner {
    bottom: -2px;
    left: -2px;
    border-right: 0;
    border-top: 0;
}

.bottom-right-corner {
    bottom: -2px;
    right: -2px;
    border-left: 0;
    border-top: 0;
}

/* 3. Controls (Switcher) */
.map-controls {
    position: absolute;
    bottom: -60px;
    /* Position relative to the frame bottom based on user sketch */
    left: 50%;
    transform: translateX(-50%);
    pointer-events: auto;
    z-index: 10;
}

/* If user wants it INSIDE the frame, adjust bottom: 20px instead of -60px. 
   Based on "Central Frame" screenshot, it looks slightly floating near bottom. 
   Let's put it solidly inside/overlapping the bottom edge. */
.map-controls {
    bottom: 20px;
}

.glass-pill {
    background: rgba(0, 85, 186, 0.85);
    border: 1px solid rgba(28, 85, 166, 0.5);
    border-radius: 50px;
    padding: 6px 10px;
    display: flex;
    align-items: center;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
}

.pill-btn {
    background: none;
    border: none;
    color: #fff;
    padding: 8px 20px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: 0.3s;
    border-radius: 30px;
    letter-spacing: 1px;
}

.pill-btn.active {
    color: #fff;
    background: rgba(28, 85, 166, 0.3);
    border: 1px solid rgba(28, 85, 166, 0.4);
    box-shadow: 0 0 10px rgba(28, 85, 166, 0.2);
}

.pill-divider {
    width: 1px;
    height: 15px;
    background: #333;
    margin: 0 5px;
}

/* 4. Tabs (Right) */
.tabs-stack {
    display: flex;
    flex-direction: column;
    gap: 20px;
    align-items: flex-end;
}

.tab-card {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 10px 25px;
    background: rgba(28, 85, 166, 0.3);
    border: 1px solid rgba(28, 85, 166, 0.5);
    backdrop-filter: blur(5px);
    border-radius: 50px;
    cursor: pointer;
    transition: 0.3s;
    color: #fff;
    text-align: left;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    pointer-events: auto;
}

.tab-card:hover {
    transform: translateX(-10px);
    background: rgba(28, 85, 166, 0.3);
    border-color: var(--secondary-blue);
    box-shadow: 0 0 15px rgba(28, 85, 166, 0.4);
}

.tab-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    box-shadow: 0 0 10px currentColor;
}

.bio {
    background: #1D54A7;
    color: #1D54A7;
}

.legal {
    background: #fff;
    color: #fff;
}

.data {
    background: #FFEA16;
    color: #FFEA16;
}

.tab-text {
    font-size: 0.9rem;
    font-weight: 500;
}

/* 5. Footer Stats & Avatar */
.stats-box {
    background: rgba(16, 25, 50, 0.6);
    padding: 10px 20px;
    border-radius: 12px;
    border: 1px solid rgba(28, 85, 166, 0.3);
    display: flex !important;
    align-items: center;
    gap: 15px;
    pointer-events: auto;
}

.stats-label-group {
    display: flex !important;
    align-items: center;
    gap: 8px;
}

.stats-text-col {
    display: flex !important;
    flex-direction: column !important;
    text-align: right;
    font-size: 0.6rem;
    color: #aaa;
    letter-spacing: 2px;
    line-height: 1.2;
    font-family: var(--font-titles);
}

.stats-colon {
    font-size: 2.5rem;
    line-height: 0.8;
    color: var(--primary-gold);
    font-weight: 300;
    margin-bottom: 5px;
    /* Visual adjustment */
}

.stats-number-col {
    display: flex;
    align-items: center;
}

.stats-number {
    font-size: 1.4rem;
    color: var(--primary-gold);
    font-family: monospace;
    font-weight: bold;
    display: block;
    white-space: nowrap;
}

/* Legacy removed: .stats-label */

.avatar-container {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    cursor: pointer;
    transition: transform 0.2s;
    pointer-events: auto;
}

.avatar-container:hover {
    transform: scale(1.05);
}

.avatar-frame {
    width: 80%;
    height: 40%;
    padding: 3px;
}

.avatar-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.avatar-label {
    margin-top: 8px;
    font-size: 0.8rem;
    color: #ccc;
    letter-spacing: 1px;
    text-transform: uppercase;
}

/* Popups & Utilities */
.hidden {
    display: none !important;
}

.popup-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.2);
    z-index: 100;
    display: flex;
    justify-content: center;
    align-items: flex-end;
}

.popup-drawer {
    width: 100%;
    max-width: 600px;
    background: #0B1021;
    border-top: 2px solid var(--secondary-blue);
    padding: 20px;
    animation: slideUp 0.4s ease-out;
}

.popup-header {
    display: flex;
    justify-content: space-between;
    color: #fff;
    margin-bottom: 20px;
}

.close-btn {
    background: none;
    border: none;
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }

    to {
        transform: translateY(0);
    }
}

@keyframes pulseLogo {

    0%,
    100% {
        filter: drop-shadow(0 0 10px rgba(28, 85, 166, 0.5));
    }

    50% {
        filter: drop-shadow(0 0 20px rgba(28, 85, 166, 0.8));
    }
}

/* Mobile */
/* Mobile */
@media (max-width: 768px) {
    .floating-ui {
        z-index: 600;
    }

    .map-frame {
        width: 100vw;
        height: 75vh;
        /* Taller to fit the tail */
        border: none;
        background: none;
        /* Center map vertically */
        margin-top: 0;
    }

    .frame-corner {
        display: none;
    }

    /* 1. Header Logic stays, just slight adjust */
    .top-left {
        top: 20px;
        left: 20px;
    }

    .top-right {
        top: 20px;
        right: 20px;
    }

    .ui-logo {
        height: 35px;
    }

    .user-name-text {
        font-size: 0.9rem;
        max-width: 120px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        display: inline-block;
        vertical-align: middle;
    }

    /* HEADER CONTROLS MOBILE */
    .header-controls {
        gap: 5px;
        /* Prevent reaching the logo */
    }

    .glass-icon-btn {
        width: 35px;
        height: 35px;
    }

    .user-display {
        padding: 5px 15px;
    }

    /* SOCIAL MOBILE: Move to Bottom Right above Avatar or Bottom Left? 
       Let's put them Bottom Left, above stats.
    */
    .left-center {
        top: auto;
        bottom: 120px;
        /* Above stats */
        left: 20px;
        transform: none;
    }

    .social-stack {
        flex-direction: row;
        /* Horizontal on mobile */
    }

    .social-btn {
        width: 38px;
        height: 38px;
    }

    /* CTA Button Mobile: Bottom Left */
    .bottom-left-cta {
        bottom: 60px;
        left: 30px;
    }

    .bottom-left-cta .cta-button {
        padding: 8px 15px;
    }

    /* 2. Tabs moved to TOP CENTER (Horizontal Row) */
    .right-center {
        top: 90px;
        right: auto;
        left: 50%;
        transform: translateX(-50%);
        width: 100%;
        display: flex;
        justify-content: center;
        pointer-events: none;
    }

    .tabs-stack {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        width: 100%;
        max-width: none;
        gap: 4px;
        padding: 0 10px;
        border: none;
    }

    .tab-card {
        padding: 4px 10px;
        border-radius: 50px;
        background: rgba(28, 85, 166, 0.3);
        border: 1px solid rgba(28, 85, 166, 0.5);
        gap: 5px;
        flex-grow: 1;
        justify-content: center;
        /* Default adjustments in specific rules below */
    }

    /* REORDER LOGIC: 
       Row 1: Short Texts (Conoceme, Ordenanzas, Vota) -> Indices 1, 3, 4
       Row 2: Long Texts (Iniciativas, Datos) -> Indices 2, 5 
    */
    .tab-card:nth-child(1) {
        order: 1;
    }

    .tab-card:nth-child(3) {
        order: 2;
        max-width: 32%;
    }

    .tab-card:nth-child(4) {
        order: 3;
        max-width: 32%;
    }

    .tab-card:nth-child(2) {
        order: 4;
        max-width: 49%;
    }

    /* Long text 1 */
    .tab-card:nth-child(5) {
        order: 5;
        max-width: 49%;
    }

    /* Long text 2 */

    .tab-text {
        display: block;
        font-size: 0.65rem;
        white-space: nowrap;
    }

    /* 3. Footer Elements LIFTED for visibility & Safe Area */
    .bottom-left {
        bottom: calc(5px + env(safe-area-inset-bottom));
        /* Lifted significantly for iOS */
        left: 20px;
    }

    .bottom-right {
        bottom: calc(0px + env(safe-area-inset-bottom));
        /* Lifted significantly for iOS */
        right: 5px;
    }

    /* Stats smaller on mobile */
    /* Stats smaller on mobile */
    .stats-number {
        font-size: 1.1rem;
    }

    .stats-text-col {
        font-size: 0.5rem;
    }

    .stats-colon {
        font-size: 1.8rem;
    }

    .avatar-frame {
        width: 60%;
        height: 40%;
    }

    /* Map Switcher also lifted significantly */
    .map-controls {
        left: 20px;
        right: auto;
        transform: none;
        bottom: calc(0px + env(safe-area-inset-bottom));
        /* Above stats box */
        display: flex;
        justify-content: flex-start;
    }
}

/* --- 6. POPUP DRAWER STYLES (NEW) --- */
.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    /* Bottom Sheet style on Mobile */
    opacity: 1;
    transition: opacity 0.3s ease;
}

.popup-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.popup-drawer {
    width: 100%;
    max-width: 600px;
    /* Desktop limit */
    background: rgba(10, 20, 40, 0.95);
    border: 1px solid var(--secondary-blue);
    border-bottom: none;
    border-radius: 20px 20px 0 0;
    padding: 20px;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.8);

    /* REMOVED: transform/transition (Let JS/GSAP handle animation) */

    /* CRITICAL: SCROLL LIMITS */
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}

/* REMOVED .popup-overlay.hidden .popup-drawer rule (JS handles Y position) */

.popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
    /* Header stays fixed */
}

.popup-header h3 {
    color: var(--primary-gold);
    font-size: 1.2rem;
    letter-spacing: 1px;
}

.close-btn {
    background: none;
    border: none;
    color: var(--text-gray);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 5px;
}

.close-btn:hover {
    color: #fff;
}

/* Swiper Container inside Popup */
.popup-drawer .swiper {
    width: 100%;
    height: 100%;
    /* Fill remaining drawer space */
    /* Crucial for nested flex scroll */
    flex-grow: 1;
}

/* Scroll INSIDE the slide, not the container */
.popup-drawer .swiper-slide {
    height: 100%;
    /* FORCE height to match container so overflow triggers */
    max-height: 100%;
    overflow-y: auto;
    /* Scrollable Text */
    box-sizing: border-box;
    /* Include padding in height calc */
    color: #ddd;
    font-size: 0.95rem;
    line-height: 1.6;
    padding-bottom: 50px !important;
    /* Extra padding so text clears the Dots */
}

/* Pagination Dots Customization */
.popup-drawer .swiper-pagination {
    position: absolute;
    bottom: 10px;
    /* Ensure dots are visible over padding */
    pointer-events: none;
    /* Let clicks pass through if needed */
}

@media (min-width: 769px) {
    .popup-overlay {
        align-items: flex-end;
        /* Force bottom anchor */
    }

    .popup-drawer {
        border-radius: 20px 20px 0 0;
        /* Flat bottom */
        border-bottom: none;
        max-height: 80vh;
        /* Slightly smaller on big screens */
        margin-bottom: 0;
    }
}

/* Swiper Overlay Fixes */
.swiper {
    padding-bottom: 30px !important;
    /* Make room for pagination */
}

.swiper-pagination-bullet {
    background: rgba(255, 255, 255, 0.4);
    opacity: 1;
}

.swiper-pagination-bullet-active {
    background: #ffffff !important;
}

.swiper-pagination {
    bottom: 0px !important;
}

/* Gallery Image Responsive */
.popup-gallery-img {
    width: 100%;
    max-height: 170px;
    /* Desktop strict */
    object-fit: contain;
    border-radius: 8px;
}

@media (max-width: 768px) {
    .popup-gallery-img {
        max-height: 350px;
        /* Mobile larger */
    }
}

/* --- MAP LABELS --- */
.map-label-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    /* Dimensions will be set by JS into inline styles to match SVG aspect ratio */
    width: 100%;
    height: 100%;
    z-index: 21;
    /* Above svg (20) */
    pointer-events: none;
    /* CRITICAL: Allow clicks to pass through */
}

.map-label {
    position: absolute;
    color: #FFFFFF;
    /* Default color */
    font-family: var(--font-main);
    font-size: 0.6rem;
    /* Desktop default */
    text-align: center;
    pointer-events: none;
    /* Extra safety */
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
    letter-spacing: 1px;

    /* Configurable Defaults (Uncomment to use per label if needed in JS or specific classes) */
    /* transform: rotate(0deg); */
    /* white-space: nowrap; */
    /* width: 150px; */
    /* line-height: 1.2; */
}

@media (max-width: 768px) {
    .map-label {
        font-size: 0.55rem;
        /* Smaller for mobile */
        letter-spacing: 0.5px;
    }
}

/* Example specific override class if needed later */