﻿/* Enhanced Notification System Styles */

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(400px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideUpFromBottom {
    from {
        opacity: 0;
        transform: translateY(100%);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Notification Bell Container */
.notification-container {
    position: relative;
    display: flex;
    align-items: center;
    z-index: 100;
}

/* Default: hide the mobile-only close button */
#notif-close-btn { display: none; }

/* Notification Toast Animations */
.notification-toast {
    transition: all 0.3s ease;
}

/* Backdrop used for mobile notification modal */
#notification-modal-backdrop {
    position: fixed;
    inset: 0; /* shorthand for top:0; right:0; bottom:0; left:0 */
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000001;
    animation: fadeIn 0.3s ease;
}

.notification-toast:hover {
    transform: translateX(-5px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
}

/* ============================================
   DESKTOP DROPDOWN (> 768px)
   ============================================ */

#notification-dropdown {
    position: absolute;
    top: 140%;
    right: 0;
    width: 450px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    display: none;
    z-index: 10000002;
    overflow: hidden;
    border: 1px solid #e5e7eb;
}

/* Notification Dropdown Scrollbar */
#notification-list::-webkit-scrollbar {
    width: 6px;
}

#notification-list::-webkit-scrollbar-track {
    background: #f1f1f1;
}

#notification-list::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 10px;
}

#notification-list::-webkit-scrollbar-thumb:hover {
    background: #5568d3;
}

/* Notification Item Styles */
.notif-item {
    transition: all 0.2s ease;
    border-bottom: 1px solid #f0f0f0;
    padding: 16px;
    cursor: pointer;
}

.notif-item:last-child {
    border-bottom: none !important;
}

.notif-item:hover {
    background: #f9fafb;
}

.notif-item:active {
    transform: scale(0.98);
}

.notif-item p {
    margin: 0;
    font-size: 0.95rem;
    line-height: 1.5;
    color: #333;
}

.notif-item-time {
    font-size: 0.75rem;
    color: #999;
    margin-top: 4px;
}

/* ============================================
   MOBILE MODAL (≤ 768px)
   ============================================ */

@media (max-width: 768px) {
    /* Hide desktop dropdown completely */
    /* Modal with reduced footprint on mobile: centered and not fullscreen */
    #notification-dropdown {
        position: fixed !important;
        top: 10vh !important; /* small offset from top */
        left: 6% !important;
        right: 6% !important;
        bottom: auto !important;
        width: auto !important;
        height: auto !important;
        max-width: 88% !important;
        max-height: 72vh !important;
        border-radius: 12px !important;
        display: none;
        flex-direction: column;
        z-index: 10000002 !important;
        background: white !important;
        border: 1px solid #e5e7eb !important;
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15) !important;
        animation: slideUpFromBottom 0.3s ease !important;
    }

    /* Show as flex when displayed */
    #notification-dropdown[style*="display: block"] {
        display: flex !important;
    }

    /* Modal Header */
    #notification-dropdown > div:first-child {
        background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%) !important;
        color: white !important;
        padding: 20px !important;
        font-size: 1.2rem !important;
        font-weight: 600 !important;
        flex-shrink: 0;
        border-bottom: none !important;
    }

    /* Close button for mobile modal header */
    #notif-close-btn {
        display: block !important;
        color: white !important;
        font-size: 1.0rem !important;
        margin-left: 8px !important;
        cursor: pointer !important;
    }

    /* Modal Body - Scrollable Content */
    #notification-list {
        flex: 1;
        overflow-y: auto;
        max-height: calc(72vh - 120px) !important; /* 72vh minus header/footer approx */
        padding: 0 !important;
        -webkit-overflow-scrolling: touch; /* smoother scrolling on iOS/Android */
    }

    .notif-item {
        padding: 16px 16px !important;
        border-bottom: 1px solid #e5e7eb !important;
        margin: 0 !important;
        background: white !important;
    }

    .notif-item p {
        font-size: 0.95rem !important;
        line-height: 1.5 !important;
    }

    /* Modal Footer - Close Button Area */
    #notification-dropdown > div:last-child {
        background: #f9fafb !important;
        padding: 16px !important;
        border-top: 1px solid #e5e7eb !important;
        flex-shrink: 0;
        text-align: center;
    }

    /* Ensure bell is visible on mobile */
    .nav-right {
        display: flex !important;
        margin-left: auto;
        margin-right: 0.5rem;
    }

    .notification-container {
        display: flex !important;
        margin-right: 0 !important;
        position: relative;
        z-index: 100;
    }

    .notification-toast {
        right: 10px !important;
        left: 10px !important;
        max-width: calc(100vw - 20px) !important;
        top: 80px !important;
    }
}

/* ============================================
   SMALL MOBILE (≤ 480px)
   ============================================ */

@media (max-width: 480px) {
    .notification-container {
        margin-right: 8px !important;
    }

    #notification-dropdown {
        width: auto !important;
        max-width: 94% !important;
        top: 8vh !important;
        max-height: 70vh !important;
        border-radius: 12px !important;
        right: 3% !important;
        left: 3% !important;
    }

    .notif-item {
        padding: 12px 12px !important;
    }

    .notif-item p {
        font-size: 0.9rem !important;
    }
}

/* Loading state for notifications */
.notification-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 30px;
    color: #9ca3af;
}

.notification-loading::after {
    content: '';
    width: 30px;
    height: 30px;
    border: 3px solid #e5e7eb;
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Notification Types Color Coding */
.notif-type-content_generated {
    border-left-color: #8b5cf6 !important;
}

.notif-type-schedule_reminder {
    border-left-color: #3b82f6 !important;
}

.notif-type-community_update {
    border-left-color: #f59e0b !important;
}

.notif-type-app_update {
    border-left-color: #10b981 !important;
}

.notif-type-enrollment_success {
    border-left-color: #667eea !important;
}

.notif-type-holiday_celebration {
    border-left-color: #ec4899 !important;
}

/* Empty state illustration */
.notification-empty-state {
    padding: 40px 20px;
    text-align: center;
    color: #9ca3af;
}

.notification-empty-state i {
    font-size: 3rem;
    margin-bottom: 12px;
    opacity: 0.5;
}