/* Extraído de pie.php (2026-09-25) para que se cachee (assets/web.config, 30d).
   Editar ACÁ; el ?v=filemtime del include invalida la caché del navegador.
   La regla de iframe (?embed=1) quedó en pie.php porque depende de PHP. */
    /* ═══════════════════════════════════════════════════════
       BOTTOM NAV — Moderno, personalizable, dark mode nativo
       ═══════════════════════════════════════════════════════ */
    
    /* Variables específicas del bottom nav */
    :root {
        --bnav-height: 56px;
        --bnav-icon-size: 20px;
        --bnav-label-size: 10px;
        --bnav-radius: 0px;
        --bnav-margin-x: 0px;
        --bnav-margin-bottom: 0px;
        --bnav-bg-blur: 22px;
    }
    
    /* Modo compacto */
    [data-bottom-nav="compact"] {
        --bnav-height: 48px;
        --bnav-icon-size: 18px;
        --bnav-label-size: 9px;
    }
    
    /* Modo flotante */
    [data-bottom-nav="floating"] {
        --bnav-radius: 28px;
        --bnav-margin-x: 12px;
        --bnav-margin-bottom: 12px;
        --bnav-bg-blur: 28px;
    }
    
    /* Modo flotante + compacto */
    [data-bottom-nav="floating"][data-bottom-nav="compact"] {
        --bnav-height: 50px;
        --bnav-radius: 25px;
    }
    
    .bottom-nav {
        position: fixed;
        bottom: var(--bnav-margin-bottom);
        left: var(--bnav-margin-x);
        right: var(--bnav-margin-x);
        /* El alto SUMA el safe-area del iPhone (home indicator). Antes era
           height fijo (--bnav-height) + padding-bottom:safe-area con
           box-sizing:border-box → el padding se comía la altura y el contenido
           quedaba aplastado a ~22px, cortando los labels (Web/Familia/…) en iOS.
           Ahora el área de contenido conserva --bnav-height y el safe-area se
           agrega como "chin" translúcido por debajo. */
        height: calc(var(--bnav-height) + env(safe-area-inset-bottom, 0px));
        /* Liquid Glass — material translúcido tipo iOS */
        background: linear-gradient(180deg, rgba(255,255,255,.85), rgba(255,255,255,.7));
        backdrop-filter: blur(var(--bnav-bg-blur)) saturate(180%);
        -webkit-backdrop-filter: blur(var(--bnav-bg-blur)) saturate(180%);
        border-top: 1px solid rgba(255,255,255,.5);
        border-radius: var(--bnav-radius);
        display: flex;
        align-items: stretch;
        justify-content: space-around;
        padding: 0 4px;
        padding-bottom: env(safe-area-inset-bottom, 0px);
        z-index: 999;
        transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
        /* brillo especular interno (arriba) + profundidad + sombra */
        box-shadow:
            inset 0 1px 0 rgba(255,255,255,.75),
            inset 0 -1px 1px rgba(255,255,255,.2),
            0 -2px 12px rgba(0,0,0,.06);
        isolation: isolate;
    }

    /* Reflejo especular superior (barrido de luz sobre el vidrio) */
    .bottom-nav::before {
        content: '';
        position: absolute;
        inset: 0;
        border-radius: inherit;
        pointer-events: none;
        background: linear-gradient(180deg,
            rgba(255,255,255,.35) 0%,
            rgba(255,255,255,.08) 40%,
            transparent 70%);
    }

    /* Modo flotante: vidrio más marcado, borde luminoso y sombra profunda */
    [data-bottom-nav="floating"] .bottom-nav {
        border: 1px solid rgba(255,255,255,.55);
        box-shadow:
            inset 0 1px 1px rgba(255,255,255,.8),
            inset 0 -1px 2px rgba(255,255,255,.25),
            0 8px 32px rgba(0,0,0,.18),
            0 2px 8px rgba(0,0,0,.1);
    }

    /* Modo flotante en iPhone: la píldora se ELEVA por encima del home
       indicator (bottom += safe-area) en vez de meter el safe-area como
       padding interno — así el vidrio no queda con un hueco muerto abajo y el
       contenido usa todo el alto. Se usa ~= para que aplique también a
       "floating compact". */
    [data-bottom-nav~="floating"] .bottom-nav {
        bottom: calc(var(--bnav-margin-bottom) + env(safe-area-inset-bottom, 0px));
        height: var(--bnav-height);
        padding-bottom: 0;
    }

    /* En modo flotante la barra ocupa margin + alto + safe-area por encima del
       borde inferior; el .main-container debe reservar ese alto para que la
       última tarjeta (Servicios) NO quede tapada por el vidrio.
       Solo hasta 1023px: en ≥1024px el bottom-nav se oculta y el layout usa
       bottom:0 (no tocar). */
    @media (max-width: 1023px) {
        [data-bottom-nav~="floating"] .main-container {
            bottom: calc(var(--bnav-margin-bottom) + var(--bnav-height)
                         + env(safe-area-inset-bottom, 0px) + 10px) !important;
        }
    }
    
    /* ── Items ── */
    .bnav-item {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 2px;
        text-decoration: none;
        border: none;
        background: none;
        cursor: pointer;
        padding: 4px 0 3px;
        position: relative;
        -webkit-tap-highlight-color: transparent;
        transition: all 0.2s ease;
        border-radius: 40px;
    }
    
    .bnav-item i {
        font-size: var(--bnav-icon-size);
        color: #8e8e93;
        transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
        line-height: 1;
    }
    
    .bnav-item span {
        font-size: var(--bnav-label-size);
        font-weight: 500;
        color: #8e8e93;
        transition: all 0.2s ease;
        letter-spacing: -.01em;
        line-height: 1;
    }
    
    /* ── Activo con color personalizado ── */
    .bnav-item.active i,
    .bnav-item.active span {
        color: var(--primary, #4CAF50) !important;
    }
    
    .bnav-item.active i {
        transform: translateY(-2px) scale(1.1);
    }
    
    .bnav-item.active span {
        font-weight: 600;
    }
    
    /* ── Indicador superior ── */
    .bnav-item.active::before {
        content: '';
        position: absolute;
        top: 0;
        left: 50%;
        transform: translateX(-50%);
        width: 28px;
        height: 2.5px;
        border-radius: 0 0 3px 3px;
        background: var(--primary, #4CAF50) !important;
        animation: slideDown 0.3s ease;
    }
    
    @keyframes slideDown {
        from { top: -5px; opacity: 0; }
        to { top: 0; opacity: 1; }
    }
    
    /* ── Centro elevado ── */
    .bnav-center {
        position: relative;
        margin-top: -16px;
    }
    
    .bnav-center-circle {
        width: 48px;
        height: 48px;
        border-radius: 50%;
        background: linear-gradient(145deg, var(--primary, #4CAF50), var(--primary-dark, #388E3C));
        display: flex;
        align-items: center;
        justify-content: center;
        box-shadow: 0 4px 14px color-mix(in srgb, var(--primary, #4CAF50) 35%, transparent);
        transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
    }
    
    .bnav-center-circle i {
        font-size: 22px;
        color: #fff !important;
    }
    
    .bnav-center span {
        margin-top: 1px;
    }
    
    .bnav-center.active span {
        color: var(--primary, #4CAF50) !important;
        font-weight: 600;
    }
    
    /* ── Centro activo: anillo blanco para distinguirlo del fondo ── */
    .bnav-center.active .bnav-center-circle {
        box-shadow:
            0 0 0 3px rgba(255,255,255,.75),
            0 4px 18px color-mix(in srgb, var(--primary, #4CAF50) 45%, transparent);
        transform: scale(1.05);
    }
    
    /* ── Dark mode: anillo con color primario suave ── */
    [data-theme="dark"] .bnav-center.active .bnav-center-circle {
        box-shadow:
            0 0 0 3px rgba(255,255,255,.35),
            0 4px 18px color-mix(in srgb, var(--primary, #4CAF50) 55%, transparent);
    }
    
    .bnav-center::before { display: none !important; }
    
    /* ── Touch feedback con ripple ── */
    .bnav-item {
        position: relative;
        overflow: hidden;
    }
    
    .bnav-item .ripple {
        position: absolute;
        border-radius: 50%;
        background-color: color-mix(in srgb, var(--primary, #4CAF50) 25%, transparent);
        transform: scale(0);
        animation: rippleAnim 0.5s linear;
        pointer-events: none;
    }
    
    @keyframes rippleAnim {
        to {
            transform: scale(4);
            opacity: 0;
        }
    }
    
    /* Hover solo en desktop */
    @media (hover: hover) {
        .bnav-item:hover i {
            transform: translateY(-2px);
        }
        .bnav-item:hover span {
            color: var(--primary, #4CAF50);
        }
        .bnav-center:hover .bnav-center-circle {
            transform: scale(1.05);
        }
    }
    
    .bnav-item:active i { transform: scale(.85); }
    .bnav-center:active .bnav-center-circle {
        transform: scale(.88);
        filter: brightness(.75);
        box-shadow: 0 2px 8px rgba(0,0,0,.35);
    }
    
    /* ═══════════════════════════════════════════════════════
       DARK MODE — Bottom Nav
       ═══════════════════════════════════════════════════════ */
    [data-theme="dark"] .bottom-nav {
        background: linear-gradient(180deg, rgba(30,42,30,.8), rgba(12,20,12,.68));
        border-top: 1px solid rgba(255,255,255,.1);
        box-shadow:
            inset 0 1px 0 rgba(255,255,255,.14),
            inset 0 -1px 1px rgba(255,255,255,.04),
            0 -2px 12px rgba(0,0,0,.35);
    }

    [data-theme="dark"] .bottom-nav::before {
        background: linear-gradient(180deg,
            rgba(255,255,255,.10) 0%,
            rgba(255,255,255,.03) 40%,
            transparent 70%);
    }
    
    [data-theme="dark"] .bnav-item i,
    [data-theme="dark"] .bnav-item span {
        color: #6b7a6b;
    }
    
    [data-theme="dark"] .bnav-item.active i {
        color: var(--primary, #66bb6a) !important;
    }
    
    [data-theme="dark"] .bnav-item.active span {
        color: var(--primary, #66bb6a) !important;
    }
    
    [data-theme="dark"] .bnav-item.active::before {
        background: var(--primary, #66bb6a) !important;
    }
    
    [data-theme="dark"] .bnav-center-circle {
        background: linear-gradient(145deg, var(--primary, #388E3C), var(--primary-dark, #2E7D32));
        box-shadow: 0 4px 14px color-mix(in srgb, var(--primary, #388E3C) 40%, transparent);
    }
    
    /* Modo flotante en dark */
    [data-theme="dark"][data-bottom-nav="floating"] .bottom-nav {
        border: 1px solid rgba(255,255,255,.12);
        box-shadow:
            inset 0 1px 1px rgba(255,255,255,.16),
            inset 0 -1px 2px rgba(255,255,255,.05),
            0 8px 32px rgba(0,0,0,.55),
            0 2px 8px rgba(0,0,0,.4);
    }
    
    /* ═══════════════════════════════════════════════════════
       SIDE MENU — Modernizado con dark mode
       ═══════════════════════════════════════════════════════ */
    .menu-overlay {
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,.45);
        z-index: 9998;
        opacity: 0;
        pointer-events: none;
        transition: opacity .3s ease;
        backdrop-filter: blur(2px);
        -webkit-backdrop-filter: blur(2px);
    }
    .menu-overlay.active {
        opacity: 1;
        pointer-events: auto;
    }
    
    .side-menu {
        position: fixed;
        top: 0;
        right: -100%;
        width: 100%;
        max-width: 340px;
        height: 100vh;
        height: 100dvh;
        background: #f8faf8;
        z-index: 9999;
        transition: right .35s cubic-bezier(.4,0,.2,1);
        overflow-y: auto;
        overscroll-behavior: contain;
    }
    .side-menu.active { right: 0; }
    
    .side-menu-header {
        background: linear-gradient(135deg, var(--primary, #4CAF50), var(--primary-dark, #388E3C));
        padding: 20px;
        padding-top: calc(20px + env(safe-area-inset-top, 0px));
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
    
    .profile-avatar-link1 {
        display: flex;
        align-items: center;
        gap: 10px;
        text-decoration: none;
        color: inherit;
        width: fit-content;
    }
    .profile-avatar1 {
        width: 46px;
        height: 46px;
        border-radius: 50%;
        object-fit: cover;
        border: 2px solid rgba(255,255,255,.5);
    }
    .profile-info { display: flex; flex-direction: column; }
    .profile-info strong { color: #fff; font-size: 14px; }
    .profile-info span { font-size: 12px; color: rgba(255,255,255,.8); }
    
    .close-menu {
        width: 36px;
        height: 36px;
        border-radius: 50%;
        background: rgba(255,255,255,.18);
        border: none;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        color: #fff;
        font-size: 18px;
        transition: background .2s;
        flex-shrink: 0;
    }
    .close-menu:active { background: rgba(255,255,255,.3); transform: scale(.9); }
    
    .side-menu-content { padding: 16px; }
    
    .menu-section { margin-bottom: 20px; }
    .menu-section-title {
        font-size: 11px;
        font-weight: 600;
        color: #888;
        text-transform: uppercase;
        letter-spacing: .5px;
        margin-bottom: 8px;
        padding-left: 4px;
    }
    
    .menu-item {
        display: flex;
        align-items: center;
        gap: 14px;
        padding: 12px 14px;
        background: #fff;
        border-radius: 10px;
        margin-bottom: 6px;
        text-decoration: none;
        transition: transform .2s, box-shadow .2s;
        box-shadow: 0 1px 3px rgba(0,0,0,.04);
    }
    .menu-item:active {
        transform: translateX(3px);
        box-shadow: 0 2px 8px color-mix(in srgb, var(--primary, #4CAF50) 15%, transparent);
    }
    .menu-item-icon {
        width: 22px;
        color: var(--primary, #4CAF50);
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 15px;
        flex-shrink: 0;
    }
    .menu-item-text {
        font-size: 14px;
        font-weight: 500;
        color: #333;
        flex: 1;
    }
    .menu-item-arrow {
        font-size: 16px;
        color: #ccc;
    }
    
    /* ═══════════════════════════════════════════════════════
       DARK MODE — Side Menu
       ═══════════════════════════════════════════════════════ */
    [data-theme="dark"] .side-menu {
        background: #0f1c0f;
    }
    [data-theme="dark"] .side-menu-header {
        background: linear-gradient(135deg, #2E7D32, #1B5E20);
    }
    [data-theme="dark"] .menu-section-title {
        color: var(--text-secondary, #a5d6a7);
    }
    [data-theme="dark"] .menu-item {
        background: var(--bg-card, #162616);
        box-shadow: 0 1px 3px rgba(0,0,0,.2);
    }
    [data-theme="dark"] .menu-item-text {
        color: var(--text-primary, #e8f5e9);
    }
    [data-theme="dark"] .menu-item-arrow {
        color: #3a5a3a;
    }
    [data-theme="dark"] .menu-item:active {
        box-shadow: 0 2px 8px color-mix(in srgb, var(--primary, #4CAF50) 20%, transparent);
    }
    [data-theme="dark"] .menu-overlay.active {
        background: rgba(0,0,0,.65);
    }
    
    /* ═══════════════════════════════════════════════════════
       IFRAME — Ocultar en desktop
       ═══════════════════════════════════════════════════════ */
    
    /* ═══════════════════════════════════════════════════════
       PAGE TRANSITIONS
       ═══════════════════════════════════════════════════════ */
    .page-transition-out {
        opacity: 0;
        transform: translateY(6px);
        transition: opacity .15s, transform .15s;
    }
    .page-transition-in {
        animation: fadeUp .2s ease;
    }
    @keyframes fadeUp {
        from { opacity: 0; transform: translateY(6px); }
        to   { opacity: 1; transform: translateY(0); }
    }
    .no-transition * { transition: none !important; }
    
    /* ═══════════════════════════════════════════════════════
       ANIMACIÓN DE ENTRADA PARA EL BOTTOM NAV
       ═══════════════════════════════════════════════════════ */
    @keyframes bnavSlideUp {
        from { transform: translateY(100%); opacity: 0; }
        to { transform: translateY(0); opacity: 1; }
    }
    .bottom-nav {
        animation: bnavSlideUp 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    }
