/* ============================================================
   App shell — navegación tipo app (Marcos, 2026-08-05)
   Reemplaza el header tradicional + menú hamburguesa por una
   barra de tabs fija abajo (móvil/tablet) y un sidebar (desktop),
   con el contenido en su propio contenedor de scroll — igual que
   pabqtas.marcossantiago.com. El objetivo del Municipio: que
   ninguna pantalla se sienta de scroll infinito.
   Se carga DESPUÉS de tema-tallado.css — usa sus variables.
   ============================================================ */

html, body {
    height: 100%;
    margin: 0;
    overflow: hidden;
}

.app-shell {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
}

/* ---------- Barra superior (móvil/tablet, <1024px) ---------- */
.app-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    padding: var(--spacing-sm) var(--spacing-lg);
    padding-top: max(var(--spacing-sm), var(--safe-area-top));
    background-color: var(--background-color);
    box-shadow: var(--shadow-sm);
    position: relative;
    z-index: 20;
}

/* ---------- Contenido: su propio scroll, no la página entera ---------- */
.app-main {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

/* ---------- Tab bar fija (móvil/tablet) ---------- */
.tab-bar {
    display: flex;
    flex-shrink: 0;
    background-color: var(--background-color);
    box-shadow: 0 -2px 14px rgba(0, 0, 0, 0.08);
    padding-bottom: var(--safe-area-bottom);
    position: relative;
    z-index: 20;
}

.tab-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-height: var(--touch-target-min);
    padding: 8px 4px 7px;
    font-size: 10.5px;
    font-weight: 600;
    color: var(--text-light);
    -webkit-tap-highlight-color: transparent;
}

.tab-item i {
    font-size: 18px;
}

.tab-item.active {
    color: var(--primary-color);
}

/* ---------- Sidebar (desktop, ≥1024px) — oculto por defecto ---------- */
.app-sidebar {
    display: none;
}

@media (min-width: 1024px) {
    .app-topbar,
    .tab-bar {
        display: none;
    }

    .app-shell {
        flex-direction: row;
    }

    .app-sidebar {
        display: flex;
        flex-direction: column;
        width: 250px;
        flex-shrink: 0;
        background-color: var(--background-color);
        box-shadow: var(--shadow-sm);
        padding: var(--spacing-xl) var(--spacing-lg);
        overflow-y: auto;
    }

    .app-sidebar .logo {
        margin-bottom: var(--spacing-xl);
        padding: 0 var(--spacing-sm);
    }

    .sidebar-nav {
        display: flex;
        flex-direction: column;
        gap: 2px;
        flex: 1;
    }

    .sidebar-link {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 12px 14px;
        border-radius: var(--radius-md);
        color: var(--text-color);
        font-weight: 600;
        font-size: var(--font-size-base);
        transition: background-color 0.2s ease, color 0.2s ease;
    }

    .sidebar-link i {
        width: 20px;
        text-align: center;
        font-size: 16px;
    }

    .sidebar-link:hover {
        background-color: var(--background-light);
    }

    .sidebar-link.active {
        background-color: var(--background-light);
        color: var(--primary-color);
    }

    .sidebar-lang {
        margin-top: var(--spacing-lg);
        padding-top: var(--spacing-lg);
        border-top: 1px solid var(--background-light);
        display: flex;
        justify-content: center;
    }
}

/* ---------- Tarjetita del Alcalde: sale una vez por navegador ----------
   Flota sobre el tab-bar (móvil) o suelta en la esquina (desktop, donde
   el sidebar vive a la izquierda así que no estorba). */
.alcalde-toast {
    position: fixed;
    right: 14px;
    bottom: calc(70px + var(--safe-area-bottom));
    z-index: 40;
    max-width: 280px;
    background: var(--background-color);
    border-radius: var(--radius-lg);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
    border: 1px solid rgba(0, 0, 0, 0.06);
    animation: alcalde-toast-in 0.35s ease-out;
}

@keyframes alcalde-toast-in {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

.alcalde-toast-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 34px 12px 12px;
    text-decoration: none;
}

.alcalde-toast-foto {
    flex: 0 0 auto;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--background-light);
}

.alcalde-toast-texto {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.alcalde-toast-texto strong {
    font-size: 0.85rem;
    color: var(--text-color);
    line-height: 1.3;
}

.alcalde-toast-texto span {
    font-size: 0.78rem;
    color: var(--primary-color);
    font-weight: 600;
}

.alcalde-toast-cerrar {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: none;
    background: var(--background-light);
    color: var(--text-light);
    display: grid;
    place-items: center;
    font-size: 0.65rem;
    cursor: pointer;
}

@media (min-width: 1024px) {
    .alcalde-toast {
        bottom: 24px;
    }
}
