/* Notification bell + dropdown panel.
 *
 * Every selector is scoped under .notif-* so nothing here can leak into other
 * pages — base.html loads every stylesheet on every page, so a bare element
 * selector would restyle the whole app (the documented CSS gotcha).
 */

.notif-bell {
    position: relative;
    display: inline-flex;
    align-items: center;
    margin-right: 8px;
}

.notif-bell-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 9999px;
    color: #ffffff;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.notif-bell-btn:hover {
    background-color: rgba(255, 255, 255, 0.12);
}

.notif-bell-icon {
    width: 20px;
    height: 20px;
    display: block;
}

.notif-bell-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: #ef4444;   /* same red as .sidebar-nav-badge */
    color: #ffffff;
    border-radius: 9999px;
    font-size: 11px;
    font-weight: 600;
    line-height: 1;
}

.notif-bell-badge[hidden] { display: none; }

/* ---- panel ---------------------------------------------------------- */

.notif-panel {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 360px;
    max-width: calc(100vw - 32px);
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
    z-index: 1000;
    overflow: hidden;
}

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

.notif-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid #f0f0f0;
}

.notif-panel-title {
    font-size: 14px;
    font-weight: 700;
    color: #1f2937;
}

.notif-panel-all {
    font-size: 12px;
    font-weight: 600;
    color: #4f46e5;
    text-decoration: none;
}

.notif-panel-all:hover { text-decoration: underline; }

.notif-panel-list {
    max-height: 420px;
    overflow-y: auto;
}

.notif-empty {
    padding: 32px 16px;
    text-align: center;
    font-size: 13px;
    color: #9ca3af;
}

.notif-empty[hidden] { display: none; }

/* ---- item ----------------------------------------------------------- */

.notif-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 16px;
    border-bottom: 1px solid #f5f5f5;
}

.notif-item:last-child { border-bottom: none; }

.notif-item-icon {
    flex-shrink: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #eef2ff;
    color: #4f46e5;
    border-radius: 9999px;
    font-size: 13px;
}

.notif-item-body {
    flex: 1 1 auto;
    min-width: 0;
}

.notif-item-title {
    font-size: 13px;
    font-weight: 600;
    color: #111827;
    margin-bottom: 2px;
}

.notif-item-msg {
    font-size: 12px;
    color: #6b7280;
    line-height: 1.4;
    /* clamp to two lines so a long message can't blow out the panel */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.notif-item-time {
    font-size: 11px;
    color: #9ca3af;
    margin-top: 4px;
}

.notif-item-actions {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: flex-end;
}

.notif-act {
    border: none;
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}

.notif-view {
    background: #4f46e5;
    color: #ffffff;
}

.notif-view:hover { background: #4338ca; }

.notif-ack {
    background: #f3f4f6;
    color: #4b5563;
    width: 28px;
    padding: 4px 0;
}

.notif-ack:hover { background: #e5e7eb; }

/* ---- small screens -------------------------------------------------- */

@media (max-width: 480px) {
    .notif-panel {
        position: fixed;
        top: 60px;
        right: 8px;
        left: 8px;
        width: auto;
    }
}

/* ====================================================================== */
/* /notifications/ page (.np-*). Scoped, like the bell above.             */
/* ====================================================================== */

.np-page {
    max-width: 760px;
    margin: 24px auto;
    padding: 0 16px;
}

.np-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 18px;
}

.np-header h1 {
    font-size: 22px;
    font-weight: 700;
    color: #111827;
    margin: 0;
}

.np-header h1 i { color: #4f46e5; margin-right: 8px; }

.np-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.np-filter {
    padding: 7px 10px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 13px;
    color: #374151;
    background: #fff;
}

.np-ack-all {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: #fff;
    color: #374151;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.np-ack-all:hover { background: #f9fafb; }
.np-ack-all:disabled { opacity: 0.6; cursor: default; }

/* ---- tabs ---- */

.np-tabs {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid #e5e7eb;
    margin-bottom: 4px;
}

.np-tab {
    appearance: none;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    padding: 10px 14px;
    font-size: 14px;
    font-weight: 600;
    color: #6b7280;
    cursor: pointer;
    margin-bottom: -1px;
}

.np-tab.is-active {
    color: #4f46e5;
    border-bottom-color: #4f46e5;
}

.np-tab-count {
    display: inline-block;
    min-width: 18px;
    padding: 1px 6px;
    margin-left: 4px;
    background: #eef2ff;
    color: #4f46e5;
    border-radius: 9999px;
    font-size: 11px;
}

/* ---- list + items ---- */

.np-list[hidden] { display: none; }

.np-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 4px;
    border-bottom: 1px solid #f0f0f0;
    transition: opacity 0.15s ease;
}

.np-removing { opacity: 0; }

.np-item-icon {
    flex-shrink: 0;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #eef2ff;
    color: #4f46e5;
    border-radius: 9999px;
    font-size: 14px;
}

.np-item-done .np-item-icon { background: #f3f4f6; color: #9ca3af; }

.np-item-body { flex: 1 1 auto; min-width: 0; }

.np-item-title {
    font-size: 14px;
    font-weight: 600;
    color: #111827;
    margin-bottom: 2px;
}

.np-item-msg {
    font-size: 13px;
    color: #6b7280;
    line-height: 1.5;
}

.np-item-time {
    font-size: 11px;
    color: #9ca3af;
    margin-top: 5px;
}

.np-item-actions {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: flex-end;
}

.np-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    border: none;
    border-radius: 7px;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    text-decoration: none;
}

.np-btn-view { background: #4f46e5; color: #fff; }
.np-btn-view:hover { background: #4338ca; }

.np-btn-ack { background: #f3f4f6; color: #4b5563; }
.np-btn-ack:hover { background: #e5e7eb; }
.np-btn-ack:disabled { opacity: 0.6; cursor: default; }

.np-empty {
    text-align: center;
    padding: 48px 16px;
    color: #9ca3af;
}

.np-empty i { font-size: 32px; margin-bottom: 10px; display: block; color: #d1d5db; }
.np-empty p { margin: 0; font-size: 14px; }

@media (max-width: 520px) {
    .np-item { flex-wrap: wrap; }
    .np-item-actions { flex-direction: row; width: 100%; justify-content: flex-end; margin-top: 8px; }
}
