/* ==============================================================================
   NOTIFICATION SYSTEM — Clean design matching G4 calculator style
   All sections: white background, thin border separators only (no grey fills)
   ============================================================================== */

/* ── Bell Button ── */
.notification-bell {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--bg-card);
    border: 1.5px solid var(--border-color);
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.notification-bell:hover {
    background: var(--bg-hover);
    border-color: var(--text-muted);
}

/* Bell highlighted when dropdown is open */
.notification-bell.active {
    background: var(--bg-hover);
    border-color: var(--text-muted);
}

.notification-bell.active > i {
    color: var(--text-primary);
}

.notification-bell > i {
    font-size: 20px;
    color: var(--text-secondary);
    transition: color 0.15s ease;
}

.notification-bell.has-unread > i {
    color: var(--text-primary);
}

/* ── Badge ── */
.notification-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    min-width: 19px;
    height: 19px;
    padding: 0 5px;
    background: #ef4444;
    color: white;
    font-size: 10px;
    font-weight: 800;
    border-radius: 10px;
    display: none;
    align-items: center;
    justify-content: center;
    border: 2.5px solid var(--bg-card);
    line-height: 1;
    letter-spacing: -0.02em;
}

/* ── Dropdown Shell ── */
.notification-dropdown {
    position: absolute;
    top: 46px;
    right: 0;
    width: 360px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 8px 28px rgba(0,0,0,0.11), 0 2px 8px rgba(0,0,0,0.06);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px) scale(0.98);
    transition: opacity 0.17s ease, transform 0.17s ease, visibility 0.17s;
    z-index: 9999;
    overflow: hidden;
}

.notification-dropdown.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* ── Header ── */
.notif-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-card);
}

.notif-header-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
}

.notif-header-btns {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Text button: "Mark all read" */
.notif-text-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}

.notif-text-btn i { font-size: 13px; }

.notif-text-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--text-muted);
}

/* Icon-only button: settings gear */
.notif-icon-btn {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 6px;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 15px;
    transition: all 0.15s;
}

.notif-icon-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--border-color);
}

/* ── Filter Tabs ── */
/* Matches calculator .calc-modes + .calc-mode-tab pattern */
.notif-tabs {
    display: flex;
    gap: 4px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-card);
}

.notif-tab {
    flex: 1;
    padding: 6px 10px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    background: transparent;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s;
    text-align: center;
}

.notif-tab:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* Active tab: filled with primary color, white text — matches calc-mode-tab.active */
.notif-tab.active {
    background: var(--primary);
    color: white;
    font-weight: 700;
}

/* ── Notification List ── */
.notif-list {
    max-height: 330px;
    overflow-y: auto;
    background: var(--bg-card);
}

.notif-list::-webkit-scrollbar { width: 4px; }
.notif-list::-webkit-scrollbar-track { background: transparent; }
.notif-list::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 2px;
}

/* ── Notification Item ── */
.notif-item {
    display: flex;
    align-items: flex-start;
    gap: 11px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background 0.12s;
    position: relative;
    background: var(--bg-card);
}

.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: var(--bg-hover); }

/* Subtle left accent for unread */
.notif-item.unread::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--primary);
    border-radius: 0 2px 2px 0;
}

/* ── Item Icon ── */
.notif-icon {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 16px;
}

.notif-icon.critical { background: rgba(239,68,68,0.10); color: #ef4444; }
.notif-icon.warning  { background: rgba(245,158,11,0.10); color: #f59e0b; }
.notif-icon.info     { background: rgba(59,130,246,0.10); color: #3b82f6; }
.notif-icon.success  { background: rgba(16,185,129,0.10); color: #10b981; }

/* ── Item Body ── */
.notif-body { flex: 1; min-width: 0; }

.notif-top {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 3px;
}

.notif-title {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.notif-time {
    font-size: 10px;
    color: var(--text-muted);
    white-space: nowrap;
    flex-shrink: 0;
}

.notif-msg {
    font-size: 12px;
    color: var(--text-secondary);
    margin: 0 0 5px;
    line-height: 1.45;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.notif-asin-tag {
    display: inline-block;
    padding: 1px 6px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    color: var(--text-muted);
    font-family: monospace;
}

/* ── Unread Dot ── */
.notif-dot {
    width: 7px;
    height: 7px;
    background: var(--primary);
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 5px;
}

/* ── Empty State ── */
.notif-empty {
    padding: 44px 20px;
    text-align: center;
    color: var(--text-muted);
    background: var(--bg-card);
}

.notif-empty i {
    font-size: 38px;
    opacity: 0.22;
    display: block;
    margin-bottom: 10px;
}

.notif-empty p {
    font-size: 13px;
    font-weight: 600;
    margin: 0 0 4px;
    color: var(--text-secondary);
}

.notif-empty small {
    font-size: 11px;
    color: var(--text-muted);
}

/* ── Footer ── */
.notif-footer {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 10px 14px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-card);
}

.notif-unread-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
}

/* ==============================================================================
   NOTIFICATION SETTINGS MODAL
   (uses .notif-modal-* classes to avoid conflict with global .modal-header{display:none})
   ============================================================================== */

/* Modal Box */
.notif-settings-modal-box {
    background: var(--bg-card);
    border-radius: 16px;
    width: 90%;
    max-width: 560px;
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,0.25);
}

/* Modal Header */
.notif-modal-header {
    display: flex !important;
    justify-content: space-between;
    align-items: flex-start;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.notif-modal-title {
    margin: 0 0 4px;
    font-size: 17px;
    font-weight: 700;
    color: var(--text-primary);
}

.notif-modal-subtitle {
    margin: 0;
    font-size: 12px;
    color: var(--text-secondary);
}

/* Modal Body */
.notif-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

.notif-modal-body::-webkit-scrollbar { width: 4px; }
.notif-modal-body::-webkit-scrollbar-track { background: transparent; }
.notif-modal-body::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 2px; }

/* Modal Footer */
.notif-modal-footer {
    display: flex;
    justify-content: flex-end;
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    flex-shrink: 0;
}

.notif-modal-close-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 9px 20px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}

.notif-modal-close-btn:hover { opacity: 0.88; }

.notif-settings-section { margin-bottom: 28px; }
.notif-settings-section:last-child { margin-bottom: 0; }

.notif-settings-section h4 {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin: 0 0 12px;
}

.notif-setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 8px;
}

.notif-setting-info {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.notif-setting-info i {
    font-size: 18px;
    color: var(--primary);
    margin-top: 1px;
}

.notif-setting-info strong {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 3px;
}

.notif-setting-info p {
    font-size: 12px;
    color: var(--text-secondary);
    margin: 0;
}

/* Toggle Switch */
.notif-toggle {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 22px;
}

.notif-toggle input { opacity: 0; width: 0; height: 0; }

.notif-toggle-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: var(--border-color);
    border-radius: 22px;
    transition: 0.25s;
}

.notif-toggle-slider:before {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: 0.25s;
}

.notif-toggle input:checked + .notif-toggle-slider { background: var(--primary); }
.notif-toggle input:checked + .notif-toggle-slider:before { transform: translateX(18px); }

/* Threshold Items */
.notif-threshold-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 8px;
}

.notif-threshold-item label {
    flex: 1;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
}

.notif-threshold-item input {
    width: 65px;
    padding: 5px 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    text-align: center;
}

.notif-threshold-unit {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    min-width: 30px;
}

/* Watchlist Info */
.notif-watchlist-info {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 12px;
}

.notif-watchlist-stat {
    padding: 14px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    text-align: center;
}

.notif-watchlist-stat strong {
    display: block;
    font-size: 22px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 3px;
}

.notif-watchlist-stat span { font-size: 11px; color: var(--text-secondary); }

.notif-watchlist-note {
    display: flex;
    gap: 8px;
    font-size: 12px;
    color: var(--text-secondary);
    padding: 10px 12px;
    background: rgba(59,130,246,0.05);
    border-radius: 8px;
    margin: 0;
}

.notif-watchlist-note i { color: #3b82f6; font-size: 15px; flex-shrink: 0; }

/* ==============================================================================
   TRACKED ITEM INDICATOR (inventory rows)
   ============================================================================== */

.inventory-tracked-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    padding: 3px 7px;
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
    font-size: 10px;
    font-weight: 700;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 3px;
    box-shadow: 0 2px 6px rgba(245,158,11,0.3);
    z-index: 10;
}

.inventory-item.tracked {
    border: 2px solid #f59e0b !important;
    box-shadow: 0 0 0 3px rgba(245,158,11,0.1);
}

@media (max-width: 768px) {
    .notification-dropdown {
        width: calc(100vw - 24px);
        right: 12px;
    }
}

/* ── Dark mode overrides ──────────────────────────────────────────────────── */

/* Tab active — dark neutral (not orange) */
[data-theme="dark"] .notif-tab.active {
    background: #3a3a3a;
    color: #ffffff;
}

/* Close/action button — dark neutral */
[data-theme="dark"] .notif-modal-close-btn {
    background: #2e2e2e;
    color: #d0d0d0;
    border: 1px solid #3a3a3a;
}
[data-theme="dark"] .notif-modal-close-btn:hover {
    background: #3a3a3a;
    color: #f0f0f0;
}

/* Setting icon — neutral grey */
[data-theme="dark"] .notif-setting-info i { color: #888888; }

/* Watchlist stat number — white (prominent number like Make.com "2/10") */
[data-theme="dark"] .notif-watchlist-stat strong { color: #f0f0f0; }

/* Unread item left-border accent — orange stays (it IS an accent indicator) */
/* .notif-item::before keeps var(--primary) = orange — correct */

/* Unread dot — orange stays (notification indicator) */
/* .notif-dot keeps var(--primary) — correct */

/* Toggle checked — orange stays (UI state indicator) */
/* .notif-toggle input:checked + .notif-toggle-slider keeps -- correct */
