/* تنسيقات نظام الإشعارات */

/* جرس الإشعارات */
#notification-bell {
    position: relative;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.3s;
}

#notification-bell:hover {
    background: rgba(0,0,0,0.05);
}

#notification-badge {
    position: absolute;
    top: 5px;
    right: 5px;
    background: #dc3545;
    color: white;
    font-size: 10px;
    font-weight: bold;
    padding: 2px 5px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}

/* Toast عالي الأولوية للتذاكر المحولة */
.urgent-notification-toast {
    z-index: 99999 !important;
}

.urgent-notification-toast .swal2-popup {
    background: linear-gradient(135deg, #ffeaa7 0%, #fdcb6e 100%) !important;
    border: 2px solid #e17055 !important;
    border-radius: 15px !important;
    animation: urgentPulse 0.8s ease-in-out !important;
}

.urgent-notification-toast .swal2-title {
    color: #2d3436 !important;
    font-weight: 600 !important;
}

.urgent-notification-toast .swal2-content {
    color: #2d3436 !important;
}

.urgent-notification-toast .swal2-confirm {
    background: #e17055 !important;
    border: none !important;
    border-radius: 8px !important;
    font-weight: 600 !important;
}

@keyframes urgentPulse {
    0% {
        transform: scale(0.8);
        opacity: 0;
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* قائمة الإشعارات المنسدلة */
#notification-dropdown {
    position: absolute;
    top: 100%;
    left: auto;
    right: 0;
    width: 400px;
    max-width: 95vw;
    max-height: 600px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    display: none;
    flex-direction: column;
    z-index: 9999;
    margin-top: 8px;
}

/* تعديل الموضع للشاشات الصغيرة */
@media (max-width: 768px) {
    #notification-dropdown {
        position: fixed;
        top: 70px;
        left: auto;
        right: 5px;
        width: 350px;
        max-width: calc(100vw - 10px);
    }
}

/* تعديل للغة العربية RTL */
[dir="rtl"] #notification-dropdown,
html[lang="ar"] #notification-dropdown {
    left: auto;
    right: 0;
}

@media (max-width: 768px) {
    [dir="rtl"] #notification-dropdown,
    html[lang="ar"] #notification-dropdown {
        left: 5px;
        right: auto;
    }
}

#notification-dropdown.show {
    display: flex;
}

.notification-header {
    padding: 16px 20px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.notification-header h5 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.notification-header-actions {
    display: flex;
    gap: 8px;
}

.notification-header-btn {
    background: none;
    border: none;
    color: #007bff;
    cursor: pointer;
    font-size: 13px;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s;
}

.notification-header-btn:hover {
    background: rgba(0,123,255,0.1);
}

#notifications-list {
    max-height: 500px;
    overflow-y: auto;
}

.notification-item {
    padding: 12px 20px;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    gap: 12px;
    align-items: start;
    cursor: pointer;
    transition: background 0.2s;
    position: relative;
}

.notification-item:hover {
    background: #f8f9fa;
}

.notification-item.unread {
    background: #f0f7ff;
}

.notification-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.notification-icon.primary { background: #e3f2fd; color: #1976d2; }
.notification-icon.success { background: #e8f5e9; color: #388e3c; }
.notification-icon.warning { background: #fff3e0; color: #f57c00; }
.notification-icon.danger { background: #ffebee; color: #d32f2f; }
.notification-icon.info { background: #e1f5fe; color: #0288d1; }
.notification-icon.secondary { background: #f5f5f5; color: #757575; }

.notification-content {
    flex: 1;
}

.notification-title {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 4px;
    color: #212529;
}

.notification-message {
    font-size: 13px;
    color: #666;
    line-height: 1.4;
    margin-bottom: 4px;
}

.notification-time {
    font-size: 12px;
    color: #999;
}

.notification-dot {
    width: 8px;
    height: 8px;
    background: #007bff;
    border-radius: 50%;
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
}

.notification-empty {
    padding: 40px 20px;
    text-align: center;
    color: #999;
    font-size: 14px;
}

.notification-footer {
    padding: 12px 20px;
    border-top: 1px solid #e0e0e0;
    text-align: center;
}

.notification-footer a {
    color: #007bff;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    display: block;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s;
}

.notification-footer a:hover {
    background: rgba(0,123,255,0.1);
    color: #0056b3;
}

/* التأكد من عدم خروج القائمة من الشاشة */
.notification-bell-wrapper {
    position: relative !important;
    overflow: visible !important;
}

.navbar-actions {
    overflow: visible !important;
}

nav, .navbar, header {
    overflow: visible !important;
}

/* منع التمرير في الخلفية عند فتح الإشعارات على الموبايل */
@media (max-width: 768px) {
    body.notification-open {
        overflow: hidden;
    }
    
    #notification-dropdown.show::before {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.3);
        z-index: -1;
    }
}

/* Toast الإشعارات */
.notification-toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 350px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    display: flex;
    gap: 12px;
    padding: 16px;
    z-index: 10000;
    transform: translateX(400px);
    opacity: 0;
    transition: all 0.3s;
}

.notification-toast.show {
    transform: translateX(0);
    opacity: 1;
}

.notification-toast.primary { border-left: 4px solid #007bff; }
.notification-toast.success { border-left: 4px solid #28a745; }
.notification-toast.warning { border-left: 4px solid #ffc107; }
.notification-toast.danger { border-left: 4px solid #dc3545; }
.notification-toast.info { border-left: 4px solid #17a2b8; }

.toast-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.notification-toast.primary .toast-icon { background: #e3f2fd; color: #007bff; }
.notification-toast.success .toast-icon { background: #e8f5e9; color: #28a745; }
.notification-toast.warning .toast-icon { background: #fff3e0; color: #ffc107; }
.notification-toast.danger .toast-icon { background: #ffebee; color: #dc3545; }
.notification-toast.info .toast-icon { background: #e1f5fe; color: #17a2b8; }

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 600;
    font-size: 15px;
    margin-bottom: 4px;
}

.toast-message {
    font-size: 13px;
    color: #666;
}

.toast-close {
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    font-size: 20px;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}

.toast-close:hover {
    background: rgba(0,0,0,0.05);
    color: #666;
}

/* تحسينات للموبايل */
@media (max-width: 768px) {
    #notification-dropdown {
        position: fixed !important;
        top: 60px !important;
        left: 8px !important;
        right: 8px !important;
        width: auto !important;
        max-width: none !important;
        margin: 0 !important;
        border-radius: 12px;
        max-height: calc(100vh - 80px);
    }
    
    .notification-header {
        padding: 12px 16px;
    }
    
    .notification-header h5 {
        font-size: 16px;
    }
    
    .notification-item {
        padding: 10px 16px;
    }
    
    .notification-icon {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }
}

/* استجابة للشاشات الصغيرة جداً */
@media (max-width: 480px) {
    #notification-dropdown {
        top: 56px !important;
        left: 6px !important;
        right: 6px !important;
        max-height: calc(100vh - 70px);
    }
    
    .notification-header {
        padding: 10px 12px;
    }
    
    .notification-header h5 {
        font-size: 14px;
    }
    
    .notification-header-btn {
        font-size: 11px;
        padding: 3px 6px;
    }
    
    .notification-item {
        padding: 8px 12px;
    }
    
    .notification-content .notification-title {
        font-size: 13px;
    }
    
    .notification-content .notification-message {
        font-size: 11px;
    }
    
    .notification-time {
        font-size: 10px;
    }
    
    .notification-toast {
        width: calc(100vw - 20px);
        right: 10px;
        left: 10px;
        margin: 0;
    }
}
