/* ============================================================
   app.css — Estilos propios de la aplicación Emergencias
   ============================================================ */

:root {
    --app-radius: 12px;
}

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

main {
    flex: 1 0 auto;
}

/* ── Tipografía y enlaces ──────────────────────────────── */
a { color: var(--link-color); }
a:hover { color: var(--accent-color); }

/* ── Navbar ─────────────────────────────────────────────── */
.app-navbar {
    box-shadow: 0 1px 0 rgba(0,0,0,.04);
}
.navbar-brand img { object-fit: contain; }

/* Iconos de acción en navbar: SIEMPRE visibles */
.navbar-icons {
    display: flex !important;
    flex-shrink: 0;
}

/* Iconos de acción en navbar: tamaño táctil en móvil */
.navbar-action-icons {
    gap: .25rem !important;
}
.navbar-icon-btn {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0 !important;
    border-radius: 50%;
    font-size: 1.15rem;
    position: relative;
    transition: background .15s;
}
.navbar-icon-btn:hover,
.navbar-icon-btn:focus {
    background: rgba(0,0,0,.06);
}
.navbar-avatar {
    width: auto !important;
    padding: 0 !important;
}
.navbar-icon-btn .msg-count {
    position: absolute;
    top: 2px;
    right: 0;
    font-size: .55rem;
    padding: 1px 4px;
    border-radius: 99px;
    background: var(--accent-color);
    color: #fff;
    font-weight: 700;
    line-height: 1.2;
}
.navbar-icon-btn .msg-count.zero {
    display: none;
}

/* Avatar circular con inicial del usuario */
.avatar-circle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--accent-color);
    color: #fff;
    font-weight: 700;
    font-size: .85rem;
}

/* ── Tarjetas / contadores home ─────────────────────────── */
.card {
    border-radius: var(--app-radius);
    border-color: var(--border-color);
}
.card-counter {
    text-align: center;
    border-left: 4px solid var(--accent-color);
    transition: transform .15s ease;
}
.card-counter:hover { transform: translateY(-2px); }
.card-counter .num {
    font-size: 2.2rem;
    font-weight: 800;
    line-height: 1;
}
.card-counter .lbl {
    text-transform: uppercase;
    font-size: .72rem;
    letter-spacing: .05em;
    color: var(--text-secondary);
}

/* ── Badges de alerta / estado ──────────────────────────── */
.badge-alerta { font-size: .75rem; }

/* Panel urgente en home */
.panel-urgente {
    border: 2px solid var(--alert-urgente);
    background: rgba(220, 53, 69, .08);
    border-radius: var(--app-radius);
    padding: 1rem;
    animation: pulseUrgente 2s infinite;
}
@keyframes pulseUrgente {
    0%, 100% { box-shadow: 0 0 0 0 rgba(220, 53, 69, .4); }
    50%      { box-shadow: 0 0 0 8px rgba(220, 53, 69, 0); }
}

.panel-activo {
    border-left: 4px solid var(--accent-color);
    border-radius: var(--app-radius);
    padding: 1rem;
}

.panel-resumen {
    background: var(--bg-secondary);
    border-radius: var(--app-radius);
    padding: 1rem;
}

/* ── Mapa ───────────────────────────────────────────────── */
#mapHome, #mapSelector, #mapDetalle {
    z-index: 0;
}
.map-home-wrap { height: 350px; width: 100%; }
.map-selector-wrap { height: 350px; width: 100%; }
.map-detalle-wrap { height: 380px; width: 100%; }
@media (max-width: 768px) {
    .map-home-wrap, .map-selector-wrap, .map-detalle-wrap { height: 250px; }
}

/* ── Mapa editor de polígonos (informes) ────────────────── */
#mapEditor { z-index: 0; }
.map-editor-wrap { height: 450px; width: 100%; min-height: 350px; }
@media (max-width: 991px) {
    .map-editor-wrap { height: 300px; }
}

#panelPoligonos {
    max-height: 450px;
    overflow-y: auto;
}
@media (max-width: 991px) {
    #panelPoligonos { max-height: 250px; }
}

.poligono-item {
    background: var(--bg-card, #f8f9fa);
    border: 1px solid var(--border-color, #dee2e6);
    border-radius: 6px;
}
.poligono-item:focus-within {
    border-color: #86b7fe;
    box-shadow: 0 0 0 .2rem rgba(13, 110, 253, .15);
}

.color-dot {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px rgba(0,0,0,.2);
    flex-shrink: 0;
}

/* Vertex markers */
.leaflet-interactive[draggable] {
    cursor: grab;
}
.leaflet-interactive[draggable]:active {
    cursor: grabbing;
}

/* Legend del mapa */
.map-legend {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--app-radius);
    padding: .75rem;
    font-size: .85rem;
}

/* ── Sidebar admin ──────────────────────────────────────── */
.admin-sidebar .nav-link {
    color: var(--text-secondary);
    border-radius: 8px;
    margin-bottom: 2px;
}
.admin-sidebar .nav-link.active,
.admin-sidebar .nav-link:hover {
    background: var(--accent-color);
    color: #fff;
}
.admin-sidebar .nav-link i { width: 20px; text-align: center; }

/* ── Chat tipo IRC ──────────────────────────────────────── */
.chat-box {
    height: 420px;
    overflow-y: auto;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--app-radius);
    padding: .75rem;
}
.chat-msg {
    margin-bottom: .5rem;
    line-height: 1.4;
}
.chat-nick {
    font-weight: 700;
    color: var(--accent-color);
}
.chat-time {
    font-size: .7rem;
    color: var(--text-secondary);
}
.chat-msg-propio { text-align: right; }

/* ── Tablas responsivas ─────────────────────────────────── */
.table thead th {
    font-size: .8rem;
    text-transform: uppercase;
    letter-spacing: .03em;
    color: var(--text-secondary);
}

/* ── Cookie banner ──────────────────────────────────────── */
.cookie-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1080;
    padding: 1rem;
    background: var(--bg-card);
    border-top: 2px solid var(--accent-color);
    box-shadow: 0 -2px 10px rgba(0,0,0,.15);
}
.cookie-cat {
    transition: background .15s;
}
.cookie-cat:hover {
    background: var(--bg-body);
}

/* ── Página 404 ─────────────────────────────────────────── */
.error-404-wrap {
    min-height: 60vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}
.error-404-wrap .code {
    font-size: 6rem;
    font-weight: 800;
    color: var(--accent-color);
    line-height: 1;
}

/* ── Utilidades varias ──────────────────────────────────── */
.cursor-pointer { cursor: pointer; }
.text-urgente   { color: var(--alert-urgente); }
.text-medio     { color: var(--alert-medio); }
.text-bajo      { color: var(--alert-bajo); }

.foto-thumb {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

/* Timeline de suceso */
.timeline {
    list-style: none;
    padding-left: 1.5rem;
    position: relative;
}
.timeline::before {
    content: '';
    position: absolute;
    left: 6px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border-color);
}
.timeline li {
    position: relative;
    margin-bottom: 1rem;
}
.timeline li::before {
    content: '';
    position: absolute;
    left: -1.5rem;
    top: 4px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--accent-color);
}

/* Timeline mini (sidebar home, actividad reciente) */
.timeline-mini {
    max-height: 360px;
    overflow-y: auto;
}
.timeline-mini li:last-child {
    border-bottom: 0 !important;
}
.timeline-mini li:hover {
    background: var(--bg-body-tertiary, rgba(0,0,0,.03));
}
.timeline-mini li a {
    display: inline-block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: bottom;
}

/* ============================================================
   Theme switch premium (estilo iOS / anime sol-luna)
   ============================================================ */
.theme-switch {
    --ts-w: 56px;
    --ts-h: 28px;
    --ts-pad: 3px;
    --ts-thumb: calc(var(--ts-h) - var(--ts-pad) * 2);

    position: relative;
    display: inline-flex;
    align-items: center;
    width: var(--ts-w);
    height: var(--ts-h);
    padding: 0;
    margin: 0;
    border: 0;
    background: none;
    cursor: pointer;
}
.theme-switch-track {
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(135deg, #87CEEB 0%, #f6c365 100%);
    box-shadow: inset 0 1px 3px rgba(0,0,0,.2), 0 1px 1px rgba(255,255,255,.4);
    transition: background .45s ease, box-shadow .45s ease;
}
.theme-switch-thumb {
    position: absolute;
    top: var(--ts-pad);
    left: var(--ts-pad);
    width: var(--ts-thumb);
    height: var(--ts-thumb);
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 2px 6px rgba(0,0,0,.35);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    transition: transform .45s cubic-bezier(.68,-0.55,.27,1.55), background .3s ease;
}
.theme-switch-icon {
    position: absolute;
    font-size: calc(var(--ts-thumb) - 8px);
    transition: opacity .3s ease, transform .45s cubic-bezier(.68,-0.55,.27,1.55);
}
.theme-switch-icon.sun  { color: #ff9a3c; opacity: 1; transform: rotate(0) scale(1); }
.theme-switch-icon.moon { color: #1f2d98; opacity: 0; transform: rotate(-90deg) scale(.5); }

/* Estado DARK: luna visible, thumb a la derecha */
html.theme-dark .theme-switch-track {
    background: linear-gradient(135deg, #141e3a 0%, #2c3e6b 100%);
    box-shadow: inset 0 1px 3px rgba(0,0,0,.6), 0 0 6px rgba(108,140,200,.3);
}
html.theme-dark .theme-switch-thumb {
    transform: translateX(calc(var(--ts-w) - var(--ts-h)));
    background: #e8e8f5;
}
html.theme-dark .theme-switch-icon.sun  { opacity: 0; transform: rotate(90deg) scale(.5); }
html.theme-dark .theme-switch-icon.moon { opacity: 1; transform: rotate(0) scale(1); }

/* Pequeñas estrellas en el track del tema oscuro */
html.theme-dark .theme-switch-track::before,
html.theme-dark .theme-switch-track::after {
    content: '';
    position: absolute;
    background: #fff;
    border-radius: 50%;
    opacity: .85;
}
html.theme-dark .theme-switch-track::before {
    width: 2px; height: 2px; top: 6px;  left: 10px;
    box-shadow: 8px 4px 0 #fff, 14px -2px 0 #fff, 4px 12px 0 #fff;
}
html.theme-dark .theme-switch-track::after {
    width: 1px; height: 1px; top: 14px; left: 22px;
    box-shadow: 6px -6px 0 #fff, -4px 2px 0 #fff;
}

/* Hover sutil */
.theme-switch:hover .theme-switch-thumb { box-shadow: 0 2px 10px rgba(0,0,0,.45); }
.theme-switch:focus-visible { outline: 2px solid var(--accent-color); outline-offset: 3px; border-radius: 999px; }

/* En móvil, ligeramente más pequeño */
@media (max-width: 768px) {
    .theme-switch { --ts-w: 50px; --ts-h: 26px; }
}

/* ── Mensajes privados (1-a-1) ─────────────────────────── */
.msg-row {
    display: flex;
    margin-bottom: .5rem;
    line-height: 1.4;
}
.msg-row.msg-mine  { justify-content: flex-end; }
.msg-row.msg-other { justify-content: flex-start; }
.msg-bubble {
    max-width: 75%;
    padding: .55rem .85rem;
    border-radius: var(--app-radius);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    word-wrap: break-word;
    overflow-wrap: anywhere;
}
.msg-row.msg-mine .msg-bubble {
    background: #dc3545;
    color: #fff;
    border-color: #dc3545;
}
html.theme-dark .msg-row.msg-mine .msg-bubble {
    background: #b02a37;
    border-color: #b02a37;
}
.msg-text { white-space: pre-wrap; }
.msg-meta {
    font-size: .68rem;
    text-align: right;
    opacity: .65;
    margin-top: .2rem;
}
.msg-adjuntos {
    display: flex;
    flex-wrap: wrap;
    gap: .25rem;
    margin-top: .35rem;
}
.msg-adjunto-thumb {
    display: inline-block;
    border-radius: 4px;
    overflow: hidden;
    line-height: 0;
}
.msg-adjunto-thumb img {
    max-width: 180px;
    max-height: 140px;
    object-fit: cover;
    cursor: zoom-in;
    transition: transform .15s;
}
.msg-adjunto-thumb:hover img { transform: scale(1.03); }

/* Lightbox sencillo para ver adjuntos en grande */
.msg-lightbox {
    position: fixed;
    inset: 0;
    z-index: 1090;
    background: rgba(0,0,0,.85);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: zoom-out;
    padding: 2rem;
}
.msg-lightbox img {
    max-width: 90vw;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 6px;
}

/* Preview de adjuntos pendientes antes del envío */
.preview-item {
    position: relative;
    border-radius: 4px;
    overflow: hidden;
    width: 50px;
    height: 50px;
}
.preview-item img { width: 100%; height: 100%; object-fit: cover; }
.preview-item .preview-remove {
    position: absolute;
    top: -2px; right: -2px;
    background: #dc3545;
    color: #fff;
    border-radius: 50%;
    width: 18px; height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 11px;
    line-height: 1;
    border: 1px solid #fff;
}

/* Badge navbar para mensajes no leídos */
.navbar-msg-badge {
    position: relative;
    display: inline-flex;
    align-items: center;
}
.navbar-msg-badge .msg-count {
    position: absolute;
    top: -6px; right: -8px;
    background: #dc3545;
    color: #fff;
    border-radius: 999px;
    font-size: .62rem;
    line-height: 1;
    padding: 3px 5px;
    border: 1px solid var(--bg-card);
    min-width: 16px;
    text-align: center;
    font-weight: 700;
}
.navbar-msg-badge .msg-count.zero { display: none; }

/* Lista de resultados de búsqueda de usuarios */
.usuario-result {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .5rem .75rem;
    cursor: pointer;
    border: none;
    border-bottom: 1px solid var(--border-color);
}
.usuario-result:hover,
.usuario-result.active {
    background: var(--bg-secondary);
}
.usuario-result .avatar-circle {
    width: 32px;
    height: 32px;
    font-size: .85rem;
}

/* ── Navbar: active state ────────────────────────────────── */
.navbar-nav .nav-link.active {
    color: var(--accent-color, #dc3545);
    font-weight: 600;
    position: relative;
}
.navbar-nav .nav-link.active::after {
    content: '';
    position: absolute;
    bottom: 2px;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 2px;
    background: var(--accent-color, #dc3545);
    border-radius: 999px;
}
.navbar-nav .dropdown-toggle.active {
    color: var(--accent-color, #dc3545);
    font-weight: 600;
}

/* ── Navbar responsive: iconos más grandes en móvil ─────── */
@media (max-width: 991.98px) {
    .navbar-icon-btn {
        width: 44px;
        height: 44px;
        font-size: 1.3rem;
    }
    .avatar-circle {
        width: 36px;
        height: 36px;
        font-size: .95rem;
    }
    .navbar-toggler {
        padding: .4rem .6rem;
        font-size: 1.1rem;
    }

    /* ── Menú colapsado: centrado y mejorado ────────────── */
    .navbar-collapse {
        padding: .75rem 1rem 1rem;
        border-top: 1px solid var(--border-color);
        margin-top: .5rem;
    }
    .navbar-collapse .navbar-nav {
        align-items: center;
        width: 100%;
        gap: .15rem;
    }
    .navbar-collapse .navbar-nav .nav-link {
        text-align: center;
        padding: .7rem 1rem;
        font-size: 1.05rem;
        border-radius: 8px;
        transition: background .15s, color .15s;
    }
    .navbar-collapse .navbar-nav .nav-link:hover {
        background: rgba(0,0,0,.05);
    }
    .navbar-collapse .navbar-nav .dropdown-menu {
        text-align: center;
        background: transparent;
        border: none;
        box-shadow: none;
        padding: 0 .5rem;
    }
    .navbar-collapse .navbar-nav .dropdown-menu .dropdown-item {
        padding: .55rem 1rem;
        border-radius: 6px;
    }
    .navbar-collapse .navbar-nav .dropdown-menu .dropdown-item:hover {
        background: rgba(0,0,0,.05);
    }

    /* ── Separadores entre grupos ────────────────────────── */
    .mobile-nav-group-main + .mobile-nav-group-tools::before,
    .mobile-nav-group-tools + .mobile-nav-group-account::before {
        content: '';
        display: block;
        width: 40px;
        height: 1px;
        background: var(--border-color);
        margin: .4rem auto;
    }

    /* ── Active state en móvil ───────────────────────────── */
    .navbar-collapse .nav-link.active {
        background: rgba(220, 53, 69, .08);
        color: var(--accent-color, #dc3545) !important;
        font-weight: 600;
    }
    .navbar-collapse .nav-link.active::after {
        display: none;
    }
    .navbar-collapse .dropdown-toggle.active {
        background: rgba(220, 53, 69, .08);
        color: var(--accent-color, #dc3545) !important;
    }

    /* Toggle tema: oculto en móvil, se muestra en perfil */
    #themeToggle {
        display: none !important;
    }
}
@media (max-width: 575.98px) {
    .navbar-icon-btn {
        width: 42px;
        height: 42px;
        font-size: 1.25rem;
    }
    .navbar-action-icons {
        gap: .15rem !important;
    }
    .navbar-brand span.fw-bold {
        font-size: .95rem;
    }
}

/* ── Profile page: toggle tema en móvil ─────────────────── */
.profile-theme-toggle {
    display: none;
}
@media (max-width: 991.98px) {
    .profile-theme-toggle {
        display: flex;
        align-items: center;
        gap: 1rem;
        padding: 1rem;
        background: var(--bg-card);
        border: 1px solid var(--border-color);
        border-radius: var(--app-radius);
        margin-bottom: 1.5rem;
    }
    .profile-theme-toggle .form-check {
        margin: 0;
    }
}

/* ============================================================
   Breaking News Ticker
   ============================================================ */
.ticker-wrap {
    background: var(--bs-danger);
    color: #fff;
    display: flex;
    align-items: stretch;
    overflow: hidden;
    position: sticky;
    top: 56px;
    z-index: 1019;
    transition: max-height .3s ease;
    max-height: 60px;
}
.ticker-collapsed {
    max-height: 0 !important;
}
.ticker-label {
    background: rgba(0,0,0,.2);
    padding: .5rem 1rem;
    font-weight: 700;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: .4rem;
    z-index: 2;
    flex-shrink: 0;
}
.ticker-content {
    flex: 1;
    overflow: hidden;
    position: relative;
    mask-image: linear-gradient(to right, transparent, black 2%, black 98%, transparent);
    -webkit-mask-image: linear-gradient(to right, transparent, black 2%, black 98%, transparent);
}
.ticker-scroll {
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
    animation: ticker-scroll linear infinite;
    padding: .5rem 0;
}
.ticker-scroll:hover {
    animation-play-state: paused;
}
.ticker-item {
    color: #fff;
    text-decoration: none;
    padding: 0 .5rem;
    font-size: .9rem;
}
.ticker-item:hover {
    text-decoration: underline;
    color: #fff;
}
.ticker-separator {
    color: rgba(25,25,25,.5);
    font-size: .25rem;
    padding: 0 .75rem;
    flex-shrink: 0;
}
.ticker-toggle {
    background: rgba(0,0,0,.2);
    border: none;
    color: #fff;
    padding: .5rem .75rem;
    cursor: pointer;
    flex-shrink: 0;
    transition: background .2s;
}
.ticker-toggle:hover {
    background: rgba(0,0,0,.35);
}
@keyframes ticker-scroll {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

/* Responsive ticker */
@media (max-width: 575.98px) {
    .ticker-label {
        padding: .4rem .6rem;
        font-size: .8rem;
    }
    .ticker-item {
        font-size: .8rem;
    }
}

/* ── Leaflet popup sucesos ─────────────────────────────────────── */
.leaflet-popup-content .popup-suceso { min-width: 160px; }
.leaflet-popup-content .popup-title { display: block; font-size: .95rem; margin-bottom: .25rem; color: #212529; }
.leaflet-popup-content .popup-meta { font-size: .8rem; color: #6c757d; }
.leaflet-popup-content .popup-link,
.leaflet-popup-content .popup-link:visited,
.leaflet-popup-content .popup-link:focus {
    display: inline-block;
    margin-top: .4rem;
    padding: .25rem .75rem;
    font-size: .8rem;
    font-weight: 500;
    color: #fff !important;
    background: #dc3545;
    border-radius: .375rem;
    text-decoration: none !important;
    transition: background .2s;
}
.leaflet-popup-content .popup-link:hover { background: #bb2d3b; color: #fff !important; }
.leaflet-popup-content-wrapper { border-radius: .5rem; }
.leaflet-popup-content { margin: .75rem 1rem; }

/* ── RSS Viewer: marcador pulsante ────────────────────────────── */
.marker-latest {
    position: relative;
    width: 24px;
    height: 24px;
}
.marker-pulse {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    animation: markerPulse 1.5s ease-out infinite;
}
.marker-dot {
    position: absolute;
    top: 4px;
    left: 4px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 0 6px rgba(0,0,0,.4);
}
@keyframes markerPulse {
    0%   { transform: scale(1);   opacity: .6; }
    100% { transform: scale(2.8); opacity: 0; }
}

/* ── RSS Viewer: popups ──────────────────────────────────────── */
.popup-rss { min-width: 170px; }
.popup-rss .popup-badge {
    display: inline-block;
    padding: .15rem .5rem;
    border-radius: .3rem;
    font-size: .75rem;
    font-weight: 600;
    color: #fff;
}
.popup-rss .popup-title {
    display: block;
    font-size: .95rem;
    margin: .3rem 0 .15rem;
    color: #212529;
}
.popup-rss .popup-meta {
    font-size: .8rem;
    color: #6c757d;
    line-height: 1.5;
}

/* ── RSS Viewer: lista ───────────────────────────────────────── */
.rss-list-wrap {
    max-height: 500px;
    overflow-y: auto;
}
@media (min-width: 992px) {
    .rss-list-wrap { max-height: 500px; }
}
.rss-list-item {
    padding: .65rem 1rem;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    transition: background .15s;
}
.rss-list-item:hover { background: #f8f9fa; }
.rss-list-item:last-child { border-bottom: none; }
.rss-pulse-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: .35rem;
    animation: markerPulse 1.5s ease-out infinite;
}
@media (max-width: 991.98px) {
    #mapaTerremotos, #mapaAlertas { height: 300px !important; }
    .rss-list-wrap { max-height: 400px; }
}

/* ── User popover ─────────────────────────────────────────── */
.autor-link {
    text-decoration: underline;
    text-decoration-style: dotted;
    text-underline-offset: 2px;
    cursor: pointer;
    transition: color .15s;
}
.autor-link:hover {
    text-decoration-style: solid;
}
.user-popover-menu {
    display: flex;
    flex-direction: column;
    min-width: 170px;
}
.user-popover-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 12px;
    color: var(--bs-body-color);
    text-decoration: none;
    border-radius: 6px;
    font-size: .875rem;
    transition: background .12s;
}
.user-popover-item:hover {
    background: var(--bs-tertiary-bg);
    color: var(--bs-body-color);
}
.popover {
    --bs-popover-border-color: var(--bs-border-color);
    box-shadow: 0 4px 16px rgba(0,0,0,.15);
    pointer-events: auto;
}
.popover:hover {
    box-shadow: 0 4px 20px rgba(0,0,0,.2);
}
.popover-body {
    padding: .5rem .25rem !important;
}

/* ============================================================
   Mapa de listado (Sucesos, Avisos, Alertas)
   ============================================================ */
.map-list-wrap {
    height: 350px;
    border-radius: 8px;
    z-index: 1;
}
@media (max-width: 768px) {
    .map-list-wrap {
        height: 300px;
    }
}

/* ============================================================
   Preloader (preload de página pública)
   ============================================================ */
#app-preloader {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.78);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    opacity: 1;
    visibility: visible;
    transition: opacity 400ms ease, visibility 400ms ease;
}
html.theme-dark #app-preloader {
    background: rgba(20, 22, 28, 0.82);
}
#app-preloader.preloader-hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.preloader-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    user-select: none;
}

.preloader-logo {
    width: 96px;
    height: 96px;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: preloader-pulse 1.4s ease-in-out infinite;
}
.preloader-logo img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 14px;
    filter: drop-shadow(0 6px 24px rgba(220, 53, 69, 0.35));
}
@keyframes preloader-pulse {
    0%, 100% { transform: scale(1); }
    50%      { transform: scale(1.08); }
}

.preloader-text {
    font-size: 1.15rem;
    font-weight: 600;
    letter-spacing: .02em;
    color: var(--text-color, #1f2933);
}
html.theme-dark .preloader-text {
    color: #e9ecef;
}

.preloader-bar {
    width: 220px;
    height: 5px;
    border-radius: 999px;
    background: rgba(108, 117, 125, 0.25);
    overflow: hidden;
    position: relative;
}
.preloader-bar span {
    position: absolute;
    top: 0;
    left: 0;
    width: 40%;
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--accent-color, #dc3545), #f97316);
    animation: preloader-slide 1.2s ease-in-out infinite;
}
@keyframes preloader-slide {
    0%   { left: -40%; }
    100% { left: 100%; }
}

@media (max-width: 480px) {
    .preloader-logo { width: 80px; height: 80px; font-size: 2.1rem; }
    .preloader-bar { width: 170px; }
}


