/* ==========================================================================
   NOTIFICATION PANEL -- Game HUD overlay
   ========================================================================== */

.notif-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(12, 10, 8, 0);
    z-index: 90;
    transition: background 0.2s;
}

.notif-backdrop-visible {
    background: rgba(12, 10, 8, 0.8);
}

/* --- Full-screen panel --- */

.notif-panel {
    position: fixed;
    inset: 0;
    background:
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 3px,
            rgba(255, 255, 255, 0.008) 3px,
            rgba(255, 255, 255, 0.008) 4px
        ),
        radial-gradient(ellipse at 50% 0%, rgba(60, 48, 30, 0.15) 0%, transparent 60%),
        var(--bg-darkest);
    z-index: 91;
    display: flex;
    flex-direction: column;
    transform: translateY(100%);
    transition: transform 0.3s ease-out;
}

.notif-panel-visible {
    transform: translateY(0);
}

/* --- Header bar (matches top-bar HUD) --- */

.notif-header {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    height: var(--top-bar-height);
    padding: 0 var(--spacing-md);
    padding-top: var(--safe-top);
    border-bottom: 2px solid var(--border-highlight);
    background: var(--bg-surface);
    flex-shrink: 0;
    box-shadow:
        0 2px 0 var(--border-dark),
        0 4px 16px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 220, 140, 0.06);
    position: relative;
    z-index: 1;
}

.notif-header::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(208, 160, 48, 0.12) 20%, rgba(208, 160, 48, 0.12) 80%, transparent);
}

.notif-close-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    min-width: 40px;
    background: none;
    border: 2px solid var(--border-dark);
    color: var(--text-dim);
    cursor: pointer;
    font-family: var(--font-pixel);
    font-size: 14px;
    transition: border-color 0.15s, color 0.15s;
    flex-shrink: 0;
}

.notif-close-btn:hover {
    border-color: var(--border-mid);
    color: var(--text-main);
}

.notif-close-btn:active {
    transform: translate(1px, 1px);
}

.notif-header-title {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    flex: 1;
}

.notif-header-title svg {
    width: 20px;
    height: 20px;
    color: var(--gold);
}

.notif-title {
    font-family: var(--font-pixel);
    font-size: 14px;
    color: var(--text-bright);
    margin: 0;
}

.notif-header-count {
    font-family: var(--font-pixel);
    font-size: 9px;
    color: var(--bg-darkest);
    background: var(--green);
    min-width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
    box-shadow: 0 0 8px rgba(104, 168, 88, 0.3);
}

.notif-header-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.notif-action-btn {
    font-family: var(--font-pixel);
    font-size: 7px;
    color: var(--text-dim);
    background: none;
    border: 2px solid var(--border-dark);
    padding: 6px 10px;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: color 0.15s, border-color 0.15s;
    min-height: 32px;
    white-space: nowrap;
}

.notif-action-btn:hover {
    color: var(--text-main);
    border-color: var(--border-mid);
}

.notif-action-btn:active {
    transform: translate(1px, 1px);
}

.notif-action-btn:disabled {
    opacity: 0.5;
    pointer-events: none;
}

.notif-action-danger {
    color: var(--red-light);
    border-color: var(--red-dark);
}

.notif-action-danger:hover {
    color: var(--red-light);
    border-color: var(--red);
}

/* --- List --- */

.notif-list {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: var(--spacing-sm);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.notif-list::-webkit-scrollbar { width: 6px; }
.notif-list::-webkit-scrollbar-track { background: var(--bg-darkest); }
.notif-list::-webkit-scrollbar-thumb {
    background: var(--border-mid);
    border: 1px solid var(--border-dark);
}

/* --- Notification card --- */

.notif-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-md);
    min-height: 72px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.015) 0%, transparent 50%),
        var(--bg-surface);
    border: 2px solid var(--border-dark);
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s, transform 0.1s;
    position: relative;
    box-shadow:
        inset 0 1px 0 rgba(255, 220, 140, 0.03),
        0 1px 3px rgba(0, 0, 0, 0.15);
}

.notif-item:hover {
    border-color: var(--border-mid);
    box-shadow:
        inset 0 1px 0 rgba(255, 220, 140, 0.03),
        0 2px 6px rgba(0, 0, 0, 0.2);
}

.notif-item:active {
    transform: translate(1px, 1px);
    box-shadow:
        inset 0 -1px 0 rgba(255, 220, 140, 0.03),
        inset 0 1px 0 rgba(0, 0, 0, 0.2);
}

/* --- Unread state --- */

.notif-item.unread {
    border-left: 4px solid var(--green);
    background:
        linear-gradient(135deg, rgba(104, 168, 88, 0.06) 0%, transparent 50%),
        var(--bg-surface);
    box-shadow:
        inset 0 1px 0 rgba(152, 216, 112, 0.04),
        -2px 0 8px rgba(104, 168, 88, 0.08),
        0 1px 3px rgba(0, 0, 0, 0.15);
}

.notif-item.unread .notif-item-title::after {
    content: 'NEW';
    font-family: var(--font-pixel);
    font-size: 7px;
    color: var(--bg-darkest);
    background: var(--green);
    padding: 1px 5px;
    margin-left: 8px;
    vertical-align: middle;
    letter-spacing: 0.5px;
}

/* --- Icon --- */

.notif-item-icon {
    width: 44px;
    height: 44px;
    min-width: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--border-dark);
    flex-shrink: 0;
}

.notif-item-icon svg {
    width: 22px;
    height: 22px;
}

.notif-icon-friend_request {
    color: var(--gold);
    background: rgba(208, 160, 48, 0.08);
    border-color: var(--gold-dark);
}

.notif-icon-plant_needs_water {
    color: #6bb5ff;
    background: rgba(60, 120, 180, 0.08);
    border-color: rgba(80, 140, 200, 0.3);
}

.notif-icon-special_event {
    color: var(--green-light);
    background: rgba(104, 168, 88, 0.08);
    border-color: var(--green-dark);
}

.notif-icon-match_invite {
    color: var(--red-light);
    background: rgba(200, 60, 60, 0.08);
    border-color: var(--red-dark);
}

.notif-icon-default {
    color: var(--text-dim);
    background: var(--bg-mid);
}

/* --- Content --- */

.notif-item-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.notif-item-title {
    font-family: var(--font-pixel);
    font-size: 11px;
    color: var(--text-bright);
    line-height: 1.4;
}

.notif-item-body {
    font-family: var(--font-pixel);
    font-size: 9px;
    color: var(--text-dim);
    line-height: 1.8;
}

.notif-item-time {
    font-family: var(--font-pixel);
    font-size: 8px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* --- Arrow / chevron --- */

.notif-item-arrow {
    font-family: var(--font-pixel);
    font-size: 12px;
    color: var(--text-muted);
    flex-shrink: 0;
    transition: color 0.15s;
}

.notif-item:hover .notif-item-arrow {
    color: var(--text-dim);
}

/* --- Empty / Loading states --- */

.notif-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-xl) var(--spacing-lg);
    text-align: center;
    flex: 1;
    gap: var(--spacing-md);
}

.notif-empty-icon {
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-surface);
    border: 2px solid var(--border-dark);
    color: var(--text-muted);
}

.notif-empty-icon svg {
    width: 28px;
    height: 28px;
}

.notif-empty-text {
    font-family: var(--font-pixel);
    font-size: 11px;
    color: var(--text-dim);
}

.notif-empty-hint {
    font-family: var(--font-pixel);
    font-size: 9px;
    color: var(--text-muted);
    line-height: 2;
    max-width: 280px;
}

.notif-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-xl);
    font-family: var(--font-pixel);
    font-size: 11px;
    color: var(--text-dim);
    flex: 1;
}

.notif-loading-spinner {
    display: inline-block;
    width: 12px;
    height: 12px;
    background: var(--green);
    animation: retro-spin 1s steps(8) infinite;
    box-shadow: 0 0 6px rgba(104, 168, 88, 0.3);
}

/* --- New item enter animation --- */

.notif-item-enter {
    opacity: 0;
    transform: translateX(-12px);
    transition: opacity 0.3s, transform 0.3s;
}

/* --- Toast notification (real-time) --- */

.notif-toast {
    position: fixed;
    top: calc(var(--safe-top, 0px) + var(--top-bar-height, 48px) + 8px);
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    opacity: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm) var(--spacing-md);
    min-width: 260px;
    max-width: 380px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.03) 0%, transparent 50%),
        var(--bg-surface);
    border: 2px solid var(--border-highlight);
    box-shadow:
        0 4px 24px rgba(0, 0, 0, 0.6),
        0 0 12px rgba(208, 160, 48, 0.1),
        inset 0 1px 0 rgba(255, 220, 140, 0.06);
    transition: opacity 0.25s, transform 0.25s;
    pointer-events: auto;
}

.notif-toast-visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.notif-toast-exit {
    opacity: 0;
    transform: translateX(-50%) translateY(-20px);
}

.notif-toast-icon {
    width: 36px;
    height: 36px;
    min-width: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--border-dark);
    flex-shrink: 0;
}

.notif-toast-icon svg {
    width: 18px;
    height: 18px;
}

.notif-toast-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.notif-toast-title {
    font-family: var(--font-pixel);
    font-size: 10px;
    color: var(--text-bright);
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.notif-toast-text {
    font-family: var(--font-pixel);
    font-size: 8px;
    color: var(--text-dim);
    line-height: 1.6;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.notif-toast-dismiss {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    min-width: 28px;
    background: none;
    border: 2px solid var(--border-dark);
    color: var(--text-muted);
    cursor: pointer;
    font-family: var(--font-pixel);
    font-size: 10px;
    flex-shrink: 0;
    transition: color 0.15s, border-color 0.15s;
}

.notif-toast-dismiss:hover {
    color: var(--text-main);
    border-color: var(--border-mid);
}

.notif-toast-dismiss:active {
    transform: translate(1px, 1px);
}
