/* ====== GOOGLE MAPS InfoWindow ====== */
.gm-style .gm-style-iw-c {
    border-radius: 12px !important;
    box-shadow: 0 4px 20px rgba(0,0,0,0.25) !important;
    padding: 0 !important;
}
.gm-style .gm-style-iw-d {
    overflow: hidden !important;
}
.gm-style .gm-style-iw-ch {
    display: none !important;
}
.gm-style-iw-chr {
    display: none !important;
}
/* Quitar borde del mapa */
.gm-style iframe + div { border: none !important; }

/* ====== REPOST MENU ====== */
.rm-item {
    padding: 14px 18px;
    display: flex; align-items: center; gap: 10px;
    cursor: pointer; font-size: 0.95rem; color: #e7e9ea;
    transition: background 0.12s; white-space: nowrap;
}
.rm-item:hover { background: rgba(255,255,255,0.06); }
.rm-item:not(:last-child) { border-bottom: 1px solid #1e2226; }

/* ====== QUOTE EMBED ====== */
.quote-embed {
    margin-top: 10px;
    border: 1px solid #2f3336;
    border-radius: 10px;
    padding: 10px 12px;
    background: rgba(255,255,255,0.02);
    cursor: pointer;
    transition: background 0.15s;
}
.quote-embed:hover { background: rgba(255,255,255,0.05); }
.quote-embed-meta    { font-size: 0.72rem; color: #71767b; margin-bottom: 4px; }
.quote-embed-title   { font-size: 0.88rem; font-weight: 700; color: #e7e9ea; margin-bottom: 2px; word-break:break-word; }
.quote-embed-content { font-size: 0.82rem; color: #94a3b8; word-break:break-word; }
.quote-embed-media   { max-width:100%; max-height:160px; border-radius:7px; margin-top:7px; object-fit:cover; display:block; }
.quote-embed-source  { font-size:0.73rem; color:#3b82f6; margin-top:5px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }

/* ====== COMMENT BOUNCE ANIMATION ====== */
@keyframes commentPop {
    0%   { transform: scale(1) rotate(0deg);   filter: brightness(1); }
    15%  { transform: scale(1.4) rotate(-8deg); filter: brightness(1.4); }
    30%  { transform: scale(0.9) rotate(6deg);  filter: brightness(1); }
    45%  { transform: scale(1.2) rotate(-4deg); filter: brightness(1.3); }
    60%  { transform: scale(1) rotate(0deg);   filter: brightness(1); }
    100% { transform: scale(1) rotate(0deg);   filter: brightness(1); }
}
@keyframes commentGlow {
    0%, 100% { box-shadow: 0 0 0px rgba(29,155,240,0); color: #94a3b8; }
    50%       { box-shadow: 0 0 8px rgba(29,155,240,0.6); color: #1d9bf0; }
}
.comment-count-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    padding: 3px 8px;
    border-radius: 99px;
    font-size: 0.8rem;
    font-weight: 600;
    user-select: none;
    animation: commentGlow 1.8s ease-in-out infinite;
}
.comment-count-btn:hover {
    background: rgba(29, 155, 240, 0.15);
    color: #1d9bf0 !important;
    box-shadow: 0 0 10px rgba(29,155,240,0.4) !important;
    animation: none;
}
.comment-count-btn .cc-icon {
    display: inline-block;
    animation: commentPop 2s ease-in-out infinite;
}
.comment-count-btn:hover .cc-icon {
    animation: none;
    transform: scale(1.3);
    transition: transform 0.15s;
}

/* ====== REPOST SPIN (hover/active only) ====== */
@keyframes repostSpin{from{transform:rotate(0deg)}to{transform:rotate(360deg)}}
#rb-btn svg, [id^="rb-"] svg{transform-origin:center;}
[id^="rb-"]:hover svg,[id^="rb-"]:active svg{animation:repostSpin 0.6s linear infinite;}

/* ====== BELL SHAKE ANIMATION ====== */
@keyframes bellShake {
    0%, 100% { transform: rotate(0deg);  }
    10%      { transform: rotate(18deg); }
    20%      { transform: rotate(-16deg);}
    30%      { transform: rotate(14deg); }
    40%      { transform: rotate(-10deg);}
    50%      { transform: rotate(5deg);  }
    60%      { transform: rotate(0deg);  }
}
.bell-shake {
    display: inline-block;
    transform-origin: top center;
    animation: bellShake 0.6s ease-in-out;
}

/* ====== AVATAR GLOW ANIMATION ====== */
@keyframes avatarGlowPulse {
    0%, 100% { box-shadow: 0 0 12px rgba(255, 71, 87, 0.6), 0 0 28px rgba(255, 71, 87, 0.2); }
    50%       { box-shadow: 0 0 22px rgba(255, 107, 53, 0.9), 0 0 44px rgba(255, 107, 53, 0.35); }
}

/* ====== BASE STYLES ====== */
:root {
    --bg-dark: #0a0b1e;
    --text-primary: #ffffff;
    --text-secondary: #94a3b8;
    --accent: #ff4757;
    --glass-bg: rgba(15, 23, 42, 0.8);
    --glass-border: rgba(255, 255, 255, 0.1);
    --card-bg: rgba(30, 41, 59, 0.5);
}

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

/* Header y navegación */
header, .dx-navbar, .dash-left, .bg-header {
    background: #0f172a;
    color: #ffffff;
}

a, .btn, button {
    color: var(--accent);
}

.topic-card, .dashboard-widget, .glass-panel {
    background: var(--card-bg) !important;
    border: 1px solid var(--glass-border) !important;
    color: var(--text-primary);
}

.topic-card h4, .topic-card-header, .topic-card-body {
    color: var(--text-primary);
}


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;
}

/* Ocultar botÃ³n de captura de pantalla del plugin */
.leaflet-control-simpleMapScreenshoter {
    display: none !important;
}

.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: calc(30px + env(safe-area-inset-bottom));
    left: 20px;
    transform: none;
    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);
    background-clip: text;
    -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: 70px;
    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: 42px;
    height: 42px;
    font-size: 1.2rem;
    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: calc(20px + env(safe-area-inset-bottom));
        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: calc(20px + env(safe-area-inset-bottom));
        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: 42px;
        height: 42px;
        padding: 0;
        border-radius: 50%;
        left: 20px;
        transform: none;
        /* Reset distinct centering */
        bottom: calc(20px + env(safe-area-inset-bottom));
        justify-content: center;
        font-size: 0;
        /* Hide text */
    }

    .floating-btn span {
        font-size: 1.2rem !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;
    }

    /* Compact Popups for Mobile - EXTRA SMALL */
    .leaflet-popup-content-wrapper {
        padding: 0;
        border-radius: 8px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    }

    .leaflet-popup-content {
        margin: 6px 8px;
        min-width: 180px !important;
        max-width: 220px !important;
        line-height: 1.2;
        font-size: 0.75rem;
    }

    .leaflet-popup-tip {
        padding: 0;
        width: 10px;
        height: 10px;
    }

    /* Reduce ALL text inside popup */
    .leaflet-popup-content div {
        font-size: 0.75rem !important;
        margin-bottom: 3px !important;
    }

    .leaflet-popup-content strong {
        font-size: 0.8rem !important;
    }

    /* Compact info boxes */
    .leaflet-popup-content div[style*="padding:8px"] {
        padding: 4px !important;
        margin: 4px 0 !important;
    }

    /* Smaller links/buttons */
    .leaflet-popup-content a {
        font-size: 0.7rem !important;
        padding: 3px 6px !important;
    }
}

/* ====== 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;
}

.static-marker {
    background-color: rgba(255, 71, 87, 0.4);
    width: 16px;
    height: 16px;
    border-radius: 50%;
    position: relative;
    border: 1px solid #fff;
}

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

.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: calc(20px + env(safe-area-inset-top));
    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: 40px;
        top: calc(20px + env(safe-area-inset-top));
        left: 15px;
    }

    #year-selector {
        top: auto !important;
        bottom: calc(25px + env(safe-area-inset-bottom)) !important;
        left: 50% !important;
        transform: translateX(-50%) !important;
        right: auto !important;
    }

    /* Hide trend chart on mobile */
    #trend-chart-panel {
        display: none !important;
    }
}

/* ====== TREND CHART STYLES ====== */
.trend-chart-container {
    background: rgba(13, 17, 23, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    transition: all 0.3s ease;
    max-height: 200px !important;
    overflow: hidden !important;
}

.trend-chart-container:hover {
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
}

/* Force canvas to respect container size */
#trendChart {
    max-height: 150px !important;
    max-width: 100% !important;
}

/* Show trend chart only on desktop (>768px) */
@media (min-width: 769px) {
    #trend-chart-panel {
        display: block !important;
    }
}

/* ====== MARKER CLUSTER STYLES ====== */
.marker-cluster-small {
    background-color: rgba(255, 71, 87, 0.6);
}

.marker-cluster-small div {
    background-color: rgba(255, 71, 87, 0.8);
}

.marker-cluster-medium {
    background-color: rgba(255, 71, 87, 0.7);
}

.marker-cluster-medium div {
    background-color: rgba(255, 71, 87, 0.9);
}

.marker-cluster-large {
    background-color: rgba(255, 71, 87, 0.8);
}

.marker-cluster-large div {
    background-color: rgba(255, 71, 87, 1);
}

.marker-cluster {
    background-clip: padding-box;
    border-radius: 50%;
    animation: clusterPulse 2s ease-in-out infinite;
}

.marker-cluster div {
    width: 30px;
    height: 30px;
    margin-left: 5px;
    margin-top: 5px;
    text-align: center;
    border-radius: 50%;
    font: 12px "Outfit", Arial, sans-serif;
    font-weight: 700;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cluster-inner {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Cluster pulse animation */
@keyframes clusterPulse {

    0%,
    100% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.1);
        opacity: 0.9;
    }
}

/* Marker entrance animation */
.leaflet-marker-icon {
    animation: markerFadeIn 0.5s ease-out;
}

@keyframes markerFadeIn {
    from {
        opacity: 0;
        transform: scale(0.5) translateY(-20px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Enhanced blinking marker removed to use pulse-red */

@keyframes markerBounce {
    0% {
        transform: translateY(-30px) scale(0);
        opacity: 0;
    }

    50% {
        transform: translateY(-5px) scale(1.1);
    }


    100% {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

/* ====== NEWS POPUP STYLES ====== */
.popup-with-news .leaflet-popup-content-wrapper {
    border: 2px solid rgba(52, 152, 219, 0.3);
    box-shadow: 0 0 20px rgba(52, 152, 219, 0.2);
}

.popup-with-news .leaflet-popup-content-wrapper::before {
    content: 'ðŸ“°';
    position: absolute;
    top: -15px;
    right: -15px;
    font-size: 1.5rem;
    background: rgba(52, 152, 219, 0.9);
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 10px rgba(52, 152, 219, 0.5);
    animation: newsGlow 2s ease-in-out infinite;
}

@keyframes newsGlow {

    0%,
    100% {
        box-shadow: 0 2px 10px rgba(52, 152, 219, 0.5);
    }

    50% {
        box-shadow: 0 2px 20px rgba(52, 152, 219, 0.8);
    }
}

/* ====== DASHBOARD PANEL STYLES ====== */
.dashboard-panel {
    position: fixed;
    left: 4px;
    top: 52%;
    transform: translateY(-50%);
    margin-top: 60px;
    /* Offset for logo */
    width: 320px;
    max-height: 70vh;
    overflow-y: auto;
    z-index: 999;
    background: rgba(13, 17, 23, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    transition: transform 0.3s ease, opacity 0.3s ease, margin-top 0.3s ease;
}

/* ====== TITLE ANIMATION ====== */
.animated-title {
    background: linear-gradient(90deg, #ffffff 0%, #ff6b81 50%, #ffffff 100%);
    background-size: 200% auto;
    color: #fff;
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: shine 4s linear infinite;
    font-weight: 700;
}

@keyframes shine {
    to {
        background-position: 200% center;
    }
}

.dashboard-panel.closed {
    transform: translate(-120%, -50%);
    opacity: 0;
    pointer-events: none;
}

.dashboard-panel.collapsed {
    transform: translateY(-50%) translateX(-420px);
    opacity: 0;
    pointer-events: none;
}

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    position: sticky;
    top: 0;
    background: rgba(13, 17, 23, 0.98);
    z-index: 10;
    border-radius: 16px 16px 0 0;
}

.dashboard-toggle-btn {
    background: transparent;
    border: none;
    color: #fff;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 5px;
    transition: transform 0.3s ease;
}

.dashboard-panel.collapsed .dashboard-toggle-btn {
    transform: rotate(180deg);
}

.dashboard-content {
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.dashboard-widget {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 15px;
    transition: all 0.3s ease;
}

.dashboard-widget:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.widget-title {
    margin: 0 0 12px 0;
    font-size: 0.9rem;
    color: #fff;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}

.quick-stats {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.stat-item:last-child {
    border-bottom: none;
}

.stat-label {
    font-size: 0.85rem;
    color: #888;
}

.stat-value {
    font-size: 0.95rem;
    color: #fff;
    font-weight: 600;
}

/* ====== YEAR SELECTOR & THEME TOGGLE (Modern UI) ====== */
.year-selector-container {
    display: flex;
    background: rgba(15, 23, 42, 0.6);
    padding: 5px;
    border-radius: 14px;
    gap: 6px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(8px);
}

.year-option-btn {
    flex: 1;
    background: transparent;
    border: none;
    color: #94a3b8;
    padding: 10px 14px;
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: 'Outfit', sans-serif;
    position: relative;
    overflow: hidden;
}

.year-option-btn:hover {
    color: #f8fafc;
    background: rgba(255, 255, 255, 0.05);
}

.year-option-btn.active {
    background: linear-gradient(135deg, #ffffff 0%, #f1f5f9 100%);
    color: #0f172a;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4), 
                0 0 0 1px rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

#theme-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0.03) 100%);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #f8fafc;
    padding: 14px;
    border-radius: 14px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: 'Outfit', sans-serif;
    width: 100%;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    position: relative;
}

#theme-toggle-btn:hover {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.12) 0%, rgba(255, 255, 255, 0.05) 100%);
    border-color: rgba(255, 255, 255, 0.25);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

#theme-toggle-btn:active {
    transform: translateY(1px);
}

#theme-icon {
    font-size: 1.1rem;
}

/* Dashboard scrollbar */
.dashboard-panel::-webkit-scrollbar {
    width: 6px;
}

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

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

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

/* Hide dashboard on mobile */
/* ====== DASHBOARD MOBILE SIDE PANEL ====== */
@media (max-width: 768px) {
    .dashboard-panel {
        display: block !important;
        position: fixed;
        top: 0 !important;
        left: 0 !important;
        bottom: 0 !important;
        right: 0 !important;
        /* Full width */
        width: 100% !important;
        max-width: none !important;
        height: 100vh !important;
        max-height: none !important;
        margin: 0 !important;
        border-radius: 0;
        /* Remove radius for full screen */
        transform: translateX(0);
        /* Removed !important to allow JS drag */
        z-index: 2000;
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        background: rgba(13, 17, 23, 1) !important;
        /* Solid background */
        box-shadow: none;
        touch-action: pan-y;
    }

    body.light-theme .dashboard-panel {
        background: #ffffff !important;
    }

    /* Closed State */
    .dashboard-panel.closed,
    .dashboard-panel.collapsed {
        transform: translateX(-100%) !important;
        opacity: 1 !important;
    }

    /* Reset Header */
    .dashboard-header::before {
        display: none;
    }

    .dashboard-header {
        padding-top: 15px;
    }

    /* Redesigned Mobile Open Button - Expansive Waves */
    #dashboard-open-btn {
        /* display managed by JS */
        left: 0 !important;
        top: 50% !important;
        bottom: auto !important;
        transform: translateY(-50%) !important;

        /* Invisible clickable area */
        width: 40px !important;
        height: 60px !important;
        padding: 0 !important;
        background: transparent !important;
        border: none !important;
        box-shadow: none !important;
        backdrop-filter: none;

        color: #ff4757 !important;
        /* Red Arrow */
        z-index: 1500;
        align-items: center;
        justify-content: center;
        cursor: pointer;

        /* Hide HTML text */
        font-size: 0 !important;
    }

    /* The Ripples / Expansive Waves - Directional Right */
    #dashboard-open-btn::before {
        content: '';
        position: absolute;
        top: 50%;
        left: 5px;
        width: 10px;
        height: 10px;
        background: rgba(255, 71, 87, 0.6);
        border-radius: 50%;
        transform: translateY(-50%);
        z-index: -1;
        /* Animation pushing waves to the right */
        animation: pulse-directional 2s infinite ease-out;
    }

    @keyframes pulse-directional {
        0% {
            transform: translateY(-50%) scale(1);
            box-shadow: 0 0 0 0 rgba(255, 71, 87, 0.8);
        }

        70% {
            /* Move shadow to the right while expanding */
            transform: translateY(-50%) translate(10px, 0);
            box-shadow: 10px 0 15px 5px rgba(255, 71, 87, 0);
        }

        100% {
            transform: translateY(-50%) translate(15px, 0);
            box-shadow: 20px 0 20px 10px rgba(255, 71, 87, 0);
        }
    }

    /* Arrow Icon */
    #dashboard-open-btn::after {
        content: 'â–¶';
        font-family: monospace, sans-serif;
        font-size: 1.2rem;
        line-height: 1;
        margin-left: 2px;
        text-shadow: 0 0 8px rgba(255, 255, 255, 0.8);
        animation: arrow-sway 2s ease-in-out infinite;
    }

    /* @keyframes pulse-red-ring has been replaced */

    @keyframes arrow-sway {

        0%,
        100% {
            transform: translateX(0);
        }

        50% {
            transform: translateX(4px);
        }
    }

    /* Close Button inside panel */
    .dashboard-toggle-btn {
        transform: rotate(0deg);
    }

    /* Scrollable content */
    .dashboard-content {
        height: calc(100vh - 70px);
        overflow-y: auto;
        padding-bottom: 40px;
    }
}

/* ====== LIGHT THEME STYLES (Facebook-inspired) ====== */

/* --- Variables & Base --- */
body.light-theme {
    background: #f0f2f5 !important;
    color: #1c1e21 !important;
}

/* --- Panels & Glass --- */
body.light-theme #settings-panel,
body.light-theme #days-counter-panel,
body.light-theme #trend-chart-panel,
body.light-theme .glass-panel {
    background: #ffffff !important;
    border: 1px solid #dddfe2 !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1) !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

/* --- Dashboard Panel --- */
body.light-theme .dashboard-panel {
    background: #ffffff !important;
    border: 1px solid #dddfe2 !important;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.08) !important;
}

body.light-theme .dashboard-header {
    background: #ffffff !important;
    border-bottom: 1px solid #dddfe2 !important;
}

/* --- Widgets --- */
body.light-theme .dashboard-widget {
    background: #f7f8fa !important;
    border: 1px solid #dddfe2 !important;
    border-radius: 10px !important;
    box-shadow: none !important;
}

body.light-theme .dashboard-widget:hover {
    background: #eef0f3 !important;
    border-color: #bcc0c4 !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08) !important;
}

/* --- Typography --- */
body.light-theme h2,
body.light-theme h3,
body.light-theme h4,
body.light-theme #days-count {
    color: #1c1e21 !important;
}

/* Ensure New Topic Modal labels stay white in Light Mode */
body.light-theme #new-topic-modal label {
    color: #ffffff !important;
}

/* Fix: allow tap/click on all inputs and selects inside modals
   (body has touch-action:pan-x pan-y which blocks tap-to-focus on mobile) */
#new-topic-modal,
#new-topic-modal *,
#mobile-alias-modal,
#mobile-alias-modal *,
#stats-modal,
#stats-modal *,
#user-profile-modal,
#user-profile-modal * {
    touch-action: auto !important;
    -webkit-user-select: auto;
    user-select: auto;
}

body.light-theme #stats-content,
body.light-theme #dept-ranking li,
body.light-theme p {
    color: #4b4f56 !important;
}

body.light-theme .widget-title {
    color: #1c1e21 !important;
    font-weight: 700 !important;
}

body.light-theme .stat-label {
    color: #65676b !important;
}

body.light-theme .stat-value {
    color: #1c1e21 !important;
}



body.light-theme .animated-title {
    background: linear-gradient(90deg, #1877f2 0%, #ff4757 50%, #1877f2 100%);
    background-size: 200% auto;
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: shine 4s linear infinite;
}

/* --- Buttons --- */
body.light-theme #theme-toggle-btn {
    background: #e7f3ff !important;
    color: #1877f2 !important;
    border: 1px solid #bdd1f5 !important;
    border-radius: 8px !important;
    font-weight: 600 !important;
}

body.light-theme #theme-toggle-btn:hover {
    background: #d0e6ff !important;
}

body.light-theme .settings-btn {
    background: #ffffff !important;
    color: #1c1e21 !important;
    border: 1px solid #dddfe2 !important;
}

body.light-theme .dashboard-toggle-btn {
    color: #65676b !important;
}

body.light-theme .barrio-header button,
body.light-theme .dashboard-header button {
    color: #65676b !important;
}

body.light-theme .barrio-header button:hover,
body.light-theme .dashboard-header button:hover {
    color: #1c1e21 !important;
    background: #f0f2f5 !important;
}

/* --- Year Selector ---*/
/* Light Theme Overrides for these specific elements */
body.light-theme .year-selector-container {
    background: #e2e8f0 !important;
    border: 1px solid #cbd5e1 !important;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05) !important;
}

body.light-theme .year-option-btn {
    color: #475569 !important;
}

body.light-theme .year-option-btn:hover {
    background: rgba(255, 255, 255, 0.4) !important;
    color: #1e293b !important;
}

body.light-theme .year-option-btn.active {
    background: #ffffff !important;
    color: #3b82f6 !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1), 
                0 0 0 1px rgba(59, 130, 246, 0.1) !important;
}

body.light-theme #theme-toggle-btn {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%) !important;
    color: #334155 !important;
    border: 1px solid #d1d5db !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05) !important;
}

body.light-theme #theme-toggle-btn:hover {
    background: #ffffff !important;
    border-color: #3b82f6 !important;
    color: #3b82f6 !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 8px 20px rgba(59, 130, 246, 0.1) !important;
}

/* --- Scrollbars --- */
body.light-theme .dashboard-panel::-webkit-scrollbar-track {
    background: #f0f2f5 !important;
}

body.light-theme .dashboard-panel::-webkit-scrollbar-thumb {
    background: #bcc0c4 !important;
    border-radius: 4px !important;
}

body.light-theme .dashboard-panel::-webkit-scrollbar-thumb:hover {
    background: #8d949e !important;
}

/* --- Community Panel --- */
body.light-theme .community-panel {
    background: #ffffff !important;
    border: 1px solid #dddfe2 !important;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.1) !important;
}

body.light-theme #community-user {
    background: #f0f2f5 !important;
    border: 1px solid #dddfe2 !important;
}

/* --- Topic Items (Feed) --- */
body.light-theme .topic-item {
    background: #ffffff !important;
    border: 1px solid #dddfe2 !important;
    border-radius: 10px !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08) !important;
}

body.light-theme .topic-item:hover {
    background: #f7f8fa !important;
    border-color: #bcc0c4 !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1) !important;
}

body.light-theme .topic-item-title {
    color: #1c1e21 !important;
    font-weight: 700 !important;
}

body.light-theme .topic-item-content {
    color: #4b4f56 !important;
}

body.light-theme .topic-item-meta {
    color: #8d949e !important;
}

body.light-theme .topic-item-author {
    color: #1877f2 !important;
    font-weight: 600 !important;
}

body.light-theme .topic-item-footer {
    border-top: 1px solid #e4e6eb !important;
}

/* --- Recent Cases --- */
body.light-theme .recent-case-item {
    background: #f7f8fa !important;
    border-left: 3px solid #ff4757 !important;
    border-top: 1px solid #dddfe2 !important;
    border-right: 1px solid #dddfe2 !important;
    border-bottom: 1px solid #dddfe2 !important;
}

body.light-theme .recent-case-item:hover {
    background: #eef0f3 !important;
}

body.light-theme .case-desc {
    color: #1c1e21 !important;
}

body.light-theme .case-dept {
    color: #8d949e !important;
}

/* --- Recent Users --- */
body.light-theme #recent-users-widget {
    background: #f7f8fa !important;
    border: 1px solid #dddfe2 !important;
}

body.light-theme .recent-user-item {
    border-bottom: 1px solid #e4e6eb !important;
}

body.light-theme .recent-user-item:hover {
    background: #eef0f3 !important;
}

body.light-theme .recent-user-alias {
    color: #1c1e21 !important;
    font-weight: 700 !important;
}

body.light-theme .recent-user-prefix {
    color: #8d949e !important;
}

/* --- Floating Logo --- */
body.light-theme .floating-logo {
    filter: brightness(0.85) !important;
}

/* --- Topic Detail Modal (mobile) --- */
body.light-theme .topic-detail-inner {
    background: #ffffff !important;
    color: #1c1e21 !important;
    border: none !important;
}

body.light-theme .topic-detail-header {
    border-bottom: 1px solid #e4e6eb !important;
    background: #f7f8fa !important;
}

body.light-theme .topic-detail-header h3,
body.light-theme #detail-author,
body.light-theme #detail-title,
body.light-theme #detail-content {
    color: #1c1e21 !important;
}

body.light-theme .topic-detail-footer {
    border-top: 1px solid #e4e6eb !important;
    background: #f7f8fa !important;
}

body.light-theme .comment-bubble {
    background: #f0f2f5 !important;
    color: #1c1e21 !important;
    border: 1px solid #e4e6eb !important;
}

body.light-theme .comment-author {
    color: #1877f2 !important;
}

body.light-theme .comment-meta {
    color: #8d949e !important;
}

body.light-theme #reply-input {
    background: #000000 !important;
    color: #ffffff !important;
    border: 1px solid rgba(0,0,0,0.2) !important;
    border-radius: 8px !important;
    padding: 10px !important;
}

/* ====== RECENT CASES WIDGET ====== */
.recent-cases-container {
    max-height: 250px;
    overflow-y: auto;
    padding-right: 5px;
    /* Space for scrollbar */
}

/* Custom scrollbar for this container */
.recent-cases-container::-webkit-scrollbar {
    width: 4px;
}

.recent-cases-container::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
}

.recent-cases-container::-webkit-scrollbar-thumb {
    background: rgba(255, 71, 87, 0.5);
    border-radius: 4px;
}

.recent-case-item {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 10px;
    margin-bottom: 8px;
    border-left: 3px solid #ff4757;
    /* Accent border */
    transition: background 0.2s;
}

.recent-case-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.case-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 4px;
    font-size: 0.85rem;
}

.case-date {
    color: #ff4757;
    font-weight: bold;
}

.case-dept {
    background: rgba(255, 255, 255, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.75rem;
}

.case-desc {
    font-size: 0.9rem;
    color: #ddd;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    /* Limit to 2 lines */
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Light Theme overrides for Recent Cases */
body.light-theme .recent-case-item {
    background: rgba(0, 0, 0, 0.03);
    border-left: 3px solid #ff4757;
}

body.light-theme .recent-case-item:hover {
    background: rgba(0, 0, 0, 0.06);
}

body.light-theme .case-desc {
    color: #555;
}

body.light-theme .case-dept {
    background: rgba(0, 0, 0, 0.05);
    color: #333;
}

/* ====== TOPIC ITEM (Community Feed) ====== */
.topic-item {
    background: linear-gradient(135deg, #2d3748 0%, #1a202c 100%);
    padding: 16px;
    border-radius: 12px;
    margin-bottom: 12px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    cursor: pointer;
    transition: box-shadow 0.2s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.topic-item:hover {
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

.topic-item-meta {
    font-size: 0.75rem;
    color: #a0aec0;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
}

.topic-item-author {
    color: #e2e8f0;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    background: transparent;
    padding: 0;
    border-radius: 0;
}

.topic-item-author-avatar {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    flex-shrink: 0;
    border: 1.5px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    font-weight: 700;
    margin-right: 4px;
}

.topic-item-author-img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.topic-item-author-name {
    background: transparent;
    padding: 0;
    border-radius: 0;
}

.topic-item-title {
    margin: 6px 0 8px 0;
    font-size: 1.1rem;
    color: #ffffff;
    font-weight: 600;
    line-height: 1.4;
}

.topic-item-content {
    margin: 0;
    font-size: 0.9rem;
    color: #d1d5db;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.5;
}

.topic-item-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
    padding-top: 0;
    gap: 8px;
}

/* Light Theme overrides for topics */
body.light-theme .topic-item {
    background: linear-gradient(135deg, #f9fafb 0%, #f3f4f6 100%);
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

body.light-theme .topic-item:hover {
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.1);
}

body.light-theme .topic-item-title {
    color: #111827;
}

body.light-theme .topic-item-content {
    color: #4b5563;
}

body.light-theme .topic-item-author {
    color: #374151;
    background: transparent;
}

body.light-theme .topic-item-author-avatar {
    background: linear-gradient(135deg, #3b82f6 0%, #1e40af 100%);
    border-color: rgba(59, 130, 246, 0.3);
}

body.light-theme .topic-item-author-name {
    background: transparent;
}

body.light-theme .topic-item-meta {
    color: #6b7280;
}

body.light-theme .topic-item:hover {
    background: #f8fafc;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

body.light-theme .topic-item-meta {
    color: #64748b;
}

body.light-theme .topic-item-author {
    color: #1e293b;
}

body.light-theme .topic-item-title {
    color: #0f172a;
}

body.light-theme .topic-item-content {
    color: #334155;
}

body.light-theme .topic-item-footer {
    padding-top: 0;
}

/* ====== MEJORADO: HASHTAGS E INTERACTIVIDAD DEL FEED ====== */
/* Hashtags dentro del contenido  */
.topic-item-content a {
    color: #00a8ff;
    font-weight: 600;
    text-decoration: none;
    border-radius: 4px;
    padding: 2px 4px;
    transition: all 0.2s ease;
    background: rgba(0, 168, 255, 0.08);
}

.topic-item-content a:hover {
    color: #26c8ff;
    background: rgba(0, 168, 255, 0.15);
    text-decoration: underline;
}

/* Light theme hashtags */
body.light-theme .topic-item-content a {
    color: #0066cc;
    background: rgba(0, 102, 204, 0.05);
}

body.light-theme .topic-item-content a:hover {
    color: #0052a3;
    background: rgba(0, 102, 204, 0.12);
}

/* ====== BOTONES Y ACCIONES EN EL FOOTER ====== */
.topic-item-footer button {
    background: transparent;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s ease;
    font-family: inherit;
}

.topic-item-footer button:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #e2e8f0;
    transform: translateY(-1px);
}

.topic-item-footer button:active {
    transform: translateY(0);
    background: rgba(255, 255, 255, 0.12);
}

/* Light theme buttons */
body.light-theme .topic-item-footer button {
    color: #64748b;
}

body.light-theme .topic-item-footer button:hover {
    background: rgba(0, 0, 0, 0.05);
    color: #334155;
}

/* ====== RECENT USERS LIST - BASE STYLES (Dark Mode Default) ====== */
.recent-user-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
    cursor: pointer;
    transition: background 0.2s ease;
    border-radius: 6px;
    padding-left: 4px;
}

.recent-user-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.recent-user-info {
    display: flex;
    flex-direction: column;
    color: #cbd5e1;
}

.recent-user-prefix {
    color: #64748b;
    font-size: 0.7rem;
}

.recent-user-alias {
    color: #e2e8f0;
    font-weight: 600;
    font-size: 0.85rem;
}

/* Light Theme overrides */
body.light-theme .recent-user-item {
    border-bottom: 1px solid rgba(0, 0, 0, 0.08) !important;
    color: #1e293b !important;
}

body.light-theme .recent-user-item:hover {
    background: rgba(0, 0, 0, 0.04) !important;
}

body.light-theme .recent-user-alias {
    color: #0f172a !important;
    font-weight: 700 !important;
}

body.light-theme .recent-user-prefix {
    color: #64748b !important;
}

/* Mobile Adjustment for Days Counter (iPhone Notch) */
@media (max-width: 768px) {
    #days-counter-panel {
        top: calc(20px + env(safe-area-inset-top)) !important;
    }

    #social-bar {
        bottom: calc(5px + env(safe-area-inset-bottom)) !important;
    }
}

/* ====== COMMUNITY PANEL (RIGHT SIDE) ====== */
.community-panel {
    position: fixed;
    right: 4px;
    left: auto;
    top: 52%;
    transform: translateY(-50%);
    margin-top: 60px;
    width: 320px;
    max-height: 70vh;
    overflow-y: auto;
    z-index: 999;

    /* Glassmorphism matches dashboard */
    background: rgba(13, 17, 23, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.community-panel.closed {
    transform: translate(120%, -50%);
    opacity: 0;
    pointer-events: none;
}

/* Open Button Styles (Right Side) */
/* (Currently inline in HTML for simplicity, can be moved here later) */


/* ====== MOBILE COMMUNITY PANEL ====== */
/* ====== MOBILE COMMUNITY PANEL ====== */
@media (max-width: 768px) {
    .community-panel {
        display: block !important;
        position: fixed;
        top: 0 !important;
        left: 0 !important;
        bottom: 0 !important;
        right: 0 !important;
        width: 100% !important;
        height: 100dvh !important;
        /* Dynamic Viewport Height */
        max-width: none !important;
        max-height: none !important;
        margin: 0 !important;
        border-radius: 0 !important;
        z-index: 2000;
        background: rgba(13, 17, 23, 1) !important;
        box-shadow: none;

        /* Side Panel Logic (Right) */
        transform: translateX(100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        overflow-y: auto !important;
        overscroll-behavior: contain;
        touch-action: pan-y;
    }

    /* Open State */
    .community-panel:not(.closed) {
        transform: translateX(0);
    }

    /* Closed State */
    .community-panel.closed {
        transform: translateX(100%);
    }

    /* Adjust Header for Mobile */
    /* Adjust Header for Mobile - Compact */
    .community-panel .dashboard-header {
        padding-top: calc(5px + env(safe-area-inset-top));
        padding-bottom: 5px;
        min-height: auto;
    }

    /* Ensure content scrolls independently */
    .community-panel .dashboard-content {
        height: calc(100vh - 80px);
        /* AproximaciÃ³n, flex serÃ­a mejor */
        overflow-y: auto;
        padding-bottom: 80px;
        /* Espacio para scroll infinito */
    }

    /* ====== TOPIC DETAIL MODAL ====== */
    .topic-detail-inner {
        background: #1e1e1e;
        color: #eee;
        border: none;
        border-radius: 0;
    }

    .topic-detail-header {
        border-bottom: 1px solid #333;
        padding-top: calc(15px + env(safe-area-inset-top));
    }

    .topic-detail-footer {
        border-top: 1px solid #333;
        background: #252525;
        padding-bottom: calc(15px + env(safe-area-inset-bottom));
    }

    /* Comments */
    .comment-bubble {
        background: #2a2a2a;
        color: #ddd;
    }

    .comment-author {
        color: #ff4757;
    }

    .comment-meta {
        color: #666;
    }

    /* Light Theme overrides for detail & comments on mobile */
    body.light-theme .topic-detail-inner {
        background: #ffffff !important;
        color: #1c1e21 !important;
    }

    body.light-theme .topic-detail-header {
        border-bottom: 1px solid #e4e6eb !important;
        background: #f7f8fa !important;
    }

    body.light-theme .topic-detail-header h3 {
        color: #1c1e21 !important;
    }

    body.light-theme .topic-detail-footer {
        border-top: 1px solid rgba(0, 0, 0, 0.05);
        background: #f8fafc;
    }

    body.light-theme .comment-bubble {
        background: #f1f5f9;
        color: #334155;
        border: 1px solid rgba(0, 0, 0, 0.05);
    }

    body.light-theme .comment-author {
        color: #ef4444;
    }

    body.light-theme .comment-meta {
        color: #94a3b8;
    }

    body.light-theme #detail-content {
        color: #475569;
    }

    body.light-theme #reply-input {
        background: #fff;
        border: 1px solid #cbd5e1;
        color: #1e293b;
    }

    /* Toggle Button Rotate on mobile inside panel */
    .community-panel .dashboard-toggle-btn {
        transform: rotate(90deg);
        /* Flecha apuntando abajo para cerrar */
    }
}


/* IOS INPUT ZOOM FIX */
@media screen and (max-width: 768px) {

    input,
    select,
    textarea {
        font-size: 16px !important;
    }
}


/* TOPIC DETAIL FULLSCREEN MOBILE */
@media (max-width: 768px) {
    #topic-detail-modal {
        padding: 0 !important;
        z-index: 10001 !important;
    }

    .topic-detail-inner {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100vw !important;
        height: 100dvh !important;
        max-width: none !important;
        max-height: none !important;
        border-radius: 0 !important;
        border: none !important;
        margin: 0 !important;
        display: flex !important;
        flex-direction: column !important;
    }

    /* Compact header and content for mobile detail */
    .topic-detail-header {
        padding: 8px 15px !important;
    }

    #detail-scroll-area {
        padding: 10px 15px !important;
    }

    .topic-detail-footer {
        padding: 10px 15px !important;
    }

    #detail-title {
        font-size: 1rem !important;
    }

    #detail-content {
        font-size: 0.9rem !important;
        line-height: 1.4 !important;
    }
}



/* DESKTOP COMMUNITY PANEL SIZE (Sidebar Layout) */
@media (min-width: 769px) {

    #community-panel.community-panel,
    #community-panel {
        position: fixed !important;
        width: 340px !important;
        /* Reset any max-width from mobile */
        max-width: none !important;

        /* Force Full Height & Position */
        top: 0 !important;
        bottom: 0 !important;
        height: 135vh !important; /* Compensate for zoom: 0.75 */
        min-height: 135vh !important;
        max-height: none !important;

        /* Pin to Right */
        right: 0 !important;
        left: auto !important;

        /* Reset Mobile Styles */
        margin: 0 !important;
        border-radius: 0 !important;
        border: none !important;
        /* Remove border if any */
        transform: none !important;
        /* Reset mobile transforms */

        z-index: 2000 !important;
        box-shadow: -5px 0 20px rgba(0, 0, 0, 0.3) !important;
    }

    /* DESKTOP STATISTICS PANEL SIZE (Sidebar Layout) */
    .dashboard-panel {
        position: fixed !important;
        width: 340px !important;
        max-width: none !important;

        /* Force Full Height & Position */
        top: 0 !important;
        bottom: 0 !important;
        height: 135vh !important; /* Compensate for zoom: 0.75 */
        min-height: 135vh !important;
        max-height: none !important;

        /* Pin to Left */
        left: 0 !important;
        right: auto !important;

        /* Reset Mobile/Card Styles */
        margin: 0 !important;
        border-radius: 0 !important;
        border: none !important;
        transform: none !important;

        z-index: 2000 !important;
        box-shadow: 5px 0 20px rgba(0, 0, 0, 0.3) !important;
    }

    /* Override Topic CTA ("SÃ© el primero") for Desktop */
    .topic-cta-box {
        font-size: 0.75rem !important;
        /* Smaller text */
        padding: 6px !important;
        /* Less padding */
        width: 85% !important;
        /* Not full width */
        margin: 8px auto !important;
        /* Centered with less margin */
        line-height: 1.2 !important;
        border-width: 1px !important;
        /* Thinner border if needed */
        opacity: 0.8;
    }

    /* Stats Button Style */
    .btn-community-stats {
        width: 70%;
        background: linear-gradient(90deg, #FFD700 0%, #FFA500 100%);
        border: none;
        padding: 4px;
        border-radius: 6px;
        color: #000;
        font-weight: bold;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 5px;
        margin: 0 auto 6px auto;
        box-shadow: 0 2px 8px rgba(255, 215, 0, 0.2);
        transition: transform 0.1s;
        font-size: 0.6rem;
    }

    .btn-community-stats:active {
        transform: scale(0.98);
    }

    /* FEED MODE EXPANDED STYLE (Constrained between panels) */
    .feed-expanded-mode {
        position: fixed;
        top: 0;
        bottom: 0;
        left: 360px;
        /* Dashboard ~320px + gap */
        right: 360px;
        /* Community ~320px + gap */
        width: auto !important;
        /* Auto width based on left/right */
        max-width: none;
        background: #1e293b !important;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
        border: 1px solid rgba(255, 255, 255, 0.1) !important;
        border-top: none !important;
        border-bottom: none !important;
        margin: 0 !important;
        pointer-events: auto;
        border-radius: 0;
        height: auto !important;
        /* Auto height based on top/bottom */
        max-height: none;
        display: flex;
        flex-direction: column;
        animation: scaleIn 0.2s ease-out;
        z-index: 5000 !important;
        /* Above map and most overlays */
        touch-action: pan-y !important;
        overflow-y: auto !important;
        overscroll-behavior: contain;
    }

    /* Mobile override for feed mode */
    @media (max-width: 1024px) {
        .feed-expanded-mode {
            left: 10px;
            right: 10px;
            top: 70px;
            bottom: 80px;
            /* Menu bar space */
        }
    }

    @keyframes scaleIn {
        from {
            transform: scale(0.9);
            opacity: 0;
        }

        to {
            transform: scale(1);
            opacity: 1;
        }
    }

    /* Override Closed State for Sidebar */
    .dashboard-panel.closed {
        transform: translateX(-100%) !important;
        opacity: 1 !important;
        /* Keep visible for slide effect, or 0 if preferred */
    }
}


/* Default Alias Color (Dark Mode) */
#user-display-alias {
    color: #fff;
}


/* LIGHT THEME FIX (Re-applied) */
body.light-theme #user-display-alias {
    color: #333 !important;
}


/* ALERTA PULSE (YELLOW) */
@keyframes pulse-yellow {
    0% {
        box-shadow: 0 0 0 0 rgba(255, 165, 2, 0.8);
    }

    70% {
        box-shadow: 0 0 0 15px rgba(255, 165, 2, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(255, 165, 2, 0);
    }
}

.alert-pulse-icon div {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: rgba(47, 53, 66, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: pulse-yellow 1.5s infinite;
    border: 2px solid #ffa502;
}


/* ALERTA PULSE UPDATE (Transparent) */
.alert-pulse-icon div {
    background: rgba(255, 255, 255, 0.1) !important;
    /* Almost transparent */
    border: 2px solid #ffa502 !important;
    /* Keep ring structure for pulse */
    backdrop-filter: blur(2px);
}


/* Mobile Icon Switch for Dashboard Button - Cleaned up */
@media (max-width: 768px) {
    /* No specific rules needed for icon text anymore */
}

/* Mobile Community Panel - Full Screen */
@media (max-width: 768px) {
    #community-panel {
        width: 100% !important;
        height: 100% !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        border-radius: 0 !important;
        margin: 0 !important;
    }
}

/* USER PROFILE STATUS - ADAPTIVE STYLES */
#prof-status-box {
    background: rgba(255, 255, 255, 0.05);
    padding: 12px;
    border-radius: 12px;
    min-height: 46px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.08);
    transition: all 0.3s;
}

#prof-status-text {
    margin: 0;
    font-size: 0.88rem;
    color: #cbd5e1 !important;
    font-style: italic;
    line-height: 1.4;
    text-align: center;
}

#prof-status-edit-btn {
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 0.72rem;
    cursor: pointer;
    margin-top: 6px;
    text-decoration: underline;
    opacity: 0.7;
    transition: opacity 0.2s;
}

#prof-status-edit-btn:hover {
    opacity: 1;
}

#prof-status-input {
    width: 100%;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid #475569;
    color: white;
    border-radius: 6px;
    padding: 8px;
    font-size: 0.8rem;
    box-sizing: border-box;
    text-align: center;
}

/* Light Theme Overrides */
body.light-theme #prof-status-box {
    background: rgba(0, 0, 0, 0.03);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

body.light-theme #prof-status-text {
    color: #475569 !important;
}

body.light-theme #prof-status-input {
    background: #fff !important;
    border: 1px solid #cbd5e1 !important;
    color: #1e293b !important;
}

body.light-theme #prof-status-edit-btn {
    color: #64748b;
}

/* RADAR PING ANIMATION (Community Alerts) */
@keyframes radar-ping {
    0% {
        transform: scale(0.8);
        opacity: 0.8;
    }

    100% {
        transform: scale(2.2);
        opacity: 0;
    }
}

/* ====== TOP CONTRIBUTORS TICKER ====== */
.top-users-ticker {
    flex: 1;
    display: flex;
    align-items: center;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 30px;
    margin: 0 15px;
    padding: 4px 10px;
    overflow: hidden;
    position: relative;
    max-width: 60%;
}

.ticker-label {
    font-size: 0.65rem;
    font-weight: bold;
    color: #e1b12c;
    text-transform: uppercase;
    margin-right: 10px;
    white-space: nowrap;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    padding-right: 10px;
    flex-shrink: 0;
}

.ticker-mask {
    flex: 1;
    overflow: hidden;
    position: relative;
    mask-image: linear-gradient(to right, transparent, black 10%, black 90%, transparent);
    -webkit-mask-image: linear-gradient(to right, transparent, black 10%, black 90%, transparent);
}

.ticker-track {
    display: flex;
    gap: 20px;
    white-space: nowrap;
    animation: ticker-scroll 20s linear infinite;
    width: max-content;
}

.ticker-track:hover {
    animation-play-state: paused;
}

.ticker-item {
    font-size: 0.75rem;
    color: #cbd5e1;
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    transition: color 0.2s;
}

.ticker-item:hover {
    color: white;
    text-decoration: underline;
}

.ticker-item b {
    color: white;
}

.ticker-rank {
    background: #334155;
    color: #fff;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.55rem;
    font-weight: bold;
}

.ticker-rank.rank-1 {
    background: #e1b12c;
    color: #1e293b;
    box-shadow: 0 0 10px rgba(225, 177, 44, 0.4);
}

.ticker-rank.rank-2 {
    background: #94a3b8;
}

.ticker-rank.rank-3 {
    background: #b45309;
}

@keyframes ticker-scroll {
    0% {
        transform: translateX(0);
    }

    100% {
        transform: translateX(-50%);
    }
}

/* Mobile adjustments */
/* Mobile adjustments */
/* Mobile adjustments for Ticker */
/* Mobile adjustments for Ticker & Header Compact */
@media (max-width: 768px) {

    /* 1. Header Layout */
    .dashboard-header {
        display: flex;
        flex-wrap: wrap;
        gap: 0;
        align-items: center;
        padding-top: calc(2px + env(safe-area-inset-top));
        /* Ultra compact */
        padding-bottom: 2px;
        min-height: auto;
        align-content: center;
    }

    /* 2. Toggle Arrow (Order 1) */
    .community-panel .dashboard-toggle-btn {
        order: 1;
        transform: rotate(0deg);
        /* Apunta a la derecha */
        font-size: 1rem;
        margin-right: 8px;
        padding: 0 4px;
        width: auto;
        display: block !important;
        /* Ensure visibility */
    }

    /* 3. Title (Order 2) */
    .dashboard-header h3 {
        order: 2;
        width: auto;
        flex-grow: 1;
        /* Ocupa el resto de la linea */
        justify-content: flex-start;
        /* Contenido a la izquierda */
        gap: 8px;
        font-size: 1rem;
        margin: 0;
        line-height: 1.2;
    }

    /* 4. Ticker (Order 3 - New Line) */
    .top-users-ticker {
        order: 3;
        display: flex;
        width: 100%;
        max-width: none;
        margin: 4px 0 0 0;
        padding: 0 8px;
        background: rgba(0, 0, 0, 0.2);
        border: none;
        border-radius: 4px;
        height: 20px;
        /* Super compact */
        align-items: center;
    }

    .ticker-label {
        display: none;
    }

    .ticker-item {
        font-size: 0.65rem;
        /* Tiny font */
    }

    .top-users-ticker .ticker-rank {
        width: 12px;
        height: 12px;
        font-size: 0.45rem;
    }
}

/* Animated CTA Box for Topics */
.topic-cta-box {
    background: linear-gradient(90deg, rgba(239, 68, 68, 0.1), rgba(255, 165, 2, 0.1));
    border: 1px dashed rgba(239, 68, 68, 0.3);
    padding: 10px 14px;
    border-radius: 12px;
    margin-top: 15px;
    font-size: 0.8rem;
    color: #ffdada;
    /* Default for Dark Mode */
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: cta-pulse 2.5s infinite ease-in-out;
    cursor: pointer;
}

/* --- MOBILE NAV ITEMS INTERACTION (Excluding Report Button) --- */
.mobile-nav-item:not(#btn-new-topic) {
    transition: transform 0.1s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.2s;
    border-radius: 12px;
    animation: nav-breathe 8s infinite ease-in-out;
    /* Super subtle life */
}

/* Stagger animations for wave effect */
.mobile-nav-item:nth-child(1) {
    animation-delay: 0s;
}

.mobile-nav-item:nth-child(2) {
    animation-delay: 1.5s;
}

.mobile-nav-item:nth-child(4) {
    animation-delay: 3s;
}

.mobile-nav-item:nth-child(5) {
    animation-delay: 4.5s;
}

@keyframes nav-breathe {

    0%,
    100% {
        transform: scale(1);
        opacity: 0.85;
    }

    50% {
        transform: scale(1.05);
        opacity: 1;
    }
}

.mobile-nav-item:not(#btn-new-topic):active {
    transform: scale(0.92);
    /* Gentle shrink */
    background-color: rgba(255, 255, 255, 0.08);
    /* Frosted touch feedback */
    animation: none;
    /* Stop breathing on press */
}

/* Light Mode support for Nav Interaction */
body.light-theme .mobile-nav-item:not(#btn-new-topic):active {
    background-color: rgba(0, 0, 0, 0.05);
}

body.light-theme .topic-cta-box {
    background: linear-gradient(90deg, rgba(239, 68, 68, 0.05), rgba(255, 165, 2, 0.05));
    border: 1px dashed rgba(239, 68, 68, 0.4);
    color: #c0392b !important;
    /* Darker red for light theme */
}

@keyframes cta-pulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.02);
    }

    100% {
        transform: scale(1);
    }
}

/* ====== MAP FREEZE HELPER ====== */
/* ====== PWA & MOBILE ENHANCEMENTS ====== */

/* Prevent pull-to-refresh / bounce effect */
html,
body {
    overscroll-behavior-y: none;
    -webkit-tap-highlight-color: transparent;
    /* Remove blue highlight */
}

/* Better touch feedback */
button:active {
    transform: scale(0.96);
    transition: transform 0.1s;
}

/* Floating Action Button (FAB) touch target fix */
#community-open-btn {
    min-width: 48px;
    min-height: 60px;
    /* Ensure tall enough */
}

/* Ensure Statistics Button is easily tappable */
.btn-community-stats {
    min-height: 32px;
    /* Touch target */
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
}

/* Search input focus improvement */
#topic-search-input:focus {
    background: rgba(0, 0, 0, 0.4) !important;
}

/* DISABLE EXPAND BUTTON ON MOBILE (User Request due to map conflict) */
@media (max-width: 768px) {
    #btn-expand-feed {
        display: none !important;
    }
}

/* End of File */
/* ====== ENERGY BAR SYSTEM ====== */
.energy-container {
    width: 100%;
    height: 12px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 10px;
    margin-top: 10px;
    position: relative;
    overflow: hidden;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.energy-fill {
    height: 100%;
    border-radius: 10px;
    width: 0%;
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.5s ease;
    position: relative;
    background: linear-gradient(90deg, #ef4444, #f97316);
}

/* Colors */
.energy-fill.low {
    background: linear-gradient(90deg, #ef4444, #dc2626);
    box-shadow: 0 0 5px rgba(239, 68, 68, 0.5);
}

.energy-fill.medium {
    background: linear-gradient(90deg, #f97316, #fb923c);
    box-shadow: 0 0 8px rgba(249, 115, 22, 0.5);
}

.energy-fill.high {
    background: linear-gradient(90deg, #06b6d4, #3b82f6);
    box-shadow: 0 0 12px rgba(6, 182, 212, 0.6);
}

/* Pulse Lightning */
.energy-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.4) 50%, rgba(255, 255, 255, 0) 100%);
    background-size: 200% 100%;
    animation: energy-pulse 2s infinite linear;
    border-radius: 10px;
}

@keyframes energy-pulse {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

/* ====== ENERGY GAIN POPUP ====== */
.energy-gain-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #ffd700;
    font-weight: bold;
    font-size: 1.5rem;
    pointer-events: none;
    z-index: 9999;
    animation: floatUpFade 2s forwards;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

@keyframes floatUpFade {
    0% {
        opacity: 0;
        transform: translate(-50%, -40%);
    }

    20% {
        opacity: 1;
        transform: translate(-50%, -60%);
    }

    100% {
        opacity: 0;
        transform: translate(-50%, -100%);
    }
}


/* Pixel War Styles */
#pixel-war-ui {
    font-family: 'Outfit', sans-serif;
    transition: all 0.3s ease;
}

.pixel-color {
    width: 25px;
    height: 25px;
    border-radius: 4px;
    cursor: pointer;
    border: 2px solid rgba(255, 255, 255, 0.1);
    transition: transform 0.1s, border-color 0.1s;
}

.pixel-color:hover {
    transform: scale(1.1);
    box-shadow: 0 0 5px rgba(255, 255, 255, 0.5);
}

.pixel-color.selected {
    border-color: #fff;
    transform: scale(1.15);
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.8);
    position: relative;
    z-index: 10;
}

/* Animations */
@keyframes pixelPop {
    0% {
        transform: scale(0);
        opacity: 0;
    }

    80% {
        transform: scale(1.2);
        opacity: 1;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.pixel-rect {
    animation: pixelPop 0.3s ease-out;
}


/* Pixel War Popup Colors */
.pixel-popup .leaflet-popup-content-wrapper {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    padding: 0;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.pixel-color-btn {
    width: 25px;
    height: 25px;
    border-radius: 4px;
    cursor: pointer;
    border: 1px solid #ccc;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    transition: transform 0.1s;
}

.pixel-color-btn:hover {
    transform: scale(1.1);
}

.pixel-color-btn.active {
    border: 2px solid #333;
    transform: scale(1.15);
}


/* Pixel War Transitions */
.fade-out {
    opacity: 0 !important;
    transition: opacity 1s ease-in-out;
    pointer-events: none;
}

.fade-in {
    opacity: 1 !important;
    transition: opacity 1s ease-in-out;
}


/* Pixel Feed Item */
.pixel-feed-item {
    font-size: 0.7rem;
    color: #e2e8f0;
    display: flex;
    align-items: center;
    gap: 6px;
    animation: fadeIn 0.3s ease-in;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pixel-feed-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* Mobile: Hacerlo muy pequeño arriba */
@media (max-width: 768px) {
    #pixel-feed {
        top: 10px !important;
        left: 50% !important;
        transform: translateX(-50%);
        width: 90%;
        max-width: 320px;
        padding: 5px 10px !important;
        background: rgba(0, 0, 0, 0.4) !important;
        border: none !important;
    }

    #pixel-feed>div:first-child {
        display: none;
        /* Ocultar título en móvil */
    }

    /* Mostrar solo los últimos 2 en móvil */
    #pixel-feed-list .pixel-feed-item:nth-child(n+3) {
        display: none;
    }

    .pixel-feed-item {
        font-size: 0.6rem;
        justify-content: center;
    }
}


/* Prevent native zooming/scrolling on map container specifically */
#map {
    touch-action: none !important;
    overscroll-behavior: none !important;
}

/* Ensure body doesn't bounce on iOS */
body {
    overscroll-behavior-y: none;
}


/* Override previous block - FIXING MAP ZOOM */
#map {
    touch-action: pan-x pan-y !important;
    overscroll-behavior: auto !important;
}


/* RESET TO DEFAULT: Leaflet controls the gestures naturally */
#map {
    touch-action: auto !important;
    overscroll-behavior: auto !important;
}

/* IMPORTANT: The only restriction we keep is on BODY overscroll to prevent pull-to-refresh on map */
body {
    overscroll-behavior-y: none;
}


/* Critical Fix for Map Interaction */
#pixel-war-ui {
    pointer-events: none !important;
    /* Let clicks pass through empty space */
}

#pixel-war-ui>* {
    pointer-events: auto !important;
    /* Re-enable clicks on actual buttons/panels */
}


/* FINAL ATTEMPT FIX MOBILE ZOOM */
html,
body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    /* Prevent page scroll completely */
    touch-action: none;
    /* Disable browser handling of gestures globally */
}

#map {
    width: 100%;
    height: 100%;
    touch-action: none !important;
    /* Force Leaflet to handle touch */
}


/* FORCE RESET LEAFLET BEHAVIOR */
html,
body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    touch-action: pan-x pan-y !important;
    /* Allow panning */
}

#map {
    width: 100%;
    height: 100%;
    touch-action: pan-x pan-y !important;
    /* Allow simple map movement */
    /* Leaflet handles zooming via separate gesture events */
}




/* FINAL CLEAN MOBILE FIX */
#pixel-war-ui {
    pointer-events: none !important;
    /* Allow clicks on map */
    /* NO VISIBILITY OVERRIDES HERE */
}

#pixel-war-ui>* {
    pointer-events: auto !important;
    /* Restore clicks for buttons */
}


/* ULTRA FINAL FIX: The Leaflet Canvas Layer was stealing touch events! */
/* This makes the vector layer transparent to clicks/touches so valid map interactions pass through to the base map tile layer */
.leaflet-overlay-pane canvas.leaflet-interactive {
    pointer-events: none !important;
}

/* ================================================================= */
/* === X-STYLE MOBILE INTERFACE (APK/MOBILE ONLY) === */
/* ================================================================= */

/* Default: Hidden on Desktop */
#mobile-x-interface {
    display: none;
}

/* Mobile Rules (<768px) */
@media (max-width: 768px) {

    /* Show X Interface */
    #mobile-x-interface {
        display: block !important;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        z-index: 4000;
        pointer-events: none;
        /* Let touches pass to map if transparent */
    }

    /* Hide Old Panels */
    #dashboard-panel,
    #community-panel .dashboard-widget,
    #dashboard-open-btn,
    #community-open-btn {
        display: none !important;
    }

    /* Force Hide Community Panel Container */
    #community-panel {
        display: none !important;
    }

    /* === HEADER === */
    .x-header-bar {
        pointer-events: auto;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 54px;
        background: rgba(0, 0, 0, 0.85);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        border-bottom: 1px solid #333;
        display: flex;
        z-index: 5000;
    }

    .x-tab {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        color: #71767b;
        font-weight: 500;
        font-size: 0.95rem;
        cursor: pointer;
        position: relative;
    }

    .x-tab.active {
        color: #e7e9ea;
        font-weight: 700;
    }

    .x-tab-indicator {
        position: absolute;
        bottom: 0;
        width: 50px;
        height: 4px;
        background: #1d9bf0;
        border-radius: 2px;
        display: none;
    }

    .x-tab.active .x-tab-indicator {
        display: block;
    }

    /* === VIEWS === */
    .x-mobile-view {
        pointer-events: auto;
        position: absolute;
        top: 54px;
        bottom: 60px;
        /* Bottom bar space */
        width: 100%;
        background: #000;
        overflow-y: auto;
        display: none;
        -webkit-overflow-scrolling: touch;
    }

    .x-mobile-view.active {
        display: block;
    }

    /* Map View Overlay */
    .x-view-map-overlay {
        background: transparent !important;
        pointer-events: none;
        /* Pass events to map */
    }

    .x-view-map-overlay .x-fab-btn {
        pointer-events: auto;
    }

    /* FAB */
    .x-fab-btn {
        position: fixed;
        bottom: 80px;
        right: 20px;
        width: 56px;
        height: 56px;
        border-radius: 50%;
        background: #1d9bf0;
        color: white;
        box-shadow: 0 4px 10px rgba(29, 155, 240, 0.4);
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 2rem;
        z-index: 6000;
        border: none;
        cursor: pointer;
        pointer-events: auto;
    }

    /* Search Bar */
    .x-search-area {
        padding: 8px 15px;
        border-bottom: 1px solid #2f3336;
        background: #000;
    }

    .x-search-input {
        width: 100%;
        background: #202327;
        border: 1px solid transparent;
        border-radius: 20px;
        padding: 8px 15px;
        color: #e7e9ea;
        outline: none;
        font-family: inherit;
    }

    .x-search-input:focus {
        background: #000;
        border-color: #1d9bf0;
    }

    /* Moved Feed Styles */
    #x-feed-target {
        padding-bottom: 20px;
    }

    #x-feed-target .widget-title,
    #x-feed-target #btn-expand-feed {
        display: none !important;
    }

    #x-feed-target .dashboard-widget {
        background: transparent !important;
        border: none !important;
        padding: 0 !important;
        border-radius: 0 !important;
    }

    #x-feed-target .recent-cases-container {
        max-height: none !important;
        padding: 0 !important;
    }

    #x-feed-target .topic-item {
        border-radius: 0 !important;
        border: none !important;
        border-bottom: 1px solid #2f3336 !important;
        background: transparent !important;
        margin: 0 !important;
    }
}

/* Exception: If we ever need to click on a SPECIFIC path inside SVG/Canvas, we'd need a different approach, 
   but for Pixel War (painting on map coordinates), this is perfect. */


/* --- MANUAL CONTROLS VISIBILITY --- */
/* Default: Hidden on Desktop */
#pixel-controls {
    display: none !important;
}

/* Mobile: Show controls (Override default) */
@media (max-width: 768px) {
    #pixel-controls {
        display: flex !important;
    }
}

/* =========================================
   LEAFLET BUG FIXES & IMPROVEMENTS
   ========================================= */

/* 1. Fondo negro para disimular líneas blancas entre tiles */
.leaflet-container {
    background-color: #000 !important;
}

/* 2. Ocultar bordes no deseados en tiles */
.leaflet-tile {
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
}

.leaflet-layer,
.leaflet-pane {
    background: transparent;
}

/* 3. Estilo de Atribución (Copyright Visible) */
.leaflet-control-attribution {
    background: rgba(0, 0, 0, 0.6) !important;
    color: #aaa !important;
    font-size: 0.75rem !important;
    border-radius: 4px_tl;
    /* top-left radius, syntax fix needed? just 4px works */
    border-top-left-radius: 8px;
    padding: 2px 8px !important;
    margin-right: 0 !important;
    margin-bottom: 0 !important;
}

.leaflet-control-attribution a {
    color: #4facfe !important;
    /* Azul celeste visible */
    font-weight: 600;
}

/* Default state: Hide the bar on desktop */
.mobile-nav-bar {
    display: none;
}

/* =========================================
   📱 MOBILE & APK STYLES
   ========================================= */

@media (max-width: 768px) {
    .mobile-nav-bar {
        display: flex;
        /* Force display */
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        width: 100% !important;
        height: 75px !important;
        background: #000000 !important;
        /* Puro Negro para que se note */
        z-index: 10000 !important;
        /* Por encima de TODO */
        justify-content: space-evenly;
        align-items: center;
        padding-bottom: env(safe-area-inset-bottom);
        box-shadow: 0 -5px 25px rgba(0, 0, 0, 0.9);
        border-top: 1px solid rgba(255, 255, 255, 0.1);
    }


    /* Hide clutter on mobile for a "Premium" look */
    .floating-logo,
    #days-counter-panel,
    #dashboard-open-btn,
    #community-open-btn,
    .floating-btn {
        display: none !important;
    }

    /* Adjust Panels for mobile */
    #dashboard-panel,
    #community-panel {
        width: 100% !important;
        max-width: none !important;
        height: calc(100% - 70px - env(safe-area-inset-bottom)) !important;
        top: 0 !important;
        bottom: auto !important;
        border-radius: 0 !important;
    }
}

.mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    gap: 2px;
    /* Reducido para que no se pisen */
    cursor: pointer;
    transition: all 0.3s ease;
    flex: 1;
    padding: 5px 2px;
}

.mobile-nav-item:active {
    background: rgba(255, 255, 255, 0.05);
    transform: scale(0.95);
}

.nav-icon {
    font-size: 1.3rem;
    /* Un pelín más chico para dar aire */
}

.nav-label {
    font-size: 0.6rem;
    /* Un pelín más chico para que no se toquen entre botones */
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0px;
    white-space: nowrap;
    /* Evitar saltos de línea feos */
}

/* Google Login FAB In the middle */
.google-fab {
    width: 50px;
    height: 50px;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    border: 2px solid #ff4757;
    margin-top: -30px;
    /* Float effect */
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

#mobile-login-btn:active .google-fab {
    transform: translateY(-5px) scale(1.1);
}

.google-fab img,
.google-fab .nav-icon {
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#mobile-login-btn .nav-label {
    color: #ff4757;
    margin-top: 2px;
}

.social-mini-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    transition: transform 0.2s ease;
}

.social-mini-icon:active {
    transform: scale(0.9);
}

/* 🔒 LOCK ANIMATIONS & STYLES */
@keyframes lockPulse {
    0% {
        transform: scale(1);
        filter: drop-shadow(0 0 0px #ef4444);
    }

    50% {
        transform: scale(1.1);
        filter: drop-shadow(0 0 10px #ef4444);
    }

    100% {
        transform: scale(1);
        filter: drop-shadow(0 0 0px #ef4444);
    }
}

@keyframes lockShake {

    0%,
    100% {
        transform: rotate(0);
    }

    10%,
    30%,
    50%,
    70%,
    90% {
        transform: rotate(-10deg);
    }

    20%,
    40%,
    60%,
    80% {
        transform: rotate(10deg);
    }
}

.locked-btn .google-fab {
    background: #1e293b !important;
    border: 1px solid #475569 !important;
    position: relative;
    overflow: visible !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
}

.locked-btn .google-fab::after {
    content: '🔒';
    position: absolute;
    top: -8px;
    right: -8px;
    background: #ef4444;
    color: white;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    border: 2px solid #000;
    animation: lockShake 3s infinite;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
    z-index: 10;
}

.locked-btn .nav-icon {
    display: none !important;
}

.locked-btn .google-fab::before {
    content: '🔒';
    font-size: 1.4rem;
    animation: lockPulse 2s infinite ease-in-out;
}

.locked-btn .nav-label {
    color: #64748b !important;
    opacity: 0.8;
}

/* Force hide class for the bottom bar */
.modal-active-force-hide #mobile-bottom-bar {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

/* Fix for Custom Div Icons background */
.custom-div-icon {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

@keyframes pulse-donation {
    0% { transform: scale(1); box-shadow: 0 0 8px rgba(255, 71, 87, 0.4); }
    50% { transform: scale(1.05); box-shadow: 0 0 15px rgba(255, 71, 87, 0.8); }
    100% { transform: scale(1); box-shadow: 0 0 8px rgba(255, 71, 87, 0.4); }
}

button[onclick="openDonationModal()"] {
    animation: pulse-donation 2s infinite cubic-bezier(0.4, 0, 0.2, 1);
}

/* ====== PC SCALING AJUSTMENT (Fix 120% zoom perception) ====== */
@media (min-width: 769px) {
    .dashboard-panel, 
    .community-panel, 
    #dashboard-open-btn, 
    #community-open-btn,
    .floating-logo,
    #days-counter-panel,
    .floating-btn {
        zoom: 0.75; /* Reduce el tamaño visual de la interfaz de paneles en PC sin romper coordenadas del mapa Leaflet */
    }
}

/* ================================================================= */
/* === MOBILE COMPOSE BOX (X-style)                               === */
/* ================================================================= */

.x-compose-box {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-bottom: 1px solid #2f3336;
    background: #000;
    cursor: pointer;
    transition: max-height 0.3s ease, opacity 0.3s ease, padding 0.3s ease, border-color 0.3s ease;
    max-height: 80px;
    overflow: hidden;
}

.x-compose-box.compose-hidden {
    max-height: 0;
    opacity: 0;
    padding-top: 0;
    padding-bottom: 0;
    border-color: transparent;
    pointer-events: none;
}

.x-compose-box:hover {
    background: #0a0a0a;
}

.x-compose-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #1e293b;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
    border: 2px solid #ff4757;
}

.x-compose-placeholder {
    flex: 1;
    color: #71767b;
    font-size: 1rem;
}

.x-compose-btn {
    background: #ff4757;
    color: #fff;
    border: none;
    border-radius: 20px;
    padding: 7px 16px;
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.2s;
    flex-shrink: 0;
}

.x-compose-btn:hover {
    background: #ff6070;
}


/* ================================================================= */
/* === DESKTOP X-STYLE INTERFACE                                  === */
/* ================================================================= */

/* Hidden on mobile */
#desktop-x-layout {
    display: none;
}

@media (min-width: 769px) {

    /* Layout container */
    #desktop-x-layout {
        display: flex;
        justify-content: center;
        position: fixed;
        top: 0; left: 0; right: 0; bottom: 0;
        z-index: 500;
        background-color: #000;
        font-family: 'Outfit', sans-serif;
        overflow: hidden;
        transition: background-color 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    }

    /* When in map mode: become transparent so map shows behind */
    #desktop-x-layout.map-mode {
        background-color: transparent !important;
        pointer-events: none;
    }

    /* Base transition settings for the 3 columns */
    #desktop-x-layout .dx-sidebar-left,
    #desktop-x-layout .dx-center,
    #desktop-x-layout .dx-sidebar-right {
        transition: opacity 0.8s cubic-bezier(0.4, 0, 0.2, 1), transform 0.8s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.8s;
        opacity: 1;
        transform: translateY(0) scale(1);
        visibility: visible;
    }

    /* Smooth fade out when entering map-mode */
    #desktop-x-layout.map-mode .dx-sidebar-left,
    #desktop-x-layout.map-mode .dx-center,
    #desktop-x-layout.map-mode .dx-sidebar-right {
        opacity: 0 !important;
        transform: translateY(15px) scale(0.98) !important;
        visibility: hidden !important;
        display: flex; /* Keep the flow so layout holds shape while fading */
    }

    /* ---- LEFT SIDEBAR ---- */
    .dx-sidebar-left {
        width: 260px;
        min-width: 260px;
        height: 100%;
        display: flex;
        flex-direction: column;
        padding: 20px 16px;
        border-right: 1px solid #2f3336;
        box-sizing: border-box;
        overflow-y: auto;
    }

    .dx-logo-wrap {
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 10px 12px;
        margin-bottom: 10px;
    }

    .dx-logo-img {
        width: 42px;
        height: 42px;
        border-radius: 50%;
        object-fit: cover;
        border: 2px solid #ff4757;
    }

    .dx-logo-name {
        font-size: 1.1rem;
        font-weight: 700;
        color: #e7e9ea;
        letter-spacing: -0.5px;
    }

    .dx-nav {
        display: flex;
        flex-direction: column;
        gap: 4px;
        margin-bottom: auto;
    }

    .dx-nav-item {
        display: flex;
        align-items: center;
        gap: 16px;
        padding: 12px 14px;
        border-radius: 50px;
        color: #e7e9ea;
        text-decoration: none;
        cursor: pointer;
        font-size: 1rem;
        font-weight: 400;
        transition: background 0.15s;
        user-select: none;
    }

    .dx-nav-item:hover {
        background: rgba(255,255,255,0.07);
    }

    .dx-nav-item.active {
        font-weight: 700;
    }

    .dx-nav-item.active .dx-nav-icon {
        filter: drop-shadow(0 0 4px #ff4757);
    }

    .dx-nav-icon {
        font-size: 1.3rem;
        width: 26px;
        text-align: center;
        flex-shrink: 0;
        display: inline-block; /* necesario para que transform funcione */
    }

    .dx-nav-label {
        font-size: 1.05rem;
    }

    .dx-report-btn {
        margin-top: 20px;
        background: #ff4757;
        color: #fff;
        border: none;
        border-radius: 50px;
        padding: 14px 24px;
        font-weight: 700;
        font-size: 1rem;
        cursor: pointer;
        width: 100%;
        transition: background 0.2s, transform 0.1s;
        font-family: 'Outfit', sans-serif;
    }

    .dx-report-btn:hover {
        background: #ff6070;
        transform: scale(1.02);
    }

    /* ---- CENTER COLUMN ---- */
    .dx-center {
        flex: 1;
        height: 100%;
        display: flex;
        flex-direction: column;
        border-right: 1px solid #2f3336;
        overflow: hidden;
        max-width: 600px;
    }

    /* Tabs */
    .dx-feed-tabs {
        display: flex;
        border-bottom: 1px solid #2f3336;
        flex-shrink: 0;
    }

    .dx-feed-tab {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        padding: 16px 0 0 0;
        color: #71767b;
        font-weight: 500;
        font-size: 0.95rem;
        cursor: pointer;
        position: relative;
        transition: color 0.2s, background 0.15s;
        user-select: none;
        height: 54px;
    }

    .dx-feed-tab:hover {
        background: rgba(255,255,255,0.04);
        color: #e7e9ea;
    }

    .dx-feed-tab.active {
        color: #e7e9ea;
        font-weight: 700;
    }

    .dx-feed-tab-indicator {
        position: absolute;
        bottom: 0;
        width: 60px;
        height: 4px;
        background: #ff4757;
        border-radius: 2px 2px 0 0;
        display: none;
    }

    .dx-feed-tab.active .dx-feed-tab-indicator {
        display: block;
    }

    /* Views */
    .dx-view {
        display: none;
        flex: 1;
        overflow-y: auto;
        flex-direction: column;
        /* Hide scrollbar but keep functionality */
        scrollbar-width: none;
        -ms-overflow-style: none;
    }

    .dx-view::-webkit-scrollbar {
        display: none !important;
    }

    .dx-view.active {
        display: flex;
        flex-direction: column;
    }

    /* Compose box */
    .dx-compose {
        padding: 12px 16px;
        border-bottom: 1px solid #2f3336;
        cursor: pointer;
        transition: max-height 0.3s ease, opacity 0.3s ease, padding 0.3s ease, border-color 0.3s ease;
        flex-shrink: 0;
        max-height: 120px;
        overflow: hidden;
    }

    .dx-compose.compose-hidden {
        max-height: 0;
        opacity: 0;
        padding-top: 0;
        padding-bottom: 0;
        border-color: transparent;
        pointer-events: none;
    }

    .dx-compose:hover {
        background: rgba(255,255,255,0.02);
    }

    .dx-compose-inner {
        display: flex;
        gap: 12px;
        align-items: flex-start;
    }

    .dx-compose-avatar-lg {
        width: 44px;
        height: 44px;
        border-radius: 50%;
        background: #1e293b;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 1.3rem;
        flex-shrink: 0;
        border: 2px solid #ff4757;
    }

    .dx-compose-right {
        flex: 1;
        display: flex;
        flex-direction: column;
        gap: 12px;
    }

    .dx-compose-fake-input {
        font-size: 1.1rem;
        color: #71767b;
        padding: 10px 0;
        border-bottom: 1px solid #2f3336;
    }

    .dx-compose-actions {
        display: flex;
        justify-content: flex-end;
    }

    .dx-compose-submit {
        background: #ff4757;
        color: #fff;
        border: none;
        border-radius: 20px;
        padding: 8px 20px;
        font-weight: 700;
        font-size: 0.9rem;
        cursor: pointer;
        transition: background 0.2s;
        font-family: 'Outfit', sans-serif;
    }

    .dx-compose-submit:hover {
        background: #ff6070;
    }

    /* Feed items */
    #dx-feed-target {
        flex: 1;
        overflow-y: auto;
        scroll-behavior: smooth;
        /* Strip container borders */
        border: none !important;
        outline: none !important;
        box-shadow: none !important;
        /* Hide scrollbar but keep functionality */
        scrollbar-width: none; /* Firefox */
        -ms-overflow-style: none; /* IE/Edge */
    }

    #dx-feed-target::-webkit-scrollbar {
        display: none !important; /* Chrome/Safari */
    }

    #dx-feed-target .recent-cases-container {
        max-height: none !important;
        overflow-y: visible !important;
        border: none !important;
        box-shadow: none !important;
    }

    /* Force dark background + strip ALL borders on every child */
    #dx-feed-target * {
        background-color: transparent !important;
        border-color: transparent !important;
        box-shadow: none !important;
        outline: none !important;
    }

    /* Re-apply ONLY bottom separator on individual cards */
    #dx-feed-target > div > div, 
    .dx-feed-item,
    [class*="case"],
    [class*="topic"] {
        border: none !important;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
        border-radius: 0 !important;
        background: transparent !important;
        margin-bottom: 0 !important;
        padding: 18px 16px !important;
        box-shadow: none !important;
        transition: background 0.2s;
    }

    #dx-feed-target > div > div:hover,
    .dx-feed-item:hover,
    [class*="case"]:hover,
    [class*="topic"]:hover {
        background: rgba(255, 255, 255, 0.03) !important;
    }
    
    /* Ensure no rounding on images in feed */
    .dx-feed-item img {
        border-radius: 12px; /* Media remains rounded for aesthetics */
    }
    .dx-feed-item .avatar-fallback, 
    .dx-feed-item [class*="avatar-uid"] {
        border-radius: 50% !important;
    }

    /* ---- RIGHT SIDEBAR ---- */
    .dx-sidebar-right {
        width: 340px;
        min-width: 300px;
        height: 100%;
        padding: 12px 16px;
        box-sizing: border-box;
        overflow-y: auto;
        display: flex;
        flex-direction: column;
        gap: 14px;
    }

    .dx-right-search {
        position: relative;
    }

    .dx-right-search input {
        width: 100%;
        background: #202327;
        border: 1px solid transparent;
        border-radius: 50px;
        padding: 10px 18px;
        color: #e7e9ea;
        outline: none;
        font-size: 0.9rem;
        font-family: 'Outfit', sans-serif;
        box-sizing: border-box;
        transition: border-color 0.2s, background 0.2s;
    }

    .dx-right-search input:focus {
        background: #000;
        border-color: #ff4757;
    }

    .dx-right-card {
        background: rgba(255,255,255,0.03);
        border: 1px solid #2f3336;
        border-radius: 16px;
        padding: 14px 16px;
    }

    .dx-right-card-title {
        font-size: 1rem;
        font-weight: 700;
        color: #ffffff !important;
        margin: 0 0 12px 0;
        padding-bottom: 10px;
        border-bottom: 1px solid #2f3336;
    }

    .dx-stat-row {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 7px 0;
        border-bottom: 1px solid rgba(255,255,255,0.05);
        font-size: 0.85rem;
        color: #94a3b8;
    }

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

    .dx-stat-val {
        color: #ff4757;
        font-weight: 700;
    }

    /* Restore text colors for content */
    #dx-feed-target,
    #dx-feed-target * {
        color: #e7e9ea;
    }

    /* User titles in sidebar should be white */
    #dx-recent-users span {
        color: #ffffff !important;
    }

    /* ====== PROFILE VIEW (X-STYLE) ====== */
    #dx-view-perfil {
        display: none;
        flex-direction: column;
        background: #000;
        overflow: hidden !important;
        min-height: 0;
    }

    #dx-view-perfil.active {
        display: flex;
    }

    #dx-prof-scroll {
        display: block;
        flex: 1 1 0;
        min-height: 0;
        overflow-y: scroll;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }

    #dx-prof-scroll::-webkit-scrollbar {
        display: none;
    }

    #dx-prof-posts {
        min-height: 100vh;
    }

    #dx-prof-posts::-webkit-scrollbar {
        display: none;
    }

    .dx-profile-header {
        position: sticky;
        top: 0;
        z-index: 100;
        background: rgba(0, 0, 0, 0.65);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        display: flex;
        align-items: center;
        padding: 4px 16px;
        height: 53px;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }

    .dx-profile-back {
        background: transparent;
        border: none;
        color: white;
        font-size: 1.2rem;
        cursor: pointer;
        width: 36px;
        height: 36px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        margin-right: 20px;
        transition: background 0.2s;
    }

    .dx-profile-back:hover {
        background: rgba(255, 255, 255, 0.1);
    }

    .dx-profile-banner {
        height: 160px;
        background: #333;
        background-size: cover;
        background-position: center;
        width: 100%;
        flex-shrink: 0;
    }

    .dx-profile-info-section {
        padding: 0 16px 16px;
        position: relative;
    }

    .dx-profile-avatar-row {
        display: flex;
        justify-content: space-between;
        align-items: flex-end;
        margin-top: -45px;
        margin-bottom: 12px;
    }

    .dx-profile-avatar-wrapper {
        width: 133px;
        height: 133px;
        border-radius: 50%;
        background: #000;
        padding: 3px;
        box-sizing: border-box;
        outline: 3px solid #ff4757;
        outline-offset: 2px;
        animation: avatarGlowPulse 2.5s ease-in-out infinite;
    }

    .dx-profile-actions {
        padding-top: 50px;
        display: flex;
        gap: 10px;
        align-items: center;
    }

    .dx-profile-actions button {
        background: white;
        color: black;
        border: none;
        border-radius: 999px;
        padding: 8px 16px;
        font-weight: 700;
        font-size: 0.95rem;
        cursor: pointer;
        transition: background 0.2s;
    }

    .dx-profile-actions button:hover {
        background: #d3d3d3;
    }

    #dx-prof-msg-btn {
        background: transparent !important;
        color: white !important;
        border: 1px solid rgba(255,255,255,0.5) !important;
    }
    #dx-prof-msg-btn:hover {
        background: rgba(255,255,255,0.1) !important;
    }

    .dx-profile-details {
        margin-bottom: 16px;
        margin-top: 4px;
    }

    .dx-profile-meta {
        display: flex;
        flex-wrap: wrap;
        gap: 12px;
        color: #71767b;
        font-size: 0.95rem;
        margin-bottom: 12px;
    }

    .dx-profile-stats {
        display: flex;
        gap: 20px;
        font-size: 0.95rem;
    }

    .dx-profile-tabs {
        display: flex;
        border-bottom: 1px solid #2f3336;
        margin-top: 4px;
        flex-shrink: 0;
        position: sticky;
        top: 0;
        z-index: 10;
        background: rgba(0, 0, 0, 0.85);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
    }

    .dx-profile-tab {
        flex: 1;
        text-align: center;
        padding: 14px 4px;
        color: #71767b;
        font-weight: 600;
        font-size: 0.85rem;
        cursor: pointer;
        transition: background 0.2s;
        position: relative;
    }

    .dx-profile-tab:hover {
        background: rgba(255, 255, 255, 0.05);
    }

    .dx-profile-tab.active {
        color: #e7e9ea;
    }

    .dx-profile-tab.active::after {
        content: '';
        position: absolute;
        bottom: 0;
        left: 50%;
        transform: translateX(-50%);
        width: 56px;
        height: 4px;
        background: #1d9bf0;
        border-radius: 99px;
    }
}

/* Hide old desktop panels when feed mode is active */
@media (min-width: 769px) {
    #desktop-x-layout:not(.map-mode) ~ #dashboard-panel,
    #desktop-x-layout:not(.map-mode) ~ #dashboard-open-btn,
    #desktop-x-layout:not(.map-mode) ~ #community-panel,
    #desktop-x-layout:not(.map-mode) ~ #community-open-btn {
        display: none !important;
    }
}
