/*
 * Netzerd — paneles unificados: notificaciones + perfil (portal usuario).
 */

/* ── Base panel ── */
.header-popover.nz-portal-panel {
    display: none;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    box-shadow: 0 18px 40px rgba(0, 38, 96, 0.14);
    overflow: hidden;
    flex-direction: column;
}

.header-popover.nz-portal-panel.show,
.header-popover.nz-portal-panel.nz-portal-popover-open {
    display: flex;
}

.nz-portal-panel__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    border-bottom: 1px solid #eef2f6;
    background: #fff;
    flex-shrink: 0;
}

.nz-portal-panel__title {
    font-size: 0.9375rem;
    font-weight: 800;
    color: #002660;
    letter-spacing: -0.01em;
}

.nz-portal-panel__body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.nz-portal-panel__foot {
    flex-shrink: 0;
    padding: 0.625rem 0.75rem;
    border-top: 1px solid #eef2f6;
    background: #fafbff;
}

.nz-portal-panel__foot a {
    display: block;
    text-align: center;
    padding: 0.65rem 0.75rem;
    border-radius: 10px;
    font-size: 0.8125rem;
    font-weight: 700;
    color: #003a8c;
    text-decoration: none;
    background: #eef3ff;
}

.nz-portal-panel__foot a:hover {
    background: #dbeafe;
}

/* ── Notificaciones ── */
.nz-portal-notif-panel .nz-notif-popover__empty {
    padding: 1.25rem 1rem;
    text-align: center;
    font-size: 0.8125rem;
    color: #64748b;
}

.nz-portal-notif-panel .nz-notif-item,
.nz-portal-notif-panel .notif-item {
    display: flex;
    align-items: flex-start;
    gap: 0.625rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #f1f5f9;
    text-decoration: none;
    color: inherit;
    transition: background 0.15s;
}

.nz-portal-notif-panel .nz-notif-item:hover,
.nz-portal-notif-panel .notif-item:hover {
    background: #f8fbff;
}

.nz-portal-notif-panel .nz-notif-item--unread {
    background: #f0f7ff;
}

.nz-portal-notif-panel .nz-notif-item__dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #3b82f6;
    flex-shrink: 0;
    margin-top: 0.35rem;
}

.nz-portal-notif-panel .nz-notif-item__dot[hidden] {
    display: none;
}

.nz-portal-notif-panel .nz-notif-item__body,
.nz-portal-notif-panel .notif-item > div {
    flex: 1;
    min-width: 0;
}

.nz-portal-notif-panel .nz-notif-item__title,
.nz-portal-notif-panel .notif-item .font-semibold {
    font-size: 0.8125rem;
    font-weight: 700;
    color: #002660;
    margin: 0 0 0.2rem;
    line-height: 1.3;
}

.nz-portal-notif-panel .nz-notif-item__msg,
.nz-portal-notif-panel .notif-item .text-xs {
    font-size: 0.75rem;
    color: #64748b;
    margin: 0;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.nz-portal-notif-panel .nz-notif-item__time,
.nz-portal-notif-panel .notif-item .text-\[11px\] {
    font-size: 0.6875rem;
    color: #94a3b8;
    margin-top: 0.25rem;
    display: block;
}

/* ── Perfil ── */
.nz-portal-profile-panel {
    padding: 0;
    min-width: 280px;
    max-width: 320px;
    flex-direction: column;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.nz-portal-profile-panel .nz-profile-menu-scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.nz-portal-profile-panel .nz-profile-menu-foot {
    flex-shrink: 0;
    border-top: 1px solid #e2e8f0;
    background: #fff;
    padding-bottom: env(safe-area-inset-bottom, 0);
}

.nz-portal-profile-panel .nz-profile-menu-foot .nz-profile-menu-item--logout {
    margin-top: 0;
    border-top: none;
    padding-top: 0.65rem;
    padding-bottom: 0.75rem;
    color: #b91c1c;
}

.nz-portal-profile-panel .nz-profile-menu-foot .nz-profile-menu-item--logout:hover {
    background: #fef2f2;
    color: #991b1b;
}

.nz-portal-profile-panel .nz-profile-menu-foot .nz-profile-menu-item--logout .nz-profile-menu-ic {
    color: #b91c1c;
}

.nz-portal-profile-panel .nz-profile-menu-foot .nz-profile-menu-item--logout:hover .nz-profile-menu-ic {
    color: #991b1b;
}

.nz-portal-profile-panel .nz-profile-menu-head {
    padding: 0.875rem 1rem 0.75rem;
    margin: 0;
    border-bottom: 1px solid #eef2f6;
}

.nz-portal-profile-panel .nz-profile-menu-name {
    font-size: 0.9375rem;
    font-weight: 700;
    color: #002660;
}

.nz-portal-profile-panel .nz-profile-menu-role {
    font-size: 0.75rem;
    color: #64748b;
    margin-top: 0.125rem;
    text-transform: capitalize;
}

.nz-portal-profile-panel .nz-profile-menu-item,
.nz-portal-profile-panel .profile-menu-item {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.65rem 1rem;
    font-size: 0.875rem;
    color: #1e293b;
    text-decoration: none;
    border-radius: 0;
    transition: background 0.15s, color 0.15s;
}

.nz-portal-profile-panel .nz-profile-menu-item:hover,
.nz-portal-profile-panel .profile-menu-item:hover {
    background: #eff6ff;
    color: #1d4ed8;
}

.nz-portal-profile-panel .nz-profile-menu-item--logout,
.nz-portal-profile-panel .nz-profile-menu-item--logout-last {
    margin-top: 0.25rem;
    border-top: 1px solid #e2e8f0;
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
    color: #b91c1c;
}

.nz-portal-profile-panel .nz-profile-menu-item--logout:hover,
.nz-portal-profile-panel .nz-profile-menu-item--logout-last:hover {
    background: #fef2f2;
    color: #991b1b;
}

.nz-portal-profile-panel .nz-profile-menu-item--logout .nz-profile-menu-ic,
.nz-portal-profile-panel .nz-profile-menu-item--logout-last .nz-profile-menu-ic {
    color: #b91c1c;
}

.nz-portal-profile-panel .nz-profile-menu-item--logout:hover .nz-profile-menu-ic,
.nz-portal-profile-panel .nz-profile-menu-item--logout-last:hover .nz-profile-menu-ic {
    color: #991b1b;
}

.nz-portal-profile-panel .nz-profile-menu-ic {
    font-size: 1.25rem;
    width: 1.375rem;
    color: #475569;
}

.nz-portal-profile-panel .nz-profile-menu-item:hover .nz-profile-menu-ic {
    color: #2563eb;
}

/* ── Cabecera móvil ── */
@media (max-width: 767.98px) {
    body.nz-user-portal header.fixed,
    body.nz-user-portal .nz-index-header,
    body.nz-user-portal .ota-shell-header {
        position: fixed !important;
        top: 0;
        left: 0;
        right: 0;
        width: 100%;
        max-width: 100vw;
        z-index: 10000 !important;
        overflow: visible !important;
    }

    body.nz-user-portal .nz-index-header .max-w-7xl,
    body.nz-user-portal .ota-shell-header .max-w-7xl,
    body.nz-user-portal header.fixed > .max-w-7xl,
    body.nz-user-portal header.fixed > div {
        overflow: visible !important;
    }

    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 {
        overflow: visible !important;
    }

    body.nz-user-portal .nz-portal-header-actions {
        overflow: visible !important;
        flex-shrink: 0;
        position: relative;
        z-index: 2;
    }

    body.nz-user-portal #notifBtn,
    body.nz-user-portal #notificationBellHeader,
    body.nz-user-portal #profileBtn,
    body.nz-user-portal #userMenuToggle {
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
        cursor: pointer;
        pointer-events: auto;
    }

    /* Un solo panel visible — popovers en body */
    body.nz-user-portal .nz-portal-panel.nz-portal-popover-open {
        display: flex !important;
        position: fixed !important;
        top: calc(3.5rem + env(safe-area-inset-top, 0px)) !important;
        left: 0.75rem !important;
        right: 0.75rem !important;
        width: auto !important;
        max-width: none !important;
        max-height: min(72vh, 520px) !important;
        z-index: 10020 !important;
        margin: 0;
        pointer-events: auto !important;
        box-shadow: 0 20px 48px rgba(15, 23, 42, 0.2);
    }

    body.nz-user-portal .nz-portal-profile-panel.nz-portal-popover-open {
        left: auto !important;
        right: 0.75rem !important;
        width: min(92vw, 320px) !important;
    }

    /* Ocultar el panel que NO está activo aunque tenga .show residual */
    body.nz-user-portal .nz-portal-panel.show:not(.nz-portal-popover-open) {
        display: none !important;
    }
}

.nz-portal-header-backdrop {
    display: none;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    top: calc(3.5rem + env(safe-area-inset-top, 0px));
    z-index: 9990;
    background: rgba(15, 23, 42, 0.28);
    pointer-events: auto;
}

body.nz-portal-header-open .nz-portal-header-backdrop {
    display: block;
}

@media (min-width: 768px) {
    .header-popover.nz-portal-panel {
        position: absolute;
        top: calc(100% + 8px);
        right: 0;
        width: min(380px, calc(100vw - 24px));
        max-height: min(560px, 78vh);
        z-index: 200;
        overflow-y: auto;
    }

    .header-popover.nz-portal-profile-panel {
        width: min(320px, calc(100vw - 24px));
    }

    .nz-portal-header-backdrop {
        display: none !important;
    }
}
