/* ====== BASE STYLES ====== */
:root {
    --bg-dark: #0a0b1e;
    --text-primary: #ffffff;
    --text-secondary: #a0a0b0;
    --accent: #ff4d4d;
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --card-bg: rgba(20, 20, 40, 0.6);
}

body {
    margin: 0;
    padding: 0;
    background-color: var(--bg-dark);
    font-family: 'Outfit', sans-serif;
    color: var(--text-primary);
    overflow-x: hidden;
    /* Evitar scroll horizontal */
}

a {
    color: var(--accent);
    text-decoration: none;
}

/* ====== SCROLLBAR CUSTOMIZATION ====== */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #0a0b1e;
}

::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* ====== PUBLIC MAP UI ====== */
#map {
    width: 100vw;
    height: 100vh;
    z-index: 1;
}

.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

/* ====== OLD UI REMOVED ====== */

.custom-tooltip {
    position: absolute;
    background: rgba(10, 11, 30, 0.9);
    border: 1px solid var(--glass-border);
    padding: 10px 15px;
    border-radius: 8px;
    color: #fff;
    pointer-events: none;
    z-index: 2000;
    font-size: 0.9rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
    white-space: nowrap;
}

.dept-label {
    background: transparent;
    border: none;
    box-shadow: none;
    color: rgba(255, 255, 255, 0.7);
    font-family: 'Outfit', sans-serif;
    font-size: 10px;
    font-weight: 600;
    text-shadow: 0 0 3px #000;
    text-align: center;
    pointer-events: none;
}

/* ====== ADMIN PANEL STYLES ====== */
.admin-container {
    display: flex;
    gap: 20px;
    max-width: 1200px;
    margin: 40px auto;
    padding: 0 20px;
    height: calc(100vh - 80px);
    /* Full height minus margins */
}

.controls-section {
    flex: 2;
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 25px;
    overflow-y: auto;
}

.news-section {
    flex: 1;
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 25px;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.admin-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
}

.dept-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 15px;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: transform 0.2s;
}

.dept-card:hover {
    transform: translateY(-2px);
    border-color: rgba(255, 255, 255, 0.2);
}

.dept-name {
    font-weight: 600;
    margin-bottom: 10px;
    display: block;
    color: #eee;
}

.input-group {
    display: flex;
    gap: 5px;
}

/* Inputs & Buttons */
input[type="number"] {
    background: #1a1b2e;
    border: 1px solid #444;
    color: #fff;
    padding: 5px;
    border-radius: 6px;
    width: 60px;
    text-align: center;
}

button {
    cursor: pointer;
    font-family: inherit;
    border: none;
    border-radius: 6px;
    transition: all 0.2s;
}

.input-group button {
    background: #333;
    color: #fff;
    width: 30px;
    font-weight: bold;
}

.input-group button:hover {
    background: #555;
}

.save-btn {
    background: var(--accent);
    color: white;
    padding: 10px 20px;
    font-weight: 600;
}

.save-btn:hover {
    background: #ff3333;
    box-shadow: 0 0 10px rgba(255, 77, 77, 0.4);
}

.confirm-btn {
    background: #3b82f6;
    color: white;
    padding: 4px 10px;
    font-size: 0.8rem;
}

.confirm-btn:hover {
    background: #2563eb;
}

/* News Feed Items */
.news-item {
    background: rgba(0, 0, 0, 0.2);
    border-left: 3px solid #555;
    padding: 12px;
    margin-bottom: 12px;
    border-radius: 0 8px 8px 0;
}

/* ====== SHARE UNIQUE DESIGN ====== */
.floating-btn {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(20, 20, 40, 0.9);
    backdrop-filter: blur(10px);
    color: #fff;
    padding: 12px 30px;
    border-radius: 50px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    transition: all 0.3s ease;
    z-index: 1000;
    display: flex;
    align-items: center;
    letter-spacing: 0.5px;
}

.floating-btn:hover {
    background: #fff;
    color: #000;
    transform: translateX(-50%) translateY(-5px);
    box-shadow: 0 15px 35px rgba(255, 255, 255, 0.2);
}

.share-card {
    background: #0f1016;
    border: 1px solid #222;
    border-radius: 24px;
    padding: 30px;
    text-align: center;
    max-width: 380px;
    width: 90%;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.9);
}

.close-share-x {
    position: absolute;
    top: 15px;
    right: 20px;
    background: transparent;
    border: none;
    color: #444;
    font-size: 2rem;
    cursor: pointer;
    line-height: 0.5;
    transition: color 0.3s;
}

.close-share-x:hover {
    color: #fff;
}

.share-title {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(45deg, #fff, #aaa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.share-subtitle {
    margin: 5px 0 20px;
    color: #666;
    font-size: 0.9rem;
}

.preview-frame {
    background: #1a1a2e;
    padding: 10px;
    border-radius: 12px;
    border: 1px solid #333;
    margin-bottom: 25px;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.5);
}

.map-preview-box {
    height: 180px;
    width: 100%;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
}

.btn-download-gradient {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, #ff4757, #ff6b81);
    color: white;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.btn-download-gradient:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(255, 71, 87, 0.4);
}

.share-divider {
    margin: 20px 0;
    position: relative;
    text-align: center;
}

.share-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    height: 1px;
    background: #222;
    z-index: 1;
}

.share-divider span {
    background: #0f1016;
    padding: 0 15px;
    color: #555;
    font-size: 0.8rem;
    position: relative;
    z-index: 2;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.social-icons-row {
    display: flex;
    justify-content: center;
    gap: 20px;
}

.social-circle-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: none;
    color: #fff;
    font-size: 1.2rem;
    cursor: pointer;
    transition: transform 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: inherit;
    font-weight: bold;
}

.social-circle-btn:hover {
    transform: scale(1.1);
}

.social-circle-btn.twitter {
    background: #000;
    border: 1px solid #333;
}

.social-circle-btn.facebook {
    background: #1877f2;
}

.social-circle-btn.whatsapp {
    background: #25d366;
}

.news-source {
    font-size: 0.7rem;
    text-transform: uppercase;
    color: var(--accent);
    font-weight: bold;
    margin-right: 10px;
}

.news-date {
    font-size: 0.75rem;
    color: #777;
}

.news-title {
    margin-top: 5px;
    font-size: 0.95rem;
    line-height: 1.4;
}

.news-title a:hover {
    text-decoration: underline;
}

.suggested-action {
    margin-top: 10px;
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.3);
    padding: 8px;
    border-radius: 6px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}


/* ====== MOBILE RESPONSIVE ====== */
/* ====== MOBILE RESPONSIVE ====== */
/* Stats Panel Styles */
.stats-panel {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 280px;
    z-index: 1000;
    padding: 15px;
    background: rgba(13, 17, 23, 0.9);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.stats-toggle-btn {
    display: none;
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 1001;
    background: rgba(13, 17, 23, 0.9);
    color: #fff;
    border: 1px solid #444;
    padding: 0;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    font-size: 1.5rem;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    cursor: pointer;
}

.close-stats-btn {
    display: none;
    /* Desktop default: no close button */
    position: absolute;
    top: 8px;
    right: 12px;
    background: transparent;
    border: none;
    color: #888;
    font-size: 1.8rem;
    cursor: pointer;
    line-height: 0.8;
}

/* ====== MOBILE RESPONSIVE ====== */
@media (max-width: 768px) {

    /* Mobile styles */
    .stats-panel {
        top: auto;
        bottom: 20px;
        right: 10px;
        left: 10px;
        width: auto;
        /* Fluid width */
        max-width: none;
        transform: translateY(150%);
        /* Hidden down */
        opacity: 0;
        pointer-events: none;

        /* Smaller font and padding */
        padding: 12px;
        font-size: 0.9rem;
    }

    .stats-panel.open {
        transform: translateY(0);
        opacity: 1;
        pointer-events: auto;
    }

    .stats-toggle-btn {
        display: flex;
        top: auto;
        bottom: 20px;
        right: 20px;
    }

    .close-stats-btn {
        display: block;
    }

    .admin-container {
        flex-direction: column;
        margin: 10px;
        padding: 0;
        height: auto;
    }

    /* Make stats compact on mobile */
    .stats-panel h3 {
        font-size: 1rem !important;
    }

    .stats-panel h4 {
        font-size: 0.8rem !important;
    }

    .stats-panel li {
        font-size: 0.85rem !important;
    }

    /* Share Button Compact for Mobile */
    .floating-btn {
        width: 50px;
        height: 50px;
        padding: 0;
        border-radius: 50%;
        left: 20px;
        transform: none;
        /* Reset distinct centering */
        bottom: 20px;
        justify-content: center;
        font-size: 0;
        /* Hide text */
    }

    .floating-btn span {
        font-size: 1.4rem !important;
        margin: 0 !important;
    }

    /* Ensure modal fits on mobile */
    .share-card {
        padding: 20px;
        width: 85%;
    }

    .share-title {
        font-size: 1.2rem;
    }

    #days-counter-panel {
        top: 15px !important;
        padding: 5px 15px !important;
        width: auto;
        white-space: nowrap;
    }
}

/* ====== MODAL BARRIOS ====== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: #161b22;
    border: 1px solid #30363d;
    padding: 25px;
    border-radius: 12px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    color: #fff;
    display: flex;
    flex-direction: column;
}

.barrios-list {
    max-height: 300px;
    overflow-y: auto;
    margin: 15px 0;
    border: 1px solid #333;
    border-radius: 6px;
    background: #0d1117;
}

.barrio-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 10px;
    border-bottom: 1px solid #222;
}

.barrio-row:last-child {
    border-bottom: none;
}

.add-barrio-form {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #333;
}

.add-barrio-form input {
    flex: 1;
}

.delete-btn {
    background: transparent;
    color: #ff4757;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    line-height: 1;
}

.modal-actions {
    margin-top: 15px;
    display: flex;
    justify-content: flex-end;
}

/* ====== LOGIN SCREEN ====== */
.login-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #0a0b1e;
    z-index: 3000;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
}

.login-box {
    background: #161b22;
    padding: 40px;
    border-radius: 16px;
    border: 1px solid #30363d;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.5);
    text-align: center;
    width: 300px;
}

.login-box h2 {
    margin-top: 0;
    color: #fff;
    font-size: 1.5rem;
    margin-bottom: 20px;
}

.login-input {
    width: 100%;
    padding: 12px;
    margin-bottom: 15px;
    background: #0d1117;
    border: 1px solid #30363d;
    color: #fff;
    border-radius: 6px;
    box-sizing: border-box;
    font-size: 1rem;
    text-align: center;
}

.login-btn {
    width: 100%;
    padding: 12px;
    background: var(--accent);
    color: white;
    font-weight: bold;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.3s;
}

.login-btn:hover {
    background: #ff3333;
}

.error-msg {
    color: #ff4757;
    margin-top: 15px;
    font-size: 0.9rem;
    display: none;
}

/* ====== LOGO STYLES ====== */
.logo-container {
    display: flex;
    justify-content: center;
    margin-bottom: 15px;
}

.app-logo {
    max-width: 120px;
    height: auto;
    filter: drop-shadow(0 0 10px rgba(255, 77, 77, 0.3));
    transition: transform 0.3s ease;
}

.app-logo:hover {
    transform: scale(1.05);
    filter: drop-shadow(0 0 15px rgba(255, 77, 77, 0.5));
}

/* Adjust HUD Title spacing */
.hud-container h1 {
    text-align: center;
    /* Center align title under logo */
    margin-top: 10px;
}

.hud-container .subtitle {
    text-align: center;
}

/* Mobile Adjustments for Logo */
@media (max-width: 768px) {
    .app-logo {
        max-width: 80px;
        /* Smaller logo on mobile */
    }

    .logo-container {
        margin-bottom: 5px;
    }
}

/* ====== BLINKING RED CIRCLE MARKER ====== */
.blinking-marker {
    background-color: rgba(255, 71, 87, 0.6);
    width: 20px;
    height: 20px;
    border-radius: 50%;
    position: relative;
    border: 2px solid #fff;
    box-shadow: 0 0 0 rgba(255, 71, 87, 0.4);
    animation: pulse-red 2s infinite;
}

.blinking-marker::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 8px;
    height: 8px;
    background-color: #ff4757;
    border-radius: 50%;
}

@keyframes pulse-red {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(255, 71, 87, 0.7);
    }

    70% {
        transform: scale(1);
        box-shadow: 0 0 0 15px rgba(255, 71, 87, 0);
    }

    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(255, 71, 87, 0);
    }
}

/* Floating Logo */
.floating-logo {
    position: absolute;
    top: 20px;
    left: 20px;
    width: 60px;
    /* Desktop size */
    z-index: 1000;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.3));
    transition: transform 0.3s ease;
    cursor: pointer;
}

.floating-logo:hover {
    transform: scale(1.1) rotate(-5deg);
}

/* Mobile Adjustment */
@media (max-width: 768px) {
    .floating-logo {
        width: 45px;
        top: 15px;
        left: 15px;
    }
}