/* Notifications page (Components/Pages/Notification.razor) and the header bell
   (Components/SubComponents/NotificationBell.razor).
   Every colour comes from the Radzen theme, so the light and dark themes both work. */

/* ---------- Notification type colours ---------- */

.notif-type-hold { --notif-type-color: var(--rz-primary); }
.notif-type-overdue { --notif-type-color: var(--rz-danger); }
.notif-type-due { --notif-type-color: var(--rz-warning); }
.notif-type-fine { --notif-type-color: var(--rz-success); }
.notif-type-booking { --notif-type-color: var(--rz-info); }
.notif-type-general { --notif-type-color: var(--rz-text-secondary-color); }

.notif-type-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--notif-type-color, var(--rz-primary));
    background: color-mix(in srgb, var(--notif-type-color, var(--rz-primary)) 14%, transparent);
}

    .notif-type-icon .rzi {
        font-size: 18px;
    }

/* ---------- Row text (page list and bell list) ---------- */

.notif-text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.notif-head {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.notif-title {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 500;
    color: var(--rz-text-color);
}

.notification-item.unread .notif-title,
.notif-bell-item.unread .notif-title {
    font-weight: 700;
}

.notif-unread-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--rz-primary);
    flex-shrink: 0;
}

.notif-time {
    font-size: 12px;
    color: var(--rz-text-secondary-color);
    white-space: nowrap;
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
}

.notification-item.unread .notif-time,
.notif-bell-item.unread .notif-time {
    color: var(--rz-text-color);
    font-weight: 600;
}

.notif-preview {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--rz-text-secondary-color);
    font-size: 13px;
}

.notif-title mark,
.notif-preview mark {
    background: color-mix(in srgb, var(--rz-primary) 22%, transparent);
    color: var(--rz-text-color);
    border-bottom: 1px solid var(--rz-primary);
    border-radius: 2px;
    padding: 0 1px;
    font-weight: inherit;
}

/* ---------- Page ---------- */

.notification-page {
    display: flex;
    flex-direction: column;
    gap: 12px;
    height: 100%;
    min-height: 0;
}

/* The page's flex gap already spaces the breadcrumb; its look comes from radzen-overrides.css. */
.notification-page > .custom-breadcrumb > .rz-breadcrumb-list {
    margin-bottom: 0;
}

.notification-toolbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    flex-shrink: 0;
}

.notif-filter {
    display: inline-flex;
    gap: 2px;
    padding: 3px;
    border: 1px solid var(--rz-base-300);
    border-radius: 999px;
    background: var(--rz-base-background-color);
}

.notif-filter-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 32px;
    padding: 4px 14px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--rz-text-secondary-color);
    font: inherit;
    font-weight: 500;
    cursor: pointer;
}

    .notif-filter-btn:hover {
        color: var(--rz-text-color);
        background: color-mix(in srgb, var(--rz-text-color) 6%, transparent);
    }

    .notif-filter-btn.active {
        background: var(--rz-primary);
        color: var(--rz-on-primary);
    }

    .notif-filter-btn:focus-visible {
        outline: 2px solid var(--rz-primary);
        outline-offset: 2px;
    }

.notif-filter-count {
    font-size: 12px;
    font-variant-numeric: tabular-nums;
}

.notif-search {
    position: relative;
    display: flex;
    align-items: center;
    flex: 1 1 260px;
    max-width: 420px;
    min-width: 0;
}

    .notif-search .notif-search-icon {
        position: absolute;
        inset-inline-start: 10px;
        font-size: 20px;
        color: var(--rz-text-secondary-color);
        pointer-events: none;
    }

    .notif-search .rz-textbox.notif-search-input {
        width: 100%;
        padding-inline-start: 38px !important;
        padding-inline-end: 38px !important;
    }

.notif-search-clear {
    position: absolute;
    inset-inline-end: 4px;
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--rz-text-secondary-color);
    cursor: pointer;
}

    .notif-search-clear:hover {
        background: color-mix(in srgb, var(--rz-text-color) 8%, transparent);
    }

    .notif-search-clear:focus-visible {
        outline: 2px solid var(--rz-primary);
    }

.notif-mark-all {
    margin-inline-start: auto;
}

.notification-content-row {
    display: grid;
    grid-template-columns: minmax(300px, 400px) minmax(0, 1fr);
    gap: 12px;
    flex: 1 1 auto;
    min-height: 0;
}

.notif-list-col,
.notif-detail-col {
    min-width: 0;
    min-height: 0;
    height: 100%;
}

.notification-page .content-panel {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    overflow: hidden;
    border: 1px solid var(--rz-base-300);
    border-radius: 8px;
    background: var(--rz-base-background-color);
}

.notif-list-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 12px;
    border-bottom: 1px solid var(--rz-base-300);
    flex-shrink: 0;
}

.notif-list-head .select-all-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--rz-text-secondary-color);
}

.notif-list-head .select-all-text {
    cursor: pointer;
}

.notification-list {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: 0 6px 8px;
}

    .notification-list::-webkit-scrollbar {
        width: 4px;
    }

    .notification-list::-webkit-scrollbar-track {
        background: transparent;
    }

    .notification-list::-webkit-scrollbar-thumb {
        background: var(--rz-primary);
        border-radius: 2px;
    }

.notif-group-label {
    padding: 14px 8px 4px;
    font-size: 12px;
    font-weight: 500;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--rz-text-secondary-color);
}

.notification-item {
    display: flex;
    align-items: flex-start;
    gap: 2px;
    padding-inline-start: 8px;
    border-radius: 8px;
}

    .notification-item:hover {
        background: color-mix(in srgb, var(--rz-text-color) 5%, transparent);
    }

    .notification-item.selected {
        background: color-mix(in srgb, var(--rz-primary) 12%, transparent);
    }

    .notification-item .rz-chkbox {
        flex-shrink: 0;
        margin-top: 17px;
    }

.notif-open {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 8px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: inherit;
    font: inherit;
    text-align: start;
    cursor: pointer;
}

    .notif-open:focus-visible {
        outline: 2px solid var(--rz-primary);
        outline-offset: -2px;
    }

.notification-page .detail-panel {
    gap: 14px;
    padding: 16px 20px;
    overflow-y: auto;
}

.notif-back {
    display: none !important;
    align-self: flex-start;
}

.detail-header {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--rz-base-300);
}

.notif-type-chip {
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 10px 2px 6px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 500;
    color: var(--rz-text-color);
    background: color-mix(in srgb, var(--notif-type-color, var(--rz-primary)) 14%, transparent);
}

    .notif-type-chip .rzi {
        font-size: 16px;
        color: var(--notif-type-color, var(--rz-primary));
    }

.detail-title {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.3;
    color: var(--rz-text-color);
}

    .detail-title:focus {
        outline: none;
    }

    .detail-title:focus-visible {
        outline: 2px solid var(--rz-primary);
        outline-offset: 2px;
    }

.detail-date {
    font-size: 13px;
    color: var(--rz-text-secondary-color);
}

.detail-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 6px;
}

.detail-body {
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 14px;
    line-height: 1.6;
    color: var(--rz-text-color);
}

    .detail-body strong,
    .detail-body b {
        font-size: 16px;
    }

.detail-related {
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    gap: 2px;
    font-weight: 500;
}

/* Empty, loading and "nothing selected" states */
.notif-empty {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 40px 24px;
    text-align: center;
    color: var(--rz-text-secondary-color);
}

    .notif-empty .rzi {
        font-size: 40px;
        color: var(--rz-text-secondary-color);
    }

.notif-empty-title {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    color: var(--rz-text-color);
}

.notif-empty-hint {
    margin: 0;
    max-width: 36ch;
    font-size: 13px;
}

.notif-skeleton-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 8px;
}

.notif-skeleton-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* Undo bar after a delete. Inverse colours so it stands out in both themes.
   The blue line along the bottom fills up over the undo window (--notif-undo-duration, set by the page);
   when it is full the bar closes and the delete stays. */
.notif-undo-bar {
    position: fixed;
    z-index: 1100;
    left: 50%;
    bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: calc(100vw - 32px);
    padding: 3px 4px 5px 14px;
    overflow: hidden;
    border-radius: 6px;
    background: var(--rz-text-color);
    color: var(--rz-base-background-color);
    font-size: 13px;
    line-height: 1.3;
    box-shadow: 0 4px 14px rgba(0, 0, 0, .22);
}

.notif-undo-text {
    min-width: 0;
}

.notif-undo-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    height: 28px;
    padding: 0 8px;
    border: 0;
    border-radius: 4px;
    background: transparent;
    color: inherit;
    font: inherit;
    font-weight: 700;
    white-space: nowrap;
    cursor: pointer;
}

    .notif-undo-btn .rzi {
        font-size: 16px;
    }

    .notif-undo-btn:hover {
        background: color-mix(in srgb, currentColor 14%, transparent);
    }

    .notif-undo-btn:focus-visible {
        outline: 2px solid currentColor;
        outline-offset: 1px;
    }

.notif-undo-progress {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 3px;
    background: var(--rz-primary);
    transform-origin: left center;
    animation: notif-undo-progress var(--notif-undo-duration, 5000ms) linear forwards;
}

[dir="rtl"] .notif-undo-progress {
    transform-origin: right center;
}

.notif-undo-bar:hover .notif-undo-progress,
.notif-undo-bar:focus-within .notif-undo-progress {
    animation-play-state: paused;
}

@keyframes notif-undo-progress {
    from {
        transform: scaleX(0);
    }

    to {
        transform: scaleX(1);
    }
}

@media (max-width: 1100px) {
    .notif-mark-all {
        margin-inline-start: 0;
    }
}

/* Phones: list first; opening a notification replaces the list, with a Back button. */
@media (max-width: 768px) {
    .notification-page {
        height: auto;
    }

    .notification-content-row {
        grid-template-columns: minmax(0, 1fr);
    }

    .notif-detail-col {
        display: none;
    }

    .notification-page.show-detail .notif-detail-col {
        display: block;
    }

    .notification-page.show-detail .notif-list-col,
    .notification-page.show-detail .notification-toolbar {
        display: none;
    }

    .notification-page .content-panel,
    .notif-list-col,
    .notif-detail-col {
        height: auto;
    }

    .notification-list {
        overflow-y: visible;
    }

    .notif-search {
        flex-basis: 100%;
        max-width: none;
    }

    .notif-back {
        display: inline-flex !important;
    }

    .notification-page .detail-panel {
        padding: 12px 16px 20px;
    }
}

/* ---------- Header bell ---------- */

.notif-bell {
    position: relative;
}

    /* On the round 44px bell, so the count overlaps its top corner rather than floating off it. */
    .notif-bell .notification-badge.bell {
        top: 2px;
        inset-inline-end: 0;
        pointer-events: none;
    }

.notif-bell-popup {
    display: none;
    position: absolute;
    width: min(360px, calc(100vw - 24px));
    overflow: hidden;
    border: var(--rz-panel-border);
    border-radius: var(--rz-border-radius);
    background-color: var(--rz-panel-background-color);
    box-shadow: var(--rz-panel-shadow);
}

.notif-bell-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 8px 8px 16px;
    border-bottom: 1px solid var(--rz-base-300);
}

.notif-bell-title {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    color: var(--rz-text-color);
}

.notif-bell-list {
    list-style: none;
    margin: 0;
    padding: 4px 0;
    max-height: min(60vh, 420px);
    overflow-y: auto;
}

.notif-bell-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    width: 100%;
    padding: 10px 16px;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    text-align: start;
    cursor: pointer;
}

    .notif-bell-item:hover {
        background: color-mix(in srgb, var(--rz-text-color) 5%, transparent);
    }

    .notif-bell-item:focus-visible {
        outline: 2px solid var(--rz-primary);
        outline-offset: -2px;
    }

.notif-bell-state {
    padding: 24px 16px;
    text-align: center;
    color: var(--rz-text-secondary-color);
}

.notif-bell-foot {
    display: flex;
    justify-content: center;
    padding: 4px;
    border-top: 1px solid var(--rz-base-300);
}
