:root {
            --primary: #0284c7;
            --primary-dark: #0c4a6e;
            --accent: #f59e0b;
            --text-dark: #0f172a;
            --text-light: #475569; /* Darker for better contrast */
            --bg-glass: rgba(255, 255, 255, 0.95);
            --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
            --font-main: 'Cairo', sans-serif;
            --anim-speed: 0.3s;
        }

        body {
            font-family: var(--font-main) !important;
            background-color: #f8fafc;
            margin: 0;
            padding-top: 90px;
            overflow-x: hidden;
        }

        /* ================= ANIMATIONS ================= */
        @keyframes slideDownFade { from { opacity: 0; transform: translateY(-20px); } to { opacity: 1; transform: translateY(0); } }

        /* --- الهيدر الرئيسي --- */
        .premium-header {
            position: fixed; top: 0; left: 0; right: 0; height: 90px;
            background: var(--bg-glass); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
            border-bottom: 1px solid rgba(226, 232, 240, 0.8); box-shadow: var(--shadow);
            z-index: 1000; display: flex; align-items: center; transition: all 0.4s ease;
        }
        .premium-header.scrolled {
            height: 75px; background: rgba(255, 255, 255, 0.98);
            box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
        }

        .header-inner {
            width: 100%; max-width: 1300px; margin: 0 auto; padding: 0 20px;
            display: flex; justify-content: space-between; align-items: center;
        }

        /* انميشن الدخول */
        .brand-wrapper, .desktop-nav-links, .desktop-auth {
            animation: slideDownFade 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) backwards;
        }
        .desktop-nav-links { animation-delay: 0.2s; }
        .desktop-auth { animation-delay: 0.3s; }

        /* --- الشعار --- */
        .brand-wrapper { display: flex; align-items: center; gap: 12px; text-decoration: none; }
        .logo-box {
            width: 50px; height: 50px; background: linear-gradient(135deg, var(--primary), var(--primary-dark));
            border-radius: 12px; display: flex; align-items: center; justify-content: center;
            color: #fff; font-size: 1.6rem; box-shadow: 0 4px 10px rgba(2, 132, 199, 0.2);
            transition: var(--anim-speed); transform: rotate(-3deg);
        }
        .brand-wrapper:hover .logo-box { transform: rotate(0deg) scale(1.05); }
        .brand-text-col { display: flex; flex-direction: column; justify-content: center; }
        .brand-title { font-size: 1.1rem; font-weight: 800; color: var(--text-dark); line-height: 1.2; }
        .brand-subtitle { font-size: 0.85rem; color: var(--text-light); font-weight: 600; display: flex; align-items: center; gap: 5px; margin-top: 3px; }
        .brand-subtitle i { color: var(--accent); font-size: 0.75rem; }

        /* --- القائمة (سطح المكتب) --- */
        .desktop-nav { display: flex; align-items: center; gap: 25px; }
        .nav-link {
            text-decoration: none; color: var(--text-light); font-weight: 600; font-size: 1.1rem;
            padding: 5px 0; transition: var(--anim-speed); position: relative; display: inline-block;
        }
        .nav-link:hover, .nav-link.active { color: var(--primary); transform: translateY(-2px); }
        .nav-link::after {
            content: ''; position: absolute; bottom: 0; right: 0; width: 0; height: 2px;
            background: var(--primary); transition: 0.3s; border-radius: 2px;
        }
        .nav-link:hover::after, .nav-link.active::after { width: 100%; }

        /* --- الأزرار (سطح المكتب) --- */
        .auth-actions { display: flex; align-items: center; gap: 10px; }
        .btn-glass {
            padding: 8px 18px; border-radius: 8px; font-weight: 700; font-size: 0.9rem;
            text-decoration: none; transition: var(--anim-speed); display: inline-flex; align-items: center; gap: 6px;
        }
        .btn-glass:hover { transform: translateY(-2px); }
        .btn-login { color: var(--primary-dark); border: 1px solid #e2e8f0; }
        .btn-login:hover { border-color: var(--primary); background: #f0f9ff; }
        .btn-register { background: var(--primary); color: white; border: 1px solid var(--primary); }
        .btn-register:hover { background: var(--primary-dark); border-color: var(--primary-dark); }

        /* --- بطاقة المستخدم (User Card) --- */
        .user-menu-wrap { position: relative; }
        .user-btn {
            background: white; border: 1px solid #e2e8f0; padding: 4px 6px 4px 12px;
            border-radius: 50px; cursor: pointer; display: flex; align-items: center; gap: 10px;
            transition: var(--anim-speed); width: auto; max-width: 250px;
        }
        .user-btn:hover { border-color: var(--primary); box-shadow: 0 4px 12px rgba(0,0,0,0.08); }
        
        .user-info-text { font-size: 0.9rem; font-weight: 700; color: var(--text-dark); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
        .user-avatar { 
            width: 36px; height: 36px; background: #e0f2fe; border-radius: 50%; 
            display: flex; align-items: center; justify-content: center; 
            color: var(--primary); font-weight: 800; font-size: 15px; flex-shrink: 0;
            border: 2px solid white; box-shadow: 0 2px 5px rgba(0,0,0,0.05);
        }

        .dropdown-box {
            position: absolute; top: 130%; left: 0; background: white; width: 260px; 
            border-radius: 16px; box-shadow: 0 20px 40px -5px rgba(0,0,0,0.1), 0 10px 15px -5px rgba(0,0,0,0.05); 
            opacity: 0; visibility: hidden; transform: translateY(15px) scale(0.95); transition: 0.25s; 
            border: 1px solid #f1f5f9; overflow: hidden;
        }
        .user-menu-wrap:hover .dropdown-box { opacity: 1; visibility: visible; transform: translateY(0) scale(1); }
        
        .card-header {
            padding: 20px; background: linear-gradient(to bottom, #f8fafc, #ffffff);
            border-bottom: 1px solid #f1f5f9; display: flex; align-items: center; gap: 15px;
        }
        .card-avatar-lg {
            width: 50px; height: 50px; background: var(--primary); color: white;
            border-radius: 12px; display: flex; align-items: center; justify-content: center;
            font-size: 1.4rem; font-weight: 700; box-shadow: 0 4px 10px rgba(37, 99, 235, 0.2);
        }
        .card-info { display: flex; flex-direction: column; gap: 2px; overflow: hidden; }
        .card-name { font-weight: 800; color: var(--text-dark); font-size: 1rem; line-height: 1.2; }
        .card-role { font-size: 0.8rem; color: var(--text-light); font-weight: 500; }

        .card-links { padding: 8px; }
        .dd-link { 
            display: flex; align-items: center; gap: 12px; padding: 12px 15px; border-radius: 10px; 
            color: var(--text-dark); text-decoration: none; font-size: 0.95rem; transition: 0.2s; 
        }
        .dd-link:hover { background: #f1f5f9; color: var(--primary); transform: translateX(-3px); }
        .dd-link.danger:hover { background: #fef2f2; color: #ef4444; }

        /* --- عناصر الهاتف --- */
        .mobile-burger { display: none; background: none; border: none; font-size: 1.5rem; color: var(--text-dark); cursor: pointer; transition: 0.3s; }
        .mobile-burger:active { transform: scale(0.9); }
        .mobile-drawer { display: none; } 
        .mobile-menu-overlay { display: none; }

        /* =========================================
           نظام التحكم في العرض (Responsive System)
           ========================================= */
        @media (min-width: 993px) {
            .mobile-only-element { display: none !important; }
            .mobile-drawer { display: none !important; }
            .mobile-menu-overlay { display: none !important; }
        }

        @media (max-width: 992px) {
            body { padding-top: 80px; }
            .premium-header { height: 80px; }
            .premium-header.scrolled { height: 70px; }
            .brand-wrapper { animation: none; }
            .desktop-nav, .auth-actions { display: none !important; } 
            .mobile-burger { display: block; animation: slideDownFade 0.6s 0.3s backwards; }
            
            .mobile-menu-overlay {
                display: block; position: fixed; top: 0; right: 0; width: 100%; height: 100%;
                background: rgba(0,0,0,0.5); z-index: 1001; opacity: 0; visibility: hidden;
                transition: 0.4s; backdrop-filter: blur(4px);
            }
            .mobile-menu-overlay.active { opacity: 1; visibility: visible; }

            .mobile-drawer {
                display: flex; flex-direction: column; position: fixed; top: 0; right: -100%; 
                width: 85%; max-width: 320px; height: 100vh; height: 100dvh; 
                background: white; z-index: 1002; transition: right 0.5s cubic-bezier(0.25, 1, 0.5, 1);
                box-shadow: -5px 0 20px rgba(0,0,0,0.15);
            }
            .mobile-drawer.active { right: 0; }
            
            .drawer-header {
                flex-shrink: 0; padding: 25px 20px; border-bottom: 1px solid #f1f5f9; 
                display: flex; align-items: center; justify-content: space-between; background: #f8fafc;
            }
            .drawer-header span { font-size: 1.25rem !important; }

            .drawer-links { 
                list-style: none; padding: 20px; margin: 0; flex-grow: 1; 
                overflow-y: auto; -webkit-overflow-scrolling: touch;
            }

            .drawer-footer { 
                flex-shrink: 0; padding: 25px 20px; background: #f8fafc; border-top: 1px solid #e2e8f0; 
                padding-bottom: calc(25px + env(safe-area-inset-bottom));
            }

            .drawer-item { opacity: 0; transform: translateX(30px); transition: 0.4s cubic-bezier(0.2, 0.8, 0.2, 1); }
            .mobile-drawer.active .drawer-item { opacity: 1; transform: translateX(0); }
            .mobile-drawer.active .drawer-item:nth-child(1) { transition-delay: 0.1s; }
            .mobile-drawer.active .drawer-item:nth-child(2) { transition-delay: 0.15s; }
            .mobile-drawer.active .drawer-item:nth-child(3) { transition-delay: 0.2s; }
            .mobile-drawer.active .drawer-item:nth-child(4) { transition-delay: 0.25s; }
            .mobile-drawer.active .drawer-item:nth-child(5) { transition-delay: 0.3s; }

            .m-link {
                display: flex; align-items: center; gap: 15px; padding: 16px; 
                text-decoration: none; color: var(--text-dark); 
                font-weight: 700; font-size: 1.15rem; 
                border-radius: 12px; border-bottom: 1px solid #f8fafc; transition: 0.3s;
            }
            .m-link i { width: 30px; text-align: center; color: #94a3b8; transition: 0.3s; font-size: 1.3rem; }
            .m-link:hover, .m-link.active { background: #f0f9ff; color: var(--primary); padding-right: 25px; }
            .m-link:hover i, .m-link.active i { color: var(--primary); transform: scale(1.1); }
            
            .m-btn {
                display: flex; justify-content: center; align-items: center; width: 100%;
                padding: 15px; border-radius: 10px; text-decoration: none; 
                font-weight: 800; font-size: 1.1rem; margin-bottom: 12px; transition: 0.3s;
            }
            .m-btn:active { transform: scale(0.97); }
        }

/* ============ زر الإشعارات ============ */
.notification-bell-wrap {
    position: relative;
    margin-left: 10px;
}

.notification-bell-btn {
    position: relative;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    background: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: #64748b;
    transition: all 0.3s ease;
}

.notification-bell-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(2, 132, 199, 0.15);
}

.notification-bell-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.notification-bell-btn.has-notifications i {
    animation: bellRing 0.5s ease-in-out;
}

@keyframes bellRing {
    0%, 100% { transform: rotate(0); }
    20%, 60% { transform: rotate(15deg); }
    40%, 80% { transform: rotate(-15deg); }
}

.notification-dot {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 10px;
    height: 10px;
    background: #ef4444;
    border-radius: 50%;
    border: 2px solid white;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.2); opacity: 0.8; }
}

/* ============ Popup الإشعارات ============ */
.notification-popup {
    position: absolute;
    top: calc(100% + 15px);
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    width: 320px;
    max-width: calc(100vw - 40px);
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 50px -10px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.05);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1050;
    overflow: hidden;
}

.notification-popup.active {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.notification-popup::before {
    content: '';
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
    border-width: 0 10px 10px 10px;
    border-style: solid;
    border-color: transparent transparent white transparent;
    filter: drop-shadow(0 -2px 2px rgba(0, 0, 0, 0.05));
}

.notification-popup-content {
    padding: 0;
}

/* حالة طلب التفعيل */
.notification-enable-prompt {
    padding: 30px 25px;
    text-align: center;
}

.notification-icon-wrap {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    background: linear-gradient(135deg, #0ea5e9, #0284c7);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: white;
    box-shadow: 0 10px 30px rgba(2, 132, 199, 0.3);
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

.notification-enable-prompt h4 {
    font-size: 1.2rem;
    font-weight: 800;
    color: #0f172a;
    margin: 0 0 10px;
}

.notification-enable-prompt p {
    font-size: 0.9rem;
    color: #64748b;
    line-height: 1.6;
    margin: 0 0 25px;
}

.notification-enable-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 14px 20px;
    background: linear-gradient(135deg, #0ea5e9, #0284c7);
    color: white;
    border: none;
    border-radius: 14px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(2, 132, 199, 0.3);
}

.notification-enable-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(2, 132, 199, 0.4);
}

.notification-enable-btn:active {
    transform: scale(0.98);
}

.notification-enable-btn i {
    font-size: 1.1rem;
}

.notification-later-btn {
    display: block;
    width: 100%;
    padding: 12px;
    margin-top: 12px;
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: color 0.2s;
}

.notification-later-btn:hover {
    color: #64748b;
}

/* حالة التفعيل الناجح */
.notification-enabled-state {
    padding: 25px;
    text-align: center;
}

.notification-enabled-state .success-icon {
    width: 60px;
    height: 60px;
    margin: 0 auto 15px;
    background: linear-gradient(135deg, #22c55e, #16a34a);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
}

.notification-enabled-state h4 {
    font-size: 1.1rem;
    font-weight: 700;
    color: #0f172a;
    margin: 0 0 8px;
}

.notification-enabled-state p {
    font-size: 0.85rem;
    color: #64748b;
    margin: 0;
}

/* حالة التحميل */
.notification-loading {
    padding: 40px;
    text-align: center;
}

.notification-loading .spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e2e8f0;
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 15px;
}

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

/* Responsive */
@media (max-width: 992px) {
    .notification-bell-wrap {
        margin-left: 5px;
        margin-right: 10px;
    }
    
    .notification-popup {
        position: fixed;
        top: 85px;
        left: 15px;
        right: 15px;
        width: auto;
        max-width: none;
        transform: translateY(10px);
    }
    
    .notification-popup.active {
        transform: translateY(0);
    }
    
    .notification-popup::before {
        display: none;
    }
}

/* ============ قائمة الإشعارات ============ */
.notifications-header {
    padding: 15px 20px;
    border-bottom: 1px solid #f1f5f9;
    background: #f8fafc;
}

.notifications-header h4 {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: #0f172a;
    display: flex;
    align-items: center;
    gap: 8px;
}

.notifications-header h4 i {
    color: var(--primary);
}

.notifications-empty {
    padding: 40px 25px;
    text-align: center;
}

.notifications-empty .empty-icon {
    width: 60px;
    height: 60px;
    margin: 0 auto 15px;
    background: #f1f5f9;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: #94a3b8;
}

.notifications-empty p {
    margin: 0 0 5px;
    font-size: 1rem;
    font-weight: 700;
    color: #64748b;
}

.notifications-empty span {
    font-size: 0.8rem;
    color: #94a3b8;
    line-height: 1.5;
    display: block;
}

/* عناصر الإشعارات */
.notifications-list {
    max-height: 350px;
    overflow-y: auto;
}

.notification-item {
    display: flex;
    gap: 12px;
    padding: 15px 20px;
    border-bottom: 1px solid #f1f5f9;
    transition: background 0.2s;
    cursor: pointer;
}

.notification-item.notif-unread {
    background: rgba(2, 132, 199, 0.06);
}

.notification-item:hover {
    background: #f8fafc;
}

.notification-item .notif-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}

.notification-item .notif-content {
    flex: 1;
    min-width: 0;
}

.notification-item .notif-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: #0f172a;
    margin-bottom: 3px;
}

.notification-item .notif-text {
    font-size: 0.8rem;
    color: #64748b;
    line-height: 1.4;
}

.notification-item .notif-time {
    font-size: 0.7rem;
    color: #94a3b8;
    margin-top: 5px;
}

.notification-item .notif-dismiss {
    border: none;
    background: transparent;
    color: #94a3b8;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    cursor: pointer;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.notification-item .notif-dismiss:hover {
    background: #f1f5f9;
    color: #0f172a;
}
