/*
 * MÓDULO: Core Frontend UI / UI/UX
 * ARCHIVO: app/static/css/mobile_ui.css
 * DESCRIPCIÓN: Hoja de estilos estabilizada y blindada.
 * ESTADO: AUDITADO / SANITIZADO
 * FECHA: 25-09-26
 * AUDITORÍA FORENSE: BAP_Produccion_Sliders_Filtros_Sidebar_250926
 * ACTUALIZACIÓN FORENSE: BAP_Mobile_Corporativo_Download_250926
 */
/* ========================================= */
/*  MOBILE UI ENHANCEMENTS (Jan 2026)       */
/* ========================================= */

/* --- STICKY BOTTOM NAV --- */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    /* Stronger border */
    display: flex;
    justify-content: space-around;
    padding: 10px 0 8px 0;
    /* Optimized padding similar to ML */
    z-index: 1050;
    /* Above most things */
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.04);
}

.bottom-nav-item {
    flex: 1;
    text-align: center;
}

.bottom-nav-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: #94a3b8;
    /* Slate 400 */
    font-size: 0.7rem;
    text-decoration: none;
    transition: all 0.2s;
}

.bottom-nav-link i {
    font-size: 1.25rem;
    margin-bottom: 3px;
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.bottom-nav-link.active {
    color: var(--bap-blue, #3185b6);
    font-weight: 600;
}

.bottom-nav-link.active i {
    transform: translateY(-2px);
    color: var(--bap-blue, #3185b6);
}

/* Adjust main content padding so it doesn't get hidden behind bottom nav */
@media (max-width: 767.98px) {
    main {
        padding-bottom: 70px;
    }

    /* Hide footer on mobile if desired, or pad it */
    footer {
        padding-bottom: 70px;
    }
}

/* --- MOBILE ACTION BAR --- */
.mobile-action-bar {
    /* Position Handling moved to Parent Navbar structure (Natural Flow) */
    background: transparent;
    /* Changed to transparent or white depending on glass effect? Let's keep transparent as it's inside glass navbar */
    padding: 0;

    /* Layout */
    width: 100%;
    margin: 0;

    display: flex;
    justify-content: center;
    gap: 0.5rem;
    align-items: center;
}

/* Navegación pública: disponible para visitantes y usuarios autenticados. */
.mobile-public-nav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    padding: 8px 12px 12px;
    border-bottom: 1px solid var(--bap-border, #d7e0e8);
}

.mobile-public-nav a {
    min-height: 46px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 10px;
    border: 1px solid var(--bap-border, #d7e0e8);
    background: var(--bap-white, #fff);
    color: var(--bap-navy, #1f1e40);
    font-size: .78rem;
    font-weight: 700;
    line-height: 1.15;
    text-decoration: none;
}

.mobile-public-nav a i {
    flex: 0 0 18px;
    color: var(--bap-blue, #3185b6);
    text-align: center;
}

.mobile-public-nav a:focus-visible,
.mobile-public-nav a:hover {
    border-color: var(--bap-blue, #3185b6);
    background: #edf7fc;
    color: var(--bap-navy, #1f1e40);
}

.mobile-property-menu {
    grid-column: 1 / -1;
}

.mobile-property-menu summary {
    min-height: 46px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 10px;
    border: 1px solid var(--bap-border, #d7e0e8);
    background: var(--bap-white, #fff);
    color: var(--bap-navy, #1f1e40);
    font-size: .78rem;
    font-weight: 700;
    line-height: 1.15;
    cursor: pointer;
    list-style: none;
}

.mobile-property-menu summary::-webkit-details-marker {
    display: none;
}

.mobile-property-menu summary > i:first-child {
    flex: 0 0 18px;
    color: var(--bap-blue, #3185b6);
    text-align: center;
}

.mobile-property-menu summary > i:last-child {
    font-size: .68rem;
    transition: transform .18s ease;
}

.mobile-property-menu[open] summary > i:last-child {
    transform: rotate(180deg);
}

.mobile-property-menu__items {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    padding-top: 6px;
}

.mobile-property-menu__items a {
    background: #f7fbfe;
}

.mobile-property-menu__items .mobile-property-menu__all {
    grid-column: 1 / -1;
    border-color: var(--bap-gold, #d3af10);
    font-weight: 800;
}

/* Ensure buttons don't stretch weirdly if centered */
.btn-mobile-action {
    flex: 1;
    /* Standard flex distribution */
    max-width: 120px;
    /* Optional constraint to keep them neat? Or full? User said "Centered", usually implies grouped. But "Full Width" was previous. I'll stick to flex:1 but constrained max-width might help centering aesthetic. Let's start with flex:1 only to be safe. */
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.8rem;
    padding: 0.35rem 0.25rem;
    border-radius: 0px !important;
    border: 1px solid #111111 !important;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}



.btn-mobile-action:active {
    transform: scale(0.98);
}

/* Fix Contrast on Active/Focus */
/* Fix Contrast on Active/Focus */
.btn-mobile-action:active,
.btn-mobile-action:focus,
.btn-mobile-action:hover {
    transform: translateY(-1px);
    box-shadow: none !important;
    /* Ensure colors stay readable */
    color: inherit;
}

.btn-mobile-primary {
    background-color: var(--bap-navy, #1f1e40) !important;
    border-color: var(--bap-navy, #1f1e40) !important;
    color: var(--bap-white, #ffffff) !important;
}

.btn-mobile-primary:active,
.btn-mobile-primary:focus {
    background-color: var(--bap-slate, #263560) !important;
    color: var(--bap-white, #ffffff) !important;
}

.btn-mobile-secondary {
    background-color: var(--bap-white, #ffffff) !important;
    border: 1px solid var(--bap-navy, #1f1e40) !important;
    color: var(--bap-navy, #1f1e40) !important;
    flex: 1;
    width: auto;
}

.btn-mobile-danger {
    background-color: var(--bap-blue, #3185b6) !important;
    border-color: var(--bap-blue, #3185b6) !important;
    color: var(--bap-white, #ffffff) !important;
}

/* --- OFFCANVAS FILTERS (Mobile) --- */
.offcanvas-filters {
    border-radius: 0px !important;
    background-color: #f4f4f7 !important;
    border-left: 1px solid #111111 !important;
}

/* --- MOBILE PROMO SLIDER --- */
.mobile-promo-slider {
    border-radius: 0px !important;
}

@media (min-width: 768px) {
    .mobile-promo-slider {
        border-radius: 0px !important;
    }

    .mobile-promo-slider .promo-content {
        height: 300px !important;
    }
}

.promo-content {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

/* --- GRID OVERRIDES FOR HIGH DENSITY --- */
@media (max-width: 575.98px) {
    .row.g-3 {
        --bs-gutter-x: 0.5rem;
        /* Tighter gutter */
        --bs-gutter-y: 0.5rem;
    }

    .product-card {
        border: 1px solid rgba(0, 0, 0, 0.05) !important;
        box-shadow: none !important;
    }

    /* Remove padding from container to maximize space */
    .container-fluid.px-lg-5 {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }

    .mobile-action-bar {
        margin: 0;
        /* Re-align with new padding */
    }

    .mobile-public-nav {
        grid-template-columns: 1fr;
    }

    .mobile-property-menu__items {
        grid-template-columns: 1fr;
    }
}

/* El slider debe conservar su imagen y proporción también bajo Passenger en
   móviles; el ancho disponible cambia cuando aparece la navegación pública. */
@media (max-width: 767.98px) {
    .bap-slider { min-height: 230px; }
    .bap-swiper { height: clamp(230px, 68vw, 360px); }
    .bap-slide-photo img,
    .bap-slide-video video { min-height: 100%; object-position: center center; }
    .bap-swiper .swiper-button-prev,
    .bap-swiper .swiper-button-next { width: 34px; height: 34px; }
    .bap-swiper .swiper-button-prev::after,
    .bap-swiper .swiper-button-next::after { font-size: .8rem; }
}
/* WCAG 2.1 Touch Target Compliance */
.btn-mobile-action, .mobile-action-bar .btn { min-height: 44px !important; padding: 0.5rem 0.75rem !important; }

/* ============================================================ */
/* 20. BAP MOBILE POLISH — navy / azul / dorado                 */
/* ============================================================ */
:root {
    --bap-mobile-navy: #1f1e40;
    --bap-mobile-slate: #263560;
    --bap-mobile-blue: #3185b6;
    --bap-mobile-gold: #d3af10;
    --bap-mobile-cloud: #f4f7f9;
}

/* Instalador PWA: identidad BAP también en el pie oscuro. */
.footer-modern .js-instalar-app {
    border: 1px solid var(--bap-mobile-gold) !important;
    background: transparent !important;
    color: var(--bap-mobile-gold) !important;
}

.footer-modern .js-instalar-app:hover,
.footer-modern .js-instalar-app:focus-visible {
    background: var(--bap-mobile-gold) !important;
    color: var(--bap-mobile-navy) !important;
}

html,
body {
    max-width: 100%;
    overflow-x: hidden;
    overflow-x: clip;
}

@media (max-width: 767.98px) {
    body {
        background: var(--bap-mobile-cloud);
        color: var(--bap-mobile-navy);
    }

    .navbar-glass {
        background: var(--bap-white, #fff) !important;
        border-bottom: 4px solid var(--bap-mobile-gold) !important;
        box-shadow: 0 3px 14px rgba(31, 30, 64, .12) !important;
    }

    .navbar-brand img {
        max-height: 46px !important;
        max-width: 180px !important;
    }

    .bap-account-icon,
    #mobileMenuToggler {
        color: var(--bap-mobile-blue) !important;
    }

    .mobile-action-bar {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 6px;
        padding: 10px 12px 12px;
        background: var(--bap-white, #fff);
    }

    .btn-mobile-action,
    .mobile-action-bar .btn {
        width: 100%;
        max-width: none;
        min-height: 48px !important;
        padding: 8px 6px !important;
        border-radius: 0 !important;
        font-family: var(--bap-font-display, "Oswald", sans-serif);
        font-size: .72rem;
        line-height: 1.1;
        letter-spacing: .03em;
        white-space: normal;
        box-shadow: 0 2px 0 rgba(31, 30, 64, .18);
    }

    .btn-mobile-action:hover,
    .btn-mobile-action:focus-visible {
        transform: translateY(-1px);
        box-shadow: 0 3px 0 rgba(31, 30, 64, .24) !important;
    }

    .mobile-public-nav {
        background: var(--bap-mobile-cloud);
        border-bottom: 1px solid var(--bap-mobile-gold);
    }

    .mobile-public-nav a {
        min-height: 48px;
        border-color: var(--bap-border, #d7e0e8);
        color: var(--bap-mobile-navy);
        background: var(--bap-white, #fff);
        box-shadow: 0 1px 0 rgba(31, 30, 64, .08);
    }

    .mobile-public-nav a i {
        color: var(--bap-mobile-gold);
    }

    #navbarMain {
        background: var(--bap-white, #fff);
        border-top: 1px solid var(--bap-border, #d7e0e8);
    }

    .bap-hero {
        min-height: 430px;
        border-bottom: 5px solid var(--bap-mobile-gold);
    }

    .bap-hero__content {
        padding: 34px 16px 38px;
    }

    .bap-hero__title {
        max-width: 100%;
        font-size: clamp(1.9rem, 9vw, 2.65rem);
        line-height: 1.04;
        text-wrap: balance;
    }

    .bap-hero__sub {
        max-width: 34rem;
        font-size: .94rem;
        line-height: 1.45;
    }

    .bap-hero__content .d-flex {
        display: grid !important;
        grid-template-columns: 1fr;
        width: 100%;
    }

    .bap-btn-cta,
    .bap-btn-outline {
        width: 100%;
        min-height: 48px;
        justify-content: center;
        padding: 12px 14px;
        font-size: .78rem;
        line-height: 1.15;
        text-align: center;
    }

    .bap-search-panel {
        margin: 0 -4px 22px;
        padding: 18px 14px;
        border-left: 4px solid var(--bap-mobile-gold);
        background: var(--bap-white, #fff);
    }

    .bap-search-panel .form-label,
    .bap-search-panel h2,
    .bap-search-panel p {
        color: var(--bap-mobile-navy, #1f1e40) !important;
    }

    .bap-search-panel .form-control,
    .bap-search-panel .form-select {
        min-height: 46px;
        border-radius: 0 !important;
        border-color: rgba(255,255,255,.42) !important;
        background: rgba(255,255,255,.98) !important;
        color: var(--bap-mobile-navy) !important;
    }

    .bap-property-card {
        border-color: var(--bap-border, #d7e0e8);
        box-shadow: 0 4px 14px rgba(31, 30, 64, .08);
    }

    .bap-property-card__cover {
        min-height: 205px;
    }

    .bap-property-card__footer {
        align-items: stretch;
        flex-direction: column;
        gap: 12px;
    }

    .bap-property-card__footer .bap-btn-search {
        width: 100% !important;
        min-height: 44px;
    }

    .bap-results-header {
        margin-bottom: 16px;
    }

    .bottom-nav {
        padding: 8px 4px calc(8px + env(safe-area-inset-bottom));
        border-top: 2px solid var(--bap-mobile-gold);
        background: rgba(255,255,255,.98);
    }

    .bottom-nav-link {
        min-height: 44px;
        color: #64748b;
        font-family: var(--bap-font-body, Inter, sans-serif);
        font-size: .68rem;
    }

    .bottom-nav-link.active,
    .bottom-nav-link.active i {
        color: var(--bap-mobile-blue);
    }
}

@media (max-width: 390px) {
    .mobile-action-bar {
        gap: 4px;
        padding-left: 8px;
        padding-right: 8px;
    }

    .btn-mobile-action,
    .mobile-action-bar .btn {
        font-size: .67rem;
        padding-left: 3px !important;
        padding-right: 3px !important;
    }

    .bap-hero__content {
        padding-left: 14px;
        padding-right: 14px;
    }
}
