   .rank-1 {
            box-shadow: 0 0 15px rgba(255, 215, 0, 0.3);
            transform: scale(1.02);
            border: 1px solid #FFD700 !important;
        }

        .rank-2 {
            border: 1px solid #C0C0C0 !important;
        }

        .rank-3 {
            border: 1px solid #CD7F32 !important;
        }

        #salesChart {
            cursor: zoom-in; /* أو zoom-out حسب الحالة، لكن zoom-in شكلها جميل */
        }

        /* =========================================================
        تصغير وتجميع الجدول (Compact Mode)
        ========================================================= */

        /* 1. إلغاء العرض الكامل وتقليل المسافات */
        #section-orders .custom-table {
            width: auto !important; /* الجدول ياخد مساحة المحتوى بس مش الشاشة كلها */
            min-width: auto !important; /* إلغاء الحد الأدنى للعرض */
            margin: 0 auto; /* توسيط الجدول في الشاشة */
            border-spacing: 0 10px; /* تقليل المسافة بين الصفوف */
        }

            /* 2. تقريب الخلايا من بعضها */
            #section-orders .custom-table th,
            #section-orders .custom-table td {
                padding: 10px 15px !important; /* تقليل الحشو الداخلي */
                text-align: right; /* محاذاة النص لليمين */
            }

                /* 3. جعل عمود الأزرار (التحكم) يلم على قد الأزرار بالظبط */
                #section-orders .custom-table td:last-child {
                    width: 1%; /* حيلة لجعل العمود ينكمش لأقل عرض ممكن */
                    white-space: nowrap; /* منع النص من النزول سطر جديد */
                }

        /* 4. تصغير الأزرار ونصوص الجدول قليلاً لتتناسب مع الشكل الملموم */
        #section-orders .icon-btn {
            width: 30px !important;
            height: 30px !important;
            font-size: 0.85rem !important;
            margin: 0 2px !important; /* مسافة صغيرة جداً بين الأزرار */
        }

        #section-orders .custom-table td {
            font-size: 0.95rem; /* تصغير الخط درجة بسيطة */
        }

        /* 5. توسيط الحاوية الأم */
        #section-orders .table-responsive {
            display: flex;
            justify-content: center; /* عشان الجدول ييجي في النص */
            background: transparent !important;
            box-shadow: none !important;
            border: none !important;
        }
        /* =========================================================
        تنسيق التابلت (المحسّن): أزرار عمودية + إخفاء ID والتاريخ
        ========================================================= */

        @media (max-width: 1200px) {

            /* 1. تفعيل السكرول الأفقي للطوارئ */
            #section-orders .table-responsive {
                display: block !important;
                overflow-x: auto !important;
            }

            /* 2. الجدول يأخذ العرض الكامل */
            #section-orders .custom-table {
                width: 100% !important;
                min-width: 100% !important;
            }

                /* 3. تنسيق عام للخلايا */
                #section-orders .custom-table th,
                #section-orders .custom-table td {
                    padding: 8px 4px !important;
                    vertical-align: middle !important;
                    font-size: 0.85rem !important;
                }

/* 4. إخفاء العمود الأول (ID) فقط */
#section-orders .custom-table th:nth-child(1),
#section-orders .custom-table td:nth-child(1) {
    display: none !important;
}

                    /* 5. ضبط عمود الأزرار ليكون عمودياً ورفيعاً */
                    #section-orders .custom-table td:last-child {
                        width: 40px !important; /* مساحة صغيرة جداً */
                        padding: 5px !important;
                    }

                        /* 6. ترتيب الأزرار فوق بعضها */
                        #section-orders .custom-table td:last-child > div {
                            display: flex !important;
                            flex-direction: column !important; /* ترتيب عمودي */
                            gap: 5px !important;
                            align-items: center !important;
                            justify-content: center !important;
                        }

            /* 7. تصغير الأزرار */
            #section-orders .icon-btn {
                width: 30px !important;
                height: 30px !important;
                font-size: 0.75rem !important;
                margin: 0 !important;
                border-radius: 6px !important;
            }

            /* 8. توزيع المساحة المتبقية بذكاء */
            #section-orders .custom-table td:nth-child(2) {
                width: 30%;
                word-break: break-word;
            }
            /* العميل */
            #section-orders .custom-table td:nth-child(3) {
                width: 35%;
                word-break: break-word;
            }
            /* المنتج */
            #section-orders .custom-table td:nth-child(4) {
                width: 15%;
                font-weight: bold;
            }
            /* السعر */
        }
        /* ==========================================================================
                0. LOADING SCREEN
                ==========================================================================
             */
        #loading-screen {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: #050505;
            z-index: 999999;
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            transition: opacity 0.8s ease;
        }

        .loader-container {
            position: relative;
            width: 120px;
            height: 120px;
        }

        .loader-ring {
            position: absolute;
            width: 100%;
            height: 100%;
            border: 4px solid transparent;
            border-top: 4px solid var(--purple);
            border-radius: 50%;
            animation: spin 1.5s linear infinite;
        }

            .loader-ring:nth-child(2) {
                border-top-color: var(--gold);
                animation-delay: -0.5s;
                width: 80%;
                height: 80%;
                top: 10%;
                left: 10%;
            }

            .loader-ring:nth-child(3) {
                border-top-color: var(--green);
                animation-delay: -1s;
                width: 60%;
                height: 60%;
                top: 20%;
                left: 20%;
            }

        .loader-text {
            margin-top: 30px;
            font-size: 1.2rem;
            color: var(--purple);
            font-weight: bold;
            letter-spacing: 2px;
            text-align: center;
        }

        .loader-subtext {
            color: var(--text-muted);
            font-size: 0.9rem;
            margin-top: 10px;
            opacity: 0.8;
        }

        @keyframes spin {
            0% {
                transform: rotate(0deg);
            }

            100% {
                transform: rotate(360deg);
            }
        }

        /* ==========================================================================
                1. CORE VARIABLES & RESET (THEME ENGINE)
                ==========================================================================
             */
        :root {
            --bg-body: #0a0a0f;
            --bg-panel: rgba(15, 15, 20, 0.85);
            --bg-card: rgba(25, 25, 35, 0.7);
            --bg-input: rgba(10, 10, 15, 0.4);
            --gold: #FFD700;
            --gold-glow: rgba(255, 215, 0, 0.1);
            --purple: #7c3aed;
            --purple-glow: rgba(124, 58, 237, 0.1);
            --neon-blue: #00d4ff;
            --neon-pink: #ff00ff;
            --green: #10b981;
            --red: #ef4444;
            --text-main: #f8fafc;
            --text-muted: #94a3b8;
            --border: 1px solid rgba(255, 255, 255, 0.08);
            --border-hover: 1px solid rgba(124, 58, 237, 0.6);
            --glass: blur(25px) saturate(180%);
            --radius-lg: 28px;
            --radius-md: 18px;
            --radius-sm: 10px;
            --shadow-lg: 0 25px 60px rgba(0,0,0,0.6);
            --gradient-purple: linear-gradient(135deg, var(--purple) 0%, #a78bfa 100%);
            --gradient-gold: linear-gradient(135deg, var(--gold) 0%, #fbbf24 100%);
            --gradient-blue: linear-gradient(135deg, var(--neon-blue) 0%, #3b82f6 100%);
        }

        * {
            box-sizing: border-box;
            outline: none;
            -webkit-tap-highlight-color: transparent;
        }

        body {
            font-family: 'Tajawal', 'Cairo', sans-serif;
            background-color: var(--bg-body);
            /* 1. حط رابط الصورة هنا مكان الرابط الموجود */
            /* طبقة سوداء شفافة بنسبة 70% فوق الصورة */
            background-image: linear-gradient(rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0.7)), url('https://media.forgecdn.net/attachments/1077/860/2025-01-25_12.png');
            /* 2. عشان الصورة تغطي الشاشة كلها وماتتكررش */
            background-size: cover;
            background-position: center;
            background-repeat: no-repeat;
            color: var(--text-main);
            margin: 0;
            height: 100vh;
            overflow: hidden;
            display: flex;
        }

        /* Scrollbar Styling */
        ::-webkit-scrollbar {
            width: 8px;
            height: 8px;
        }

        ::-webkit-scrollbar-track {
            background: rgba(255, 255, 255, 0.02);
            border-radius: 10px;
        }

        ::-webkit-scrollbar-thumb {
            background: rgba(124, 58, 237, 0.3);
            border-radius: 10px;
        }

            ::-webkit-scrollbar-thumb:hover {
                background: rgba(124, 58, 237, 0.5);
            }

        /* ==========================================================================
                2. ANIMATIONS
                ==========================================================================
             */
        @keyframes float {
            0%, 100% {
                transform: translateY(0) translateX(0);
            }

            33% {
                transform: translateY(-15px) translateX(10px);
            }

            66% {
                transform: translateY(5px) translateX(-10px);
            }
        }

        @keyframes glow {
            0%, 100% {
                box-shadow: 0 0 5px var(--purple-glow);
            }

            50% {
                box-shadow: 0 0 10px var(--purple-glow);
            }
        }

        @keyframes slideInUp {
            from {
                transform: translateY(40px);
                opacity: 0;
            }

            to {
                transform: translateY(0);
                opacity: 1;
            }
        }

        @keyframes slideInDown {
            from {
                transform: translateY(-40px) translateX(-50%);
                opacity: 0;
            }

            to {
                transform: translateY(0) translateX(-50%);
                opacity: 1;
            }
        }

        @keyframes fadeIn {
            from {
                opacity: 0;
            }

            to {
                opacity: 1;
            }
        }

        @keyframes pulse {
            0%, 100% {
                opacity: 1;
            }

            50% {
                opacity: 0.7;
            }
        }

        @keyframes shimmer {
            0% {
                background-position: -1000px 0;
            }

            100% {
                background-position: 1000px 0;
            }
        }

        @keyframes shake {
            0%, 100% {
                transform: rotate(0deg);
            }

            20% {
                transform: rotate(-15deg);
            }

            40% {
                transform: rotate(15deg);
            }

            60% {
                transform: rotate(-10deg);
            }

            80% {
                transform: rotate(10deg);
            }
        }

        /* ==========================================================================
                3. LOGIN SCREEN (SECURE GATE)
                ==========================================================================
             */
        #login-screen {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: linear-gradient(135deg, #0a0a0f 0%, #1a1a2e 100%);
            z-index: 99999;
            display: flex;
            justify-content: center;
            align-items: center;
            flex-direction: column;
            transition: opacity 0.8s ease;
        }

        .login-card {
            background: rgba(20, 20, 30, 0.9);
            padding: 60px 50px;
            border-radius: var(--radius-lg);
            border: 1px solid rgba(124, 58, 237, 0.1);
            text-align: center;
            width: 90%;
            max-width: 450px;
            box-shadow: 0 0 50px rgba(124, 58, 237, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.05);
            backdrop-filter: var(--glass);
            animation: slideInUp 0.8s cubic-bezier(0.2, 0.8, 0.2, 1);
            position: relative;
            overflow: hidden;
        }

            .login-card::before {
                content: '';
                position: absolute;
                top: 0;
                left: 0;
                right: 0;
                height: 1px;
                background: var(--gradient-purple);
                animation: shimmer 3s infinite linear;
            }

        .login-logo {
            width: 120px;
            margin-bottom: 25px;
            filter: drop-shadow(0 0 10px var(--purple-glow));
            animation: float 6s ease-in-out infinite;
        }

        .login-title {
            font-size: 2.2rem;
            font-weight: 900;
            margin-bottom: 10px;
            background: linear-gradient(45deg, var(--purple), var(--neon-blue));
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            text-shadow: 0 0 10px rgba(124, 58, 237, 0.2);
            letter-spacing: 1px;
            font-family: 'Tajawal', sans-serif;
        }

        .login-subtitle {
            color: var(--text-muted);
            font-size: 1rem;
            margin-bottom: 40px;
            letter-spacing: 1px;
            font-weight: 300;
        }

        .auth-input-group {
            position: relative;
            margin-bottom: 30px;
        }

        .auth-input {
            width: 100%;
            padding: 20px 25px;
            background: rgba(255,255,255,0.03);
            border: 1px solid rgba(124, 58, 237, 0.1);
            border-radius: var(--radius-md);
            color: #fff;
            font-size: 1.2rem;
            text-align: center;
            letter-spacing: 4px;
            transition: all 0.3s ease;
            font-family: 'Cairo', sans-serif;
            font-weight: 600;
        }

            .auth-input:focus {
                border-color: var(--purple);
                background: rgba(124, 58, 237, 0.03);
                box-shadow: 0 0 20px var(--purple-glow);
                transform: translateY(-2px);
            }

        .btn-auth {
            width: 100%;
            padding: 20px;
            background: var(--gradient-purple);
            color: white;
            border: none;
            border-radius: var(--radius-md);
            font-size: 1.2rem;
            font-weight: bold;
            cursor: pointer;
            transition: all 0.3s ease;
            box-shadow: 0 10px 25px rgba(124, 58, 237, 0.2);
            position: relative;
            overflow: hidden;
            letter-spacing: 1px;
            font-family: 'Tajawal', sans-serif;
        }

            .btn-auth::before {
                content: '';
                position: absolute;
                top: 0;
                left: -100%;
                width: 100%;
                height: 100%;
                background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
                transition: 0.5s;
            }

            .btn-auth:hover {
                transform: translateY(-3px);
                box-shadow: 0 15px 35px rgba(124, 58, 237, 0.3);
            }

                .btn-auth:hover::before {
                    left: 100%;
                }

        /* ==========================================================================
                4. LAYOUT & SIDEBAR
                ==========================================================================
             */
        .app-layout {
            display: grid;
            grid-template-columns: 300px 1fr;
            width: 100%;
            height: 100vh;
            opacity: 0;
            animation: fadeIn 0.5s ease forwards 0.3s;
        }

        .sidebar {
            background: rgba(15, 15, 25, 0.9);
            backdrop-filter: var(--glass);
            border-left: 1px solid rgba(124, 58, 237, 0.05);
            padding: 30px 25px;
            display: flex;
            flex-direction: column;
            gap: 20px;
            z-index: 100;
            box-shadow: 10px 0 30px rgba(0,0,0,0.2);
            position: relative;
            overflow-y: auto;
        }

            .sidebar::before {
                content: '';
                position: absolute;
                top: 0;
                left: 0;
                right: 0;
                height: 1px;
                background: linear-gradient(90deg, transparent, var(--purple), transparent);
            }

        .brand {
            display: flex;
            align-items: center;
            gap: 20px;
            margin-bottom: 50px;
            padding: 0 10px;
        }

            .brand img {
                width: 55px;
                height: 55px;
                border-radius: 12px;
                border: 2px solid rgba(124, 58, 237, 0.2);
                padding: 5px;
                background: rgba(124, 58, 237, 0.05);
                transition: all 0.3s ease;
            }

                .brand img:hover {
                    transform: rotate(15deg) scale(1.1);
                    border-color: var(--purple);
                }

        .brand-text h3 {
            margin: 0;
            font-size: 1.4rem;
            color: white;
            font-weight: 800;
            letter-spacing: 1px;
            font-family: 'Tajawal', sans-serif;
        }

        .brand-text span {
            font-size: 0.85rem;
            color: var(--purple);
            letter-spacing: 3px;
            font-weight: bold;
            text-transform: uppercase;
            background: linear-gradient(45deg, var(--purple), var(--neon-blue));
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            font-family: 'Tajawal', sans-serif;
        }

        .nav-btn {
            background: transparent;
            border: none;
            width: 100%;
            padding: 18px 25px;
            border-radius: var(--radius-md);
            color: var(--text-muted);
            font-size: 1.1rem;
            font-weight: 600;
            display: flex;
            align-items: center;
            gap: 20px;
            cursor: pointer;
            transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
            text-align: right;
            position: relative;
            overflow: hidden;
            font-family: 'Tajawal', sans-serif;
        }

            .nav-btn::before {
                content: '';
                position: absolute;
                top: 0;
                right: -100%;
                width: 100%;
                height: 100%;
                background: linear-gradient(90deg, transparent, rgba(124, 58, 237, 0.05), transparent);
                transition: 0.5s;
            }

            .nav-btn i {
                width: 25px;
                font-size: 1.3rem;
                transition: 0.3s;
            }

            .nav-btn:hover {
                background: rgba(255,255,255,0.02);
                color: white;
                transform: translateX(-5px);
            }

                .nav-btn:hover::before {
                    right: 100%;
                }

            .nav-btn.active {
                background: linear-gradient(90deg, rgba(124, 58, 237, 0.1) 0%, transparent 100%);
                color: var(--purple);
                border-right: 3px solid var(--purple);
                font-weight: 700;
                box-shadow: inset 0 0 20px rgba(124, 58, 237, 0.05);
            }

                .nav-btn.active i {
                    color: var(--purple);
                    filter: drop-shadow(0 0 5px var(--purple-glow));
                }

        .logout-btn {
            margin-top: auto;
            color: var(--red);
            border: 1px solid rgba(239, 68, 68, 0.1);
        }

            .logout-btn:hover {
                background: rgba(239, 68, 68, 0.05);
                color: var(--red);
                border-color: rgba(239, 68, 68, 0.2);
            }

        /* ==========================================================================
                5. MAIN CONTENT AREA
                ==========================================================================
             */
        .main-content {
            padding: 40px 50px;
            overflow-y: auto;
            flex: 1;
            background: rgba(10, 10, 15, 0.3);
            position: relative;
            width: 100%;
            max-width: 100%;
            overflow-x: hidden;
        }

        .header-bar {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 50px;
            padding-bottom: 20px;
            border-bottom: 1px solid rgba(255,255,255,0.03);
        }

        .page-title h1 {
            font-size: 2.3rem;
            margin: 0;
            font-weight: 800;
            background: linear-gradient(45deg, var(--text-main), var(--text-muted));
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            letter-spacing: 0.5px;
            font-family: 'Tajawal', sans-serif;
        }

        .page-title p {
            color: var(--text-muted);
            margin: 10px 0 0;
            font-size: 1rem;
            max-width: 600px;
            font-family: 'Cairo', sans-serif;
            font-weight: 400;
        }

        /* Stats Cards */
        .stats-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
            gap: 25px;
            margin-bottom: 40px;
        }

        .stat-card {
            background: var(--bg-card);
            border: var(--border);
            border-radius: var(--radius-md);
            padding: 30px;
            display: flex;
            align-items: center;
            gap: 25px;
            transition: all 0.4s ease;
            position: relative;
            overflow: hidden;
            cursor: pointer;
        }

            .stat-card::before {
                content: '';
                position: absolute;
                top: 0;
                left: 0;
                width: 100%;
                height: 100%;
                background: linear-gradient(45deg, transparent 30%, rgba(255,255,255,0.01) 50%, transparent 70%);
                transform: translateX(-100%);
                transition: transform 0.6s;
            }

            .stat-card:hover {
                transform: translateY(-5px);
                border-color: var(--purple);
                box-shadow: 0 15px 40px rgba(0,0,0,0.4);
            }

                .stat-card:hover::before {
                    transform: translateX(100%);
                }

            .stat-card::after {
                content: '';
                position: absolute;
                top: 0;
                left: 0;
                width: 100%;
                height: 3px;
                background: var(--gradient-purple);
            }

        .stat-icon {
            width: 60px;
            height: 60px;
            background: rgba(124, 58, 237, 0.08);
            border-radius: 16px;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 1.8rem;
            color: var(--purple);
            transition: all 0.3s ease;
        }

        .stat-card:hover .stat-icon {
            background: rgba(124, 58, 237, 0.15);
            transform: scale(1.05) rotate(5deg);
        }

        .stat-info h4 {
            margin: 0;
            color: var(--text-muted);
            font-size: 0.95rem;
            font-weight: 500;
            letter-spacing: 0.5px;
            font-family: 'Cairo', sans-serif;
        }

        .stat-info span {
            font-size: 2rem;
            font-weight: bold;
            color: white;
            display: block;
            margin-top: 5px;
            font-family: 'Tajawal', sans-serif;
        }

        /* Forms */
        .glass-panel {
            background: rgba(20, 20, 30, 0.6);
            border: 1px solid rgba(124, 58, 237, 0.1);
            border-radius: var(--radius-lg);
            padding: 40px;
            margin-bottom: 40px;
            box-shadow: 0 15px 40px rgba(0,0,0,0.2), inset 0 1px 0 rgba(255,255,255,0.03);
            width: 100%;
            max-width: 100%;
            box-sizing: border-box;
            backdrop-filter: var(--glass);
        }

        .form-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
            gap: 20px;
            margin-bottom: 25px;
        }

        .c-input {
            width: 100%;
            padding: 16px 20px;
            background: rgba(15, 15, 25, 0.4);
            border: 1px solid rgba(124, 58, 237, 0.1);
            border-radius: var(--radius-sm);
            color: white;
            font-family: 'Cairo', sans-serif;
            transition: all 0.3s ease;
            max-width: 100%;
            box-sizing: border-box;
            font-size: 1rem;
        }

            .c-input:focus {
                border-color: var(--purple);
                background: rgba(124, 58, 237, 0.03);
                box-shadow: 0 0 15px rgba(124, 58, 237, 0.15);
                transform: translateY(-2px);
            }

        select.c-input {
            appearance: none;
            cursor: pointer;
            background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%237c3aed' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14L2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
            background-repeat: no-repeat;
            background-position: left 20px center;
            padding-left: 50px;
        }

        .btn-action {
            padding: 15px 35px;
            border-radius: var(--radius-sm);
            border: none;
            font-weight: bold;
            cursor: pointer;
            display: inline-flex;
            align-items: center;
            gap: 12px;
            transition: all 0.3s ease;
            font-size: 1rem;
            font-family: 'Tajawal', sans-serif;
            position: relative;
            overflow: hidden;
            letter-spacing: 0.3px;
        }

            .btn-action::before {
                content: '';
                position: absolute;
                top: 0;
                left: -100%;
                width: 100%;
                height: 100%;
                background: linear-gradient(90deg, transparent, rgba(255,255,255,0.05), transparent);
                transition: 0.5s;
            }

            .btn-action:hover::before {
                left: 100%;
            }

        .btn-primary {
            background: var(--gradient-purple);
            color: white;
            box-shadow: 0 8px 20px rgba(124, 58, 237, 0.2);
        }

            .btn-primary:hover {
                background: linear-gradient(135deg, #6d28d9 0%, #8b5cf6 100%);
                transform: translateY(-2px);
                box-shadow: 0 12px 25px rgba(124, 58, 237, 0.3);
            }

        .btn-success {
            background: var(--gradient-blue);
            color: white;
        }

        .btn-cancel {
            background: rgba(255,255,255,0.03);
            color: var(--text-muted);
            border: 1px solid rgba(255,255,255,0.05);
        }

        /* Products List (Grid Layout) */
        .products-container {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
            gap: 25px;
            width: 100%;
        }

        .product-card {
            background: var(--bg-card);
            border: var(--border);
            border-radius: var(--radius-md);
            padding: 20px;
            position: relative;
            transition: all 0.4s ease;
            width: 100%;
            box-sizing: border-box;
            overflow: hidden;
        }

            .product-card::before {
                content: '';
                position: absolute;
                top: 0;
                left: 0;
                right: 0;
                height: 1px;
                background: var(--gradient-purple);
                transform: scaleX(0);
                transition: transform 0.4s ease;
            }

            .product-card:hover {
                border-color: var(--purple);
                transform: translateY(-5px);
                box-shadow: 0 15px 35px rgba(0,0,0,0.3);
            }

                .product-card:hover::before {
                    transform: scaleX(1);
                }

        .p-img {
            width: 100%;
            height: 180px;
            object-fit: cover;
            border-radius: var(--radius-sm);
            margin-bottom: 20px;
            transition: all 0.3s ease;
            border: 1px solid rgba(255,255,255,0.03);
        }

        .product-card:hover .p-img {
            transform: scale(1.02);
            border-color: rgba(124, 58, 237, 0.2);
        }

        .p-details h3 {
            margin: 0 0 10px;
            font-size: 1.2rem;
            font-weight: 700;
            color: white;
            line-height: 1.4;
            font-family: 'Tajawal', sans-serif;
        }

        .p-price {
            color: var(--gold);
            font-weight: bold;
            font-size: 1.4rem;
            margin: 10px 0;
            display: flex;
            align-items: center;
            gap: 10px;
            font-family: 'Tajawal', sans-serif;
        }

        .p-actions {
            margin-top: 20px;
            display: flex;
            gap: 12px;
        }
/* =========================================================
   📦 تصغير كروت المنتجات (Compact Products Mode)
   ========================================================= */

/* 1. تصغير عرض الكارت وتقليل المسافات لزيادة العدد في الصف الواحد */
.products-container {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)) !important; /* كانت 300px */
    gap: 15px !important;
}

/* 2. تقليل الهوامش الداخلية للكارت */
.product-card {
    padding: 12px !important; /* كانت 20px */
}

/* 3. تصغير صورة المنتج */
.p-img {
    height: 130px !important; /* كانت 180px */
    margin-bottom: 10px !important;
}

/* 4. تصغير الخطوط (الاسم، السعر، المنصة) */
.p-details h3 {
    font-size: 1rem !important; /* اسم المنتج */
    margin-bottom: 5px !important;
}

.p-details div[style*="font-size:0.9rem"] {
    font-size: 0.75rem !important; /* الوصف المختصر */
    margin-bottom: 5px !important;
}

.p-price {
    font-size: 1.1rem !important; /* السعر */
    margin: 8px 0 !important;
}

/* 5. تصغير أزرار التحكم (التعديل، الحذف، السحب) */
.p-actions {
    margin-top: 12px !important;
    gap: 8px !important;
}

#section-products .icon-btn, 
#section-products .drag-handle {
    width: 32px !important; /* كانت 40px */
    height: 32px !important;
    font-size: 0.85rem !important;
    border-radius: 8px !important;
}
        .icon-btn {
            width: 40px;
            height: 40px;
            border-radius: 10px;
            border: none;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: all 0.3s ease;
            font-size: 1.1rem;
            position: relative;
            overflow: hidden;
        }

            .icon-btn::before {
                content: '';
                position: absolute;
                top: 0;
                left: -100%;
                width: 100%;
                height: 100%;
                background: linear-gradient(90deg, transparent, rgba(255,255,255,0.05), transparent);
                transition: 0.5s;
            }

            .icon-btn:hover::before {
                left: 100%;
            }

        .btn-edit {
            background: rgba(59, 130, 246, 0.1);
            color: var(--neon-blue);
            border: 1px solid rgba(59, 130, 246, 0.15);
        }

            .btn-edit:hover {
                background: rgba(59, 130, 246, 0.2);
                transform: translateY(-2px);
                box-shadow: 0 5px 12px rgba(59, 130, 246, 0.2);
            }

        .btn-del {
            background: rgba(239, 68, 68, 0.1);
            color: var(--red);
            border: 1px solid rgba(239, 68, 68, 0.15);
        }

            .btn-del:hover {
                background: rgba(239, 68, 68, 0.2);
                transform: translateY(-2px);
                box-shadow: 0 5px 12px rgba(239, 68, 68, 0.2);
            }

        .drag-handle {
            margin-right: auto;
            cursor: grab;
            color: #666;
            transition: all 0.3s ease;
            width: 40px;
            height: 40px;
            display: flex;
            align-items: center;
            justify-content: center;
            border-radius: 10px;
            background: rgba(255,255,255,0.02);
            border: 1px solid rgba(255,255,255,0.03);
        }

            .drag-handle:hover {
                color: var(--purple);
                background: rgba(124, 58, 237, 0.08);
                border-color: rgba(124, 58, 237, 0.15);
            }

            .drag-handle:active {
                cursor: grabbing;
                transform: scale(0.95);
            }

        /* Orders Table */
        .table-responsive {
            overflow-x: auto;
            border-radius: var(--radius-md);
            border: var(--border);
            width: 100%;
            background: rgba(20, 20, 30, 0.4);
        }

        .custom-table {
            width: 100%;
            border-collapse: collapse;
            min-width: 1000px;
        }

            .custom-table th {
                background: rgba(124, 58, 237, 0.08);
                padding: 25px;
                text-align: right;
                color: var(--text-muted);
                font-weight: 600;
                font-size: 1rem;
                letter-spacing: 0.5px;
                border-bottom: 1px solid rgba(124, 58, 237, 0.05);
                font-family: 'Cairo', sans-serif;
            }

            .custom-table td {
                padding: 25px;
                border-bottom: 1px solid rgba(255,255,255,0.02);
                color: white;
                vertical-align: middle;
                transition: all 0.3s ease;
                font-family: 'Tajawal', sans-serif;
            }

            .custom-table tr:hover td {
                background: rgba(255,255,255,0.01);
            }

        .status-pill {
            padding: 8px 16px;
            border-radius: 50px;
            font-size: 0.85rem;
            font-weight: bold;
            display: inline-flex;
            align-items: center;
            gap: 8px;
            transition: all 0.3s ease;
            letter-spacing: 0.3px;
            font-family: 'Tajawal', sans-serif;
        }

        .st-pending {
            background: rgba(245, 158, 11, 0.08);
            color: #f59e0b;
            border: 1px solid rgba(245, 158, 11, 0.15);
        }

        .st-completed {
            background: rgba(16, 185, 129, 0.08);
            color: var(--green);
            border: 1px solid rgba(16, 185, 129, 0.15);
        }

        .st-cancelled {
            background: rgba(239, 68, 68, 0.08);
            color: var(--red);
            border: 1px solid rgba(239, 68, 68, 0.15);
        }

        /* ==========================================================================
                6. MODAL & TOAST
                ==========================================================================
             */
        .modal-overlay {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0,0,0,0.8);
            backdrop-filter: blur(5px);
            z-index: 2000;
            display: none;
            justify-content: center;
            align-items: center;
            animation: fadeIn 0.3s ease;
        }

        .modal-box {
            background: #1a1a2e;
            border: 1px solid rgba(124, 58, 237, 0.2);
            width: 90%;
            max-width: 600px;
            border-radius: var(--radius-lg);
            padding: 40px;
            position: relative;
            animation: slideInUp 0.4s ease;
            box-shadow: 0 0 50px rgba(124, 58, 237, 0.15), inset 0 1px 0 rgba(255,255,255,0.03);
            backdrop-filter: var(--glass);
        }

        .modal-header {
            font-size: 1.4rem;
            font-weight: bold;
            margin-bottom: 30px;
            display: flex;
            justify-content: space-between;
            align-items: center;
            color: var(--purple);
            padding-bottom: 20px;
            border-bottom: 1px solid rgba(124, 58, 237, 0.08);
            font-family: 'Tajawal', sans-serif;
        }

        .close-modal {
            cursor: pointer;
            font-size: 1.8rem;
            color: var(--text-muted);
            transition: all 0.3s ease;
            width: 40px;
            height: 40px;
            display: flex;
            align-items: center;
            justify-content: center;
            border-radius: 50%;
            background: rgba(255,255,255,0.02);
        }

            .close-modal:hover {
                color: var(--red);
                background: rgba(239, 68, 68, 0.08);
                transform: rotate(90deg);
            }

        /* Toast */
        #toast-container {
            position: fixed;
            top: 30px;
            left: 50%;
            transform: translateX(-50%);
            z-index: 10000;
            display: flex;
            flex-direction: column;
            gap: 15px;
        }

        .toast-msg {
            background: rgba(30, 30, 45, 0.95);
            color: white;
            padding: 15px 30px;
            border-radius: 50px;
            box-shadow: 0 10px 30px rgba(0,0,0,0.4), 0 0 0 1px rgba(124, 58, 237, 0.05);
            border-left: 3px solid;
            display: flex;
            align-items: center;
            gap: 15px;
            font-weight: 600;
            animation: slideInDown 0.4s ease;
            min-width: 350px;
            justify-content: center;
            backdrop-filter: var(--glass);
            letter-spacing: 0.3px;
            font-family: 'Tajawal', sans-serif;
        }

        /* ==========================================================================
                7. AD MANAGEMENT SECTION
                ==========================================================================
             */
        .ad-cards-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
            gap: 25px;
            width: 100%;
            margin-bottom: 30px;
        }

        .ad-card-item {
            background: rgba(25, 25, 40, 0.6);
            border: 1px solid rgba(124, 58, 237, 0.1);
            border-radius: var(--radius-md);
            padding: 25px;
            width: 100%;
            box-sizing: border-box;
            transition: all 0.4s ease;
            display: flex;
            flex-direction: column;
            gap: 20px;
            position: relative;
            overflow: hidden;
        }

            .ad-card-item::before {
                content: '';
                position: absolute;
                top: 0;
                left: 0;
                right: 0;
                height: 1px;
                background: var(--gradient-purple);
                transform: scaleX(0);
                transition: transform 0.4s ease;
            }

            .ad-card-item:hover {
                border-color: rgba(124, 58, 237, 0.3);
                transform: translateY(-5px);
                box-shadow: 0 15px 35px rgba(0,0,0,0.25);
            }

                .ad-card-item:hover::before {
                    transform: scaleX(1);
                }

            .ad-card-item h4 {
                margin: 0;
                font-size: 1.3rem;
                color: white;
                display: flex;
                align-items: center;
                gap: 10px;
                font-family: 'Tajawal', sans-serif;
            }

        .ad-preview-container {
            width: 100%;
            height: 200px;
            border-radius: var(--radius-sm);
            overflow: hidden;
            position: relative;
            background: linear-gradient(45deg, #0f0f1a, #1a1a2e);
            border: 1px solid rgba(255, 255, 255, 0.03);
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .ad-preview-img {
            width: 100%;
            height: 100%;
            object-fit: cover;
            transition: all 0.5s ease;
        }

            .ad-preview-img.loading {
                filter: blur(5px);
                opacity: 0.7;
            }

        .no-preview {
            text-align: center;
            color: #666;
            padding: 20px;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            height: 100%;
            gap: 15px;
        }

            .no-preview i {
                font-size: 3rem;
                margin-bottom: 10px;
                opacity: 0.2;
            }

        .ad-input-group {
            display: flex;
            flex-direction: column;
            gap: 15px;
        }

        .ad-input-label {
            font-size: 0.9rem;
            color: var(--text-muted);
            display: flex;
            align-items: center;
            gap: 10px;
            font-weight: 500;
            font-family: 'Cairo', sans-serif;
        }

            .ad-input-label i {
                color: var(--purple);
                font-size: 1.1rem;
            }

        .ad-input {
            width: 100%;
            padding: 14px 18px;
            background: rgba(15, 15, 25, 0.5);
            border: 1px solid rgba(124, 58, 237, 0.1);
            border-radius: var(--radius-sm);
            color: white;
            font-family: 'Cairo', sans-serif;
            transition: all 0.3s ease;
            font-size: 1rem;
            box-sizing: border-box;
        }

            .ad-input:focus {
                border-color: var(--purple);
                background: rgba(124, 58, 237, 0.05);
                box-shadow: 0 0 15px rgba(124, 58, 237, 0.2);
                transform: translateY(-2px);
            }

            .ad-input::placeholder {
                color: #555;
            }

        .refresh-preview-btn {
            position: absolute;
            top: 15px;
            right: 15px;
            background: rgba(0, 0, 0, 0.6);
            border: 1px solid rgba(124, 58, 237, 0.15);
            color: white;
            width: 36px;
            height: 36px;
            border-radius: 50%;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 1rem;
            transition: all 0.3s ease;
            z-index: 10;
            backdrop-filter: blur(5px);
        }

            .refresh-preview-btn:hover {
                background: var(--purple);
                transform: rotate(90deg);
                box-shadow: 0 0 15px rgba(124, 58, 237, 0.4);
            }

        .save-ad-btn {
            width: 100%;
            padding: 20px;
            background: var(--gradient-purple);
            color: white;
            border: none;
            border-radius: var(--radius-md);
            font-weight: 800;
            font-size: 1.1rem;
            cursor: pointer;
            transition: all 0.4s ease;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 15px;
            box-shadow: 0 12px 35px rgba(124, 58, 237, 0.2);
            max-width: 500px;
            margin: 30px auto 0;
            letter-spacing: 0.5px;
            position: relative;
            overflow: hidden;
            font-family: 'Tajawal', sans-serif;
        }

            .save-ad-btn::before {
                content: '';
                position: absolute;
                top: 0;
                left: -100%;
                width: 100%;
                height: 100%;
                background: linear-gradient(90deg, transparent, rgba(255,255,255,0.05), transparent);
                transition: 0.6s;
            }

            .save-ad-btn:hover {
                transform: translateY(-3px);
                box-shadow: 0 18px 45px rgba(124, 58, 237, 0.3);
            }

                .save-ad-btn:hover::before {
                    left: 100%;
                }

            .save-ad-btn:disabled {
                opacity: 0.6;
                cursor: not-allowed;
                transform: none !important;
            }

        /* ==========================================================================
                8. MOBILE RESPONSIVE
                ==========================================================================
             */
        .mobile-header {
            display: none;
            padding: 20px 25px;
            background: rgba(15, 15, 25, 0.9);
            justify-content: space-between;
            align-items: center;
            border-bottom: 1px solid rgba(124, 58, 237, 0.05);
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            z-index: 1000;
            backdrop-filter: var(--glass);
        }

        .mobile-menu-btn {
            background: rgba(124, 58, 237, 0.08);
            border: 1px solid rgba(124, 58, 237, 0.15);
            color: var(--purple);
            font-size: 1.5rem;
            width: 50px;
            height: 50px;
            border-radius: 12px;
            cursor: pointer;
            transition: all 0.3s ease;
            display: flex;
            align-items: center;
            justify-content: center;
        }

            .mobile-menu-btn:hover {
                background: rgba(124, 58, 237, 0.15);
                transform: rotate(90deg);
            }

        /* إضافة backdrop للقائمة الجانبية */
        #sidebar-backdrop {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: rgba(0,0,0,0.5);
            backdrop-filter: blur(2px);
            z-index: 999;
            display: none;
        }

        @media (max-width: 1024px) {
            .app-layout {
                grid-template-columns: 1fr;
                display: block;
            }

            .sidebar {
                position: fixed;
                left: -100%;
                top: 0;
                height: 100%;
                width: 300px;
                transition: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
                z-index: 1001;
                box-shadow: 10px 0 40px rgba(0,0,0,0.3);
                backdrop-filter: none !important;
            }

                .sidebar.active {
                    left: 0;
                }

            .mobile-header {
                display: flex;
                backdrop-filter: none !important;
            }

            .main-content {
                padding: 80px 25px 25px 25px;
                height: 100vh;
                overflow-y: auto;
            }

            .products-container,
            .ad-cards-grid {
                grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
            }

            .glass-panel {
                padding: 30px;
                backdrop-filter: none !important;
            }

            .ad-preview-container {
                height: 180px;
            }

            #sidebar-backdrop.active {
                display: block;
            }
        }

        @media (max-width: 768px) {
            .page-title h1 {
                font-size: 2rem;
            }

            .stats-grid {
                grid-template-columns: 1fr;
            }

            .form-grid {
                grid-template-columns: 1fr;
            }

            .products-container,
            .ad-cards-grid {
                grid-template-columns: 1fr;
            }

            .modal-box {
                padding: 30px 20px;
            }
        }

        /* ==========================================================================
                9. ENHANCEMENTS
                ==========================================================================
             */
        .version-badge {
            position: absolute;
            bottom: 20px;
            left: 20px;
            background: rgba(124, 58, 237, 0.08);
            border: 1px solid rgba(124, 58, 237, 0.15);
            border-radius: 20px;
            padding: 8px 16px;
            font-size: 0.75rem;
            color: var(--purple);
            font-weight: 600;
            letter-spacing: 1px;
        }

        .connection-status {
            position: fixed;
            bottom: 20px;
            right: 20px;
            display: flex;
            align-items: center;
            gap: 10px;
            background: rgba(16, 185, 129, 0.08);
            border: 1px solid rgba(16, 185, 129, 0.15);
            border-radius: 20px;
            padding: 8px 16px;
            font-size: 0.8rem;
            color: var(--green);
            z-index: 100;
            backdrop-filter: blur(5px);
        }

            .connection-status.offline {
                background: rgba(239, 68, 68, 0.08);
                border-color: rgba(239, 68, 68, 0.15);
                color: var(--red);
            }

        .connection-dot {
            width: 8px;
            height: 8px;
            border-radius: 50%;
            background: var(--green);
            animation: pulse 2s infinite;
        }

        .connection-status.offline .connection-dot {
            background: var(--red);
        }

        .notification-bell {
            position: relative;
            cursor: pointer;
            font-size: 1.3rem;
            color: var(--text-muted);
            transition: all 0.3s ease;
            padding: 10px;
            border-radius: 50%;
            background: rgba(255,255,255,0.02);
        }

            .notification-bell:hover {
                color: var(--purple);
                background: rgba(124, 58, 237, 0.08);
                transform: scale(1.1);
            }

            .notification-bell::after {
                content: '';
                position: absolute;
                top: 8px;
                right: 8px;
                width: 8px;
                height: 8px;
                background: var(--red);
                border-radius: 50%;
                border: 2px solid var(--bg-panel);
                display: none;
            }

            .notification-bell.has-notification::after {
                display: block;
                animation: pulse 1.5s infinite;
            }

            .notification-bell.has-notification {
                animation: shake 0.5s ease-in-out;
            }

        .select-box {
            position: relative;
            width: 100%;
            background-color: #252525;
            border: 1px solid #333;
            border-radius: 8px;
            transition: 0.3s;
        }

            .select-box::after {
                content: '';
                position: absolute;
                left: 15px;
                top: 50%;
                width: 0;
                height: 0;
                border-left: 5px solid transparent;
                border-right: 5px solid transparent;
                border-top: 6px solid #888;
                transform: translateY(-50%);
                pointer-events: none;
                transition: 0.3s;
            }

            .select-box:focus-within {
                border-color: #7289da;
                box-shadow: 0 0 0 3px rgba(114, 137, 218, 0.2);
            }

        /* تنسيق الخيارات الداخلية */
        .c-input option {
            background-color: #252525;
            color: #fff;
            padding: 15px;
        }

        .select-box:hover::after {
            border-top-color: #fff;
        }

        /* ==========================================================================
                10. LIVE CHAT BUTTON
                ==========================================================================
             */
        #live-chat-button {
            position: fixed;
            bottom: 90px;
            left: 20px;
            background: linear-gradient(135deg, #7c3aed, #a855f7);
            color: white;
            width: 60px;
            height: 60px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 24px;
            cursor: pointer;
            box-shadow: 0 8px 25px rgba(124, 58, 237, 0.4);
            z-index: 999;
            transition: all 0.3s ease;
            border: none;
            animation: pulse-chat 2s infinite;
        }

        @keyframes pulse-chat {
            0%, 100% {
                transform: scale(1);
                box-shadow: 0 8px 25px rgba(124, 58, 237, 0.4);
            }

            50% {
                transform: scale(1.05);
                box-shadow: 0 12px 30px rgba(124, 58, 237, 0.6);
            }
        }

        #live-chat-button:hover {
            transform: scale(1.1) rotate(5deg);
            box-shadow: 0 15px 35px rgba(124, 58, 237, 0.6);
        }

        #live-chat-button.has-unread::after {
            content: '';
            position: absolute;
            top: 5px;
            right: 5px;
            width: 12px;
            height: 12px;
            background: #ff4757;
            border-radius: 50%;
            border: 2px solid #1a1a2e;
            animation: pulse 1.5s infinite;
        }

        @media (max-width: 1024px) {
            #live-chat-button {
                bottom: 80px;
                left: 15px;
                width: 55px;
                height: 55px;
                font-size: 22px;
            }
        }

        @media (max-width: 768px) {
            #live-chat-button {
                bottom: 70px;
                left: 10px;
                width: 50px;
                height: 50px;
                font-size: 20px;
            }
        }

        /* Live Chat Modal */
        #live-chat-modal {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0,0,0,0.9);
            backdrop-filter: blur(10px);
            z-index: 9999;
            display: none;
            justify-content: center;
            align-items: center;
            animation: fadeIn 0.3s ease;
        }

        .live-chat-container {
            width: 95%;
            height: 90%;
            max-width: 1200px;
            background: #1a1a2e;
            border-radius: 20px;
            border: 1px solid rgba(124, 58, 237, 0.3);
            overflow: hidden;
            box-shadow: 0 25px 50px rgba(0,0,0,0.5);
            display: flex;
            flex-direction: column;
        }

        .live-chat-header {
            background: linear-gradient(135deg, #6f42c1, #8e44ad);
            padding: 20px 30px;
            text-align: center;
            border-bottom: 3px solid #ffd700;
            box-shadow: 0 4px 20px rgba(0,0,0,0.3);
        }

            .live-chat-header h2 {
                font-size: 1.8rem;
                margin: 0;
                color: white;
                text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
            }

        .live-chat-subtitle {
            opacity: 0.9;
            font-size: 0.9rem;
            margin-top: 5px;
            color: rgba(255,255,255,0.9);
        }

        .live-chat-content {
            flex: 1;
            overflow: hidden;
            display: flex;
        }

        .live-chat-iframe {
            width: 100%;
            height: 100%;
            border: none;
            background: white;
        }

        .close-live-chat {
            position: absolute;
            top: 15px;
            left: 15px;
            background: rgba(239, 68, 68, 0.2);
            color: white;
            width: 40px;
            height: 40px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            font-size: 1.5rem;
            transition: all 0.3s ease;
            border: 1px solid rgba(239, 68, 68, 0.3);
            z-index: 10;
        }

            .close-live-chat:hover {
                background: rgba(239, 68, 68, 0.4);
                transform: rotate(90deg);
            }

        /* ==========================================================================
                11. MOBILE BOTTOM NAVIGATION
                ==========================================================================
             */
        .mobile-bottom-nav {
            position: fixed;
            bottom: 0;
            left: 0;
            right: 0;
            background: rgba(20, 20, 30, 0.95);
            backdrop-filter: blur(20px);
            border-top: 1px solid rgba(124, 58, 237, 0.1);
            display: none;
            justify-content: space-around;
            align-items: center;
            padding: 10px 0;
            z-index: 1000;
            box-shadow: 0 -5px 20px rgba(0, 0, 0, 0.3);
        }

        .mobile-nav-btn {
            background: transparent;
            border: none;
            color: var(--text-muted);
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 5px;
            padding: 12px 10px;
            width: 100%;
            cursor: pointer;
            transition: all 0.3s ease;
            font-family: 'Tajawal', sans-serif;
            font-size: 0.8rem;
            position: relative;
        }

            .mobile-nav-btn i {
                font-size: 1.2rem;
                transition: all 0.3s ease;
            }

            .mobile-nav-btn.active {
                color: var(--purple);
            }

                .mobile-nav-btn.active i {
                    color: var(--purple);
                    transform: translateY(-3px);
                    filter: drop-shadow(0 0 5px rgba(124, 58, 237, 0.3));
                }

                .mobile-nav-btn.active::after {
                    content: '';
                    position: absolute;
                    top: -1px;
                    width: 30px;
                    height: 3px;
                    background: var(--gradient-purple);
                    border-radius: 2px;
                }

            .mobile-nav-btn:hover:not(.active) {
                color: white;
                transform: translateY(-2px);
            }

                .mobile-nav-btn:hover:not(.active) i {
                    color: white;
                }

        /* إظهار شريط التنقل في الموبايل فقط */
        @media (max-width: 1024px) {
            .mobile-bottom-nav {
                display: flex;
            }

            /* تعديل padding للمحتوى الرئيسي ليتناسب مع شريط التنقل */
            .main-content {
                padding-bottom: 80px !important;
            }
        }

        /* --- 5. أهم جزء: الشبكة المتجاوبة (Responsive Grid) --- */
        /* هذا الكلاس سنضعه بدلاً من الستايل المباشر في الـ HTML */
        .responsive-grid {
            display: grid;
            grid-template-columns: 1fr 1fr; /* عمودين للشاشات الكبيرة */
            gap: 12px;
            margin-bottom: 12px;
        }

        .grid-tools {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 10px;
        }

        /* --- Media Queries (للموبايل والتابلت) --- */
        @media (max-width: 768px) {
            /* تحويل الشبكة لعمود واحد في الموبايل */
            .responsive-grid, .grid-tools {
                grid-template-columns: 1fr !important;
            }

            /* تصغير الهوامش قليلاً */
            .modal-box {
                padding: 15px;
                width: 90% !important;
            }
        }
        /* --- تنسيق الشات الأساسي (للكمبيوتر) --- */
        .chat-container {
            display: flex;
            height: 85vh; /* ارتفاع الشات */
            overflow: hidden;
            background: #fff;
            border-radius: 10px;
            box-shadow: 0 5px 15px rgba(0,0,0,0.05);
        }

        .chat-sidebar {
            width: 300px; /* عرض القائمة في الكمبيوتر */
            border-left: 1px solid #eee; /* في حالة العربي RTL */
            overflow-y: auto;
            background: #f9fafb;
            flex-shrink: 0; /* منع الانكماش */
        }

        .chat-main {
            flex: 1; /* يأخذ باقي المساحة */
            display: flex;
            flex-direction: column;
        }

        /* --- 📱 الحل السحري للتابلت والموبايل (Responsive) --- */
        @media (max-width: 992px) {

            .chat-container {
                flex-direction: column; /* تحويل الاتجاه لعمودي */
                height: auto; /* الارتفاع حسب المحتوى */
                min-height: 80vh;
            }

            /* 1. قائمة المستخدمين في التابلت */
            .chat-sidebar {
                width: 100%; /* العرض بالكامل */
                height: 150px; /* ارتفاع قصير */
                border-left: none;
                border-bottom: 1px solid #eee;
                display: flex; /* عرض المستخدمين بجانب بعض (اختياري) */
                overflow-x: auto; /* سكرول بالعرض لو القائمة طويلة */
                overflow-y: hidden;
            }

                /* (اختياري) تحسين شكل كارت المستخدم في القائمة العلوية */
                .chat-sidebar .user-card {
                    min-width: 200px; /* عرض ثابت للكارت عشان يظهروا جنب بعض */
                }

            /* 2. منطقة الشات */
            .chat-main {
                width: 100%;
                height: 600px; /* ارتفاع ثابت لمنطقة الرسائل */
            }
        }

        @media (max-width: 992px) and (min-width: 600px) {
            .chat-sidebar {
                width: 80px; /* تصغير القائمة جداً */
                text-align: center;
            }

                /* إخفاء اسم المستخدم وإظهار الصورة فقط لتوفير مساحة */
                .chat-sidebar .user-name,
                .chat-sidebar .last-message {
                    display: none;
                }

                .chat-sidebar .user-avatar {
                    margin: 0 auto; /* توسيط الصورة */
                }
        }
        /* --- تعديل نافذة اللايف شات لتملأ الشاشة في التابلت والموبايل --- */
        @media (max-width: 1024px) {
            .live-chat-container {
                width: 100% !important;
                height: 100% !important;
                max-width: 100% !important;
                border-radius: 0 !important; /* إلغاء الحواف الدائرية لتملأ الأركان */
                border: none !important;
            }

            /* تكبير زر الإغلاق ليسهل ضغطه باللمس */
            .close-live-chat {
                top: 10px;
                left: 10px;
                width: 45px;
                height: 45px;
                font-size: 1.2rem;
                background: rgba(239, 68, 68, 0.9); /* لون أحمر واضح */
                z-index: 2000; /* لضمان ظهوره فوق أي شيء */
            }
        }

        /* =========================================================
        إصلاح نافذة اللايف شات للتابلت والموبايل
        (توسيع النافذة لتصبح ملء الشاشة)
        ========================================================= */
        @media (max-width: 1024px) {
            /* جعل الحاوية تأخذ الشاشة بالكامل */
            .live-chat-container {
                width: 100% !important;
                height: 100% !important;
                max-width: 100% !important;
                border-radius: 0 !important; /* إلغاء الحواف الدائرية */
                border: none !important;
                display: flex !important;
                flex-direction: column !important;
            }

            /* تكبير زر الإغلاق وتحسين مكانه للمس */
            .close-live-chat {
                top: 15px !important;
                left: 15px !important;
                width: 45px !important;
                height: 45px !important;
                background: rgba(220, 38, 38, 0.9) !important; /* لون أحمر واضح */
                z-index: 99999 !important; /* فوق كل شيء */
                box-shadow: 0 4px 15px rgba(0,0,0,0.3);
            }

            /* التأكد من أن الـ iframe واخد المساحة كلها */
            .live-chat-content,
            .live-chat-iframe {
                height: 100% !important;
                width: 100% !important;
            }
        }

        /* 1. الشبكة: نخلي الكروت تيجي جنب بعض بمسافات ضيقة */
        .stats-grid {
            display: grid;
            /* الكارت الواحد ياخد مساحة صغيرة، ولو الشاشة واسعة يحطهم 4 جنب بعض */
            grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
            gap: 8px; /* المسافة بين الكروت صغيرة جداً */
            margin-bottom: 20px;
        }

        /* 2. الكارت نفسه: نشيل الفراغات الزيادة */
        .stat-card {
            padding: 8px 12px; /* حشو داخلي صغير */
            display: flex;
            align-items: center; /* الأيقونة والكلام على نفس السطر */
            gap: 10px; /* مسافة بين الأيقونة والكلام */
            min-height: unset; /* إلغاء أي طول ثابت قديم */
        }

        /* 3. تصغير الأيقونة والدايرة اللي حواليها */
        .stat-icon {
            width: 32px; /* عرض الدائرة */
            height: 32px; /* طول الدائرة */
            font-size: 0.9rem; /* حجم الرمز نفسه */
            border-radius: 8px; /* تدويرة خفيفة */
            display: flex;
            align-items: center;
            justify-content: center;
            background: rgba(255, 255, 255, 0.05); /* خلفية خفيفة للأيقونة */
        }

        /* 4. تصغير الكلام (العنوان) */
        .stat-info h4 {
            font-size: 0.7rem; /* خط صغير جداً للعنوان */
            margin: 0;
            opacity: 0.7;
            white-space: nowrap; /* يمنع الكلام ينزل سطرين */
        }

        /* 5. تصغير الرقم */
        .stat-info span {
            font-size: 1rem; /* حجم الرقم */
            font-weight: bold;
            line-height: 1;
            display: block;
            margin-top: 2px;
        }

        /* =========================================================
   ⚡ تصميم زر ونافذة الانتقال السريع (Quick Actions) ⚡
   ========================================================= */

/* زر الانتقال السريع العائم */
#quick-actions-trigger {
    position: fixed;
    bottom: 90px;
    right: 20px; /* على اليمين لعدم التعارض مع اللايف شات */
    background: linear-gradient(135deg, var(--neon-blue), #3b82f6);
    color: white;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    cursor: pointer;
    box-shadow: 0 8px 25px rgba(0, 212, 255, 0.4);
    z-index: 999;
    transition: all 0.3s ease;
    border: none;
    animation: pulse-qa 2.5s infinite;
}

@keyframes pulse-qa {
    0%, 100% { transform: scale(1); box-shadow: 0 8px 25px rgba(0, 212, 255, 0.4); }
    50% { transform: scale(1.05); box-shadow: 0 12px 30px rgba(0, 212, 255, 0.6); }
}

#quick-actions-trigger:hover {
    transform: scale(1.1) rotate(15deg);
}

/* شبكة الأزرار داخل النافذة */
.quick-actions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

/* تصميم كارت كل قسم */
.qa-btn {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    padding: 20px 10px;
    color: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    font-family: 'Tajawal', sans-serif;
    font-weight: bold;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.qa-btn i {
    font-size: 2.2rem;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.qa-btn:hover {
    background: rgba(0, 212, 255, 0.08);
    border-color: rgba(0, 212, 255, 0.3);
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.3);
}

.qa-btn:hover i {
    transform: scale(1.2);
    filter: drop-shadow(0 0 10px rgba(255,255,255,0.3));
}

/* تعديلات للموبايل */
@media (max-width: 1024px) {
    #quick-actions-trigger {
        bottom: 85px; /* يرتفع ليكون أعلى شريط التنقل السفلي */
        right: 15px;
        width: 55px;
        height: 55px;
        font-size: 22px;
    }

    .quick-actions-grid {
        grid-template-columns: repeat(3, 1fr); /* 3 أعمدة في الموبايل */
        gap: 10px;
    }

    .qa-btn {
        padding: 15px 5px;
        font-size: 0.8rem;
        gap: 10px;
    }
    
    .qa-btn i {
        font-size: 1.8rem;
    }
}
@media (max-width: 400px) {
    .quick-actions-grid {
        grid-template-columns: repeat(2, 1fr); /* عمودين للشاشات الصغيرة جداً */
    }
}

/* =========================================
   🔍 ستايل محرك البحث (Spotlight)
   ========================================= */
.spotlight-box {
    width: 90% !important;
    max-width: 650px !important;
    background: rgba(15, 15, 25, 0.95) !important;
    border: 1px solid var(--purple) !important;
    box-shadow: 0 20px 60px rgba(124, 58, 237, 0.3) !important;
    padding: 0 !important;
    border-radius: 15px !important;
    overflow: hidden;
}

.spotlight-header {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 20px 25px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    background: rgba(0, 0, 0, 0.2);
}

.spotlight-header i {
    color: var(--purple);
    font-size: 1.5rem;
}

.spotlight-header input {
    flex: 1;
    background: transparent;
    border: none;
    color: white;
    font-size: 1.2rem;
    outline: none;
    font-family: 'Cairo', sans-serif;
}

.spotlight-esc {
    font-size: 0.8rem;
    background: rgba(255, 255, 255, 0.1);
    padding: 4px 8px;
    border-radius: 6px;
    color: var(--text-muted);
    cursor: pointer;
    font-weight: bold;
}

.spotlight-results {
    max-height: 50vh;
    overflow-y: auto;
    padding: 10px;
    display: flex;
    flex-direction: column;
}

.spotlight-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    border-radius: 10px;
    cursor: pointer;
    transition: 0.2s;
    border: 1px solid transparent;
}

.spotlight-item:hover {
    background: rgba(124, 58, 237, 0.1);
    border-color: rgba(124, 58, 237, 0.2);
    transform: translateX(-5px);
}

.spotlight-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

/* =========================================
   🔥 ستايل المنتجات الأكثر مبيعاً (Hot Items)
   ========================================= */
.hot-item-row {
    display: flex;
    align-items: center;
    gap: 15px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 12px;
    border-radius: 12px;
}

.hot-item-img {
    width: 50px;
    height: 50px;
    border-radius: 8px;
    object-fit: cover;
    border: 1px solid rgba(255, 69, 0, 0.3);
}

.hot-item-progress-bg {
    flex: 1;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    overflow: hidden;
    margin-top: 8px;
}

.hot-item-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #ff4500, #ff8c00);
    border-radius: 10px;
    transition: width 1s ease-in-out;
}

#orders-load-more-footer {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 18px 0 10px;
}

#orders-load-more-btn {
    min-width: 220px;
    padding: 12px 20px;
}

/* إخفاء زر المستشار الذكي في شاشات الموبايل (أصغر من 768 بيكسل) */
@media (max-width: 768px) {
    #general-ai-btn {
        display: none !important;
    }
}
    .calc-btn {
        padding: 15px 5px;
        border: none;
        border-radius: 8px;
        font-size: 1.1rem;
        cursor: pointer;
        transition: 0.2s;
        background: rgba(255, 255, 255, 0.08);
        color: #fff;
    }
    .calc-btn:hover {
        background: rgba(255, 255, 255, 0.2);
        transform: translateY(-2px);
    }
    .op-btn {
        color: #25D366;
        font-weight: bold;
    }
    

/* ستايل المهمة لما يتعمل عليها صح */
.task-done-style {
    background: rgba(16, 185, 129, 0.05) !important; /* خلفية خضراء خفيفة جداً */
    border-color: var(--green) !important;
    transition: all 0.3s ease;
}

.task-done-style div {
    color: var(--text-muted) !important; /* بهتان النص */
}
/* الكارت اللي بيفضل مكانه وأنت بتسحب (الشفاف) */
.sortable-ghost {
    opacity: 0.3;
    background: var(--purple) !important;
    border: 2px dashed #fff !important;
}

/* شكل الكارت وهو "طاير" تحت الماوس */
.sortable-drag {
    cursor: grabbing !important;
    box-shadow: 0 15px 30px rgba(0,0,0,0.5) !important;
    transform: rotate(3deg);
}

.task-item {
    cursor: grab; /* شكل اليد للسحب */
    user-select: none; /* منع تحديد النص وأنت بتسحب */
}

.task-item:active {
    cursor: grabbing !important;
}

.task-column {
    min-height: 200px; /* عشان تقدر تسحب لعمود فاضي */
}
.task-column {
    background: rgba(255, 255, 255, 0.02);
    border-radius: 15px;
    padding: 15px;
    min-height: 400px;
    border: 1px solid rgba(255,255,255,0.05);
}
.column-header {
    display: flex;
    justify-content: space-between;
    padding-bottom: 15px;
    margin-bottom: 15px;
    font-weight: bold;
    font-size: 0.9rem;
}
.task-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.task-item {
    background: var(--bg-card);
    border-radius: 10px;
    padding: 15px;
    border: 1px solid rgba(255,255,255,0.05);
    cursor: grab;
    transition: 0.3s;
}
.task-item:hover {
    border-color: var(--purple);
    transform: translateX(-5px);
}
.task-user {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 10px;
    display: flex;
    align-items: center;
    gap: 5px;
}
.task-badge {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.65rem;
    text-transform: uppercase;
}
/* تأمين مساحة السحب حتى لو العمود فاضي */
.task-list {
    min-height: 150px; /* طول مناسب للسحب */
    padding: 10px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.02);
    transition: background 0.3s;
}

/* تأثير بصري عند السحب فوق عمود */
.task-list.sortable-chosen {
    background: rgba(124, 58, 237, 0.05);
}

/* شكل الكارت وهو بيتحرك */
.sortable-ghost {
    opacity: 0.4;
    border: 2px dashed var(--purple) !important;
    background: rgba(124, 58, 237, 0.1) !important;
}

.task-item {
    cursor: grab !important; /* شكل اليد للسحب */
    user-select: none;
}

.task-item:active {
    cursor: grabbing !important;
}
        /* =========================================================
        تظبيط نوافذ الإيميل والأدوات للشاشات الصغيرة (Mobile Modals Fix)
        ========================================================= */

        /* تعديلات عامة لجميع النوافذ المنبثقة لضمان عدم خروجها عن الشاشة */
        .modal-box {
            width: 95% !important;
            max-height: 90vh !important;
            overflow-y: auto !important;
        }

        @media (max-width: 768px) {
            /* تصغير الهوامش الداخلية في الموبايل */
            .modal-box {
                padding: 20px 15px !important; 
            }

            /* تعديل نافذة الإيميل */
            #email-modal .modal-header {
                flex-direction: column;
                align-items: flex-start !important;
                gap: 15px;
                font-size: 1.2rem !important;
                margin-bottom: 20px !important;
                padding-bottom: 15px !important;
            }

            #email-modal .modal-header > div {
                width: 100%;
                justify-content: space-between;
            }

            /* جعل حقول الإيميل والباسورد تحت بعضها بدلاً من بجانب بعضها */
            #email-modal .form-grid,
            #email-modal > .modal-box > div[style*="display: grid"] { 
                grid-template-columns: 1fr !important; 
                gap: 10px !important;
            }

            #email-modal .form-group {
                margin-bottom: 15px !important;
            }
            
            #email-modal .c-input {
                padding: 12px 15px !important; /* تصغير حجم الحقول قليلاً */
            }

            /* تعديل نافذة الأدوات */
            #tools-modal .modal-header {
                font-size: 1.2rem !important;
            }

            #tools-modal .stat-card {
                padding: 10px !important;
            }
            
            #tools-modal .stat-icon {
                width: 35px !important;
                height: 35px !important;
                font-size: 1rem !important;
            }
        }

        .active-carts-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
            gap: 15px;
        }

        .ghost-card {
            background: rgba(255, 0, 255, 0.05);
            border: 1px solid rgba(255, 0, 255, 0.2);
            border-radius: 12px;
            padding: 15px;
            position: relative;
            overflow: hidden;
            transition: 0.3s;
        }

            .ghost-card:hover {
                transform: translateY(-3px);
                box-shadow: 0 0 20px rgba(255, 0, 255, 0.15);
                border-color: #ff00ff;
            }

        .ghost-head {
            display: flex;
            justify-content: space-between;
            font-size: 0.9rem;
            margin-bottom: 10px;
            color: #ff00ff;
            font-weight: bold;
        }

        .ghost-item {
            display: flex;
            gap: 10px;
            margin-bottom: 8px;
            background: rgba(0,0,0,0.2);
            padding: 8px;
            border-radius: 8px;
            align-items: center;
        }

            .ghost-item img {
                width: 30px;
                height: 30px;
                border-radius: 6px;
                object-fit: cover;
            }

        .ghost-actions {
            margin-top: 10px;
            display: flex;
            gap: 5px;
        }

        @keyframes ghost-pulse {
            0% {
                box-shadow: 0 0 0 0 rgba(255, 0, 255, 0.4);
            }

            70% {
                box-shadow: 0 0 0 10px rgba(255, 0, 255, 0);
            }

            100% {
                box-shadow: 0 0 0 0 rgba(255, 0, 255, 0);
            }
        }

        .live-user-dot {
            width: 10px;
            height: 10px;
            background: #0f0;
            border-radius: 50%;
            box-shadow: 0 0 5px #0f0;
            animation: pulse 1s infinite;
        }

        /* تنسيق الحاوية الأساسية */
        .sticky-note-container {
            position: fixed;
            bottom: 80px; /* مرفوع شوية عشان الزر العائم */
            left: 20px;
            width: 280px;
            height: 300px;
            background: #fff9c4; /* لون أصفر فاتح زي الستيكي نوت */
            border-radius: 12px;
            box-shadow: 0 10px 40px rgba(0,0,0,0.4);
            z-index: 10000;
            display: flex;
            flex-direction: column;
            transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275); /* انيميشن ناعم */
            overflow: hidden;
            border: 1px solid rgba(0,0,0,0.1);
        }

        /* تنسيق الهيدر */
        .note-header {
            background: rgba(0,0,0,0.05);
            padding: 10px 15px;
            display: flex;
            justify-content: space-between;
            align-items: center;
            cursor: move; /* شكل الماوس يدل على السحب */
            border-bottom: 1px solid rgba(0,0,0,0.05);
            color: #444;
            font-weight: bold;
            font-family: 'Cairo', sans-serif;
        }

        /* أزرار التحكم */
        .note-controls i {
            cursor: pointer;
            margin-left: 8px;
            transition: 0.2s;
            padding: 5px;
            border-radius: 50%;
        }

            .note-controls i:hover {
                background: rgba(0,0,0,0.1);
                color: #000;
            }

        /* مكان الكتابة */
        .note-body {
            flex: 1;
            width: 100%;
            background: transparent;
            border: none;
            resize: none;
            padding: 15px;
            font-family: 'Tajawal', sans-serif;
            font-size: 1rem;
            line-height: 1.5;
            color: #333;
            outline: none;
        }

        /* --- حالات الورقة (Classes) --- */

        /* 1. حالة التصغير (Minimize) */
        .sticky-note-container.minimized {
            height: 45px !important; /* ارتفاع الهيدر بس */
            width: 200px !important;
            bottom: 20px;
        }

        /* 2. حالة التكبير (Maximize) */
        .sticky-note-container.maximized {
            width: 80% !important;
            height: 80% !important;
            bottom: 10% !important;
            left: 10% !important;
            border-radius: 20px;
            box-shadow: 0 0 100px rgba(0,0,0,0.7);
        }
        /* =========================================================
        تظبيط نافذة المنتجات للشاشات الصغيرة (Mobile Modal Fix)
        ========================================================= */
        #product-modal .modal-box {
            width: 95% !important;
            max-width: 600px !important; /* تصغير العرض قليلاً */
            max-height: 85vh !important; /* أقصى طول للنافذة 85% من الشاشة */
            overflow-y: auto !important; /* عمل سكرول داخلي إذا كثرت الخانات */
            padding: 25px !important; /* تقليل الهوامش الداخلية */
        }

        /* تعديلات مخصصة للموبايل فقط */
        @media (max-width: 768px) {
            #product-modal .modal-box {
                padding: 15px !important; /* مساحة أكبر للبيانات في الموبايل */
            }

            #product-modal .form-grid {
                grid-template-columns: 1fr !important; /* جعل الخانات تحت بعضها */
                gap: 12px !important; /* تقليل المسافة بين الخانات */
            }

            /* إلغاء تمدد حقل الاسم في الموبايل ليناسب الشاشة */
            #product-modal #p-title {
                grid-column: span 1 !important; 
            }

            #product-modal .modal-header {
                font-size: 1.1rem !important;
                margin-bottom: 15px !important;
                padding-bottom: 10px !important;
            }

            #product-modal .btn-action {
                padding: 12px !important;
                font-size: 0.95rem !important;
            }
        }

/* =========================================================
   📱 ترقيات الموبايل الأسطورية (MOBILE ULTRA OPTIMIZATION)
   ========================================================= */

@media (max-width: 1024px) {
    /* 1. ضبط المسافات الآمنة للمحتوى الرئيسي */
    .main-content {
        padding: 90px 15px 110px 15px !important; /* مساحة للهيدر فوق وشريط التنقل تحت */
        height: 100vh;
        overflow-y: auto;
        overflow-x: hidden;
    }

    /* 2. التوزيع الذكي للأزرار العائمة (منع التداخل) */
    /* زر الانتقال السريع (يمين) */
#quick-actions-trigger {
        bottom: 115px !important; /* زودنا الرقم عشان يترفع لفوق وميغطيش على القائمة السفلية */
        right: 15px !important;
        width: 50px !important;
        height: 50px !important;
        font-size: 20px !important;
    }
    
    /* زر اللايف شات (يسار) */
/* زر اللايف شات (يسار) */
    #live-chat-button {
        bottom: 115px !important; /* 🚀 رفعنا الزرار عشان يبقى قصاد زرار الانتقال السريع */
        left: 15px !important;
        right: auto !important;
        width: 50px !important;
        height: 50px !important;
        font-size: 20px !important;
    }

    /* زر الملاحظات (يسار - فوق اللايف شات) */
    button[onclick*="sticky-notes"] {
        bottom: 145px !important; 
        left: 15px !important;
        width: 45px !important;
        height: 45px !important;
    }

    /* 3. تظبيط النوافذ المنبثقة (Modals) لتناسب شاشة الهاتف */
    .modal-box {
        width: 95% !important;
        max-height: 85vh !important;
        overflow-y: auto !important;
        padding: 20px 15px !important;
        border-radius: 15px !important;
    }
    
    /* رأس النافذة المنبثقة */
    .modal-header {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 10px;
    }
    
    .modal-header .close-modal {
        position: absolute;
        top: 15px;
        left: 15px;
        background: rgba(239, 68, 68, 0.1);
        color: var(--red);
    }

    /* جعل حقول الإدخال تحت بعضها */
    .form-grid, #email-modal > .modal-box > div[style*="display: grid"] {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }
    
    .header-bar {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
}

@media (max-width: 768px) {
    /* =======================================
       🌟 السحر الحقيقي: تحويل الجداول لكروت 🌟
       ======================================= */
    
    /* إخفاء عناوين الجدول العلوية */
    .custom-table thead {
        display: none !important;
    }

    /* تحويل الجدول لعناصر بلوك */
    .custom-table, .custom-table tbody, .custom-table tr, .custom-table td {
        display: block !important;
        width: 100% !important;
    }

    /* تصميم الصف كأنه كارت منفصل */
    .custom-table tr {
        background: rgba(25, 25, 35, 0.8) !important;
        margin-bottom: 15px !important;
        border-radius: 15px !important;
        border: 1px solid rgba(124, 58, 237, 0.2) !important;
        padding: 15px !important;
        box-shadow: 0 5px 15px rgba(0,0,0,0.2) !important;
        position: relative;
    }

    /* تصميم الخلايا داخل الكارت */
    .custom-table td {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        text-align: left !important;
        padding: 10px 0 !important;
        border-bottom: 1px dashed rgba(255,255,255,0.05) !important;
        font-size: 0.95rem !important;
    }

    /* إزالة الخط السفلي من آخر خلية وتوسيط الأزرار */
    .custom-table td:last-child {
        border-bottom: none !important;
        padding-bottom: 0 !important;
        justify-content: center !important;
        margin-top: 10px;
    }

    /* تظبيط أزرار الأكشن داخل الجداول في الموبايل */
    .custom-table td:last-child > div {
        flex-direction: row !important;
        flex-wrap: wrap;
        justify-content: center !important;
        gap: 8px !important;
        width: 100%;
    }

    .custom-table .icon-btn {
        width: 42px !important;
        height: 42px !important;
        font-size: 1.1rem !important;
    }

    /* إضافة عناوين للخلايا (Labels) تلقائياً عبر CSS */
    
    /* 1. جدول الطلبات */
    #orders-body td:nth-child(1)::before { content: "رقم الطلب:"; color: var(--text-muted); font-size: 0.85rem; font-weight: bold; }
    #orders-body td:nth-child(2)::before { content: "العميل:"; color: var(--text-muted); font-size: 0.85rem; font-weight: bold; }
    #orders-body td:nth-child(3)::before { content: "المنتج:"; color: var(--text-muted); font-size: 0.85rem; font-weight: bold; }
    #orders-body td:nth-child(4)::before { content: "السعر:"; color: var(--text-muted); font-size: 0.85rem; font-weight: bold; }
    #orders-body td:nth-child(5)::before { content: "التاريخ:"; color: var(--text-muted); font-size: 0.85rem; font-weight: bold; }
    #orders-body td:nth-child(6)::before { content: "الملاحظات:"; color: var(--text-muted); font-size: 0.85rem; font-weight: bold; }
    #orders-body td:nth-child(7)::before { content: "الحالة:"; color: var(--text-muted); font-size: 0.85rem; font-weight: bold; }
    
    /* 2. جدول العملاء */
    #users-body td:nth-child(1) { display: none !important; } /* إخفاء رقم التسلسل */
    #users-body td:nth-child(2)::before { content: "الصورة:"; color: var(--text-muted); font-size: 0.85rem; font-weight: bold; }
    #users-body td:nth-child(3)::before { content: "الاسم:"; color: var(--text-muted); font-size: 0.85rem; font-weight: bold; }
    #users-body td:nth-child(4)::before { content: "الإيميل:"; color: var(--text-muted); font-size: 0.85rem; font-weight: bold; }
    #users-body td:nth-child(5)::before { content: "الطلبات:"; color: var(--text-muted); font-size: 0.85rem; font-weight: bold; }

    /* 3. جدول المحافظ */
    #wallets-body td:nth-child(1)::before { content: "العميل:"; color: var(--text-muted); font-size: 0.85rem; font-weight: bold; }
    #wallets-body td:nth-child(2)::before { content: "الإيميل:"; color: var(--text-muted); font-size: 0.85rem; font-weight: bold; }
    #wallets-body td:nth-child(3)::before { content: "الرصيد:"; color: var(--text-muted); font-size: 0.85rem; font-weight: bold; }
    #wallets-body td:nth-child(4)::before { content: "آخر تحديث:"; color: var(--text-muted); font-size: 0.85rem; font-weight: bold; }

    /* =======================================
       تنظيمات أخرى للشاشات الصغيرة
       ======================================= */
    
    /* شبكة الإحصائيات (كارتين جنب بعض بدل واحد) */
    .stats-grid {
        grid-template-columns: 1fr 1fr !important;
        gap: 10px !important;
    }
    
    /* قائمة الانتقال السريع (Quick Actions) - 3 في الصف */
    .quick-actions-grid {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 8px !important;
    }
    .qa-btn {
        padding: 12px 5px !important;
    }
    .qa-btn i {
        font-size: 1.5rem !important;
    }
    .qa-btn span {
        font-size: 0.75rem !important;
    }
    
    /* لوحة المهام (Kanban) */
    .task-column {
        min-height: auto !important;
        margin-bottom: 20px;
    }
}

/* للشاشات الصغيرة جداً جداً */
@media (max-width: 400px) {
    .stats-grid {
        grid-template-columns: 1fr !important;
    }
    .quick-actions-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

/* ستايل رسايل الخزنة المركزية */
.vault-msg {
    background: rgba(255, 255, 255, 0.05);
    padding: 12px 15px;
    border-radius: 8px;
    border-right: 3px solid var(--gold);
    display: flex;
    justify-content: space-between;
    align-items: center;
    animation: slideInUp 0.3s ease;
}

.vault-msg-content {
    color: white;
    font-family: monospace;
    font-size: 1.1rem;
    letter-spacing: 1px;
    word-break: break-all;
}

.vault-msg-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 5px;
    font-family: 'Cairo', sans-serif;
}

.vault-msg-actions {
    display: flex;
    gap: 15px;
    color: #aaa;
    font-size: 1.1rem;
}

.vault-msg-actions i {
    cursor: pointer;
    transition: 0.2s;
}

.vault-msg-actions .fa-copy:hover { color: var(--green); transform: scale(1.2); }
.vault-msg-actions .fa-trash-alt:hover { color: var(--red); transform: scale(1.2); }

/* ستايل عناصر الرادار */
.activity-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 8px;
    border-right: 3px solid transparent;
    transition: 0.3s;
}

.activity-item:hover {
    background: rgba(255, 255, 255, 0.05);
    transform: translateX(-5px);
}

.activity-icon-box {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.9rem;
}

.activity-info {
    flex: 1;
}

.activity-user {
    font-weight: bold;
    color: #fff;
    font-size: 0.85rem;
}

.activity-text {
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-top: 2px;
}

.activity-time {
    font-size: 0.7rem;
    color: #555;
    white-space: nowrap;
}
/* تنسيق الرابط المولد */
#generatedLink {
    cursor: pointer; /* بيخلي الماوس يتحول لإيد */
    color: var(--neon-blue); /* لون مميز */
    text-decoration: underline; /* خط تحت الكلام */
    transition: 0.3s;
}

#generatedLink:hover {
    color: var(--purple); /* لونه يتغير لما يقرب منه */
    text-shadow: 0 0 10px var(--purple-glow); /* وهج بسيط */
}

/* زر الذكاء الاصطناعي العائم في المنتصف */
#general-ai-btn {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #10b981, #059669); /* لون أخضر زمردي مميز */
    color: white;
    width: 65px;
    height: 65px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    cursor: pointer;
    box-shadow: 0 8px 25px rgba(16, 185, 129, 0.4);
    z-index: 9998;
    border: none;
    transition: all 0.3s ease;
    animation: float 4s ease-in-out infinite;
}

#general-ai-btn:hover {
    transform: translateX(-50%) scale(1.1);
    box-shadow: 0 12px 35px rgba(16, 185, 129, 0.6);
}

/* تنسيق منطقة الرد في نافذة الذكاء الاصطناعي */
#ai-response-area {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(16, 185, 129, 0.2);
    border-radius: 12px;
    padding: 15px;
    margin-top: 15px;
    min-height: 100px;
    max-height: 250px;
    overflow-y: auto;
    color: #e2e8f0;
    font-size: 1rem;
    line-height: 1.6;
    display: none;
    white-space: pre-wrap;
}

@media (max-width: 1024px) {
    
    /* 1. تصغير ورفع زراير التحكم اللي جوه الملاحظة (اللي إنت باعت كودها) */
    .note-controls i {
        font-size: 0.85rem !important; /* تصغير حجم الأيقونة */
        padding: 4px !important; /* تصغير المساحة حوالين الأيقونة */
        margin-top: -5px !important; /* رفع الزراير لفوق شوية */
    }

    /* 2. تصغير ورفع الزرار العائم (القلم) اللي بيفتح الملاحظات عشان ميتداخلش مع اللايف شات */
    button[onclick*="sticky-notes"] {
        bottom: 175px !important; /* رفعناه لفوق بمسافة ممتازة */
        width: 40px !important; /* صغرنا العرض */
        height: 40px !important; /* صغرنا الطول */
        font-size: 16px !important; /* صغرنا حجم القلم اللي جواه */
    }
    
    /* (اختياري) لو حابب تصغر حجم نافذة الملاحظات نفسها في الموبايل وترفعها شوية */
    .sticky-note-container {
        bottom: 100px !important; /* رفعناها عن الشريط السفلي */
        width: 250px !important; /* صغرنا عرضها */
        height: 250px !important; /* صغرنا طولها */
    }
}

