/* ==========================================
   NOTIFICATION DROPDOWN
   Hộp thông báo với giao diện đẹp và mượt mà
   ========================================== */

/* Notification Bell Button */
.notification-bell-btn {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 0.5rem;
    transition: all 0.2s ease;
    cursor: pointer;
    background: transparent;
    border: none;
    color: var(--color-text-tertiary);
}

.notification-bell-btn:hover {
    background-color: var(--color-bg-tertiary);
    color: var(--color-text-primary);
}

/* Badge số lượng thông báo chưa đọc */
.notification-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    border-radius: 9999px;
    font-size: 0.625rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(239, 68, 68, 0.4);
    animation: badge-pulse 2s ease-in-out infinite;
}

@keyframes badge-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* Dropdown container */
.notification-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 0.5rem;
    width: 380px;
    max-height: 600px;
    background: white;
    border-radius: 0.75rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    border: 1px solid #e5e7eb;
    overflow: hidden;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

:is(.dark) .notification-dropdown {
    background: #1e293b;
    border-color: #334155;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
}

/* Header */
.notification-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #e5e7eb;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
}

:is(.dark) .notification-header {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    border-color: #334155;
}

.notification-header h3 {
    font-size: 0.9375rem;
    font-weight: 700;
    color: #0f172a;
    margin: 0;
}

:is(.dark) .notification-header h3 {
    color: #f1f5f9;
}

.notification-header-actions {
    display: flex;
    gap: 0.5rem;
}

.mark-all-read-btn {
    font-size: 0.75rem;
    color: #3b82f6;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 0.375rem;
    transition: all 0.2s;
    font-weight: 600;
}

.mark-all-read-btn:hover {
    background: rgba(59, 130, 246, 0.1);
}

:is(.dark) .mark-all-read-btn {
    color: #60a5fa;
}

/* Body - List of notifications */
.notification-body {
    max-height: 450px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}

.notification-body::-webkit-scrollbar {
    width: 6px;
}

.notification-body::-webkit-scrollbar-track {
    background: transparent;
}

.notification-body::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

:is(.dark) .notification-body {
    scrollbar-color: #475569 transparent;
}

:is(.dark) .notification-body::-webkit-scrollbar-thumb {
    background: #475569;
}

/* Individual notification item */
.notification-item {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #f1f5f9;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    opacity: 1;
    transform: translateX(0);
}

.notification-item:hover {
    background: #fafbfc;
}

.notification-item.unread {
    background: linear-gradient(90deg, #eff6ff 0%, #f0f9ff 100%);
}

.notification-item.unread::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 60%;
    background: linear-gradient(180deg, #3b82f6 0%, #2563eb 100%);
    border-radius: 0 2px 2px 0;
}

:is(.dark) .notification-item {
    border-color: #334155;
}

:is(.dark) .notification-item:hover {
    background: #1e293b;
}

:is(.dark) .notification-item.unread {
    background: linear-gradient(90deg, #1e3a8a 0%, #1e40af 100%);
}

/* Notification content */
.notification-content {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.notification-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.5rem;
}

.notification-title {
    font-size: 0.875rem;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.4;
    flex: 1;
}

:is(.dark) .notification-title {
    color: #f1f5f9;
}

.notification-type-badge {
    padding: 0.125rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.625rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

.notification-type-badge.info {
    background: #dbeafe;
    color: #1e40af;
}

.notification-type-badge.success {
    background: #d1fae5;
    color: #065f46;
}

.notification-type-badge.warning {
    background: #fef3c7;
    color: #92400e;
}

.notification-type-badge.error {
    background: #fee2e2;
    color: #991b1b;
}

:is(.dark) .notification-type-badge.info {
    background: #1e3a8a;
    color: #bfdbfe;
}

:is(.dark) .notification-type-badge.success {
    background: #065f46;
    color: #a7f3d0;
}

:is(.dark) .notification-type-badge.warning {
    background: #78350f;
    color: #fde68a;
}

:is(.dark) .notification-type-badge.error {
    background: #7f1d1d;
    color: #fecaca;
}

.notification-message {
    font-size: 0.8125rem;
    color: #475569;
    line-height: 1.5;
}

:is(.dark) .notification-message {
    color: #cbd5e1;
}

.notification-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.5rem;
}

.notification-time {
    font-size: 0.75rem;
    color: #94a3b8;
}

:is(.dark) .notification-time {
    color: #64748b;
}

.notification-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.notification-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 0.875rem;
    font-size: 0.8125rem;
    border: 1px solid transparent;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 600;
    white-space: nowrap;
}

.notification-action-btn:active {
    transform: translateY(1px);
}

/* Compact action buttons - Icon only, smaller size */
.notification-action-btn-compact {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
    background: transparent;
}

.notification-action-btn-compact:hover {
    transform: translateY(-2px);
}

.notification-action-btn-compact:active {
    transform: translateY(0);
}

.notification-link-btn {
    background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%);
    color: #15803d;
    border-color: #86efac;
}

.notification-link-btn:hover {
    background: linear-gradient(135deg, #bbf7d0 0%, #86efac 100%);
    border-color: #4ade80;
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.3);
}

.notification-reply-btn {
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    color: #1e40af;
    border-color: #93c5fd;
}

.notification-reply-btn:hover {
    background: linear-gradient(135deg, #bfdbfe 0%, #93c5fd 100%);
    border-color: #60a5fa;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.notification-delete-btn {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    color: #991b1b;
    border-color: #fca5a5;
}

.notification-delete-btn:hover {
    background: linear-gradient(135deg, #fecaca 0%, #fca5a5 100%);
    border-color: #f87171;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.2);
}

:is(.dark) .notification-link-btn {
    background: linear-gradient(135deg, #14532d 0%, #166534 100%);
    color: #bbf7d0;
    border-color: #166534;
}

:is(.dark) .notification-link-btn:hover {
    background: linear-gradient(135deg, #166534 0%, #15803d 100%);
    border-color: #22c55e;
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.4);
}

:is(.dark) .notification-reply-btn {
    background: linear-gradient(135deg, #1e3a8a 0%, #1e40af 100%);
    color: #bfdbfe;
    border-color: #1e40af;
}

:is(.dark) .notification-reply-btn:hover {
    background: linear-gradient(135deg, #1e40af 0%, #2563eb 100%);
    border-color: #3b82f6;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

:is(.dark) .notification-delete-btn {
    background: linear-gradient(135deg, #7f1d1d 0%, #991b1b 100%);
    color: #fecaca;
    border-color: #991b1b;
}

:is(.dark) .notification-delete-btn:hover {
    background: linear-gradient(135deg, #991b1b 0%, #b91c1c 100%);
    border-color: #dc2626;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
}

/* Confirm Delete Modal */
.notification-confirm-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    animation: fadeIn 0.2s ease;
}

.notification-confirm-modal.show {
    display: flex;
}

.notification-confirm-content {
    background: white;
    border-radius: 1rem;
    padding: 1.5rem;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    animation: slideUp 0.3s ease;
}

:is(.dark) .notification-confirm-content {
    background: #1e293b;
    color: #f1f5f9;
}

.notification-confirm-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.notification-confirm-icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #d97706;
    flex-shrink: 0;
}

:is(.dark) .notification-confirm-icon {
    background: linear-gradient(135deg, #78350f 0%, #92400e 100%);
    color: #fde68a;
}

.notification-confirm-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: #0f172a;
    margin: 0;
}

:is(.dark) .notification-confirm-title {
    color: #f1f5f9;
}

.notification-confirm-message {
    color: #64748b;
    font-size: 0.875rem;
    line-height: 1.5;
    margin-bottom: 1.5rem;
}

:is(.dark) .notification-confirm-message {
    color: #94a3b8;
}

.notification-confirm-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
}

.notification-confirm-btn {
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: 0.5rem;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.notification-confirm-btn:active {
    transform: translateY(1px);
}

.notification-confirm-cancel {
    background: #f1f5f9;
    color: #475569;
}

.notification-confirm-cancel:hover {
    background: #e2e8f0;
}

:is(.dark) .notification-confirm-cancel {
    background: #334155;
    color: #cbd5e1;
}

:is(.dark) .notification-confirm-cancel:hover {
    background: #475569;
}

.notification-confirm-delete {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
}

.notification-confirm-delete:hover {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Empty state */
.notification-empty {
    padding: 3rem 1.5rem;
    text-align: center;
    color: #94a3b8;
}

.notification-empty-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 1rem;
    opacity: 0.5;
}

.notification-empty p {
    font-size: 0.875rem;
    margin: 0;
}

:is(.dark) .notification-empty {
    color: #64748b;
}

/* Loading state */
.notification-loading {
    padding: 2rem;
    text-align: center;
    color: #94a3b8;
}

.notification-loading-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #e5e7eb;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 1rem;
}

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

/* Reply Modal */
.notification-reply-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.notification-reply-modal.show {
    opacity: 1;
    visibility: visible;
}

.notification-reply-content {
    background: white;
    border-radius: 0.75rem;
    padding: 1.5rem;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
}

:is(.dark) .notification-reply-content {
    background: #1e293b;
}

.notification-reply-header {
    margin-bottom: 1rem;
}

.notification-reply-header h3 {
    font-size: 1.125rem;
    font-weight: 700;
    color: #0f172a;
    margin: 0 0 0.5rem 0;
}

:is(.dark) .notification-reply-header h3 {
    color: #f1f5f9;
}

.notification-reply-textarea {
    width: 100%;
    min-height: 120px;
    padding: 0.75rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    resize: vertical;
    transition: all 0.2s;
}

.notification-reply-textarea:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

:is(.dark) .notification-reply-textarea {
    background: #0f172a;
    border-color: #334155;
    color: #f1f5f9;
}

.notification-reply-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1rem;
}

.notification-reply-submit,
.notification-reply-cancel {
    padding: 0.5rem 1.25rem;
    border: none;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.notification-reply-submit {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
}

.notification-reply-submit:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.notification-reply-cancel {
    background: #f1f5f9;
    color: #475569;
}

.notification-reply-cancel:hover {
    background: #e2e8f0;
}

:is(.dark) .notification-reply-cancel {
    background: #334155;
    color: #cbd5e1;
}

:is(.dark) .notification-reply-cancel:hover {
    background: #475569;
}

/* Responsive */
@media (max-width: 640px) {
    .notification-dropdown {
        width: calc(100vw - 2rem);
        right: 1rem;
    }

    .notification-reply-content {
        width: calc(100vw - 2rem);
        padding: 1.25rem;
    }
}

/* ==========================================
   TOAST NOTIFICATIONS (Real-time)
   ========================================== */

.notification-toast-container {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
}

.notification-toast {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    min-width: 320px;
    max-width: 420px;
    padding: 16px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    border-left: 4px solid #3b82f6;
    pointer-events: auto;
    opacity: 0;
    transform: translateX(400px);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

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

:is(.dark) .notification-toast {
    background: #1e293b;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
}

/* Toast types */
.notification-toast-info {
    border-left-color: #3b82f6;
}

.notification-toast-success {
    border-left-color: #10b981;
}

.notification-toast-warning {
    border-left-color: #f59e0b;
}

.notification-toast-error {
    border-left-color: #ef4444;
}

/* Toast icon */
.notification-toast-icon {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #eff6ff;
    color: #3b82f6;
}

.notification-toast-info .notification-toast-icon {
    background: #eff6ff;
    color: #3b82f6;
}

.notification-toast-success .notification-toast-icon {
    background: #d1fae5;
    color: #10b981;
}

.notification-toast-warning .notification-toast-icon {
    background: #fef3c7;
    color: #f59e0b;
}

.notification-toast-error .notification-toast-icon {
    background: #fee2e2;
    color: #ef4444;
}

:is(.dark) .notification-toast-info .notification-toast-icon {
    background: #1e3a8a;
    color: #93c5fd;
}

:is(.dark) .notification-toast-success .notification-toast-icon {
    background: #065f46;
    color: #6ee7b7;
}

:is(.dark) .notification-toast-warning .notification-toast-icon {
    background: #78350f;
    color: #fcd34d;
}

:is(.dark) .notification-toast-error .notification-toast-icon {
    background: #7f1d1d;
    color: #fca5a5;
}

/* Toast content */
.notification-toast-content {
    flex: 1;
    min-width: 0;
}

.notification-toast-title {
    font-size: 0.9375rem;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 4px;
    line-height: 1.4;
}

:is(.dark) .notification-toast-title {
    color: #f1f5f9;
}

.notification-toast-message {
    font-size: 0.8125rem;
    color: #64748b;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

:is(.dark) .notification-toast-message {
    color: #94a3b8;
}

/* Toast close button */
.notification-toast-close {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: #94a3b8;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.notification-toast-close:hover {
    background: #f1f5f9;
    color: #0f172a;
}

:is(.dark) .notification-toast-close:hover {
    background: #334155;
    color: #f1f5f9;
}

/* Bell Ring Animation */
@keyframes bell-ring {
    0%, 100% {
        transform: rotate(0deg);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: rotate(-15deg);
    }
    20%, 40%, 60%, 80% {
        transform: rotate(15deg);
    }
}

.notification-bell-ring {
    animation: bell-ring 0.8s ease-in-out;
}

/* Mobile responsive */
@media (max-width: 640px) {
    .notification-toast-container {
        top: 60px;
        right: 12px;
        left: 12px;
    }

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