/* User Notifications Styles */

/* Notification Icon */
#notification-icon {
    position: relative;
    padding: 10px 15px;
    color: #333;
    text-decoration: none;
}

#notification-icon:focus,
#notification-icon:hover {
    color: #007bff;
    text-decoration: none;
}

#notification-icon.has-notifications {
    color: #007bff;
}

/* Notification Badge */
.notification-badge {
    position: absolute;
    top: 5px;
    right: 8px;
    background-color: #dc3545;
    color: white;
    border-radius: 50%;
    padding: 2px 6px;
    font-size: 11px;
    font-weight: bold;
    line-height: 1;
    min-width: 18px;
    text-align: center;
    border: 2px solid white;
}

/* Notification Dropdown Menu */
.notification-dropdown-menu {
    width: 350px;
    min-width: 350px;
    max-width: 400px;
    max-height: 400px;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0;
    /* Ensure proper scrolling behavior */
    box-sizing: border-box;
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on mobile */
}

.notification-dropdown-menu .dropdown-header {
    padding: 10px 15px;
    font-weight: bold;
    color: #333;
    border-bottom: 1px solid #eee;
    /* Make header stick to top */
    flex-shrink: 0;
    background-color: #fff;
    position: sticky;
    top: 0;
    z-index: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Close button styling */
.notification-close {
    background: none;
    border: none;
    font-size: 18px;
    color: #999;
    padding: 0;
    margin: 0;
    cursor: pointer;
    line-height: 1;
}

.notification-close:hover {
    color: #333;
}

/* Create a scrollable content container */
.notification-dropdown-content {
    flex: 1;
    overflow-y: auto;
    min-height: 0; /* Allow flexbox to shrink */
}

/* Notification Items in Dropdown */
.notification-item {
    width: 100%;
    display: block;
    float: none;
    /* Remove flex-shrink: 0 to allow proper scrolling */
    flex-shrink: 1;
}

.notification-item a {
    display: block;
    padding: 0;
    color: #333;
    text-decoration: none;
    border-bottom: 1px solid #f5f5f5;
    width: 100%;
}

.notification-item a:hover {
    background-color: #f8f9fa;
    text-decoration: none;
    color: #333;
}

.notification-item-link {
    display: block;
    width: 100%;
    padding: 10px 15px;
    white-space: normal;
    text-decoration: none;
    color: #333;
    border-bottom: 1px solid #f0f0f0;
}

.notification-item-link:hover {
    background-color: #f8f9fa;
    text-decoration: none;
    color: #333;
}

.notification-item-content {
    padding: 12px 15px;
    position: relative;
}

.notification-heading {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 5px;
    cursor: pointer;
    padding: 5px 0;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    line-height: 1.3;
}

.notification-heading:hover {
    color: #007bff;
}

.notification-text {
    font-size: 12px;
    color: #666;
    margin-bottom: 6px;
    line-height: 1.3;
    max-height: 40px;
    overflow: hidden;
}

.notification-content {
    font-size: 13px;
    color: #666;
    line-height: 1.4;
    margin-top: 8px;
    display: none;
    padding: 8px 0;
}

.notification-content.expanded {
    display: block;
    text-wrap: auto;
}

.notification-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
    font-size: 12px;
    color: #999;
    /* Always show the meta (date) */
    opacity: 1;
}

.notification-date {
    font-size: 12px;
    color: #999;
}

.go-to-target {
    background: none;
    border: none;
    color: #007bff;
    font-size: 12px;
    padding: 2px 5px;
    margin-left: 10px;
    opacity: 0.7;
    cursor: pointer;
}

.go-to-target:hover {
    color: #0056b3;
    background-color: transparent;
    opacity: 1;
}

.go-to-target:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.mark-read-inline {
    background: none;
    border: none;
    color: #007bff;
    font-size: 12px;
    padding: 2px 5px;
    margin-left: 10px;
    opacity: 0.7;
}

.mark-read-inline:hover {
    color: #0056b3;
    background-color: transparent;
    opacity: 1;
}

.notification-toggle-icon {
    color: #999;
    font-size: 12px;
    transition: transform 0.2s ease;
}

.notification-toggle-icon.expanded {
    transform: rotate(180deg);
}

/* Loading and Empty States */
.notification-loading a,
.notification-empty a {
    padding: 15px;
    text-align: center;
    color: #999;
    font-style: italic;
}

/* Footer */
.notification-footer {
    text-align: center;
    border-top: 1px solid #eee;
    margin-top: 5px;
    flex-shrink: 0;
    background-color: #fff;
    /* Ensure footer sticks to bottom */
    position: sticky;
    bottom: 0;
}

.notification-footer a {
    display: block;
    padding: 10px 15px;
    text-align: center;
    font-weight: 600;
    color: #007bff;
    background-color: #f8f9fa;
    text-decoration: none;
}

.notification-footer a:hover {
    background-color: #e9ecef;
    text-decoration: none;
}

.notification-empty a {
    color: #999;
    font-style: italic;
}

/* Custom scrollbar styling for webkit browsers */
.notification-dropdown-menu::-webkit-scrollbar {
    width: 6px;
}

.notification-dropdown-menu::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.notification-dropdown-menu::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.notification-dropdown-menu::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .notification-dropdown-menu {
        width: 280px;
        min-width: 280px;
        max-width: 300px;
        max-height: 350px; /* Reduce height on mobile */
        right: 0;
        left: auto;
    }
    
    .notification-item-content {
        padding: 10px 12px;
    }
    
    .notification-heading {
        font-size: 12px;
    }
    
    .notification-text {
        font-size: 11px;
    }
}

@media (max-width: 480px) {
    .notification-dropdown-menu {
        width: 280px;
        min-width: 280px;
        max-width: 280px;
        max-height: 300px; /* Further reduce height on small screens */
    }
}

/* Animation for new notifications */
@keyframes notification-pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.notification-badge.new-notification {
    animation: notification-pulse 0.5s ease-in-out;
}

/* All Notifications Page Styles */
.notifications-list {
    margin-bottom: 20px;
}

/* Notification Section Styling for All Notifications Page */
.notification-section {
    margin-bottom: 25px;
}

.notification-section-header {
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #f0f0f0;
}

.notification-section-header.with-separator {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 3px solid #e9ecef;
}

.section-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #495057;
    display: flex;
    align-items: center;
    gap: 8px;
}

.notification-count-badge {
    background-color: #007bff;
    color: white;
    font-size: 12px;
    padding: 3px 8px;
    border-radius: 12px;
    font-weight: 500;
    margin-left: 8px;
}

.notification-count-badge.read {
    background-color: #28a745;
}

/* Additional styles for All Notifications page */
.notification-item {
    border: 1px solid #ddd;
    border-radius: 5px;
    padding: 15px;
    margin-bottom: 10px;
    background-color: #fff;
    transition: background-color 0.2s ease, box-shadow 0.2s ease, border-left-color 0.3s ease;
}

.notification-item:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.notification-item.unread {
    border-left: 4px solid #007bff;
    background-color: #f8f9fa;
    box-shadow: 0 1px 3px rgba(0,123,255,0.12);
}

.notification-item.read {
    opacity: 0.85;
    background-color: #fff;
    border-left: 4px solid #28a745;
}

.notification-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
}

.notification-header .notification-heading {
    margin: 0;
    font-size: 16px;
    flex-grow: 1;
    border-bottom: none;
    padding: 0;
    cursor: default;
}

.notification-header .notification-heading a {
    color: #333;
    text-decoration: none;
}

.notification-header .notification-heading a:hover {
    text-decoration: underline;
}

.notification-header .notification-date {
    color: #666;
    font-size: 12px;
    white-space: nowrap;
    margin-left: 15px;
}

.notification-content {
    color: #555;
    margin-bottom: 10px;
    line-height: 1.4;
}

.notification-actions {
    text-align: right;
}

.notification-actions .btn {
    margin-left: 8px;
}

.badge {
    margin-left: 8px;
}

.mark-read-btn {
    font-size: 12px;
    padding: 4px 8px;
}

/* Mark All as Read button styling */
.mark-all-read-btn {
    font-size: 14px;
    padding: 8px 16px;
    margin-left: 20px;
}

.panel-heading-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

@media (max-width: 768px) {
    .notification-header {
        flex-direction: column;
    }

    .notification-header .notification-date {
        margin-left: 0;
        margin-top: 5px;
    }

    .panel-heading-content {
        flex-direction: column;
        align-items: flex-start;
    }

    .mark-all-read-btn {
        margin-left: 0;
        margin-top: 10px;
    }

    .notification-actions {
        text-align: left;
    }

    .section-title {
        font-size: 16px;
    }

    .notification-section-header.with-separator {
        margin-top: 20px;
        padding-top: 15px;
    }
}

@media (max-width: 480px) {
    .section-title {
        font-size: 15px;
    }
}

.notifications-dashboard {
    margin-bottom: 30px;
}

    .notifications-dashboard .panel-heading-content {
        display: flex;
        justify-content: space-between;
        align-items: center;
        width: 100%;
    }

    .notifications-dashboard .mark-all-read-btn {
        margin-left: 20px;
        font-size: 14px;
        padding: 8px 16px;
    }

    .notifications-dashboard .notifications-list {
        margin-bottom: 20px;
    }

    /* Notification Section Styling */
    .notifications-dashboard .notification-section {
        margin-bottom: 25px;
    }

    .notifications-dashboard .notification-section-header {
        margin-bottom: 15px;
        padding-bottom: 10px;
        border-bottom: 2px solid #f0f0f0;
    }

        .notifications-dashboard .notification-section-header.with-separator {
            margin-top: 30px;
            padding-top: 20px;
            border-top: 3px solid #e9ecef;
        }

    .notifications-dashboard .section-title {
        margin: 0;
        font-size: 18px;
        font-weight: 600;
        color: #495057;
        display: flex;
        align-items: center;
        gap: 8px;
    }

    .notifications-dashboard .notification-count-badge {
        background-color: #007bff;
        color: white;
        font-size: 12px;
        padding: 3px 8px;
        border-radius: 12px;
        font-weight: 500;
        margin-left: 8px;
    }

        .notifications-dashboard .notification-count-badge.read {
            background-color: #28a745;
        }

    .notifications-dashboard .notification-item {
        border: 1px solid #ddd;
        border-radius: 5px;
        padding: 20px;
        margin-bottom: 15px;
        background-color: #fff;
        transition: all 0.2s ease;
        position: relative;
    }

        .notifications-dashboard .notification-item:hover {
            box-shadow: 0 2px 8px rgba(0,0,0,0.1);
        }

        .notifications-dashboard .notification-item.unread {
            border-left: 4px solid #007bff;
            background-color: #f8f9fa;
            box-shadow: 0 1px 3px rgba(0,123,255,0.12);
        }

        .notifications-dashboard .notification-item.read {
            opacity: 0.85;
            background-color: #fff;
            border-left: 4px solid #28a745;
        }

    .notifications-dashboard .notification-header {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        margin-bottom: 12px;
    }

    .notifications-dashboard .notification-heading {
        margin: 0;
        font-size: 18px;
        font-weight: 600;
        flex-grow: 1;
        line-height: 1.3;
        color: #333;
    }

    .notifications-dashboard .notification-date {
        color: #666;
        font-size: 13px;
        white-space: nowrap;
        margin-left: 20px;
        font-weight: 500;
    }

    .notifications-dashboard .notification-content {
        color: #555;
        margin-bottom: 15px;
        line-height: 1.5;
        font-size: 14px;
        /* Always display content */
        display: block;
    }

    .notifications-dashboard .notification-actions {
        text-align: right;
        margin-top: 10px;
    }

        .notifications-dashboard .notification-actions .btn {
            margin-left: 8px;
        }

    .notifications-dashboard .badge {
        margin-left: 10px;
        font-size: 11px;
        padding: 4px 8px;
    }

    .notifications-dashboard .mark-read-btn {
        font-size: 13px;
        padding: 6px 12px;
        border-radius: 3px;
    }

        .notifications-dashboard .mark-read-btn:hover {
            background-color: #6c757d;
        }

    .notifications-dashboard .pagination {
        justify-content: center;
        margin-top: 30px;
    }

        .notifications-dashboard .pagination .page-link {
            color: #007bff;
            border-color: #dee2e6;
            padding: 8px 16px;
        }

        .notifications-dashboard .pagination .page-item.active .page-link {
            background-color: #007bff;
            border-color: #007bff;
        }

        .notifications-dashboard .pagination .page-link:hover {
            color: #0056b3;
            background-color: #e9ecef;
        }

/* Mobile responsiveness */
@media (max-width: 768px) {
    .notifications-dashboard .panel-heading-content {
        flex-direction: column;
        align-items: flex-start;
    }

    .notifications-dashboard .mark-all-read-btn {
        margin-left: 0;
        margin-top: 10px;
    }

    .notifications-dashboard .notification-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .notifications-dashboard .notification-date {
        margin-left: 0;
        margin-top: 8px;
        font-size: 12px;
    }

    .notifications-dashboard .notification-heading {
        font-size: 16px;
    }

    .notifications-dashboard .notification-item {
        padding: 15px;
    }

    .notifications-dashboard .pagination .page-link {
        padding: 6px 12px;
        font-size: 14px;
    }

    .notifications-dashboard .notification-actions {
        text-align: left;
    }

    .notifications-dashboard .section-title {
        font-size: 16px;
    }

    .notifications-dashboard .notification-section-header.with-separator {
        margin-top: 20px;
        padding-top: 15px;
    }
}

@media (max-width: 480px) {
    .notifications-dashboard .notification-item {
        margin-bottom: 10px;
        padding: 12px;
    }

    .notifications-dashboard .notification-heading {
        font-size: 15px;
    }

    .notifications-dashboard .notification-content {
        font-size: 13px;
    }

    .notifications-dashboard .section-title {
        font-size: 15px;
    }
}