/* /the-perfection-paradox/notification-center.css (V4 - Interactive Command Center) */

/* 1. Bell Icon Container */
.notification-bell-container {
    position: relative;
    display: none;
}

.auth-logged-in .notification-bell-container {
    display: block;
}

#notification-bell-button {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: background-color 0.2s, color 0.2s;
    position: relative;
}

#notification-bell-button:hover,
#notification-bell-button[aria-expanded="true"] {
    background-color: rgba(255, 255, 255, 0.1);
    color: #fff;
}

#notification-bell-button svg {
    width: 22px;
    height: 22px;
    display: block;
}

/* 2. Unread Badge — Pill with count */
.unread-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    background-color: #f56c6c;
    border-radius: 999px;
    border: 1.5px solid rgba(15, 17, 26, 1);
    display: none;
    font-size: 0.65rem;
    font-weight: 700;
    color: #fff;
    text-align: center;
    line-height: 16px;
    box-sizing: border-box;
}

.unread-badge.is-visible {
    display: block;
}

/* 3. Bell Shake Animation */
@keyframes bellRing {
    0%   { transform: rotate(0); }
    15%  { transform: rotate(14deg); }
    30%  { transform: rotate(-12deg); }
    45%  { transform: rotate(10deg); }
    60%  { transform: rotate(-8deg); }
    75%  { transform: rotate(4deg); }
    100% { transform: rotate(0); }
}
#notification-bell-button.is-ringing svg {
    animation: bellRing 0.6s ease-in-out;
    transform-origin: top center;
}

/* 4. Notification Panel — Spring animation */
.notification-panel {
    position: fixed;
    top: 80px;
    right: 35px;
    width: 380px;
    max-width: 90vw;
    background: rgba(21, 24, 38, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(74, 144, 226, 0.3);
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    z-index: 9995;
    display: flex;
    flex-direction: column;
    max-height: 450px;

    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px) scale(0.98);
    transition: opacity 0.25s cubic-bezier(0.34, 1.56, 0.64, 1),
                visibility 0.25s ease,
                transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.notification-panel.is-visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* 5. Panel Header */
.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    border-bottom: 1px solid rgba(74, 144, 226, 0.2);
    flex-shrink: 0;
}

.panel-header h3 {
    margin: 0;
    font-size: 1rem;
    color: #fff;
}

.panel-header-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.panel-action-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.35);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: color 0.2s, background-color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.panel-action-btn:hover {
    color: rgba(255, 255, 255, 0.8);
    background-color: rgba(255, 255, 255, 0.08);
}

.panel-action-btn .material-symbols-outlined {
    font-size: 1.15rem !important;
}

/* 6. Filter Tabs */
.panel-filter-tabs {
    display: flex;
    padding: 0 8px;
    gap: 4px;
    border-bottom: 1px solid rgba(74, 144, 226, 0.15);
    flex-shrink: 0;
}

.panel-filter-tab {
    flex: 1;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.45);
    font-size: 0.8rem;
    padding: 8px 4px;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: color 0.2s, border-color 0.2s;
}

.panel-filter-tab:hover {
    color: rgba(255, 255, 255, 0.8);
}

.panel-filter-tab.is-active {
    color: #4a90e2;
    border-bottom-color: #4a90e2;
}

/* 7. Panel Body & List */
.panel-body {
    overflow-y: auto;
    flex-grow: 1;
}

.notification-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

/* 8. Date Group Headers */
.notif-date-header {
    padding: 10px 15px 4px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(74, 144, 226, 0.6);
    list-style: none;
}

/* 9. Notification Items */
.notification-item {
    padding: 12px 15px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    border-bottom: 1px solid rgba(74, 144, 226, 0.1);
    cursor: pointer;
    transition: background-color 0.2s;
    position: relative;
}

.notification-item:hover {
    background-color: rgba(74, 144, 226, 0.1);
}

.notification-item.is-read .notification-content p {
    color: #a9b3c1;
}

/* Unread Indicator Dot */
.notification-item::before {
    content: '';
    display: block;
    width: 8px;
    height: 8px;
    background-color: #4a90e2;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 5px;
    opacity: 1;
    transition: opacity 0.3s;
}

.notification-item.is-read::before {
    opacity: 0;
}

.notification-content {
    flex-grow: 1;
    min-width: 0;
}

.notification-content p {
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.5;
    color: #f1f1f1;
}

.notification-content .timestamp {
    font-size: 0.75rem;
    color: #a9b3c1;
    margin-top: 4px;
}

/* Right Column — actions + timestamp */
.notif-right-col {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: space-between;
    align-self: stretch;
    flex-shrink: 0;
    gap: 4px;
}

.notif-right-actions {
    display: flex;
    align-items: center;
    gap: 2px;
}

.notif-right-col .timestamp {
    font-size: 0.7rem;
    color: rgba(169, 179, 193, 0.7);
    white-space: nowrap;
}

/* 10. Staggered Entrance Animation */
@keyframes notifSlideIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.notif-entrance {
    animation: notifSlideIn 0.25s ease-out both;
}

/* 11. Dismiss Animation */
@keyframes notifDismiss {
    to {
        opacity: 0;
        transform: translateX(30px);
        max-height: 0;
        padding-top: 0;
        padding-bottom: 0;
        margin: 0;
        border-bottom-width: 0;
        overflow: hidden;
    }
}

.notification-item.is-dismissing {
    animation: notifDismiss 0.3s ease forwards;
}

/* 12. Dismiss Button (X) */
.notif-dismiss-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.15);
    cursor: pointer;
    padding: 2px;
    flex-shrink: 0;
    opacity: 0;
    transition: opacity 0.2s, color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.notification-item:hover .notif-dismiss-btn {
    opacity: 1;
}

.notif-dismiss-btn:hover {
    color: #f56c6c;
}

.notif-dismiss-btn .material-symbols-outlined {
    font-size: 0.9rem !important;
}

/* 13. Type Icons */
.notif-type-icon {
    font-size: 1.1rem !important;
    flex-shrink: 0;
    margin-top: 2px;
    color: rgba(255, 255, 255, 0.25);
    transition: color 0.2s;
}

.notification-item:not(.is-read) .notif-type-icon                                { color: rgba(74, 144, 226, 0.7); }
.notification-item:not(.is-read) .notif-type-icon[data-type="dm"]                { color: #4a90e2; }
.notification-item:not(.is-read) .notif-type-icon[data-type="system"]            { color: #f59e0b; }
.notification-item:not(.is-read) .notif-type-icon[data-type="announcement"]      { color: #22c55e; }
.notification-item:not(.is-read) .notif-type-icon[data-type="review"]            { color: #a78bfa; }
.notification-item:not(.is-read) .notif-type-icon[data-type="like"]              { color: #f87171; }
.notification-item:not(.is-read) .notif-type-icon[data-type="nakama_request"]    { color: #a78bfa; }

/* 14. Clickable Notification — Chevron */
.notification-item.is-clickable {
    cursor: pointer;
}

.notification-item:not(.is-clickable) {
    cursor: default;
}

.notif-chevron {
    font-size: 1rem !important;
    flex-shrink: 0;
    color: rgba(255, 255, 255, 0.2);
    margin-top: 2px;
    transition: color 0.2s, transform 0.2s;
}

.notification-item.is-clickable:hover .notif-chevron {
    color: rgba(74, 144, 226, 0.7);
    transform: translateX(2px);
}

/* 15. Nakama Action Buttons */
.notif-actions-row {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.notif-action-btn {
    padding: 4px 14px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    transition: background-color 0.2s, transform 0.1s;
    position: relative;
    overflow: hidden;
}

.notif-action-btn:active {
    transform: scale(0.96);
}

/* Ripple effect */
.notif-action-btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 50% 50%, rgba(255,255,255,0.25) 0%, transparent 60%);
    opacity: 0;
    transition: opacity 0.3s;
}

.notif-action-btn:active::after {
    opacity: 1;
}

.notif-action-btn.accept {
    background: rgba(74, 144, 226, 0.2);
    color: #4a90e2;
    border-color: rgba(74, 144, 226, 0.4);
}

.notif-action-btn.accept:hover {
    background: rgba(74, 144, 226, 0.35);
}

.notif-action-btn.decline {
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.5);
    border-color: rgba(255, 255, 255, 0.1);
}

.notif-action-btn.decline:hover {
    background: rgba(255, 255, 255, 0.1);
}

.notif-action-btn:disabled {
    opacity: 0.5;
    cursor: wait;
}

.notif-action-result {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.5);
    font-style: italic;
}

.notif-action-result.success {
    color: #67c23a;
}

/* 16. Empty State */
.empty-state {
    display: none;
    padding: 40px 20px;
    text-align: center;
    color: #a9b3c1;
}

.notification-list:empty + .empty-state {
    display: block;
}

/* 17. Load More Button */
.notif-load-more-btn {
    display: block;
    width: 100%;
    padding: 10px;
    background: none;
    border: none;
    border-top: 1px solid rgba(74, 144, 226, 0.1);
    color: #4a90e2;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
}

.notif-load-more-btn:hover {
    background-color: rgba(74, 144, 226, 0.1);
}

.notif-load-more-btn:disabled {
    color: rgba(255, 255, 255, 0.3);
    cursor: wait;
}

/* 18. Message Preview (DM stacking) */
.notif-preview {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.45);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 260px;
    font-style: italic;
}

.notification-item:not(.is-read) .notif-preview {
    color: rgba(255, 255, 255, 0.6);
}

/* 19. Message Count Badge (grouped DMs) */
.notif-msg-count {
    margin-left: 6px;
    color: rgba(74, 144, 226, 0.6);
    font-weight: 600;
}
