/* Notification System Styles */
:root {
    --notification-width: 380px;
    --notification-header-height: 60px;
    --notification-item-min-height: 80px;
    --notification-z-index: 10000;
}

/* Bell Wrapper */
.notification-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-right: 0.5rem;
}

/* Bell Icon Button */
.notification-icon {
    position: relative;
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 50%;
    background: var(--surface-glass);
    border: 1px solid var(--border-glass);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    font-size: 1.1rem;
    outline: none;
    padding: 0;
}

.notification-icon:hover,
.notification-icon[aria-expanded="true"] {
    background: var(--surface-glass-hover);
    border-color: var(--primary-color);
    color: var(--text-primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.15);
}

/* Badge */
.notification-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
    font-size: 0.65rem;
    font-weight: 800;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid rgba(13, 12, 29, 0.8); /* Matches bg-primary approx */
    box-shadow: 0 2px 5px rgba(220, 38, 38, 0.4);
    animation: badge-pop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 10;
}

/* Pulse Animation for Badge */
.notification-icon.has-unread::after {
    content: '';
    position: absolute;
    top: -2px;
    right: -2px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #ef4444;
    z-index: 5;
    animation: pulse-ring 2s cubic-bezier(0.215, 0.61, 0.355, 1) infinite;
}

@keyframes pulse-ring {
    0% { transform: scale(0.8); opacity: 0.8; }
    100% { transform: scale(2.4); opacity: 0; }
}

@keyframes badge-pop {
    0% { transform: scale(0); }
    100% { transform: scale(1); }
}

/* Dropdown Container */
.notification-dropdown {
    position: absolute;
    top: calc(100% + 1rem);
    right: -1rem;
    width: var(--notification-width);
    background: var(--dropdown-bg, #0D0C1D); /* Fallback to dark */
    /* Glass effect */
    background: rgba(13, 12, 29, 0.85); 
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    
    border: 1px solid var(--border-glass);
    border-radius: 16px;
    box-shadow: 
        0 20px 25px -5px rgba(0, 0, 0, 0.3), 
        0 10px 10px -5px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px) scale(0.98);
    transform-origin: top right;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: var(--notification-z-index);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

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

/* Header */
.notification-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-glass);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.02);
}

.notification-header h4 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-headings);
    letter-spacing: -0.01em;
}

.mark-all-read {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.mark-all-read:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--primary-color);
}

/* List */
.notification-list {
    max-height: 480px;
    overflow-y: auto;
    overscroll-behavior: contain;
}

/* Scrollbar Styling */
.notification-list::-webkit-scrollbar {
    width: 6px;
}
.notification-list::-webkit-scrollbar-track {
    background: transparent;
}
.notification-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}
.notification-list::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Notification Item */
.notification-item {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    cursor: pointer;
    transition: background 0.2s;
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* Last item no border */
.notification-item:last-child {
    border-bottom: none;
}

.notification-item:hover {
    background: rgba(255, 255, 255, 0.03);
}

/* Unread State */
.notification-item.unread {
    background: linear-gradient(90deg, rgba(79, 70, 229, 0.05) 0%, transparent 100%);
}

.notification-item.unread:hover {
    background: linear-gradient(90deg, rgba(79, 70, 229, 0.08) 0%, transparent 100%);
}

.notification-item.unread::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--primary-color);
    box-shadow: 2px 0 8px rgba(79, 70, 229, 0.4);
}

/* Content */
.notification-title {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-primary);
    line-height: 1.4;
    padding-right: 1rem; /* Leave space for potential close/actions */
}

.notification-message {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

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

.notification-time {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    font-weight: 500;
}

.notification-link {
    font-size: 0.75rem;
    color: var(--accent-primary);
    text-decoration: none;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    opacity: 0.9;
    transition: all 0.2s;
}

.notification-link:hover {
    opacity: 1;
    transform: translateX(3px);
}

/* Empty State */
.notification-empty {
    padding: 4rem 2rem;
    text-align: center;
    color: var(--text-tertiary);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.notification-empty i {
    font-size: 3rem;
    color: rgba(255, 255, 255, 0.1);
    margin-bottom: 0.5rem;
}

.notification-empty p {
    font-size: 0.95rem;
}

/* Mobile Responsive */
@media (max-width: 640px) {
    .notification-wrapper {
        position: static; /* Allows absolute dropdown to be relative to screen or parent */
    }
    
    .notification-dropdown {
        width: calc(100vw - 2rem);
        right: 1rem;
        left: 1rem;
        top: 60px; /* Adjust based on navbar height */
        max-height: 70vh;
    }
}
