        @font-face {
            font-family: 'Noto Sans Arabic';
            font-style: normal;
            font-weight: 400;
            font-display: swap;
            src: url('../fonts/Noto_Sans_Arabic/static/NotoSansArabic-Regular.ttf') format('truetype');
        }
        @font-face {
            font-family: 'Noto Sans Arabic';
            font-style: normal;
            font-weight: 500;
            font-display: swap;
            src: url('../fonts/Noto_Sans_Arabic/static/NotoSansArabic-Medium.ttf') format('truetype');
        }
        @font-face {
            font-family: 'Noto Sans Arabic';
            font-style: normal;
            font-weight: 700;
            font-display: swap;
            src: url('../fonts/Noto_Sans_Arabic/static/NotoSansArabic-Bold.ttf') format('truetype');
        }
        @font-face {
            font-family: 'Noto Sans Arabic';
            font-style: normal;
            font-weight: 900;
            font-display: swap;
            src: url('../fonts/Noto_Sans_Arabic/static/NotoSansArabic-Black.ttf') format('truetype');
        }

        :root {
            /* درجة أزرق iOS هادئة وراقية */
            --accent: #007AFF;
            --accent-glow: rgba(0, 122, 255, 0.3);

            /* الوضع النهاري (الافتراضي) */
            --bg-dark: #f4f4f5;
            --panel-bg: #ffffff;
            --text-main: #18181b;
            --text-muted: #71717a;
            --border-color: #e4e4e7;
            --input-bg: #f1f1f2;
        }

        /* متغيرات الوضع الليلي */
        body.dark-mode {
            --bg-dark: #09090b;
            --panel-bg: #121214;
            --text-main: #ffffff;
            --text-muted: #a1a1aa;
            --border-color: #27272a;
            --input-bg: #18181b;
        }

    .hidden {
        display: none !important;
    }

        .header-logo {
            height: 32px; /* تم زيادة الارتفاع لجعله أكبر */
            transition: all 0.2s ease; /* إضافة انتقال ناعم لتحسين المظهر */
        }

        body.dark-mode .header-logo {
            filter: brightness(0) invert(1); /* تحويل اللوجو للون الأبيض ليكون واضحاً واحترافياً في الوضع الداكن */
        }

        body {
            font-family: 'Noto Sans Arabic', sans-serif;
            background-color: var(--bg-dark);
            color: var(--text-main);
            margin: 0; padding: 0;
            height: 100vh; overflow: hidden;
            transition: background-color 0.3s ease, color 0.3s ease;
        }

    .studio-grid { display: grid; grid-template-columns: 400px 1fr; height: 100vh; height: 100dvh; width: 100vw; overflow: hidden; }

        @media (max-width: 1024px) {
        .studio-grid {
                display: flex !important;
                flex-direction: column !important;
            }
            .sidebar {
                width: 100% !important;
                flex: 1 !important;
                height: auto !important;
                border-right: none !important;
                border-top: 1px solid var(--border-color);
                order: 2;
                overflow: hidden !important;
            }
            .canvas-wrapper {
                width: 100% !important;
                height: auto !important;
                max-height: 42vh !important;
                padding: 12px !important;
                order: 1;
                flex-shrink: 0;
            }
        }

        .sidebar {
            background-color: var(--panel-bg);
            border-left: 1px solid var(--border-color);
            display: flex; flex-direction: column;
            height: 100%; overflow: hidden;
            transition: all 0.3s ease;
        width: 400px;
        flex-shrink: 0;
        }

        .sidebar-disabled {
            pointer-events: none;
            opacity: 0.5;
            filter: grayscale(0.5);
            cursor: not-allowed;
        }

        .sidebar-content { flex: 1; overflow-y: auto; padding: 1.5rem; }
        .canvas-wrapper { background: var(--bg-dark); display: flex; align-items: center; justify-content: center; padding: 40px; position: relative; height: 100%; overflow: hidden; }

        .phone-mockup {
            position: relative;
            max-height: 100%;
            max-width: 100%;
            background: #000;
            border-radius: 24px;
            padding: 0;
            border: 6px solid #27272a;
            box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.2);
            display: flex;
            align-items: center; justify-content: center;
            z-index: 10;
            overflow: hidden;
            transition: aspect-ratio 0.4s cubic-bezier(0.4, 0, 0.2, 1);
            cursor: grab;
            user-select: none;
            touch-action: none;
        }

        .export-overlay {
            position: absolute; inset: 0; background: var(--panel-bg); z-index: 50; display: none; flex-direction: column; align-items: center; justify-content: center; padding: 2rem; text-align: center;
        }

        .confirm-modal {
            position: fixed; inset: 0; background: rgba(0,0,0,0.4); backdrop-filter: blur(8px); z-index: 2000; display: none; align-items: center; justify-content: center; padding: 20px;
        }

        .modal-card {
            background: var(--panel-bg); border: 1px solid var(--border-color); border-radius: 24px; width: 100%; max-width: 400px; padding: 2.5rem; text-align: center; box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.15); animation: modalSlideUp 0.3s ease-out;
        }

        @keyframes modalSlideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

        .progress-container { width: 80%; height: 8px; background: var(--input-bg); border-radius: 10px; overflow: hidden; margin: 20px 0; }
        .progress-bar { height: 100%; width: 0%; background: var(--accent); transition: width 0.4s ease; box-shadow: 0 0 15px var(--accent-glow); }

        canvas { width: 100%; height: 100%; border-radius: 18px; object-fit: cover; background: #000; pointer-events: none; }
        .custom-scroll::-webkit-scrollbar { width: 6px; }
        .custom-scroll::-webkit-scrollbar-track { background: transparent; }
        .custom-scroll::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 10px; }

        input[type="range"] { accent-color: var(--accent); }

        .reciter-btn { text-align: right; padding: 10px; border-radius: 10px; border: 1px solid var(--border-color); background: var(--input-bg); transition: all 0.2s; font-size: 13px; color: var(--text-main); width: 100%; margin-bottom: 4px; display: flex; justify-content: space-between; align-items: center; }
        .reciter-btn.active { border-color: var(--accent); background: rgba(0, 122, 255, 0.1); color: var(--accent); font-weight: bold; }
        .style-badge { font-size: 10px; padding: 3px 8px; border-radius: 6px; background: var(--border-color); color: var(--text-muted); font-weight: 700; }
        .reciter-btn.active .style-badge { background: var(--accent); color: white; }

        .tab-container { display: flex; background: var(--input-bg); padding: 4px; border-radius: 12px; margin-bottom: 16px; border: 1px solid var(--border-color); }
        .tab-btn { flex: 1; padding: 10px; text-align: center; font-size: 12px; font-weight: 700; border-radius: 9px; color: var(--text-muted); transition: all 0.2s; cursor: pointer; }
        .tab-btn:hover { color: var(--text-main); }
        .tab-btn.active { background: var(--panel-bg); color: var(--accent); box-shadow: 0 2px 8px rgba(0,0,0,0.08); }

        .loading-overlay { position: absolute; inset: 0; background: rgba(255,255,255,0.9); display: flex; flex-direction: column; align-items: center; justify-content: center; z-index: 100; border-radius: 18px; text-align: center; padding: 20px; }
        body.dark-mode .loading-overlay { background: rgba(0,0,0,0.85); }

        .toggle-switch { position: relative; display: inline-block; width: 44px; height: 24px; flex-shrink: 0; }
        .toggle-switch input { opacity: 0; width: 0; height: 0; }
        .slider { position: absolute; cursor: pointer; inset: 0; background-color: var(--border-color); transition: .4s; border-radius: 24px; }
        .slider:before { position: absolute; content: ""; height: 18px; width: 18px; left: 3px; bottom: 3px; background-color: white; transition: .4s; border-radius: 50%; }
        input:checked + .slider { background-color: var(--accent); }
        input:checked + .slider:before { transform: translateX(20px); }

        input[type="color"] { -webkit-appearance: none; border: none; width: 100%; height: 38px; cursor: pointer; background: none; }
        input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
        input[type="color"]::-webkit-color-swatch { border: 1px solid var(--border-color); border-radius: 8px; }

    .settings-tab-btn {
        padding: 8px 4px;
        font-weight: 700;
        color: var(--text-muted);
        border-radius: 8px;
        transition: all 0.2s;
        display: flex;
        align-items: center;
        gap: 4px;
        cursor: pointer;
        white-space: nowrap;
    }
    .settings-tab-btn:hover { color: var(--text-main); background: rgba(0, 122, 255, 0.05); }
    .settings-tab-btn.active { background: var(--panel-bg); color: var(--accent); box-shadow: 0 2px 8px rgba(0,0,0,0.05); }

        .file-upload-btn { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; padding: 12px; background: var(--input-bg); border: 2px dashed var(--border-color); border-radius: 12px; text-align: center; cursor: pointer; transition: all 0.2s; font-size: 11px; color: var(--text-muted); }
        .file-upload-btn:hover { border-color: var(--accent); color: var(--text-main); background: rgba(0, 122, 255, 0.05); }

        .asset-thumb { width: 100%; aspect-ratio: 1/1; border-radius: 12px; object-fit: cover; cursor: pointer; border: 2px solid transparent; transition: all 0.2s; background: var(--input-bg); }
        .asset-thumb:hover { border-color: var(--accent); transform: scale(1.05); z-index: 10; }
        .asset-thumb.active { border-color: var(--accent); box-shadow: 0 0 15px var(--accent-glow); }

        .theme-toggle-btn {
            background: var(--input-bg);
            border: 1px solid var(--border-color);
            color: var(--text-main);
            padding: 8px;
            border-radius: 10px;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: all 0.2s;
        }
        .theme-toggle-btn:hover {
            border-color: var(--accent);
        }

        input[type="text"], input[type="number"] {
            background-color: var(--input-bg) !important;
            border: 1px solid var(--border-color) !important;
            color: var(--text-main) !important;
            font-family: 'Noto Sans Arabic', sans-serif;
        }

        .custom-select-wrapper {
            position: relative;
            width: 100%;
            color: var(--text-main);
        }

        .custom-select-trigger {
            width: 100%;
            background-color: var(--input-bg);
            border: 1px solid var(--border-color);
            padding: 0.75rem;
            border-radius: 0.75rem;
            outline: none;
            font-size: 0.875rem;
            text-align: right;
            cursor: pointer;
            display: flex;
            justify-content: space-between;
            align-items: center;
            transition: all 0.2s;
        }

        .custom-select-trigger .lucide-chevron-down {
             transition: transform 0.3s ease-in-out;
        }

        .custom-select-wrapper.open .custom-select-trigger .lucide-chevron-down {
            transform: rotate(180deg);
        }

        .custom-select-trigger:focus,
        .custom-select-wrapper.open .custom-select-trigger {
            border-color: var(--accent);
        }

        .custom-select-options {
            position: absolute;
            top: calc(100% + 8px);
            left: 0;
            right: 0;
            background-color: var(--panel-bg);
            border: 1px solid var(--border-color);
            border-radius: 0.75rem;
            max-height: 200px;
            overflow-y: auto;
            z-index: 1000;
            opacity: 0;
            visibility: hidden;
            transform: translateY(-10px);
            transition: all 0.3s ease;
            box-shadow: 0 10px 20px rgba(0,0,0,0.1);
            padding: 0.5rem;
        }

        .custom-select-wrapper.open .custom-select-options {
            opacity: 1;
            visibility: visible;
            transform: translateY(0);
        }

        .custom-select-option {
            padding: 0.75rem 1rem;
            cursor: pointer;
            transition: background-color 0.2s;
            border-radius: 0.5rem;
            font-size: 0.875rem;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        .custom-select-option:hover {
            background-color: var(--input-bg);
        }

        .custom-select-option.selected {
            background-color: var(--accent);
            color: white;
            font-weight: bold;
        }

        .success-check { width: 60px; height: 60px; background: var(--accent); border-radius: 50%; display: flex; align-items: center; justify-content: center; margin-bottom: 20px; box-shadow: 0 0 20px var(--accent-glow); animation: bounceIn 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55); }
        @keyframes bounceIn { 0% { transform: scale(0.3); opacity: 0; } 50% { transform: scale(1.1); } 100% { transform: scale(1); opacity: 1; } }
        .alert-warning-pulse { animation: warningPulse 2s infinite; }
        @keyframes warningPulse { 0% { border-color: rgba(239, 68, 68, 0.2); background: rgba(239, 68, 68, 0.05); } 50% { border-color: rgba(239, 68, 68, 0.6); background: rgba(239, 68, 68, 0.15); } 100% { border-color: rgba(239, 68, 68, 0.2); background: rgba(239, 68, 68, 0.05); } }
        .animate-fade-in-up { animation: fadeInUp 0.8s ease-out forwards; }
        @keyframes fadeInUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

        @media (max-width: 1024px) {
            .sidebar-content .space-y-6 {
                --tw-space-y-reverse: 0;
                margin-top: calc(0px * calc(1 - var(--tw-space-y-reverse)));
                margin-bottom: calc(0px * var(--tw-space-y-reverse));
            }
             .sidebar-content > div > section{
                border-bottom: 1px solid var(--border-color);
            }
        }
