/**
 * Notification Center - Modern 2025 Design
 * Jutalompont.com
 * Refactored for better performance and cleaner design
 */

/* ====================================
   NOTIFICATION WRAPPER & TRIGGER
   ==================================== */

.notification-wrapper {
    position: relative;
    display: inline-block;
}

.notification-trigger-btn {
    position: relative;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.notification-trigger-btn:hover {
    transform: scale(1.05);
}

.notification-trigger-btn .fa-bell {
    transition: transform 0.3s ease;
}

.notification-trigger-btn:hover .fa-bell {
    transform: rotate(15deg);
    animation: bellRing 0.5s ease-in-out;
}

@keyframes bellRing {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(15deg); }
    75% { transform: rotate(-15deg); }
}

/* Badge with pulse animation */
.notification-badge.pulse {
    animation: badgePulse 2s infinite;
}

@keyframes badgePulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.2); }
}

/* ====================================
   NOTIFICATION CENTER PANEL
   ==================================== */

.notification-center {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    width: 420px;
    max-width: calc(100vw - 32px);
    background: var(--jp-bg-card, #1e293b);
    border: 1px solid var(--jp-border, rgba(255, 255, 255, 0.1));
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5),
                0 0 0 1px rgba(255, 255, 255, 0.05) inset;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px) scale(0.95);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 9999;
    overflow: hidden;
    backdrop-filter: blur(20px);
}

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

/* Arrow pointer */
.notification-center::before {
    content: '';
    position: absolute;
    top: -8px;
    right: 20px;
    width: 16px;
    height: 16px;
    background: var(--jp-bg-card);
    border-left: 1px solid var(--jp-border);
    border-top: 1px solid var(--jp-border);
    transform: rotate(45deg);
    z-index: -1;
}

/* ====================================
   HEADER SECTION
   ==================================== */

.notification-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--jp-border);
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.12), rgba(139, 92, 246, 0.06));
}

.notification-title {
    display: flex;
    align-items: center;
    gap: 10px;
}

.notification-title i {
    color: var(--jp-primary);
    font-size: 18px;
}

.notification-title h6 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--jp-text);
}

.notification-count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    padding: 0 8px;
    background: var(--jp-primary);
    color: white;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.notification-actions {
    display: flex;
    gap: 8px;
}

.notification-action-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: var(--jp-text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
}

.notification-action-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--jp-text);
    transform: translateY(-2px);
}

.notification-action-btn i {
    font-size: 14px;
}

/* ====================================
   TABS SECTION
   ==================================== */

.notification-tabs {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid var(--jp-border);
}

.notification-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 12px;
    color: var(--jp-text-muted);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    min-width: 96px;
}

.notification-tab:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--jp-text);
}

.notification-tab.active {
    background: rgba(99, 102, 241, 0.15);
    color: #fff;
    border-color: rgba(99, 102, 241, 0.25);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.25);
}

.notification-tab i {
    font-size: 14px;
}

.notification-tab .tab-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
}

.notification-tab.active .tab-count {
    background: rgba(255, 255, 255, 0.3);
}

/* ====================================
   NOTIFICATIONS LIST
   ==================================== */

.notification-list {
    max-height: 450px;
    overflow-y: auto;
    scroll-behavior: smooth;
}

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

.notification-list::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
}

.notification-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.notification-list::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Loading state */
.notification-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 2rem;
    min-height: 200px;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--jp-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.notification-loading p {
    margin-top: 1rem;
    color: var(--jp-text-muted);
    font-size: 14px;
}

/* Empty state */
.notification-empty {
    text-align: center;
    padding: 3rem 2rem;
}

.notification-empty i {
    font-size: 48px;
    color: var(--jp-text-muted);
    opacity: 0.5;
    margin-bottom: 1rem;
}

.notification-empty p {
    color: var(--jp-text-muted);
    font-size: 14px;
    margin: 0;
}

/* Notification item */
.notification-item {
    position: relative;
    display: flex;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--jp-border);
    cursor: pointer;
    transition: all 0.2s ease;
    background: transparent;
    border-radius: 12px;
    margin: 0 8px 8px;
}

.notification-item:hover {
    background: rgba(255, 255, 255, 0.05);
    transform: translateY(-1px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.12);
}

.notification-item.unread {
    background: rgba(99, 102, 241, 0.06);
}

.notification-item.unread::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--jp-primary);
}

.notification-icon {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    font-size: 18px;
}

.notification-icon.success {
    background: rgba(34, 197, 94, 0.1);
    color: #22c55e;
}

.notification-icon.info {
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
}

.notification-icon.warning {
    background: rgba(251, 146, 60, 0.1);
    color: #fb923c;
}

.notification-icon.error {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

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

.notification-title-text {
    font-size: 14px;
    font-weight: 600;
    color: var(--jp-text);
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.notification-message {
    font-size: 13px;
    color: var(--jp-text-muted);
    line-height: 1.5;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.notification-time {
    font-size: 12px;
    color: var(--jp-text-muted);
    margin-top: 6px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.notification-time i {
    font-size: 10px;
}

.notification-actions-item {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.notification-delete-btn {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    color: var(--jp-text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.12);
}

.notification-delete-btn:hover {
    background: rgba(239, 68, 68, 0.16);
    border-color: rgba(239, 68, 68, 0.35);
    color: #fff;
    transform: scale(1.05);
    box-shadow: 0 6px 14px rgba(239, 68, 68, 0.25);
}

.notification-delete-btn i {
    pointer-events: none;
    font-size: 13px;
}

.notification-delete-btn:focus-visible {
    outline: 2px solid rgba(239, 68, 68, 0.45);
    outline-offset: 2px;
}

/* ====================================
   FOOTER SECTION
   ==================================== */

.notification-footer {
    padding: 12px 20px;
    border-top: 1px solid var(--jp-border);
    background: rgba(0, 0, 0, 0.2);
}

.view-all-link {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px;
    color: var(--jp-primary);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.view-all-link:hover {
    background: rgba(99, 102, 241, 0.1);
    gap: 12px;
}

.view-all-link i {
    font-size: 12px;
    transition: transform 0.2s ease;
}

.view-all-link:hover i {
    transform: translateX(4px);
}

/* ====================================
   RESPONSIVE DESIGN
   ==================================== */

@media (max-width: 768px) {
    .notification-center {
        width: 360px;
    }
    
    .notification-header {
        padding: 14px 16px;
    }
    
    .notification-title h6 {
        font-size: 15px;
    }
    
    .notification-tabs {
        padding: 10px 12px;
    }
    
    .notification-tab {
        padding: 8px 12px;
        font-size: 13px;
    }
    
    .notification-list {
        max-height: 350px;
    }
    
    .notification-item {
        padding: 14px 16px;
    }
}

@media (max-width: 480px) {
    .notification-center {
        width: 320px;
    }
    
    .notification-tab span {
        display: none;
    }
    
    .notification-tab {
        justify-content: center;
    }
}

/* ====================================
   LIGHT MODE OVERRIDES
   ==================================== */

[data-bs-theme="light"] .notification-center {
    background: white;
    border-color: rgba(0, 0, 0, 0.1);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
}

[data-bs-theme="light"] .notification-center::before {
    background: white;
    border-color: rgba(0, 0, 0, 0.1);
}

[data-bs-theme="light"] .notification-header {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.05), rgba(139, 92, 246, 0.02));
}

[data-bs-theme="light"] .notification-tabs {
    background: rgba(0, 0, 0, 0.02);
}

[data-bs-theme="light"] .notification-tab:hover {
    background: rgba(0, 0, 0, 0.05);
}

[data-bs-theme="light"] .notification-item:hover {
    background: rgba(0, 0, 0, 0.02);
}

[data-bs-theme="light"] .notification-item.unread {
    background: rgba(99, 102, 241, 0.03);
}

[data-bs-theme="light"] .notification-footer {
    background: rgba(0, 0, 0, 0.02);
}

[data-bs-theme="light"] .notification-action-btn {
    background: rgba(0, 0, 0, 0.05);
    border-color: rgba(0, 0, 0, 0.1);
}

[data-bs-theme="light"] .notification-action-btn:hover {
    background: rgba(0, 0, 0, 0.1);
}
