/* 
 * Notification Panel Z-Index Fix
 * Ensures notification panel appears above all content on all pages
 */

/* ── Header and notification elements ── */
.top-bar {
    z-index: 50 !important;
}

#notif-wrap {
    position: relative !important;
    z-index: 9999 !important;
}

#notif-panel {
    position: absolute !important;
    z-index: 9999 !important;
    background: rgba(255,255,255,0.95) !important;
    backdrop-filter: blur(20px) !important;
    -webkit-backdrop-filter: blur(20px) !important;
    border: 1px solid rgba(0,0,0,0.08) !important;
    border-radius: 16px !important;
    box-shadow: 0 12px 40px rgba(0,0,0,0.2) !important;
    right: 0 !important;
    top: 44px !important;
    width: min(300px, calc(100vw - 32px)) !important;
    overflow: hidden !important;
}

/* ── Ensure notification panel is above common elements ── */
#notif-panel {
    z-index: 9999 !important;
}

/* ── Override any conflicting z-index values ── */
.kb-main,
main,
.content,
.sidebar,
.modal,
.dropdown,
.tooltip {
    z-index: auto !important;
}

/* ── Specific overrides for common high z-index elements ── */
.leaflet-control-container,
.leaflet-popup,
.leaflet-tooltip {
    z-index: 1000 !important;
}

/* ── Toast notifications should be even higher ── */
.toast,
.notification-sound-toast {
    z-index: 10000 !important;
}

/* ── Popup overlays should be highest ── */
.popup-overlay {
    z-index: 10001 !important;
}

/* ── Bottom navigation ── */
.bottom-nav {
    z-index: 40 !important;
}

/* ── Sidebar ── */
#kb-sidebar {
    z-index: 30 !important;
}

/* ── Ensure notification badge is visible ── */
#notif-badge {
    z-index: 51 !important;
    position: absolute !important;
}

/* ── Mobile specific fixes ── */
@media (max-width: 768px) {
    #notif-panel {
        right: 8px !important;
        width: calc(100vw - 16px) !important;
        max-width: 320px !important;
    }
}

/* ── Animation for notification panel ── */
#notif-panel {
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

#notif-panel[style*="display: block"],
#notif-panel[style*="display:block"] {
    opacity: 1 !important;
    transform: translateY(0) !important;
}

/* ── Ensure panel content is properly styled ── */
#notif-panel .notif-header {
    padding: 14px 16px;
    border-bottom: 1px solid rgba(0,0,0,0.06);
    font-weight: 600;
    font-size: 14px;
    color: #1c1c1e;
    background: rgba(255,255,255,0.8);
}

#notif-list {
    max-height: 280px;
    overflow-y: auto;
    background: rgba(255,255,255,0.9);
}

/* ── Notification list items ── */
#notif-list a {
    display: block;
    padding: 12px 16px;
    text-decoration: none;
    border-bottom: 1px solid rgba(0,0,0,0.05);
    transition: background-color 0.15s ease;
}

#notif-list a:hover {
    background-color: rgba(0,0,0,0.02);
}

#notif-list a:last-child {
    border-bottom: none;
}

/* ── Empty state ── */
#notif-list p {
    text-align: center;
    color: #8e8e93;
    font-size: 12px;
    padding: 16px;
    margin: 0;
}