/* 
   SDM Mobile Standard (Mejores prácticas UI/UX tipo Kotlin/Native)
   - Minimiza espacios perdidos en bordes.
   - Botones (touch targets) estandarizados a mínimo 48px de alto para fácil pulsación.
   - Alineación fluida de cards.
*/

@media (max-width: 768px) {
    html, body {
        overflow-x: hidden;
        width: 100%;
    }
    
    .sdm-layout-wrapper {
        overflow-x: hidden;
        width: 100%;
    }

    /* Contenedores sin padding lateral (o muy mínimo) para no gastar espacio en móviles */
    .container-mobile-flush {
        padding-left: 0 !important;
        padding-right: 0 !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        width: 100% !important;
        overflow-x: hidden;
    }
    
    .card-mobile-flush {
        margin-left: 0 !important;
        margin-right: 0 !important;
        width: 100% !important;
        border-radius: 12px !important;
    }
    
    .card-mobile-flush .card-body {
        padding: 0.75rem 0.5rem !important;
    }
    
    .card-mobile-flush .card-header {
        padding: 0.5rem 0.6rem !important;
    }

    /* Header Compacto en Móvil */
    .diamond-header-compact {
        padding: 8px 12px !important;
        margin-bottom: 0.5rem !important;
        border-radius: 10px !important;
    }
    .diamond-header-compact h4 {
        font-size: 1.05rem !important;
    }

    /* Barra Ejecutiva de Filtros Financieros (Tablero Ejecutivo) */
    .financial-toolbar-controls {
        width: 100% !important;
        display: flex !important;
        flex-direction: column !important;
        gap: 0.5rem !important;
    }

    #filterPillsGroup {
        display: flex !important;
        width: 100% !important;
        padding: 2px !important;
        background: #f1f5f9 !important;
        border-radius: 50rem !important;
        border: 1px solid #e2e8f0 !important;
        margin: 0 !important;
    }

    #filterPillsGroup .btn-filter-pill {
        flex: 1 1 0 !important;
        text-align: center !important;
        padding: 6px 1px !important;
        font-size: 0.72rem !important;
        font-weight: 600 !important;
        white-space: nowrap !important;
        border-radius: 50rem !important;
        border: none !important;
        line-height: 1.2 !important;
        transition: all 0.2s ease !important;
    }

    #filterPillsGroup .btn-filter-pill.active {
        background-color: var(--md-blue-deep, #0A2A66) !important;
        color: #ffffff !important;
        box-shadow: 0 2px 6px rgba(10, 42, 102, 0.25) !important;
    }

    .financial-date-range-bar {
        display: flex !important;
        width: 100% !important;
        align-items: center !important;
        justify-content: space-between !important;
        background: #ffffff !important;
        padding: 3px 6px !important;
        border-radius: 50rem !important;
        border: 1.5px solid rgba(25, 183, 165, 0.4) !important;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04) !important;
    }

    .financial-date-input {
        flex: 1 1 0 !important;
        min-width: 0 !important;
        width: 100% !important;
        font-size: 0.75rem !important;
        text-align: center !important;
        padding: 4px 2px !important;
        border: none !important;
        background: transparent !important;
        color: #334155 !important;
        font-weight: 500 !important;
    }

    /* Ajustes generales a tipografía para no saturar móviles */
    .mobile-condensed-title {
        font-size: 1.15rem !important;
    }
    
    /* Utilidad para expandir elementos al 100% de la pantalla ignorando márgenes del padre si es necesario */
    .mobile-edge-to-edge {
        margin-left: -0.25rem !important;
        margin-right: -0.25rem !important;
        border-radius: 0 !important;
        border-left: 0 !important;
        border-right: 0 !important;
    }
}

/* --- Botones Móviles Estándar --- */
.btn-mobile-standard {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;         /* Minimum touch target by UX best practices */
    padding: 0.5rem 1.25rem;
    border-radius: 0.75rem;   /* Suave pero no pill (no completamente redondo) */
    font-weight: 600;
    transition: all 0.2s ease;
    gap: 0.5rem;              /* Espacio estándar para iconos */
}

/* Versión de acción principal (Primary Action) */
.btn-mobile-action {
    background-color: var(--md-blue-deep);
    color: white;
    border: none;
    box-shadow: 0 4px 6px -1px rgba(10, 42, 102, 0.15);
}
.btn-mobile-action:hover, .btn-mobile-action:active {
    background-color: #071f4f;
    color: white;
    transform: translateY(1px);
}

/* Versión secundaria / outline */
.btn-mobile-outline {
    background-color: transparent;
    color: var(--md-blue-deep);
    border: 1.5px solid var(--md-blue-deep);
}
.btn-mobile-outline:hover, .btn-mobile-outline:active {
    background-color: rgba(10, 42, 102, 0.05);
    color: var(--md-blue-deep);
}

/* Modificador de ancho completo ideal para sticky buttons o single actions en móviles */
.btn-mobile-full {
    width: 100%;
}

/* --- Utilidades de Ancho Responsivo Estándar (evita desbordamientos en flex-row) --- */
@media (min-width: 576px) {
    .w-sm-auto {
        width: auto !important;
    }
}

@media (min-width: 768px) {
    .w-md-auto {
        width: auto !important;
    }
}

/* ==========================================================================
   PWA STANDALONE & SAFE AREAS (PANTALLA COMPLETA Y EXPERIENCIA NATIVA)
   ========================================================================== */
:root {
    --safe-area-top: env(safe-area-inset-top, 0px);
    --safe-area-bottom: env(safe-area-inset-bottom, 0px);
    --safe-area-left: env(safe-area-inset-left, 0px);
    --safe-area-right: env(safe-area-inset-right, 0px);
}

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    scroll-behavior: smooth;
    min-height: 100%;
    overflow-x: hidden;
    touch-action: pan-y;
}

body {
    min-height: 100%;
    overflow-x: hidden;
    width: 100%;
    position: relative;
    touch-action: pan-y;
    -webkit-overflow-scrolling: touch;
    -webkit-tap-highlight-color: transparent;
    /* Respeta áreas seguras (notch, dynamic island y barra inferior de gestos) */
    padding-top: env(safe-area-inset-top, 0px);
    padding-bottom: env(safe-area-inset-bottom, 0px);
    padding-left: env(safe-area-inset-left, 0px);
    padding-right: env(safe-area-inset-right, 0px);
}

/* Habilitar deslizamiento vertical táctil en todos los contenedores principales */
main, section, .hero-immersive, .hero-glass-card, .holo-card, .showcase-wrapper, .card {
    touch-action: pan-y;
}

/* Overlay de menú móvil con pointer-events controlado para no bloquear toques */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(10, 42, 102, 0.4);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}
.sidebar-overlay.show {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* Header Navbar con soporte para notch / Dynamic Island */
.glass-navbar {
    padding-top: calc(0.5rem + env(safe-area-inset-top, 0px)) !important;
    padding-left: calc(1rem + env(safe-area-inset-left, 0px)) !important;
    padding-right: calc(1rem + env(safe-area-inset-right, 0px)) !important;
}

/* Barra inferior flotante desactivada por redundancia */
.mobile-sticky-cta {
    display: none !important;
}

/* Floating Actions Stack respetando barra de gestos / Safe Area */
.floating-actions-stack {
    position: fixed !important;
    bottom: calc(16px + env(safe-area-inset-bottom, 0px)) !important;
    right: calc(14px + env(safe-area-inset-right, 0px)) !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    gap: 10px !important;
    z-index: 9999 !important;
    pointer-events: none !important;
}

.floating-actions-stack a {
    pointer-events: auto !important;
}

.btn-floating-action {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 50% !important;
}

.btn-back-to-top {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 42px !important;
    height: 42px !important;
    background: rgba(10, 42, 102, 0.92) !important;
    border: 1.5px solid rgba(255, 255, 255, 0.4) !important;
    color: #ffffff !important;
    font-size: 1.25rem !important;
    opacity: 0.95 !important;
    visibility: visible !important;
    box-shadow: 0 4px 14px rgba(10, 42, 102, 0.3) !important;
}

.btn-whatsapp-global {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 50px !important;
    height: 50px !important;
    background: #25D366 !important;
    color: #ffffff !important;
    font-size: 1.7rem !important;
    box-shadow: 0 8px 24px rgba(37, 211, 102, 0.35) !important;
}

/* Sidebar móvil respetando Safe Areas */
.mobile-sidebar {
    padding-top: calc(1.5rem + env(safe-area-inset-top, 0px)) !important;
    padding-bottom: calc(1.5rem + env(safe-area-inset-bottom, 0px)) !important;
}

/* ==========================================================================
   OPTIMIZACIÓN DE ESCALA PARA TELÉFONOS MÓVILES (GAMA MEDIA: 360px - 430px)
   ========================================================================== */
@media (max-width: 768px) {
    /* Hero a pantalla completa equilibrada */
    .hero-immersive {
        min-height: calc(100svh - 60px) !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        padding-top: 4.25rem !important;
        padding-bottom: 2rem !important;
    }

    /* Contenedor móvil con padding mínimo por lado */
    .container-mobile-flush {
        padding-left: 6px !important;
        padding-right: 6px !important;
    }

    /* Tarjeta Hero Welcome Premium con padding mínimo por lado */
    .hero-glass-card {
        padding: 1.25rem 0.85rem !important;
        border-radius: 1.35rem !important;
        margin: 0 auto !important;
        width: 100% !important;
        background: rgba(255, 255, 255, 0.84) !important;
        backdrop-filter: blur(25px) saturate(180%) !important;
        -webkit-backdrop-filter: blur(25px) saturate(180%) !important;
        border: 1px solid rgba(255, 255, 255, 0.9) !important;
        box-shadow: 0 16px 36px -10px rgba(10, 42, 102, 0.12), 0 0 0 1px rgba(0, 196, 196, 0.12) !important;
    }

    /* Tipografía Hero adaptada a smartphones (proporción premium) */
    .hero-title-responsive {
        font-size: clamp(1.42rem, 5.8vw, 1.85rem) !important;
        line-height: 1.18 !important;
        letter-spacing: -0.025em !important;
        margin-bottom: 0.55rem !important;
    }

    .hero-glass-card h2,
    .hero-subtitle-responsive {
        font-size: clamp(0.85rem, 3.4vw, 0.96rem) !important;
        line-height: 1.44 !important;
        margin-bottom: 1.15rem !important;
        padding: 0 0.1rem !important;
    }

    /* Botones CTA en Hero con touch target ergonómico */
    .hero-glass-card .btn-lg {
        min-height: 46px !important;
        padding: 0.65rem 1rem !important;
        font-size: 0.92rem !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
    }

    .hero-actions-group {
        gap: 0.55rem !important;
    }

    /* Cinta de confianza compacta */
    .trust-banner {
        padding: 1.25rem 0.5rem !important;
    }
    .trust-logo {
        font-size: 0.8rem !important;
        gap: 0.4rem !important;
    }
    .trust-logo i {
        font-size: 1.25rem !important;
    }

    /* Tarjetas de filosofía 5S compactas */
    .holo-card {
        padding: 1.25rem 1rem !important;
        border-radius: 1rem !important;
    }

    /* Modales en móvil: ocupan ancho completo con esquinas redondeadas estándar */
    .modal-dialog {
        margin: 0.75rem !important;
    }

    /* Desactivar background-attachment: fixed en móvil para eliminar congelamientos de touchmove y lags */
    .hero-immersive, .parallax-section {
        background-attachment: scroll !important;
    }
}


