/* Notification Bell + Sidebar Badge styles */

:root {
    --zetra-notification-bg: #ffffff;
    --zetra-notification-bg-soft: #f6f9fc;
    --zetra-notification-bg-hover: #eef5fc;
    --zetra-notification-border: #dce5ee;
    --zetra-notification-text: #243447;
    --zetra-notification-muted: #667789;
    --zetra-notification-shadow: 0 18px 42px rgba(15, 23, 42, .16);
}

html.dark-mode,
[data-bs-theme="dark"] {
    --zetra-notification-bg: #20252a;
    --zetra-notification-bg-soft: #262d34;
    --zetra-notification-bg-hover: rgba(255, 255, 255, .07);
    --zetra-notification-border: rgba(255, 255, 255, .10);
    --zetra-notification-text: #edf3f8;
    --zetra-notification-muted: #a5b0ba;
    --zetra-notification-shadow: 0 18px 46px rgba(0, 0, 0, .34);
}

/* Header bell badge */
#notificationBellContainer {
    flex: 0 0 auto;
    position: relative;
}

#notificationBellContainer .navbar-link {
    position: relative;
    min-width: 42px;
    justify-content: center;
    overflow: visible;
}

.notification-badge {
    position: absolute;
    top: 6px;
    right: 6px;
    transform: translate(45%, -35%);
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 999px;
    background: var(--bs-danger, #dc3545);
    color: #fff;
    font-size: 11px;
    font-weight: 800;
    line-height: 20px;
    text-align: center;
    display: inline-block;
    box-shadow: 0 0 0 2px var(--zetra-notification-bg, #fff), 0 8px 18px rgba(220, 53, 69, .28);
    pointer-events: none;
    white-space: nowrap;
    z-index: 2;
}

/* Bell dropdown */
.notification-dropdown-menu {
    --bs-dropdown-bg: var(--zetra-notification-bg);
    --bs-dropdown-color: var(--zetra-notification-text);
    --bs-dropdown-border-color: var(--zetra-notification-border);
    --bs-dropdown-link-color: var(--zetra-notification-text);
    --bs-dropdown-link-hover-color: var(--zetra-notification-text);
    --bs-dropdown-link-hover-bg: var(--zetra-notification-bg-hover);
    width: 380px;
    max-width: calc(100vw - 16px);
    padding: 0;
    overflow: hidden;
    border: 1px solid var(--zetra-notification-border) !important;
    border-radius: 10px;
    color: var(--zetra-notification-text) !important;
    background: var(--zetra-notification-bg) !important;
    box-shadow: var(--zetra-notification-shadow);
}

#header.app-header:has(#notificationBellDropdown.show) {
    z-index: 1090 !important;
    overflow: visible !important;
}

#header.app-header #notificationBellContainer > .notification-dropdown-menu {
    position: absolute !important;
    top: calc(100% + 8px) !important;
    left: 0 !important;
    right: auto !important;
    margin: 0 !important;
    transform: none !important;
    z-index: 1095;
}

.notification-dropdown-header {
    min-height: 44px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--zetra-notification-border);
    color: var(--zetra-notification-text);
    background: linear-gradient(180deg, var(--zetra-notification-bg-soft), var(--zetra-notification-bg));
    font-weight: 800;
}

.notification-dropdown-header > span {
    min-width: 0;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.notification-dropdown-header i {
    width: 24px;
    height: 24px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--bs-primary, #348fe2);
    background: rgba(var(--bs-primary-rgb, 52, 143, 226), .13);
}

.notification-dropdown-header a,
.notification-dropdown-footer a {
    height: 28px;
    padding: 0 9px;
    border: 1px solid rgba(var(--bs-primary-rgb, 52, 143, 226), .26);
    border-radius: 7px;
    display: inline-flex;
    align-items: center;
    color: var(--bs-primary, #348fe2) !important;
    background: rgba(var(--bs-primary-rgb, 52, 143, 226), .08);
    font-weight: 800;
    line-height: 1;
}

.notification-dropdown-list {
    max-height: min(420px, calc(100vh - 160px));
    padding: 7px;
    background: var(--zetra-notification-bg);
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: rgba(var(--bs-primary-rgb, 52, 143, 226), .36) transparent;
}

.notification-dropdown-item {
    display: flex;
    gap: 11px;
    min-height: 76px;
    padding: 10px;
    border: 1px solid transparent;
    border-radius: 8px;
    text-decoration: none;
    color: var(--zetra-notification-text);
    background: transparent;
    transition: background-color .15s ease, border-color .15s ease, transform .15s ease;
}

.notification-dropdown-item + .notification-dropdown-item {
    margin-top: 4px;
}

.notification-dropdown-item:hover,
.notification-dropdown-item:focus {
    border-color: rgba(var(--bs-primary-rgb, 52, 143, 226), .26);
    background: var(--zetra-notification-bg-hover);
    color: var(--zetra-notification-text);
    transform: translateY(-1px);
}

.notification-dropdown-icon {
    flex: 0 0 auto;
    width: 30px;
    height: 30px;
    border-radius: 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: var(--bs-primary, #348fe2);
    background: rgba(var(--bs-primary-rgb, 52, 143, 226), .12);
    font-size: 14px;
}

.notification-dropdown-icon i {
    color: inherit !important;
}

.notification-dropdown-icon:has(.text-warning) {
    color: var(--bs-warning, #f59c1a);
    background: rgba(var(--bs-warning-rgb, 245, 156, 26), .14);
}

.notification-dropdown-icon:has(.text-danger) {
    color: var(--bs-danger, #ff5b57);
    background: rgba(var(--bs-danger-rgb, 255, 91, 87), .13);
}

.notification-dropdown-icon:has(.text-success) {
    color: var(--bs-success, #00acac);
    background: rgba(var(--bs-success-rgb, 0, 172, 172), .13);
}

.notification-dropdown-icon:has(.text-info) {
    color: var(--bs-info, #49b6d6);
    background: rgba(var(--bs-info-rgb, 73, 182, 214), .13);
}

.notification-dropdown-body {
    flex: 1 1 auto;
    min-width: 0;
    padding-top: 1px;
}

.notification-dropdown-title {
    font-size: 13px;
    line-height: 1.25;
    margin-bottom: 4px;
    color: var(--zetra-notification-text);
    font-weight: 800;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.notification-dropdown-message {
    font-size: 12px;
    line-height: 1.35;
    color: var(--zetra-notification-muted) !important;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.notification-dropdown-meta {
    width: fit-content;
    max-width: 100%;
    min-height: 20px;
    margin-top: 6px;
    padding: 0 7px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--zetra-notification-muted) !important;
    background: var(--zetra-notification-bg-soft);
    font-size: 11px;
    font-weight: 800;
    line-height: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.notification-dropdown-meta.text-warning {
    color: var(--bs-warning, #f59c1a) !important;
    background: rgba(var(--bs-warning-rgb, 245, 156, 26), .13);
}

.notification-dropdown-meta.text-danger {
    color: var(--bs-danger, #ff5b57) !important;
    background: rgba(var(--bs-danger-rgb, 255, 91, 87), .12);
}

.notification-dropdown-meta.text-info {
    color: var(--bs-info, #49b6d6) !important;
    background: rgba(var(--bs-info-rgb, 73, 182, 214), .13);
}

.notification-dropdown-footer {
    min-height: 42px;
    padding: 7px 10px;
    border-top: 1px solid var(--zetra-notification-border);
    background: var(--zetra-notification-bg-soft);
}

#notificationBellFooterCount {
    height: 24px;
    padding: 0 8px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    color: var(--zetra-notification-muted) !important;
    background: var(--zetra-notification-bg);
    font-size: 11px;
    font-weight: 800;
    line-height: 1;
}

@media (max-width: 575.98px) {
    #header.app-header:has(#notificationBellDropdown.show) {
        z-index: 1090 !important;
        overflow: visible !important;
    }

    #notificationBellContainer {
        position: static;
    }

    .notification-dropdown-menu {
        position: fixed !important;
        inset: 59px 12px auto 12px !important;
        top: 59px !important;
        right: 12px !important;
        left: 12px !important;
        width: auto !important;
        min-width: 0;
        max-width: none;
        max-height: min(72vh, calc(100vh - 88px));
        margin: 0 !important;
        transform: none !important;
        border-radius: 10px;
        box-shadow: var(--zetra-notification-shadow);
        z-index: 1085;
    }

    .notification-dropdown-menu.show {
        display: flex;
        flex-direction: column;
    }

    .notification-dropdown-list {
        flex: 1 1 auto;
        max-height: min(48vh, calc(100vh - 190px));
    }

    @supports (height: 100dvh) {
        .notification-dropdown-menu {
            max-height: min(72dvh, calc(100dvh - 88px));
        }

        .notification-dropdown-list {
            max-height: min(48dvh, calc(100dvh - 190px));
        }
    }

    .notification-badge {
        top: 5px;
        right: 7px;
        transform: translate(35%, -30%);
    }

    .notification-dropdown-header,
    .notification-dropdown-footer {
        flex: 0 0 auto;
    }

    .notification-dropdown-footer {
        align-items: center !important;
        flex-wrap: nowrap;
        gap: 6px !important;
        padding: 8px 12px;
    }

    .notification-dropdown-footer .small {
        font-size: 12px !important;
    }

    #notificationBellFooterCount,
    .notification-dropdown-footer a {
        white-space: nowrap;
    }

    .notification-dropdown-footer a {
        margin-left: 0 !important;
    }
}

/* Sidebar leaf badge */
.sidebar-badge {
    margin-left: auto;
    min-width: 22px;
    padding: 1px 7px;
    border-radius: 10px;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 16px;
    text-align: center;
    background: #6c757d;
    align-self: center;
}

.app-sidebar .menu-link .sidebar-badge {
    margin-left: 8px;
}

/* Parent alert (exclamation icon) */
.sidebar-parent-alert {
    display: inline-block;
    font-size: 11px;
    line-height: 1;
    vertical-align: middle;
}

@media (max-width: 380px) {
    .notification-dropdown-item {
        gap: 9px;
        padding: 9px;
    }

    .notification-dropdown-icon {
        width: 28px;
        height: 28px;
    }
}
