/**
 * أنماط نظام الإشعارات المتطور
 * Advanced Notifications System Styles
 */

/* حاوية الإشعارات الرئيسية */
.notifications-container {
    position: fixed;
    z-index: 10000;
    max-width: 400px;
    width: 100%;
    pointer-events: none;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    direction: rtl;
}

/* مواقع الإشعارات */
.notifications-container.position-top-left {
    top: 20px;
    left: 20px;
}

.notifications-container.position-top-right {
    top: 20px;
    right: 20px;
}

.notifications-container.position-bottom-left {
    bottom: 20px;
    left: 20px;
}

.notifications-container.position-bottom-right {
    bottom: 20px;
    right: 20px;
}

.notifications-container.position-bottom-center {
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
}

/* الإشعار الفردي */
.kooralive-notification {
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.95), rgba(30, 30, 30, 0.95));
    backdrop-filter: blur(20px);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 15px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    pointer-events: all;
    position: relative;
    overflow: hidden;
    transform: translateX(100%);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    min-height: 80px;
    display: flex;
    align-items: center;
    gap: 15px;
}

/* تأثيرات الظهور */
.kooralive-notification.show {
    transform: translateX(0);
    opacity: 1;
}

.kooralive-notification.hide {
    transform: translateX(100%);
    opacity: 0;
    margin-bottom: 0;
    padding-top: 0;
    padding-bottom: 0;
    min-height: 0;
}

/* أنواع الإشعارات */
.kooralive-notification.type-success {
    border-left: 4px solid #4CAF50;
    background: linear-gradient(135deg, rgba(76, 175, 80, 0.1), rgba(0, 0, 0, 0.95));
}

.kooralive-notification.type-error {
    border-left: 4px solid #f44336;
    background: linear-gradient(135deg, rgba(244, 67, 54, 0.1), rgba(0, 0, 0, 0.95));
}

.kooralive-notification.type-warning {
    border-left: 4px solid #ff9800;
    background: linear-gradient(135deg, rgba(255, 152, 0, 0.1), rgba(0, 0, 0, 0.95));
}

.kooralive-notification.type-info {
    border-left: 4px solid #2196F3;
    background: linear-gradient(135deg, rgba(33, 150, 243, 0.1), rgba(0, 0, 0, 0.95));
}

/* الأولوية */
.kooralive-notification.priority-3 {
    animation: priority-pulse 2s infinite;
    box-shadow: 0 10px 40px rgba(244, 67, 54, 0.4);
}

.kooralive-notification.priority-2 {
    box-shadow: 0 10px 40px rgba(255, 152, 0, 0.2);
}

/* أيقونة الإشعار */
.notification-icon {
    font-size: 2rem;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
}

/* محتوى الإشعار */
.notification-content {
    flex: 1;
    min-width: 0;
}

.notification-title {
    color: #fff;
    font-size: 1.1rem;
    font-weight: bold;
    margin-bottom: 5px;
    line-height: 1.3;
}

.notification-message {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9rem;
    line-height: 1.4;
    margin-bottom: 10px;
}

/* إجراءات الإشعار */
.notification-actions {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.notification-action-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.notification-action-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.notification-action-btn.primary {
    background: #4CAF50;
    border-color: #4CAF50;
}

.notification-action-btn.primary:hover {
    background: #45a049;
}

/* زر الإغلاق */
.notification-close {
    position: absolute;
    top: 10px;
    left: 10px;
    width: 24px;
    height: 24px;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.6);
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.notification-close:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    transform: scale(1.1);
}

/* شريط التقدم */
.notification-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: linear-gradient(90deg, #4CAF50, #45a049);
    border-radius: 0 0 16px 16px;
    transition: width linear;
}

.notification-progress.type-success {
    background: linear-gradient(90deg, #4CAF50, #45a049);
}

.notification-progress.type-error {
    background: linear-gradient(90deg, #f44336, #d32f2f);
}

.notification-progress.type-warning {
    background: linear-gradient(90deg, #ff9800, #f57c00);
}

.notification-progress.type-info {
    background: linear-gradient(90deg, #2196F3, #1976D2);
}

/* نافذة طلب الإذن */
.notification-permission-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    direction: rtl;
}

.notification-permission-modal.show {
    opacity: 1;
    visibility: visible;
}

.permission-modal-content {
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.95), rgba(30, 30, 30, 0.95));
    backdrop-filter: blur(20px);
    border-radius: 20px;
    padding: 40px;
    max-width: 400px;
    width: 90%;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    transform: scale(0.8);
    transition: transform 0.3s ease;
}

.notification-permission-modal.show .permission-modal-content {
    transform: scale(1);
}

.permission-icon {
    font-size: 4rem;
    margin-bottom: 20px;
    opacity: 0.8;
}

.permission-modal-content h3 {
    color: #fff;
    font-size: 1.5rem;
    margin-bottom: 15px;
    font-weight: bold;
}

.permission-modal-content p {
    color: rgba(255, 255, 255, 0.8);
    font-size: 1rem;
    line-height: 1.5;
    margin-bottom: 30px;
}

.permission-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.permission-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 100px;
}

.permission-btn.allow-btn {
    background: #4CAF50;
    color: #fff;
}

.permission-btn.allow-btn:hover {
    background: #45a049;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(76, 175, 80, 0.4);
}

.permission-btn.deny-btn {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.permission-btn.deny-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

/* تحديث عداد الإشعارات في الهيدر */
.notification-bell {
    position: relative;
    display: inline-block;
}

.notification-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #f44336;
    color: #fff;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 0.7rem;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: notification-bounce 0.6s ease-in-out;
    min-width: 20px;
    padding: 0 4px;
}

.notification-badge.hidden {
    display: none;
}

/* تأثيرات الحركة */
@keyframes priority-pulse {
    0%, 100% {
        box-shadow: 0 10px 40px rgba(244, 67, 54, 0.4);
    }
    50% {
        box-shadow: 0 10px 40px rgba(244, 67, 54, 0.8);
    }
}

@keyframes notification-bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-5px);
    }
    60% {
        transform: translateY(-3px);
    }
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

@keyframes slideInLeft {
    from {
        transform: translateX(-100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutLeft {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(-100%);
        opacity: 0;
    }
}

@keyframes slideInUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes slideOutDown {
    from {
        transform: translateY(0);
        opacity: 1;
    }
    to {
        transform: translateY(100%);
        opacity: 0;
    }
}

/* تحسينات للأجهزة المحمولة */
@media (max-width: 768px) {
    .notifications-container {
        max-width: calc(100% - 20px);
        left: 10px !important;
        right: 10px !important;
        transform: none !important;
    }
    
    .kooralive-notification {
        padding: 15px;
        border-radius: 12px;
    }
    
    .notification-icon {
        width: 40px;
        height: 40px;
        font-size: 1.5rem;
    }
    
    .notification-title {
        font-size: 1rem;
    }
    
    .notification-message {
        font-size: 0.85rem;
    }
    
    .notification-actions {
        flex-direction: column;
        gap: 8px;
    }
    
    .notification-action-btn {
        justify-content: center;
        padding: 10px 16px;
    }
    
    .permission-modal-content {
        padding: 30px 20px;
        margin: 20px;
    }
    
    .permission-buttons {
        flex-direction: column;
        gap: 10px;
    }
    
    .permission-btn {
        width: 100%;
    }
}

/* تحسينات للوضع المظلم */
@media (prefers-color-scheme: dark) {
    .kooralive-notification {
        background: linear-gradient(135deg, rgba(20, 20, 20, 0.95), rgba(40, 40, 40, 0.95));
        border-color: rgba(255, 255, 255, 0.15);
    }
    
    .permission-modal-content {
        background: linear-gradient(135deg, rgba(20, 20, 20, 0.95), rgba(40, 40, 40, 0.95));
        border-color: rgba(255, 255, 255, 0.15);
    }
}

/* تحسينات للوضع الفاتح */
@media (prefers-color-scheme: light) {
    .kooralive-notification {
        background: linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(240, 240, 240, 0.95));
        border-color: rgba(0, 0, 0, 0.1);
        color: #333;
    }
    
    .notification-title {
        color: #333;
    }
    
    .notification-message {
        color: rgba(0, 0, 0, 0.7);
    }
    
    .notification-close {
        color: rgba(0, 0, 0, 0.6);
        background: rgba(0, 0, 0, 0.1);
    }
    
    .notification-close:hover {
        color: #000;
        background: rgba(0, 0, 0, 0.2);
    }
    
    .permission-modal-content {
        background: linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(240, 240, 240, 0.95));
        border-color: rgba(0, 0, 0, 0.1);
        color: #333;
    }
    
    .permission-modal-content h3 {
        color: #333;
    }
    
    .permission-modal-content p {
        color: rgba(0, 0, 0, 0.7);
    }
}

/* تأثيرات خاصة للإشعارات المهمة */
.kooralive-notification.urgent {
    animation: urgent-shake 0.5s ease-in-out 3;
}

@keyframes urgent-shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* تحسينات الأداء */
.kooralive-notification {
    will-change: transform, opacity;
    contain: layout style paint;
}

.notification-progress {
    will-change: width;
}

/* تحسينات إمكانية الوصول */
.kooralive-notification[role="alert"] {
    /* للقارئات الشاشة */
}

.notification-close:focus {
    outline: 2px solid #4CAF50;
    outline-offset: 2px;
}

.permission-btn:focus {
    outline: 2px solid #4CAF50;
    outline-offset: 2px;
}

/* تأثيرات التمرير */
.kooralive-notification:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.4);
}

.kooralive-notification:hover .notification-close {
    opacity: 1;
}

/* تحسينات للطباعة */
@media print {
    .notifications-container,
    .notification-permission-modal {
        display: none !important;
    }
}
