/**
 * Notification System - Phase 2: Styles
 * Top navigation bell icon and dropdown styling
 */

/* Top header bar (new addition to layout) */
.crm-top-header {
    background: #ffffff;
    border-bottom: 1px solid #e5e7eb;
    padding: 0.75rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.crm-top-header-left {
    flex: 1;
}

.crm-top-header-right {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

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

.notification-bell {
    position: relative;
    display: inline-block;
    color: #ffffff;
    font-size: 1.25rem;
    cursor: pointer;
    transition: color 0.2s ease;
    text-decoration: none;
}

.notification-bell:hover {
    color: #e5e7eb;
}

.notification-bell.has-unread {
    color: #ffffff;
}

/* Notification badge (unread count) */
.notification-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #2a5298;
    color: #ffffff;
    font-size: 0.75rem;
    font-weight: 600;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Notification dropdown container */
.notification-dropdown {
    min-width: 400px;
    max-width: 400px;
    max-height: 500px;
    border: 1px solid #e5e7eb;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    border-radius: 0.5rem;
    padding: 0;
}

/* Dropdown header */
.notification-dropdown-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #e5e7eb;
    background: #f9fafb;
}

.notification-dropdown-header h6 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: #111827;
}

.view-all-link {
    font-size: 0.875rem;
    color: #2a5298;
    text-decoration: none;
    font-weight: 500;
}

.view-all-link:hover {
    color: #1e3c72;
    text-decoration: underline;
}

/* Dropdown list */
.notification-dropdown-list {
    max-height: 350px;
    overflow-y: auto;
    padding: 0;
}

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

.notification-dropdown-list::-webkit-scrollbar-track {
    background: #f3f4f6;
}

.notification-dropdown-list::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
}

.notification-dropdown-list::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* Individual notification item */
.notification-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    cursor: pointer;
    transition: background-color 0.2s ease;
    position: relative;
    border-bottom: 1px solid #f3f4f6;
    background-color: #ffffff !important; /* Force white background */
}

.notification-item:last-child {
    border-bottom: none;
}

.notification-item:hover {
    background-color: #f9fafb !important; /* Force gray on hover */
}

.notification-item.unread {
    background-color: #ffffff !important; /* Force white for unread */
}

.notification-item.unread:hover {
    background-color: #f9fafb !important; /* Force gray on hover */
}

/* Notification icon */
.notification-icon {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 1rem;
}

/* Category-specific colors */
.notification-icon.bg-success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.notification-icon.bg-info {
    background: linear-gradient(135deg, #2a5298 0%, #1e3c72 100%);
}

.notification-icon.bg-warning {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

.notification-icon.bg-danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

.notification-icon.bg-secondary {
    background: linear-gradient(135deg, #6b7280 0%, #4b5563 100%);
}

.notification-icon.bg-primary {
    background: linear-gradient(135deg, #2a5298 0%, #1e3c72 100%);
}

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

.notification-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: #111827 !important;
    margin-bottom: 0.25rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.notification-message {
    font-size: 0.8125rem;
    color: #374151 !important;
    margin-bottom: 0.25rem;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-height: 1.4;
}

.notification-time {
    font-size: 0.75rem;
    color: #6b7280 !important;
}

/* Unread dot indicator */
.notification-unread-dot {
    position: absolute;
    top: 50%;
    right: 1rem;
    transform: translateY(-50%);
    width: 8px;
    height: 8px;
    background: #2a5298;
    border-radius: 50%;
}

/* Dropdown footer */
.notification-dropdown-footer {
    padding: 0.75rem 1rem;
    border-top: 1px solid #e5e7eb;
    background: #f9fafb;
    text-align: center;
}

.mark-all-read-btn {
    font-size: 0.875rem;
    color: #2563eb;
    text-decoration: none;
    font-weight: 500;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
}

.mark-all-read-btn:hover {
    color: #1d4ed8;
    text-decoration: underline;
}

/* Empty state */
.notification-empty-state {
    text-align: center;
    padding: 2rem 1rem;
    color: #9ca3af;
}

.notification-empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    display: block;
    opacity: 0.5;
}

/* Loading state */
.notification-loading {
    text-align: center;
    padding: 2rem 1rem;
}

/* Animations */
.notification-item {
    animation: slideInRight 0.2s ease;
}

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

/* Badge pulse animation */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

.notification-badge {
    animation: pulse 2s ease-in-out infinite;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .notification-dropdown {
        min-width: 100vw;
        max-width: 100vw;
        border-radius: 0;
        border-left: none;
        border-right: none;
    }
    
    .notification-dropdown-list {
        max-height: calc(100vh - 150px);
    }
    
    .crm-top-header {
        padding: 0.5rem 1rem;
    }
    
    .crm-top-header-right {
        gap: 1rem;
    }
    
    .notification-bell {
        font-size: 1.125rem;
    }
}

/* Accessibility */
.notification-bell:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
    border-radius: 0.25rem;
}

.notification-item:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: -2px;
}

/* Dark mode support (optional future enhancement) */
@media (prefers-color-scheme: dark) {
    .crm-top-header {
        background: #1f2937;
        border-bottom-color: #374151;
    }
    
    .notification-bell {
        color: #d1d5db;
    }
    
    .notification-bell:hover {
        color: #f3f4f6;
    }
    
    .notification-dropdown {
        background: #1f2937;
        border-color: #374151;
    }
    
    .notification-dropdown-header {
        background: #111827;
        border-bottom-color: #374151;
    }
    
    .notification-dropdown-header h6 {
        color: #f3f4f6;
    }
    
    .notification-item {
        border-bottom-color: #374151;
    }
    
    .notification-item:hover {
        background-color: #374151;
    }
    
    .notification-item.unread {
        background-color: #1e3a8a;
    }
    
    .notification-title {
        color: #f3f4f6;
    }
    
    .notification-message {
        color: #d1d5db;
    }
}
