/**
 * Notification Center — modal, preferences, mini toasts
 */

/* Topbar bell (desktop + mobile; mobile tweaks in mobile-pwa.css) */
.topbar-notifications-bell {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    margin-right: 0.25rem;
    background: none;
    border: none;
    border-radius: 50%;
    color: #374151;
    font-size: 1.2rem;
    cursor: pointer;
    position: relative;
    flex-shrink: 0;
    transition: background 0.2s ease, color 0.2s ease;
}

.topbar-notifications-bell:hover {
    background: rgba(var(--brand-green-rgb, 16, 185, 129), 0.08);
    color: var(--brand-green, #10b981);
}

.topbar-notifications-bell:active {
    background: rgba(0, 0, 0, 0.06);
    transform: scale(0.96);
}

.topbar-notifications-bell-badge {
    position: absolute;
    top: 7px;
    right: 7px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ef4444;
    border: 1.5px solid #fff;
    animation: pulse 2s infinite;
}

.topbar-user-email {
    cursor: default;
}

.push-denied-banner {
    font-size: 0.875rem;
    border-radius: 10px;
}

/* ============================================
   NOTIFICATIONS MODAL
   ============================================ */

/*
 * Self-contained full-viewport dimming (Bootstrap backdrop disabled on #notificationsModal).
 * html { zoom: 0.9 } on desktop otherwise clips the backdrop to the main column only.
 */
#notificationsModal.notifications-modal.show {
    display: block !important;
    position: fixed !important;
    inset: 0 !important;
    width: 100vw !important;
    max-width: none !important;
    height: 100vh !important;
    height: 100dvh !important;
    margin: 0 !important;
    padding: 0 !important;
    z-index: 1065 !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    background: rgba(0, 0, 0, 0.4) !important;
}

body.modal-open:has(#notificationsModal.show) > .modal-backdrop {
    display: none !important;
}

@media (min-width: 769px) {
    html.notifications-modal-active {
        zoom: 1 !important;
    }
}

.notifications-modal-dialog {
    max-width: min(720px, calc(100vw - 1.5rem));
    margin: 1rem auto;
}

.notifications-modal-content {
    border: none;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 24px 48px rgba(15, 23, 42, 0.18);
}

.notifications-modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.25rem 1.5rem;
    border-bottom: none;
    background: linear-gradient(
        135deg,
        rgba(16, 185, 129, 0.12) 0%,
        rgba(16, 185, 129, 0.03) 100%
    );
}

.notifications-modal-header .modal-title {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--brand-green, #10b981);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
}

.notifications-modal-title-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 10px;
    background: rgba(16, 185, 129, 0.15);
    color: var(--brand-green, #10b981);
}

.notifications-modal-subtitle {
    font-size: 0.875rem;
    color: #64748b;
    margin-top: 0.25rem;
}

.notifications-guide-btn {
    border-radius: 8px;
    font-size: 0.8125rem;
    font-weight: 500;
    color: #475569;
    white-space: nowrap;
}

.notifications-guide-btn:hover {
    color: var(--brand-green, #10b981);
    background: #fff;
}

.notifications-modal-tabs {
    padding: 0 1.25rem;
    border-bottom: 1px solid #e2e8f0;
    background: #f8fafc;
    gap: 0.25rem;
    flex-wrap: nowrap;
}

.notifications-modal-tabs .nav-link {
    border: none;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    color: #64748b;
    font-size: 0.875rem;
    font-weight: 500;
    padding: 0.75rem 1rem;
    margin-bottom: -1px;
    white-space: nowrap;
}

.notifications-modal-tabs .nav-link:hover {
    color: #0f172a;
    background: transparent;
}

.notifications-modal-tabs .nav-link.active {
    color: var(--brand-green, #10b981);
    background: transparent;
    border-bottom-color: var(--brand-green, #10b981);
}

.notifications-modal-body {
    padding: 1.25rem 1.5rem 1.5rem;
    max-height: min(65vh, 520px);
    overflow-y: auto;
}

.notifications-modal-body .notification-item {
    border-radius: 12px;
    margin-bottom: 0.75rem;
}

.notifications-modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid #e2e8f0;
    background: #fafafa;
}

/* Feed tab */
.notifications-modal-body .empty-notifications {
    padding: 2.5rem 1rem;
    text-align: center;
}

.notifications-modal-body .empty-notifications i {
    font-size: 2.5rem;
    color: var(--brand-green, #10b981);
    opacity: 0.85;
}

.smm-notifications-list:empty {
    display: none;
}

/* SMM weekly brief feed items */
.notification-item-smm {
    position: relative;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-left: 3px solid var(--brand-green, #10b981);
    border-radius: 10px;
    padding: 0.85rem 2.5rem 0.85rem 0.85rem;
    margin-bottom: 0.65rem;
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.notification-item-smm:hover {
    border-color: var(--brand-green, #10b981);
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.1);
}

.notification-item-smm .notification-dismiss {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    width: 24px;
    height: 24px;
    padding: 0;
    border: none;
    background: transparent;
    color: #94a3b8;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.05rem;
    font-weight: 300;
    line-height: 1;
    transition: color 0.15s, background 0.15s;
}

.notification-item-smm .notification-dismiss:hover {
    color: #334155;
    background: #f1f5f9;
}

.notif-smm-row {
    display: flex;
    align-items: flex-start;
    gap: 0.7rem;
}

.notif-smm-icon {
    flex-shrink: 0;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.14), rgba(16, 185, 129, 0.06));
    color: var(--brand-green-hover, #059669);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

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

.notif-smm-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.5rem;
}

.notif-smm-title {
    font-weight: 600;
    font-size: 0.875rem;
    color: #1e293b;
}

.notif-smm-when {
    font-size: 0.75rem;
    color: #94a3b8;
    margin-top: 0.1rem;
}

.notif-smm-expand {
    flex-shrink: 0;
    border: none;
    background: transparent;
    color: #64748b;
    padding: 0.15rem;
    cursor: pointer;
    border-radius: 6px;
    line-height: 1;
}

.notif-smm-expand:hover {
    color: var(--brand-green-hover, #059669);
    background: #f1f5f9;
}

.notif-smm-compact {
    font-size: 0.8125rem;
    color: #64748b;
    margin-top: 0.35rem;
    line-height: 1.45;
}

.notif-smm-expanded {
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid #f1f5f9;
}

.notif-smm-details {
    margin: 0 0 0.5rem;
    font-size: 0.78rem;
}

.notif-smm-details div {
    margin-bottom: 0.35rem;
}

.notif-smm-details dt {
    font-weight: 600;
    color: #475569;
    display: inline;
    margin-right: 0.25rem;
}

.notif-smm-details dd {
    display: inline;
    margin: 0;
    color: #64748b;
}

.notif-smm-hints-label {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #94a3b8;
    margin: 0 0 0.35rem;
}

.notif-smm-hints {
    margin: 0 0 0.5rem;
    padding-left: 1.1rem;
    font-size: 0.78rem;
    color: #64748b;
}

.notif-smm-action {
    display: inline-block;
    margin-top: 0.35rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--brand-green-hover, #059669);
    text-decoration: none;
}

.notif-smm-action:hover {
    color: var(--brand-green-strong, #047857);
    text-decoration: underline;
}

/* Preferences tab */
.notifications-prefs-intro {
    font-size: 0.9375rem;
    color: #475569;
    line-height: 1.5;
}

.notifications-section-label {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #94a3b8;
    margin: 0 0 0.75rem;
}

.notifications-pref-cards {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.notifications-pref-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.125rem;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: #fff;
    cursor: pointer;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    margin: 0;
}

.notifications-pref-card:hover {
    border-color: rgba(16, 185, 129, 0.4);
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
}

.notifications-pref-card-text {
    flex: 1;
    min-width: 0;
}

.notifications-pref-card-text strong {
    display: block;
    font-size: 0.9375rem;
    font-weight: 600;
    color: #0f172a;
}

.notifications-pref-card-text small {
    display: block;
    font-size: 0.8125rem;
    color: #64748b;
    margin-top: 0.15rem;
    line-height: 1.35;
}

.notifications-pref-card .form-check-input {
    width: 2.75rem;
    height: 1.5rem;
    cursor: pointer;
    flex-shrink: 0;
}

.notifications-pref-card .form-check-input:checked {
    background-color: var(--brand-green, #10b981);
    border-color: var(--brand-green, #10b981);
}

/* Guide tab */
.notifications-guide-lead {
    font-size: 0.9375rem;
    color: #475569;
    line-height: 1.5;
    margin-bottom: 1.25rem;
}

.notifications-guide-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.notifications-guide-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 1.125rem 1.25rem;
    height: 100%;
}

.notifications-guide-card-head {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    margin-bottom: 0.85rem;
}

.notifications-guide-card-icon {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 8px;
    background: rgba(16, 185, 129, 0.1);
    color: var(--brand-green, #10b981);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

.notifications-guide-card-head h6 {
    margin: 0;
    font-size: 0.9375rem;
    font-weight: 600;
    color: #0f172a;
}

.notifications-guide-steps {
    margin: 0;
    padding-left: 1.2rem;
    font-size: 0.8125rem;
    color: #475569;
    line-height: 1.5;
}

.notifications-guide-steps li {
    margin-bottom: 0.5rem;
}

.notifications-guide-steps li:last-child {
    margin-bottom: 0;
}

.notifications-guide-figure {
    margin: 1rem auto 0;
    padding: 0;
    max-width: 340px;
    text-align: center;
}

.notifications-guide-figure img {
    display: block;
    width: 100%;
    max-width: 100%;
    height: auto;
    max-height: 420px;
    object-fit: contain;
    margin-inline: auto;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
}

.notifications-guide-figure figcaption {
    margin-top: 0.5rem;
    font-size: 0.75rem;
    color: #64748b;
    line-height: 1.45;
}

.notifications-guide-card--desktop {
    grid-column: 1 / -1;
}

.notifications-guide-footnote {
    margin: 1.25rem 0 0;
    padding: 0.75rem 1rem;
    font-size: 0.8125rem;
    color: #64748b;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

/* ============================================
   MINI TOAST NOTIFICATIONS
   ============================================ */

.mini-toast-container {
    position: fixed;
    top: 70px;
    right: 20px;
    z-index: 1050;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.mini-toast {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    background: #fff;
    border-radius: 10px;
    padding: 12px 14px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    min-width: 260px;
    max-width: 320px;
    font-size: 13px;
    line-height: 1.4;
    pointer-events: auto;
    opacity: 0;
    transform: translateX(20px);
    transition: all 0.3s ease;
    border-left: 3px solid #ddd;
}

.mini-toast.show {
    opacity: 1;
    transform: translateX(0);
}

.mini-toast.hide {
    opacity: 0;
    transform: translateX(20px);
}

.mini-toast.success {
    border-left-color: var(--brand-green, #10b981);
}

.mini-toast.error {
    border-left-color: #dc3545;
}

.mini-toast.info {
    border-left-color: #0d6efd;
}

.mini-toast-icon {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mini-toast-icon svg {
    width: 100%;
    height: 100%;
}

.mini-toast.success .mini-toast-icon {
    color: var(--brand-green, #10b981);
}

.mini-toast.error .mini-toast-icon {
    color: #dc3545;
}

.mini-toast.info .mini-toast-icon {
    color: #0d6efd;
}

.mini-toast-content {
    flex: 1;
    min-width: 0;
}

.mini-toast-content strong {
    display: block;
    font-weight: 600;
    color: #212529;
    margin-bottom: 2px;
    font-size: 13px;
}

.mini-toast-content span {
    color: #6c757d;
    font-size: 12px;
}

.mini-toast-close {
    flex-shrink: 0;
    background: none;
    border: none;
    padding: 0;
    margin: -2px -4px -2px 0;
    font-size: 18px;
    line-height: 1;
    color: #adb5bd;
    cursor: pointer;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.15s ease;
}

.mini-toast-close:hover {
    color: #6c757d;
    background: #f8f9fa;
}

@media (max-width: 640px) {
    .notifications-modal-dialog {
        max-width: calc(100vw - 0.5rem);
        margin: 0.25rem auto;
    }

    .notifications-modal-header {
        padding: 1rem 1.125rem;
    }

    .notifications-modal-tabs {
        padding: 0 0.75rem;
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
    }

    .notifications-modal-tabs .nav-link {
        padding: 0.65rem 0.75rem;
        font-size: 0.8125rem;
    }

    .notifications-modal-body {
        padding: 1rem 1.125rem 1.25rem;
        max-height: min(70vh, 560px);
    }

    .notifications-guide-grid {
        grid-template-columns: 1fr;
    }

    .mini-toast-container {
        left: 16px;
        right: 16px;
        top: 60px;
    }

    .mini-toast {
        max-width: 100%;
        min-width: auto;
    }
}
