/* ============================================================
   AvisaMUR — app.css
   Reset mínimo + variables + componentes
   ============================================================ */

/* ── Variables ───────────────────────────────────────────── */
:root {
    --color-primary:   #1D3557;   /* azul oscuro Murcia */
    --color-accent:    #E63946;   /* rojo alertas */
    --color-success:   #52B788;
    --color-warning:   #E9C46A;
    --color-text:      #1a1a2e;
    --color-text-muted:#6b7280;
    --color-bg:        #f8f9fa;
    --color-surface:   #ffffff;
    --color-border:    #e2e8f0;

    --urgency-emergencia: #E63946;
    --urgency-alta:       #F4A261;
    --urgency-media:      #E9C46A;
    --urgency-baja:       #52B788;

    --radius-sm: 6px;
    --radius:    10px;
    --radius-lg: 16px;

    --shadow-sm: 0 1px 3px rgba(0,0,0,.08);
    --shadow:    0 4px 12px rgba(0,0,0,.10);
    --shadow-lg: 0 8px 30px rgba(0,0,0,.15);

    --navbar-h: 58px;
    --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

/* ── Reset ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; scroll-behavior: smooth; }

body {
    font-family: var(--font);
    color: var(--color-text);
    background: var(--color-bg);
    line-height: 1.6;
}

a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; display: block; }

/* ── Navbar ──────────────────────────────────────────────── */
.navbar {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: var(--color-primary);
    height: var(--navbar-h);
    box-shadow: var(--shadow);
}

.navbar__inner {
    max-width: 1200px;
    margin: 0 auto;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1rem;
    gap: 1rem;
}

.navbar__logo {
    font-size: 1.4rem;
    font-weight: 800;
    letter-spacing: -.5px;
    color: #fff;
    text-decoration: none;
    flex-shrink: 0;
}
.navbar__logo:hover { text-decoration: none; opacity: .9; }
.navbar__logo-mark  { color: #fff; }
.navbar__logo-mur   { color: var(--urgency-alta); }

.navbar__nav {
    display: flex;
    align-items: center;
    gap: .75rem;
    flex-wrap: wrap;
}

.navbar__link {
    color: rgba(255,255,255,.85);
    font-size: .9rem;
    font-weight: 500;
    transition: color .15s;
}
.navbar__link:hover, .navbar__link--btn:hover { color: #fff; text-decoration: none; }

.navbar__link--btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: .9rem;
    font-weight: 500;
    color: rgba(255,255,255,.85);
    padding: 0;
}

/* ── Main ────────────────────────────────────────────────── */
.main { min-height: calc(100vh - var(--navbar-h) - 52px); }

/* ── Footer ──────────────────────────────────────────────── */
.footer {
    background: var(--color-primary);
    color: rgba(255,255,255,.6);
    font-size: .8rem;
    padding: .75rem 1rem;
}
.footer__inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    gap: .5rem;
    flex-wrap: wrap;
}
.footer a { color: rgba(255,255,255,.7); }
.footer a:hover { color: #fff; }

/* ── Botones ─────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .55rem 1.1rem;
    border-radius: var(--radius-sm);
    font-size: .9rem;
    font-weight: 600;
    cursor: pointer;
    border: 2px solid transparent;
    transition: background .15s, border-color .15s, opacity .15s;
    text-decoration: none;
    white-space: nowrap;
}
.btn:disabled { opacity: .55; cursor: default; }

.btn--primary  { background: var(--color-accent); color: #fff; }
.btn--primary:hover { background: #c1121f; text-decoration: none; }

.btn--secondary { background: var(--color-primary); color: #fff; }
.btn--secondary:hover { background: #162940; text-decoration: none; }

.btn--ghost {
    background: transparent;
    border-color: var(--color-border);
    color: var(--color-text);
}
.btn--ghost:hover { background: var(--color-border); text-decoration: none; }

.btn--danger  { background: var(--urgency-emergencia); color: #fff; }

.btn--sm { padding: .35rem .75rem; font-size: .82rem; }
.btn--lg { padding: .75rem 1.5rem; font-size: 1rem; }
.btn--full { width: 100%; justify-content: center; }

.btn--vote {
    background: #eef2ff;
    border-color: #c7d2fe;
    color: var(--color-primary);
    font-size: .9rem;
}
.btn--vote:hover    { background: #e0e7ff; }
.btn--voted         { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }
.btn--voted:hover   { background: #162940; }

/* ── Badges ──────────────────────────────────────────────── */
.badge {
    display: inline-block;
    padding: .2rem .55rem;
    border-radius: 999px;
    font-size: .75rem;
    font-weight: 700;
    letter-spacing: .03em;
    text-transform: uppercase;
}
.badge--urgency.badge--emergencia { background: var(--urgency-emergencia); color: #fff; }
.badge--urgency.badge--alta       { background: var(--urgency-alta);       color: #fff; }
.badge--urgency.badge--media      { background: var(--urgency-media);      color: #333; }
.badge--urgency.badge--baja       { background: var(--urgency-baja);       color: #fff; }
.badge--status   { background: #e2e8f0; color: #555; }

/* ── Mapa ────────────────────────────────────────────────── */
.mapa-page { position: relative; }

.mapa-filters {
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    padding: .5rem 1rem;
    position: sticky;
    top: var(--navbar-h);
    z-index: 800;
}
.mapa-filters__inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: .5rem;
    flex-wrap: wrap;
}

.filter-select {
    padding: .35rem .65rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: .85rem;
    background: #fff;
    cursor: pointer;
    flex: 1;
    min-width: 160px;
    max-width: 280px;
}

.mapa-canvas {
    height: calc(100vh - var(--navbar-h) - 48px - 52px); /* fallback para Safari antiguo */
    height: calc(100dvh - var(--navbar-h) - 48px - 52px); /* dvh evita el bug del teclado en iOS */
    width: 100%;
    z-index: 1;
}

/* ── FAB (botón flotante mobile) ─────────────────────────── */
.fab {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 900;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--color-accent);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-lg);
    font-size: 1.5rem;
    text-decoration: none;
    transition: transform .15s, background .15s;
}
.fab:hover { transform: scale(1.08); background: #c1121f; text-decoration: none; }
.fab--login { background: var(--color-primary); }
.fab--login:hover { background: #162940; }
.fab__icon { line-height: 1; }

/* ── Panel lateral ───────────────────────────────────────── */
.side-panel {
    position: fixed;
    top: var(--navbar-h);
    right: 0;
    bottom: 0;
    width: 360px;
    max-width: 100vw;
    background: var(--color-surface);
    box-shadow: var(--shadow-lg);
    z-index: 700;
    overflow-y: auto;
    transition: transform .25s ease;
}
.side-panel[hidden] { display: none; }

.side-panel__close {
    position: sticky;
    top: 0;
    display: block;
    width: 100%;
    padding: .75rem 1rem;
    background: var(--color-primary);
    color: #fff;
    border: none;
    font-size: 1.4rem;
    text-align: right;
    cursor: pointer;
    line-height: 1;
}
.side-panel__close:hover { background: #162940; }

.side-panel__body { padding: 1rem; }

/* ── Detalle en panel ────────────────────────────────────── */
.detail-photo {
    width: 100%;
    max-height: 220px;
    object-fit: cover;
    border-radius: var(--radius);
    margin-bottom: 1rem;
}
.detail-header { margin-bottom: .5rem; }
.detail-title  { font-size: 1.1rem; font-weight: 700; margin-bottom: .4rem; }
.detail-meta   { font-size: .82rem; color: var(--color-text-muted); margin-bottom: .75rem; }
.detail-desc   { font-size: .9rem; line-height: 1.7; margin-bottom: 1rem; }
.detail-actions { display: flex; gap: .5rem; flex-wrap: wrap; }

/* ── Formularios ─────────────────────────────────────────── */
.form-page {
    max-width: 520px;
    margin: 2rem auto;
    padding: 0 1rem;
}
.form-card {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow);
}
.form-card h1 { font-size: 1.4rem; margin-bottom: .25rem; }
.form-card .subtitle { color: var(--color-text-muted); font-size: .9rem; margin-bottom: 1.5rem; }

.form-group { margin-bottom: 1.25rem; }
.form-group label {
    display: block;
    font-size: .85rem;
    font-weight: 600;
    margin-bottom: .35rem;
}
.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: .6rem .85rem;
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: .95rem;
    font-family: inherit;
    transition: border-color .15s;
    background: #fff;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(29,53,87,.12);
}
.form-group textarea { resize: vertical; min-height: 110px; }
.form-hint { font-size: .78rem; color: var(--color-text-muted); margin-top: .25rem; }

/* ── Alertas ─────────────────────────────────────────────── */
.alert {
    padding: .75rem 1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
    font-size: .9rem;
}
.alert--error   { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.alert--success { background: #d1fae5; color: #065f46; border: 1px solid #6ee7b7; }
.alert--info    { background: #e0f2fe; color: #0369a1; border: 1px solid #7dd3fc; }

/* ── Estados carga / error ───────────────────────────────── */
.loading { color: var(--color-text-muted); font-style: italic; }
.error   { color: var(--urgency-emergencia); }

/* ── Mapa Leaflet: override pin ──────────────────────────── */
.avisamur-pin {
    background: transparent !important;
    border: none !important;
}
.leaflet-tooltip { font-family: var(--font); font-size: .82rem; }

/* ── Contenido centrado (listas, admin, etc.) ───────────── */
.page-wrap {
    max-width: 900px;
    margin: 2rem auto;
    padding: 0 1rem;
}
.page-title { font-size: 1.5rem; font-weight: 700; margin-bottom: 1.25rem; }

/* ── Tarjeta de incidencia (listados) ───────────────────── */
.incident-card {
    background: var(--color-surface);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    margin-bottom: .75rem;
    box-shadow: var(--shadow-sm);
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}
.incident-card__icon { font-size: 1.8rem; line-height: 1; flex-shrink: 0; }
.incident-card__body { flex: 1; min-width: 0; }
.incident-card__title {
    font-size: 1rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.incident-card__meta { font-size: .8rem; color: var(--color-text-muted); margin-top: .15rem; }
.incident-card__actions { display: flex; gap: .4rem; align-items: center; flex-shrink: 0; }

/* ── Auth: input password con botón ojo ─────────────────── */
.input-password {
    position: relative;
    display: flex;
}
.input-password input {
    flex: 1;
    padding-right: 2.8rem !important;
}
.toggle-pass {
    position: absolute;
    right: .5rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    padding: .2rem;
    line-height: 1;
    color: var(--color-text-muted);
}
.toggle-pass:hover { color: var(--color-text); }

/* ── Indicador fuerza contraseña ─────────────────────────── */
.password-strength {
    margin-top: .4rem;
}
.password-strength__bar {
    height: 4px;
    background: var(--color-border);
    border-radius: 999px;
    overflow: hidden;
    margin-bottom: .25rem;
}
.password-strength__fill {
    height: 100%;
    border-radius: 999px;
    transition: width .3s ease, background .3s ease;
    width: 0%;
}
.password-strength__label {
    font-size: .75rem;
    font-weight: 600;
}

/* ── Badge email no verificado ───────────────────────────── */
.verify-banner {
    background: #fef3c7;
    color: #92400e;
    border-bottom: 1px solid #fde68a;
    padding: .6rem 1rem;
    font-size: .85rem;
    text-align: center;
}
.verify-banner a { color: #78350f; font-weight: 600; }
.verify-banner__btn {
    background: none; border: none; cursor: pointer; padding: 0;
    color: #78350f; font-weight: 600; font-size: inherit;
    text-decoration: underline;
}

/* ── Campo requerido ─────────────────────────────────────── */
.req { color: var(--color-accent); margin-left: .15rem; }

/* ── Pie de formulario ("¿Ya tienes cuenta?") ────────────── */
.form-footer {
    margin-top: 1.25rem;
    text-align: center;
    font-size: .88rem;
    color: var(--color-text-muted);
}

/* ── Flash bars ──────────────────────────────────────────── */
.flash-bar {
    position: relative;
    padding: .65rem 2.5rem .65rem 1rem; /* espacio para botón × */
    font-size: .9rem;
    text-align: center;
    border-bottom: 1px solid transparent;
}
.flash-bar--success, .flash-bar:not(.flash-bar--error) {
    background: #d1fae5;
    color: #065f46;
    border-color: #6ee7b7;
}
.flash-bar--error {
    background: #fee2e2;
    color: #991b1b;
    border-color: #fca5a5;
}
/* Botón de cierre manual */
.flash-bar__close {
    position: absolute;
    right: .65rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
    line-height: 1;
    color: inherit;
    opacity: .55;
    padding: .2rem .3rem;
}
.flash-bar__close:hover { opacity: 1; }

/* ── Detalle de incidencia ───────────────────────────────── */
.page-wrap--detail  { max-width: 1100px; }

/* ── Perfil de usuario ───────────────────────────────────── */
.page-wrap--narrow  { max-width: 640px; }

.profile-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: .75rem;
    margin: 1.5rem 0 2rem;
}
.profile-stat {
    background: var(--color-bg-alt);
    border-radius: var(--radius-md);
    padding: 1rem .75rem;
    text-align: center;
}
.profile-stat__num {
    display: block;
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--color-primary);
    line-height: 1;
}
.profile-stat__label {
    display: block;
    font-size: .75rem;
    color: var(--color-text-muted);
    margin-top: .35rem;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.profile-section {
    background: var(--color-bg-alt);
    border-radius: var(--radius-md);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.25rem;
}
.profile-section__title {
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 1rem;
    color: var(--color-text);
}

.profile-info {
    display: grid;
    grid-template-columns: 6rem 1fr;
    gap: .4rem .75rem;
    margin: 0;
    font-size: .9rem;
}
.profile-info dt { color: var(--color-text-muted); font-weight: 500; }
.profile-info dd { margin: 0; word-break: break-all; }

.form-inline {
    display: flex;
    flex-direction: column;
    gap: .5rem;
}
.form-inline .form-group {
    display: flex;
    gap: .5rem;
    align-items: center;
}
.form-inline .form-input { flex: 1; }

.form-stack { display: flex; flex-direction: column; gap: 1rem; }

.profile-links {
    margin-top: 2rem;
    font-size: .9rem;
}
.profile-links a { color: var(--color-primary); text-decoration: none; }
.profile-links a:hover { text-decoration: underline; }

@media (max-width: 480px) {
    .profile-stats { grid-template-columns: repeat(2, 1fr); }
}

.breadcrumb {
    font-size: .82rem;
    color: var(--color-text-muted);
    margin-bottom: 1.25rem;
    display: flex;
    gap: .4rem;
    align-items: center;
    flex-wrap: wrap;
}
.breadcrumb a { color: var(--color-primary); }

.detail-layout {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 2rem;
    align-items: start;
}

.detail-main__photo {
    width: 100%;
    aspect-ratio: 16 / 9;
    max-height: 400px;
    object-fit: cover;
    border-radius: var(--radius-lg);
    margin-bottom: 1.25rem;
    background: var(--color-bg-alt);  /* placeholder mientras carga */
}
.detail-main__header { margin-bottom: .75rem; }
.detail-main__title  { font-size: 1.6rem; font-weight: 800; margin-bottom: .5rem; line-height: 1.3; }
.detail-main__badges { display: flex; gap: .5rem; flex-wrap: wrap; }

.detail-meta-list {
    list-style: none;
    margin: 1rem 0 1.25rem;
    display: flex;
    flex-direction: column;
    gap: .35rem;
    font-size: .9rem;
}
.detail-meta-list a { color: var(--color-primary); }

.detail-main__desc { margin-bottom: 1.5rem; }
.detail-main__desc h2 { font-size: 1.05rem; margin-bottom: .5rem; }
.detail-main__desc p  { line-height: 1.75; }

.detail-main__vote {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    padding: 1rem 0;
    border-top: 1px solid var(--color-border);
}
.votes-display { font-size: 1rem; color: var(--color-text-muted); font-weight: 600; }

.detail-side__map-wrap {
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow);
}
.mapa-detalle {
    height: 280px;
    width: 100%;
}

/* ── Mis reportes ────────────────────────────────────────── */
.mis-reportes-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
    gap: .75rem;
}
.mis-reportes-count {
    font-size: .85rem;
    color: var(--color-text-muted);
    margin-bottom: 1rem;
}

.incident-card__note {
    font-size: .8rem;
    color: var(--color-text-muted);
    margin-top: .25rem;
}

/* Pills de estado */
.status-pill {
    display: inline-block;
    padding: .25rem .6rem;
    border-radius: 999px;
    font-size: .75rem;
    font-weight: 700;
    white-space: nowrap;
}
.status--pending     { background: #fef3c7; color: #92400e; }
.status--approved    { background: #dbeafe; color: #1e40af; }
.status--forwarded   { background: #ede9fe; color: #5b21b6; } /* púrpura: "en tránsito" hacia el Ayuntamiento */
.status--progress,
.status--in_progress { background: #e0e7ff; color: #3730a3; } /* alias para JS que use inc.status directamente */
.status--resolved    { background: #d1fae5; color: #065f46; }
.status--rejected    { background: #fee2e2; color: #991b1b; }

/* Empty state */
.empty-state {
    text-align: center;
    padding: 4rem 1rem;
}
.empty-state__icon { font-size: 3.5rem; margin-bottom: 1rem; }
.empty-state h2    { font-size: 1.3rem; margin-bottom: .5rem; }
.empty-state p     { color: var(--color-text-muted); margin-bottom: 1.5rem; }

/* ── Página 404 ──────────────────────────────────────────── */
.error-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - var(--navbar-h) - 52px - 60px);
    padding: 2rem 1rem;
}
.error-page__inner { text-align: center; max-width: 480px; }
.error-page__code  { font-size: 7rem; font-weight: 900; color: var(--color-border); line-height: 1; }
.error-page__title { font-size: 1.6rem; margin-bottom: .5rem; }
.error-page__msg   { color: var(--color-text-muted); margin-bottom: 2rem; line-height: 1.7; }
.error-page__actions { display: flex; gap: .75rem; justify-content: center; flex-wrap: wrap; }

/* ── Checkbox RGPD (compartido por reporte.php y registro.php) ── */
.form-group--check { margin-top: 1.25rem; }
.check-label {
    display: flex;
    align-items: flex-start;
    gap: .6rem;
    font-size: .88rem;
    cursor: pointer;
    line-height: 1.5;
}
.check-label input[type="checkbox"] {
    width: auto;
    flex-shrink: 0;
    margin-top: .2rem;
    accent-color: var(--color-primary);
}

/* ── Panel lateral: transición CSS ──────────────────────── */
/*
   En desktop:  entra por la derecha (translateX)
   En mobile:   entra por abajo (translateY)
   Clase .side-panel--open activa la posición final.
   hidden="true" se aplica ANTES de la clase para que el inicio
   sea invisible; el JS quita hidden primero, luego añade --open.
*/
@media (min-width: 641px) {
    .side-panel {
        transform: translateX(100%);
        transition: transform .3s cubic-bezier(.4,0,.2,1);
    }
    .side-panel--open { transform: translateX(0); }
    .side-panel[hidden] { display: block; transform: translateX(100%); visibility: hidden; }
    .side-panel--open   { visibility: visible; }
}

@media (max-width: 640px) {
    .side-panel {
        width: 100%;
        top: 0;
        transform: translateY(100%);
        transition: transform .3s cubic-bezier(.4,0,.2,1);
    }
    .side-panel--open  { transform: translateY(0); }
    .side-panel[hidden] { display: block; transform: translateY(100%); visibility: hidden; }
    .side-panel--open   { visibility: visible; }
}

/* ── Filter select activo ────────────────────────────────── */
.filter-select--on {
    border-color: var(--color-primary);
    background: #eef4ff;
    font-weight: 600;
    color: var(--color-primary);
}

/* ── Overlay "sin resultados" en el mapa ─────────────────── */
.no-results-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 500;
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    padding: 2rem 2.5rem;
    box-shadow: var(--shadow-lg);
    text-align: center;
    pointer-events: none;
    max-width: 320px;
    width: calc(100% - 2rem);
}
.no-results-overlay__icon { font-size: 2.5rem; line-height: 1; margin-bottom: .75rem; }
.no-results-overlay__title { font-size: 1rem; font-weight: 700; margin-bottom: .35rem; }
.no-results-overlay__text  { font-size: .85rem; color: var(--color-text-muted); }

/* ── Toast notification ──────────────────────────────────── */
.toast-container {
    position: fixed;
    bottom: 5rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: .5rem;
    align-items: center;
    pointer-events: none;
}

.toast {
    background: var(--color-primary);
    color: #fff;
    padding: .65rem 1.25rem;
    border-radius: 999px;
    font-size: .88rem;
    font-weight: 600;
    box-shadow: var(--shadow-lg);
    white-space: nowrap;
    animation: toastIn .25s ease forwards;
    pointer-events: auto;
}
.toast--success { background: #065f46; }
.toast--error   { background: var(--urgency-emergencia); }
.toast--out     { animation: toastOut .25s ease forwards; }

@keyframes toastIn {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes toastOut {
    from { opacity: 1; transform: translateY(0); }
    to   { opacity: 0; transform: translateY(12px); }
}

/* ── Animación shake (errores de formulario) ─────────────── */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%       { transform: translateX(-6px); }
    40%       { transform: translateX(6px); }
    60%       { transform: translateX(-4px); }
    80%       { transform: translateX(4px); }
}
.shake { animation: shake .4s ease; }

/* ── Char counter (textarea/input con límite) ────────────── */
.char-count {
    font-size: .75rem;
    color: var(--color-text-muted);
    text-align: right;
    margin-top: .2rem;
    transition: color .15s;
}
.char-count--warn { color: var(--urgency-alta); }
.char-count--crit { color: var(--urgency-emergencia); font-weight: 700; }

/* ── Tarjeta incidencia: hover + clicable ────────────────── */
.incident-card {
    transition: box-shadow .15s, transform .15s;
    cursor: pointer;
}
.incident-card:hover {
    box-shadow: var(--shadow);
    transform: translateY(-1px);
}

/* ── FAB: mejora hover ───────────────────────────────────── */
.fab::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: rgba(255,255,255,.12);
    opacity: 0;
    transition: opacity .15s;
}
.fab:hover::after { opacity: 1; }

/* ── Accesibilidad: foco visible ─────────────────────────── */
.btn:focus-visible,
.navbar__link:focus-visible,
.navbar__link--btn:focus-visible,
a:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
    border-radius: 3px;
}
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    /* inputs ya tienen box-shadow en :focus, outline sería redundante */
    outline: none;
}

/* ── Nickname en navbar: truncar si es largo ─────────────── */
.navbar__link--nick {
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: inline-block;
    vertical-align: middle;
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 768px) {
    .detail-layout { grid-template-columns: 1fr; }
    .detail-side   { order: -1; }
    .mapa-detalle  { height: 200px; }
}

@media (max-width: 640px) {
    /* Filtrar: redundante en móvil (los selects ya auto-filtran) */
    #btnFilter { display: none; }

    /* Navbar: deja que crezca si el contenido lo requiere */
    .navbar { height: auto; min-height: var(--navbar-h); }
    .navbar__inner { padding: .5rem 1rem; flex-wrap: nowrap; gap: .5rem; }
    .navbar__nav   { flex-wrap: nowrap; gap: .25rem; }
    .navbar__link--hide-mobile { display: none; }
    .navbar__link--nick { max-width: 90px; }

    /* Mapa canvas ajustado */
    .mapa-canvas { height: calc(100vh - var(--navbar-h) - 90px); height: calc(100dvh - var(--navbar-h) - 90px); }

    /* Filtros full-width */
    .filter-select { max-width: 100%; }

    /* Formularios */
    .form-card { padding: 1.25rem; }

    /* Detalle */
    .detail-main__title { font-size: 1.25rem; }

    /* Error page */
    .error-page__code { font-size: 5rem; }

    /* Tarjeta: título en 2 líneas máximo en lugar de truncar a 1 */
    .incident-card__title {
        white-space: normal;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }
}

@media (max-width: 480px) {
    /* Botones en tarjetas más compactos */
    .incident-card { padding: .75rem 1rem; gap: .65rem; }
    .incident-card__actions { flex-direction: column; gap: .3rem; align-items: flex-end; }
    .incident-card__actions .btn { font-size: .78rem; padding: .25rem .55rem; }
    .status-pill { font-size: .7rem; padding: .2rem .45rem; }
}

/* ── Clusters del mapa ──────────────────────────────────────── */
.cluster-pin {
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--color-primary);
    color: #fff;
    font-weight: 700;
    font-family: var(--font-base);
    border: 3px solid #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,.35);
    cursor: pointer;
    transition: transform .15s ease, box-shadow .15s ease;
}
.cluster-pin:hover {
    transform: scale(1.12);
    box-shadow: 0 4px 14px rgba(0,0,0,.4);
}
/* Overrides de la librería — eliminar fondo predeterminado */
.leaflet-cluster-anim .leaflet-marker-icon,
.leaflet-cluster-anim .leaflet-marker-shadow {
    transition: transform .3s ease-out, opacity .3s ease-in;
}
