/* ============================================
   NOTIFICATIONS
   Modal, bell badge, and notification items
   ============================================ */

.notification-list {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-3);
    display: flex;
    flex-direction: column;
    gap: var(--space-2-5);
}

/* Custom Scrollbar for list */
.notification-list::-webkit-scrollbar {
    width: 6px;
}

.notification-list::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: var(--radius-xl);
}

.notification-item {
    position: relative;
    padding: var(--space-4);
    border-radius: var(--radius-2xl);
    background: var(--panel-bg);
    border: 1px solid var(--border-color);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
}

.notification-item.unread {
    background: var(--bg-secondary);
    border-color: var(--accent-color);
    border-left: 4px solid var(--accent-color);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.notification-item:hover {
    transform: translateY(-2px);
    background: var(--entry-hover-bg);
    border-color: var(--text-accent);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.notification-item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: var(--space-2);
}

.notification-item-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
    padding-right: var(--space-3);
}

.notification-badge-new {
    background: var(--accent-color);
    color: var(--button-primary-text);
    font-size: 0.65rem;
    font-weight: 800;
    padding: var(--space-0-5) var(--space-1-5);
    border-radius: var(--radius-xl);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 4px var(--accent-glow);
}

.notification-item-body {
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--text-secondary);
    margin-bottom: var(--space-3);
    overflow-wrap: break-word;
}

.notification-item-body p {
    margin: 0 0 var(--space-2) 0;
}

.notification-item-body p:last-child {
    margin-bottom: 0;
}

.notification-item-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: var(--space-3);
    padding-top: var(--space-3);
    border-top: 1px solid color-mix(in srgb, var(--text-color) 5%, transparent);
}

.notification-item-date {
    font-size: 0.75rem;
    font-family: var(--font-mono);
    color: var(--text-muted);
    opacity: 0.7;
}

/* A broadcast corrected after it was sent says so, quietly. */
.notification-item-edited {
    font-style: italic;
    opacity: 0.9;
}

.notification-read-status {
    display: flex;
    align-items: center;
    gap: var(--space-1-5);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-accent);
}

.notification-read-status.is-read {
    color: var(--text-muted);
    opacity: 0.5;
}

.notification-item-actions {
    display: flex;
    gap: var(--space-2);
}

.notification-action-btn {
    background: var(--accent-bg);
    border: 1px solid var(--accent-color);
    color: var(--accent-color);
    padding: var(--space-1) var(--space-2-5);
    border-radius: var(--radius-md);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: var(--space-1);
}

.notification-action-btn:hover {
    background: var(--accent-color);
    color: var(--button-primary-text);
    box-shadow: 0 0 8px var(--accent-glow);
}

.notification-action-btn:disabled {
    opacity: 0.55;
    cursor: wait;
}

.notification-action-btn:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

/* Inbox actions are touch targets on phones. */
@media (max-width: 768px) {
    .notification-action-btn {
        min-height: 40px;
    }
}

.notification-pod-decline-btn {
    border-color: color-mix(in srgb, var(--danger-color) 68%, var(--border-color));
    background: color-mix(in srgb, var(--danger-color) 9%, transparent);
    color: var(--danger-color);
}

.notification-pod-decline-btn:hover:not(:disabled) {
    border-color: var(--danger-color);
    background: var(--danger-color);
    color: white;
    box-shadow: 0 0 8px color-mix(in srgb, var(--danger-color) 45%, transparent);
}

.notification-pod-accept-btn:hover:not(:disabled) {
    background: var(--accent-color);
}

/* Empty State */
.notification-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 64px 32px;
    text-align: center;
    color: var(--text-muted);
}

.notification-empty-icon {
    font-size: 4rem;
    margin-bottom: var(--space-4);
    opacity: 0.15;
    animation: pulse 3s infinite ease-in-out;
}

.notification-empty p {
    margin: 0;
    font-size: 1rem;
    font-weight: 500;
}

/* Shared unread count badge */
.notification-count-badge {
    background: var(--mtg-red-mana);
    color: white;
    font-size: 10px;
    font-weight: 800;
    min-width: 18px;
    height: 18px;
    border-radius: var(--radius-xl);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 var(--space-1);
    border: 2px solid var(--panel-bg-opaque);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    z-index: 10;
    pointer-events: none;
    animation: badgePop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.notification-avatar-badge {
    position: absolute;
    top: -6px;
    right: -8px;
}

.notification-menu-count {
    position: static;
    margin-left: auto;
    border-color: var(--popup-bg);
    flex: 0 0 auto;
}

@keyframes badgePop {
    0% { transform: scale(0); }
    100% { transform: scale(1); }
}

/* Base modal centers with fixed, but if we use the overlay it might be different.
   The current modal-overlay uses flex.
*/

@keyframes modalFadeUp {
    0% { transform: translateY(30px); opacity: 0; }
    100% { transform: translateY(0); opacity: 1; }
}

@media (max-width: 768px) {

    .notification-list {
        padding: var(--space-2);
    }
}

/* ── Session toast log (Toast Notices tab) ──────────────────────────────────
   Every toast shown this session, newest first, so a message that auto-dismissed
   can still be read back. Rows reuse the toast type classes (.toast-success …)
   purely for their --toast-accent custom property. */
.toast-log-item {
    display: flex;
    align-items: flex-start;
    gap: var(--space-2-5);
    padding: var(--space-2-5) var(--space-3-5);
    border-bottom: 1px solid var(--border-color);
    font-size: 0.85rem;
}

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

.toast-log-icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    margin-top: var(--space-px);
    color: var(--toast-accent, var(--accent-color));
}

.toast-log-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.toast-log-message {
    color: var(--text-color);
    overflow-wrap: anywhere;
}

/* Optional longer explanation, collapsed by default. */
.toast-log-details summary {
    cursor: pointer;
    color: var(--accent-color);
    font-size: 0.75rem;
    user-select: none;
}

.toast-log-details summary:hover {
    text-decoration: underline;
}

.toast-log-details-body {
    margin-top: var(--space-1);
    padding: var(--space-2) var(--space-2-5);
    border-left: 2px solid var(--toast-accent, var(--accent-color));
    background: color-mix(in srgb, var(--text-color) 3%, transparent);
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    color: var(--text-muted);
    font-size: 0.78rem;
    line-height: 1.5;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.toast-log-time {
    flex-shrink: 0;
    color: var(--text-muted);
    font-size: 0.72rem;
    font-variant-numeric: tabular-nums;
    margin-top: var(--space-0-5);
}

/* Above every other modal overlay (z-index 6000): almost anything in the app,
   including an open modal, can raise a toast, and clicking that toast must be able
   to open this modal on top of whatever raised it. Toasts themselves (9999) still
   float above. The modal renders through the shared BaseModal shell, whose overlay
   class is fixed, so the lift keys off the shell class it passes instead. */
.base-modal-overlay:has(> .notifications-base-modal) {
    z-index: var(--z-modal-stacked);
}

/* In-app link on a log entry ("Go see achievements") — same quiet-link voice as
   the details summary, sized as a tap target. */
.toast-log-link {
    align-self: flex-start;
    padding: 0;
    border: none;
    background: none;
    color: var(--accent-color);
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
}

.toast-log-link:hover,
.toast-log-link:focus-visible {
    text-decoration: underline;
}
