/* Notification Bell System - Shared Styles */

/* Notification Bell */
.notification-bell {
    position: relative;
    display: inline-block;
}

.bell-button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    position: relative;
    transition: transform 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.bell-button:hover {
    transform: scale(1.1);
}

.bell-button svg {
    width: 24px;
    height: 24px;
    fill: white;
    transition: fill 0.2s ease;
}

.bell-button.open svg {
    fill: #F59E0B;
}

.notification-badge {
    position: absolute;
    top: 0.25rem;
    right: 0.25rem;
    background-color: #EF4444;
    color: white;
    border-radius: 50%;
    min-width: 1.25rem;
    height: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 800; /* Extra bold for legibility */
    padding: 0 0.25rem;
    box-shadow: 0 2px 4px rgba(239, 68, 68, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.3); /* Red glow + white border for contrast */
    z-index: 10;
    line-height: 1;
    letter-spacing: -0.3px; /* Tighter spacing for numbers */
}

/* Notification Dropdown */
.notification-dropdown {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    width: 380px;
    max-height: 500px;
    background: #1f1748;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 1rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    z-index: 9999;
    display: none;
    flex-direction: column;
}

/* Desktop: Ensure proper positioning context */
@media (min-width: 768px) {
    .notification-dropdown {
        /* Reset base positioning - will be overridden by .nav-notification-bell .notification-dropdown */
    }
}

.notification-dropdown.open {
    display: flex;
}

.notification-header {
    padding: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.notification-header h3 {
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-semibold);
    margin: 0;
    color: var(--color-text);
}

.mark-all-read {
    background: none;
    border: none;
    color: #F59E0B;
    font-size: 0.85rem;
    cursor: pointer;
    font-weight: 500;
    padding: 0.25rem 0.5rem;
}

.mark-all-read:hover {
    text-decoration: underline;
}

.notification-list {
    flex: 1;
    overflow-y: auto;
    max-height: 360px;
}

.notification-item {
    padding: 1rem 1.25rem; /* Reduced vertical padding, slightly more horizontal */
    border-bottom: 1px solid rgba(255, 255, 255, 0.08); /* Subtler border */
    cursor: pointer;
    transition: background 0.2s ease;
    position: relative; /* For positioning close button */
}

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

.notification-close-btn {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    background: rgba(255, 255, 255, 0.15) !important;
    border: 1px solid rgba(255, 255, 255, 0.3) !important;
    color: rgba(255, 255, 255, 0.8) !important;
    cursor: pointer !important;
    padding: 0 !important;
    line-height: 1 !important;
    border-radius: 0.25rem !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.2s ease !important;
    z-index: 10 !important; /* Ensure it's above everything */
    font-size: 1.4rem !important;
    font-weight: 700 !important;
    width: 28px !important;
    height: 28px !important;
    min-width: 28px !important;
    min-height: 28px !important;
}

.notification-close-btn:hover {
    background: rgba(255, 255, 255, 0.25) !important;
    color: rgba(255, 255, 255, 1) !important;
    border-color: rgba(255, 255, 255, 0.5) !important;
    transform: scale(1.1) !important;
}

.notification-item.unread {
    background: rgba(245, 158, 11, 0.1);
}

.notification-item.read {
    opacity: 0.7;
}

.notification-content {
    margin-bottom: 0.375rem; /* Reduced spacing */
    padding-right: 2.5rem; /* Space for close button */
}

.notification-title {
    font-weight: var(--font-weight-semibold);
    font-size: var(--font-size-base) !important; /* Match Home page daily-tip-content */
    margin-bottom: 0.375rem; /* Reduced spacing */
    line-height: var(--line-height-normal);
}

.notification-message {
    font-size: var(--font-size-sm) !important; /* Match Home page subtext sizes */
    color: rgba(255, 255, 255, 0.8);
    line-height: var(--line-height-normal);
}

.notification-footer-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.375rem; /* Reduced spacing */
}

.notification-time {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.5);
}

.notification-action-btn {
    background: #EC4899;
    color: white;
    border: none;
    padding: 0.4rem 0.8rem;
    border-radius: 0.5rem;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease;
}

.notification-action-btn:hover {
    background: #DB2777;
}

.notification-dropdown-footer {
    padding: 0.75rem 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
}

.view-all-link {
    color: #F59E0B;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
}

.view-all-link:hover {
    text-decoration: underline;
}

.notification-empty {
    padding: 3rem 2rem;
    text-align: center;
    color: rgba(255, 255, 255, 0.6);
}

.notification-empty-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

/* Desktop: Proper positioning relative to nav-notification-bell */
@media (min-width: 768px) {
    /* Ensure nav-notification-bell is positioned relative for dropdown positioning */
    .nav-top .nav-notification-bell {
        position: relative !important;
    }
    
    /* Position dropdown absolutely relative to nav-notification-bell */
    .nav-top .nav-notification-bell .notification-dropdown {
        position: absolute !important;
        top: calc(100% + 0.5rem) !important;
        right: 0 !important;
        left: auto !important;
        width: 380px !important;
        max-width: calc(100vw - var(--space-4) * 2) !important;
        z-index: 1999 !important; /* Just above nav (1998) */
        transform: none !important;
        margin: 0 !important;
    }
    
    /* Ensure dropdown doesn't get cut off by overflow */
    .nav-top .nav-top-menu {
        overflow: visible !important;
    }
    
    .nav-top .nav-top-container {
        overflow: visible !important;
    }
    
    /* Override any conflicting styles from page-specific CSS */
    body .nav-top .nav-notification-bell .notification-dropdown {
        position: absolute !important;
        top: calc(100% + 0.5rem) !important;
    }
}

/* Mobile Full-Screen Dropdown */
@media (max-width: 767px) {
    .notification-dropdown {
        position: fixed;
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        max-height: 80vh;
        border-radius: 1rem 1rem 0 0;
        animation: slideUp 0.3s ease;
    }

    @keyframes slideUp {
        from {
            transform: translateY(100%);
        }
        to {
            transform: translateY(0);
        }
    }
}
