/* ========================================================
   BOTTOM NAVIGATION BAR (MOBILE ONLY) - NATIVE APP FEEL
   ======================================================== */

body .bottom-nav-mobile,
#wrapper .bottom-nav-mobile {
    display: none;
    position: fixed;
    bottom: 15px;
    left: 4%;
    width: 92%;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(15px) saturate(150%);
    -webkit-backdrop-filter: blur(15px) saturate(150%);
    border: 1px solid rgba(255, 255, 255, 0.8);
    border-radius: 40px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.12);
    z-index: 9999;
    padding-bottom: 0;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.3s ease;
}

/* Scroll Hide Class */
body .bottom-nav-mobile.hidden-pill,
#wrapper .bottom-nav-mobile.hidden-pill {
    transform: translateY(150px);
    opacity: 0;
}

@media (max-width: 767px) {
    body .bottom-nav-mobile,
    #wrapper .bottom-nav-mobile {
        display: flex;
        justify-content: space-around;
        align-items: center;
        height: 65px;
    }

    /* Ajustar el cuerpo para que no quede oculto detrás de la barra */
    html body, 
    html body.has-bottom-nav {
        padding-bottom: calc(70px + env(safe-area-inset-bottom, 0px));
    }
}

html[data-theme="dark"] body .bottom-nav-mobile,
html[data-theme="dark"] #wrapper .bottom-nav-mobile {
    background: rgba(15, 23, 42, 0.65);
    border: 1px solid rgba(255,255,255,0.1);
    box-shadow: 0 12px 35px rgba(0,0,0,0.4);
}

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: #475569; /* Color gris oscuro para coincidir con la imagen */
    font-size: 10px;
    font-weight: 700;
    flex: 1;
    height: 100%;
    transition: color 0.3s;
    position: relative;
}

.bottom-nav-item.active {
    color: #2563EB; /* Azul más oscuro para activo */
}

[data-theme="dark"] .bottom-nav-item.active {
    color: #60A5FA;
}

.bottom-nav-icon {
    width: 24px;
    height: 24px;
    margin-bottom: 4px;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.bottom-nav-item:active .bottom-nav-icon {
    transform: scale(0.9);
}

.bottom-nav-item.active .bottom-nav-icon {
    transform: translateY(-2px);
}

/* --- FAB: BÓTON CENTRAL FLOTANTE --- */
.bottom-nav-fab-wrapper {
    position: relative;
    top: -15px; /* Stick out a bit from the pill */
    flex: 0 0 65px;
    display: flex;
    justify-content: center;
}

.bottom-nav-fab {
    background: #2563EB; /* Color azul sólido para coincidir con la imagen */
    width: 58px;
    height: 58px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: 0 8px 25px rgba(37, 99, 235, 0.4); /* Sombra más sutil */
    text-decoration: none;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.3s ease;
    border: 3px solid rgba(255, 255, 255, 0.9);
}

[data-theme="dark"] .bottom-nav-fab {
    border-color: #0F172A;
}

.bottom-nav-fab:active {
    transform: scale(0.95);
}

.bottom-nav-fab svg {
    width: 28px;
    height: 28px;
}

/* ========================================================
   PWA SMART INSTALL BANNER (NATIVE APP FEEL 2026)
   ======================================================== */
.pwa-install-banner {
    position: fixed;
    bottom: 95px; /* Above the mobile nav pill */
    left: 50%;
    transform: translateX(-50%);
    width: 92%;
    max-width: 480px;
    z-index: 10000;
    animation: pwaSlideUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes pwaSlideUp {
    from {
        opacity: 0;
        transform: translate(-50%, 40px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translate(-50%, 0) scale(1);
    }
}

.pwa-banner-card {
    background: rgba(15, 23, 42, 0.92);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 20px;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45), 0 0 25px rgba(0, 242, 254, 0.15);
    position: relative;
}

.pwa-btn-close {
    position: absolute;
    top: 8px;
    right: 10px;
    background: transparent;
    border: none;
    color: #94a3b8;
    font-size: 14px;
    cursor: pointer;
    line-height: 1;
    padding: 4px;
    transition: color 0.2s;
}

.pwa-btn-close:hover {
    color: #ffffff;
}

.pwa-banner-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

.pwa-app-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    flex-shrink: 0;
    object-fit: cover;
}

.pwa-banner-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.pwa-app-title {
    display: flex;
    align-items: center;
    gap: 6px;
}

.pwa-app-title strong {
    font-size: 13px;
    color: #ffffff;
    font-weight: 800;
    letter-spacing: -0.2px;
}

.pwa-badge-app {
    font-size: 9px;
    background: rgba(0, 242, 254, 0.15);
    color: #00f2fe;
    border: 1px solid rgba(0, 242, 254, 0.3);
    padding: 1px 6px;
    border-radius: 10px;
    font-weight: 700;
    text-transform: uppercase;
}

.pwa-app-desc {
    margin: 0;
    font-size: 11px;
    color: #94a3b8;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pwa-btn-install {
    background: linear-gradient(135deg, #00f2fe, #2563eb);
    color: #ffffff;
    border: none;
    border-radius: 14px;
    padding: 8px 16px;
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(0, 242, 254, 0.35);
    transition: all 0.25s ease;
    white-space: nowrap;
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.pwa-btn-install:active {
    transform: scale(0.95);
}

@media (min-width: 768px) {
    .pwa-install-banner {
        bottom: 24px;
        right: 24px;
        left: auto;
        transform: none;
        animation: pwaSlideUpDesk 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    }

    @keyframes pwaSlideUpDesk {
        from {
            opacity: 0;
            transform: translateY(30px) scale(0.95);
        }
        to {
            opacity: 1;
            transform: translateY(0) scale(1);
        }
    }
}
