/*
 * Netzerd — barra inferior fija (móvil) + contención responsive portal usuario.
 */

.nz-user-tabbar {
    display: none;
}

@media (max-width: 767.98px) {
    html:has(body.nz-user-portal) {
        overflow-x: hidden;
        max-width: 100%;
    }

    body.nz-user-portal {
        overflow-x: hidden;
        max-width: 100vw;
        width: 100%;
        min-height: 100dvh;
        padding-bottom: calc(5.25rem + env(safe-area-inset-bottom, 0px)) !important;
        -webkit-overflow-scrolling: touch;
    }

    body.nz-user-portal #nz-site-public,
    body.nz-user-portal main,
    body.nz-user-portal .main-content,
    body.nz-user-portal .max-w-7xl,
    body.nz-user-portal .max-w-6xl,
    body.nz-user-portal .max-w-\[1600px\] {
        max-width: 100% !important;
        box-sizing: border-box;
    }

    body.nz-user-portal img,
    body.nz-user-portal video {
        max-width: 100%;
    }

    /* Chips horizontales duplicados (menú va en tabbar inferior) */
    body.nz-user-portal main.md\:hidden .flex.overflow-x-auto.gap-3.hide-scrollbar {
        display: none !important;
    }

    body.nz-user-portal main.md\:hidden {
        padding-bottom: calc(5.25rem + env(safe-area-inset-bottom, 0px)) !important;
        max-width: 100vw;
        overflow-x: hidden;
        box-sizing: border-box;
    }

    body.nz-user-portal .px-8,
    body.nz-user-portal .md\:px-8 {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }

    /* Index: contenido PC en móvil */
    body.page-index.nz-user-portal #nzIndexMain,
    body.page-index.nz-user-portal main.nz-index-main {
        display: block !important;
        padding-top: 3.75rem !important;
        padding-bottom: calc(5.25rem + env(safe-area-inset-bottom, 0px)) !important;
        max-width: 100vw;
        overflow-x: hidden;
        box-sizing: border-box;
    }

    /* Cabecera compacta: solo logo + coins + notif + foto */
    body.nz-user-portal .nz-index-header,
    body.nz-user-portal .ota-shell-header {
        width: 100%;
        max-width: 100vw;
        left: 0;
        right: 0;
    }

    body.nz-user-portal .nz-index-header .max-w-7xl,
    body.nz-user-portal .ota-shell-header .max-w-7xl {
        max-width: 100% !important;
        width: 100%;
        padding-left: 0.75rem !important;
        padding-right: 0.75rem !important;
        margin-left: auto;
        margin-right: auto;
        box-sizing: border-box;
    }

    body.nz-user-portal .nz-index-header__top,
    body.nz-user-portal .ota-shell-header > .max-w-7xl > .flex.justify-between,
    body.nz-user-portal header.fixed .flex.justify-between {
        width: 100%;
        max-width: 100%;
        min-height: 3.5rem;
        height: auto;
        flex-wrap: nowrap !important;
        gap: 0.35rem !important;
        overflow: visible !important;
    }

    body.nz-user-portal .nz-index-header__top > .flex.items-center.gap-4,
    body.nz-user-portal .ota-shell-header .flex.items-center.gap-4 {
        min-width: 0;
        flex: 0 0 auto;
        overflow: visible;
    }

    body.nz-user-portal .nz-header-coins-slot {
        flex: 1 1 0;
        min-width: 0;
    }

    body.nz-user-portal .nz-index-header__top > .flex.items-center.gap-2,
    body.nz-user-portal .ota-shell-header .flex.items-center.gap-2,
    body.nz-user-portal .nz-portal-header-actions {
        flex-shrink: 0;
        overflow: visible !important;
        position: relative;
        z-index: 6;
    }

    body.nz-user-portal .nz-index-header__top img.nz-user-portal-logo,
    body.nz-user-portal .ota-shell-header img.nz-user-portal-logo,
    body.nz-user-portal .nz-index-header__top img[alt="Netzerd"],
    body.nz-user-portal .ota-shell-header img[alt="Netzerd"] {
        height: 2.5rem;
        width: 2.5rem;
        max-width: 2.5rem;
        object-fit: contain;
    }

    /* Ocultar menú de texto superior en móvil (va abajo en tabbar) */
    body.nz-user-portal nav.nz-index-header__desktop-nav,
    body.nz-user-portal nav.nz-index-header__desktop-nav.hidden,
    body.nz-user-portal .ota-shell-header nav.ota-shell-nav,
    body.nz-user-portal .ota-shell-header nav.hidden.md\:flex,
    body.nz-user-portal header nav.hidden.md\:flex,
    body.nz-user-portal .nz-mobile-nav-row {
        display: none !important;
        width: 0 !important;
        height: 0 !important;
        overflow: hidden !important;
        visibility: hidden !important;
        pointer-events: none !important;
    }

    body.nz-user-portal #notifBtn,
    body.nz-user-portal #notificationBellHeader {
        padding: 0.35rem !important;
    }

    body.nz-user-portal #profileBtn,
    body.nz-user-portal #userMenuToggle,
    body.nz-user-portal .user-menu-toggle-white {
        width: 2.25rem !important;
        height: 2.25rem !important;
        flex-shrink: 0;
    }

    /* Cabeceras standalone (actividades, miembros, etc.) */
    body.nz-user-portal > header.fixed,
    body.nz-user-portal header.fixed.top-0 {
        width: 100%;
        max-width: 100vw;
    }

    body.nz-user-portal > header.fixed .max-w-7xl,
    body.nz-user-portal header.fixed > .max-w-7xl {
        max-width: 100% !important;
        width: 100%;
        padding-left: 0.75rem !important;
        padding-right: 0.75rem !important;
        box-sizing: border-box;
    }

    body.nz-user-portal > header.fixed .flex.justify-between.items-center,
    body.nz-user-portal header.fixed .flex.justify-between {
        height: 3.5rem !important;
        min-height: 3.5rem;
        gap: 0.35rem !important;
        flex-wrap: nowrap;
        overflow: visible;
    }

    body.nz-user-portal > header.fixed .flex.items-center.gap-8 {
        gap: 0.5rem !important;
        min-width: 0;
        flex: 0 0 auto;
        overflow: visible;
    }

    body.nz-user-portal > header.fixed img[alt="Netzerd"],
    body.nz-user-portal header.fixed img[alt="Netzerd"] {
        height: 2rem;
        max-width: 7rem;
        width: auto;
        object-fit: contain;
    }

    body.nz-user-portal > header.fixed nav.hidden.md\\:flex,
    body.nz-user-portal header.fixed nav.hidden.md\\:flex {
        display: none !important;
    }

    body.nz-user-portal > main.max-w-7xl,
    body.nz-user-portal main.max-w-7xl {
        padding-top: 4.25rem !important;
        padding-bottom: calc(5.25rem + env(safe-area-inset-bottom, 0px)) !important;
    }

    body.page-alojamientos .main-content.search-layout-full,
    body.page-actividades .main-content,
    body.page-miembros .main-content,
    body.page-red_social .main-content,
    body.page-profile .main-content,
    body.page-edit_profile .main-content,
    body.page-chat .main-content,
    body.page-membresias .main-content,
    body.page-tienda .main-content,
    body.page-noticias .main-content,
    body.page-descargar .main-content,
    body.page-detalle_noticia .main-content,
    body.page-streaming_tv .main-content {
        padding-top: 4rem !important;
    }

    /* ── Barra inferior fija al viewport ── */
    .nz-user-tabbar {
        display: flex !important;
        align-items: flex-end;
        justify-content: space-around;
        gap: 0;
        position: fixed !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100% !important;
        max-width: 100vw !important;
        margin: 0 !important;
        z-index: 9999 !important;
        min-height: 3.75rem;
        padding: 0.35rem 0.5rem calc(0.35rem + env(safe-area-inset-bottom, 0px));
        background: rgba(255, 255, 255, 0.97);
        backdrop-filter: blur(20px) saturate(1.2);
        -webkit-backdrop-filter: blur(20px) saturate(1.2);
        border-top: 1px solid rgba(226, 232, 240, 0.9);
        box-shadow: 0 -1px 0 rgba(15, 23, 42, 0.04), 0 -12px 40px rgba(15, 23, 42, 0.08);
        transform: translateZ(0);
        -webkit-transform: translateZ(0);
    }

    .nz-user-tabbar__item {
        position: relative;
        flex: 1 1 0;
        min-width: 0;
        max-width: 5.5rem;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 0.2rem;
        min-height: 3rem;
        padding: 0.25rem 0.15rem;
        border: none;
        border-radius: 14px;
        background: transparent;
        color: #94a3b8;
        text-decoration: none;
        font-family: inherit;
        cursor: pointer;
        transition: color 0.18s ease, background 0.18s ease;
        -webkit-tap-highlight-color: transparent;
    }

    .nz-user-tabbar__icon {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 2rem;
        height: 2rem;
        border-radius: 12px;
        transition: background 0.18s ease, transform 0.18s ease;
    }

    .nz-user-tabbar__item .material-symbols-outlined {
        font-size: 1.375rem;
        line-height: 1;
        font-variation-settings: 'FILL' 0, 'wght' 350, 'GRAD' 0, 'opsz' 24;
        transition: font-variation-settings 0.18s ease;
    }

    .nz-user-tabbar__label {
        font-size: 0.625rem;
        font-weight: 600;
        letter-spacing: 0.01em;
        line-height: 1.1;
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .nz-user-tabbar__item.is-active {
        color: #003a8c;
    }

    .nz-user-tabbar__item.is-active .nz-user-tabbar__icon {
        background: linear-gradient(145deg, #eff6ff 0%, #dbeafe 100%);
        box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.12);
    }

    .nz-user-tabbar__item.is-active .material-symbols-outlined {
        font-variation-settings: 'FILL' 1, 'wght' 500, 'GRAD' 0, 'opsz' 24;
        color: #2563eb;
    }

    .nz-user-tabbar__item.is-active::before {
        content: '';
        position: absolute;
        top: 0.125rem;
        left: 50%;
        transform: translateX(-50%);
        width: 1.125rem;
        height: 2px;
        border-radius: 2px;
        background: #2563eb;
    }

    .nz-user-tabbar__item:active:not(.is-active) .nz-user-tabbar__icon {
        background: #f1f5f9;
    }

    .nz-user-tabbar__item--more.is-active .nz-user-tabbar__icon {
        background: linear-gradient(145deg, #f0fdf4 0%, #dcfce7 100%);
        box-shadow: inset 0 0 0 1px rgba(22, 163, 74, 0.12);
    }

    .nz-user-tabbar__item--more.is-active .material-symbols-outlined {
        color: #16a34a;
    }

    .nz-user-tabbar__item--more.is-active::before {
        background: #16a34a;
    }

    /* Sheet "Más secciones" */
    .nz-tabbar-sheet {
        position: fixed;
        inset: 0;
        z-index: 10000;
        pointer-events: none;
        visibility: hidden;
        transition: visibility 0.25s;
    }

    .nz-tabbar-sheet.is-open {
        pointer-events: auto;
        visibility: visible;
    }

    .nz-tabbar-sheet__backdrop {
        position: absolute;
        inset: 0;
        background: rgba(15, 23, 42, 0.4);
        opacity: 0;
        transition: opacity 0.25s ease;
    }

    .nz-tabbar-sheet.is-open .nz-tabbar-sheet__backdrop {
        opacity: 1;
    }

    .nz-tabbar-sheet__panel {
        position: absolute;
        left: 0;
        right: 0;
        bottom: 0;
        padding: 0.75rem 1rem calc(1rem + env(safe-area-inset-bottom, 0px));
        background: #fff;
        border-radius: 20px 20px 0 0;
        box-shadow: 0 -8px 40px rgba(15, 23, 42, 0.14);
        transform: translateY(100%);
        transition: transform 0.28s cubic-bezier(0.32, 0.72, 0, 1);
    }

    .nz-tabbar-sheet.is-open .nz-tabbar-sheet__panel {
        transform: translateY(0);
    }

    .nz-tabbar-sheet__handle {
        width: 2.5rem;
        height: 4px;
        margin: 0 auto 0.75rem;
        border-radius: 4px;
        background: #e2e8f0;
    }

    .nz-tabbar-sheet__title {
        margin: 0 0 0.875rem;
        font-size: 0.8125rem;
        font-weight: 700;
        letter-spacing: 0.06em;
        text-transform: uppercase;
        color: #64748b;
    }

    .nz-tabbar-sheet__grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.625rem;
    }

    .nz-tabbar-sheet__link {
        display: flex;
        align-items: center;
        gap: 0.75rem;
        padding: 0.875rem 1rem;
        border-radius: 14px;
        background: #f8fafc;
        border: 1px solid #eef2f6;
        color: #334155;
        text-decoration: none;
        transition: background 0.15s, border-color 0.15s;
    }

    .nz-tabbar-sheet__link.is-active {
        background: #eff6ff;
        border-color: #bfdbfe;
        color: #003a8c;
    }

    .nz-tabbar-sheet__link-icon {
        font-size: 1.375rem;
        color: #2563eb;
        font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24;
    }

    .nz-tabbar-sheet__link-label {
        font-size: 0.875rem;
        font-weight: 600;
    }

    body.nz-tabbar-sheet-open {
        overflow: hidden;
    }
}

@media (min-width: 768px) {
    .nz-user-tabbar {
        display: none !important;
    }

    .nz-tabbar-sheet {
        display: none !important;
    }

    body.nz-user-portal {
        padding-bottom: 0 !important;
    }
}
