/**
 * نظام الإشعارات المحسّن - رمضان 2026
 * نسخة الزر العائم مع ميزة القراءة اليدوية (Manual Read)
 */

:root {
    --notif-primary: #8B0000;
    --notif-secondary: #B22222;
    --notif-success: #2ecc71;
    --notif-dark: rgba(15, 15, 15, 0.98);
    --notif-border: rgba(139, 0, 0, 0.4);
    --accent: #FFD700;
    --notif-shadow: 0 10px 40px rgba(0, 0, 0, 0.8);
    --z-top: 2147483647; 
}

/* الزر العائم للإشعارات */
.notif-floating-toggle {
    position: fixed;
    bottom: 130px;
    right: 25px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--notif-primary), var(--notif-secondary));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    cursor: pointer;
    z-index: var(--z-top);
    box-shadow: 0 8px 25px rgba(139, 0, 0, 0.5);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.notif-floating-toggle:hover {
    transform: scale(1.1) rotate(15deg);
}

.notif-floating-toggle i {
    font-size: 24px;
    animation: bell-ring 4s infinite ease-in-out;
}

@keyframes bell-ring {
    0%, 100% { transform: rotate(0); }
    5%, 15%, 25% { transform: rotate(20deg); }
    10%, 20%, 30% { transform: rotate(-20deg); }
    35% { transform: rotate(0); }
}

/* عداد الإشعارات */
.notif-floating-badge {
    position: absolute;
    top: -2px;
    left: -2px;
    background: #ff4d4d;
    color: #fff;
    font-size: 11px;
    font-weight: bold;
    min-width: 22px;
    height: 22px;
    padding: 0 5px;
    border-radius: 11px;
    display: none;
    align-items: center;
    justify-content: center;
    border: 2px solid #fff;
    box-shadow: 0 3px 10px rgba(0,0,0,0.4);
    z-index: 2;
}

/* لوحة الإشعارات */
.notif-floating-panel {
    position: fixed;
    bottom: 100px;
    right: 25px;
    width: 380px;
    max-height: 450px;
    background: var(--notif-dark);
    border: 1px solid var(--notif-border);
    border-radius: 20px;
    box-shadow: var(--notif-shadow);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: calc(var(--z-top) - 1);
    display: none;
    flex-direction: column;
    overflow: hidden;
    transform-origin: bottom right;
    animation: panelScaleIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes panelScaleIn {
    from { opacity: 0; transform: scale(0.5); }
    to { opacity: 1; transform: scale(1); }
}

/* تم نقل تنسيق الهيدر للأسفل مع تحسينات الأزرار */

.notif-panel-title {
    font-weight: 800;
    font-size: 18px;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* تم نقل تنسيق الأزرار للأسفل مع تحسينات الأزرار */

.notif-action-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #eee;
    padding: 8px 14px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Cairo', sans-serif;
    font-size: 13px;
    font-weight: 600;
    /* إصلاحات خاصة بـ iPhone/Safari */
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    outline: none;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    white-space: nowrap;
}

.notif-action-btn i {
    font-size: 14px;
}

.notif-action-btn:hover {
    background: rgba(46, 204, 113, 0.25);
    color: #2ecc71;
    border-color: #2ecc71;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(46, 204, 113, 0.2);
}

.notif-action-btn.delete-btn {
    background: rgba(231, 76, 60, 0.1);
    border-color: rgba(231, 76, 60, 0.3);
    color: #ff7675;
}

.notif-action-btn.delete-btn:hover {
    background: rgba(231, 76, 60, 0.25);
    color: #ff4d4d;
    border-color: #ff4d4d;
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.2);
}

/* تحسين شكل الهيدر ليتناسب مع الأزرار الجديدة */
.notif-panel-header {
    padding: 15px 20px;
    background: linear-gradient(to bottom, rgba(139, 0, 0, 0.4), rgba(0, 0, 0, 0.2));
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.notif-header-actions {
    display: flex;
    gap: 10px;
    margin: 0 15px;
    flex: 1;
    justify-content: flex-end;
}

@media (max-width: 480px) {
    .notif-action-btn .btn-text {
        display: none;
    }
    .notif-action-btn {
        padding: 8px;
    }
}

.notif-panel-close {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: 0.3s;
}

.notif-panel-close:hover {
    background: var(--notif-primary);
    transform: rotate(90deg);
}

.notif-panel-tabs {
    display: flex;
    padding: 10px 15px;
    gap: 8px;
    background: rgba(0, 0, 0, 0.3);
    flex-shrink: 0;
}

.notif-panel-tab {
    flex: 1;
    padding: 10px;
    text-align: center;
    border-radius: 12px;
    cursor: pointer;
    color: #888;
    font-size: 14px;
    font-weight: 700;
    transition: 0.3s;
    border: 1px solid transparent;
    font-family: 'Cairo';
}

.notif-panel-tab.active {
    color: #fff;
    background: rgba(139, 0, 0, 0.4);
    border-color: rgba(139, 0, 0, 0.6);
}

.notif-panel-items {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    max-height: 350px;
    scrollbar-width: thin;
    scrollbar-color: var(--notif-primary) transparent;
}

.notif-panel-items::-webkit-scrollbar { width: 5px; }
.notif-panel-items::-webkit-scrollbar-thumb { background: var(--notif-primary); border-radius: 10px; }

.notif-panel-item {
    display: flex;
    gap: 15px;
    padding: 15px;
    border-radius: 15px;
    margin-bottom: 10px;
    text-decoration: none;
    color: #fff;
    transition: 0.3s;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.notif-panel-item:hover {
    background: rgba(139, 0, 0, 0.1);
    border-color: rgba(139, 0, 0, 0.3);
    transform: translateX(-5px);
}

.notif-panel-item.unread {
    background: rgba(139, 0, 0, 0.15);
    border-right: 4px solid var(--notif-primary);
}

.notif-item-icon {
    width: 45px;
    height: 45px;
    background: rgba(139, 0, 0, 0.2);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
    font-size: 20px;
    flex-shrink: 0;
}

.notif-item-info { flex: 1; min-width: 0; }
.notif-item-title { font-size: 15px; font-weight: 700; margin-bottom: 4px; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.notif-item-msg { font-size: 12px; color: #aaa; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.notif-item-time { font-size: 10px; color: #666; margin-top: 8px; display: flex; align-items: center; gap: 5px; }

.notif-panel-empty {
    padding: 80px 20px;
    text-align: center;
    color: #666;
}

.notif-panel-empty i { font-size: 50px; margin-bottom: 15px; opacity: 0.3; }

/* التوافق مع الموبايل */
@media (max-width: 768px) {
    .notif-floating-toggle {
        bottom: 110px;
        right: 20px;
        width: 55px;
        height: 55px;
        z-index: var(--z-top) !important;
    }
    
    .notif-floating-panel {
        bottom: 0;
        right: 0;
        width: 100%;
        height: 70vh;
        max-height: 70vh;
        border-radius: 25px 25px 0 0;
        transform-origin: bottom center;
        animation: panelSlideUp 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
        z-index: var(--z-top) !important;
        /* ضمان بقاء القائمة داخل هيكل الموقع */
        box-sizing: border-box;
        left: 0;
        margin: 0;
    }
    
    @keyframes panelSlideUp {
        from { transform: translateY(100%); }
        to { transform: translateY(0); }
    }
    
    .notif-panel-items {
        max-height: calc(70vh - 150px);
    }
}

/* أنماط إضافية للإشعارات الخاصة والاحترافية */
.notif-panel-item-wrapper {
    position: relative;
    margin-bottom: 10px;
}

.notif-delete-btn {
    position: absolute;
    top: 10px;
    left: 10px;
    width: 28px;
    height: 28px;
    background: rgba(231, 76, 60, 0.15);
    border: 1px solid rgba(231, 76, 60, 0.3);
    color: #ff4d4d;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: 0.3s;
    opacity: 0;
    z-index: 5;
}

.notif-panel-item-wrapper:hover .notif-delete-btn {
    opacity: 1;
}

.notif-delete-btn:hover {
    background: #e74c3c;
    color: #fff;
    transform: scale(1.1);
}

.private-badge {
    background: rgba(230, 126, 34, 0.15);
    color: #e67e22;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 9px;
    font-weight: bold;
    border: 1px solid rgba(230, 126, 34, 0.3);
    margin-right: 8px;
}

/* أيقونات ملونة حسب النوع */
.notif-item-icon.gift { background: rgba(241, 196, 15, 0.15); color: #f1c40f; }
.notif-item-icon.warning { background: rgba(231, 76, 60, 0.15); color: #e74c3c; }
.notif-item-icon.update { background: rgba(52, 152, 219, 0.15); color: #3498db; }
.notif-item-icon.admin_custom { background: rgba(155, 89, 182, 0.15); color: #9b59b6; }
.notif-item-icon.new_episode { background: rgba(46, 204, 113, 0.15); color: #2ecc71; }
