
        /* CSS الأساسي */
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }
        
        body {
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            background: #f5f5f5;
            color: #333;
            line-height: 1.6;
            direction: rtl;
        }
        
        .container {
            max-width: 1200px;
            margin: 0 auto;
            padding: 20px;
        }
        
        .header {
            text-align: center;
            background: #667eea;
            color: white;
            padding: 30px;
            border-radius: 15px;
            margin-bottom: 30px;
            position: relative;
        }
        
        .header h1 {
            font-size: 2.5rem;
            margin-bottom: 10px;
        }
        
        .header p {
            font-size: 1.1rem;
            opacity: 0.9;
        }
        
        .header-controls {
            position: absolute;
            left: 20px;
            top: 20px;
        }
        
        .main-content {
            display: grid;
            grid-template-columns: 300px 1fr;
            gap: 30px;
        }
        
        .sidebar {
            background: white;
            border-radius: 15px;
            padding: 20px;
            box-shadow: 0 5px 15px rgba(0,0,0,0.1);
        }
        
        .form-builder {
            background: white;
            border-radius: 15px;
            padding: 30px;
            box-shadow: 0 5px 15px rgba(0,0,0,0.1);
        }
        
        .alert {
            padding: 15px;
            border-radius: 8px;
            margin-bottom: 20px;
            text-align: center;
        }
        
        .alert-success {
            background: #d4edda;
            color: #155724;
            border: 1px solid #c3e6cb;
        }
        
        .alert-danger {
            background: #f8d7da;
            color: #721c24;
            border: 1px solid #f5c6cb;
        }
        
        .form-group {
            margin-bottom: 20px;
        }
        
        .form-control {
            width: 100%;
            padding: 12px;
            border: 2px solid #ddd;
            border-radius: 8px;
            font-size: 16px;
            transition: all 0.3s;
        }
        
        .form-control:focus {
            border-color: #4CAF50;
            outline: none;
        }
        
        .btn {
            padding: 12px 24px;
            border: none;
            border-radius: 8px;
            cursor: pointer;
            font-size: 16px;
            font-weight: 600;
            transition: all 0.3s;
        }
        
        .btn-primary {
            background: #4CAF50;
            color: white;
        }
        
        .btn-primary:hover {
            background: #2E7D32;
        }
        
        /* أنماط إضافية للقوالب الجاهزة */
        .templates-section {
            margin-top: 30px;
            padding-top: 20px;
            border-top: 1px solid #e5e7eb;
        }
        
        .templates-grid {
            display: grid;
            grid-template-columns: 1fr;
            gap: 10px;
            margin-top: 15px;
        }
        
        .template-form {
            width: 100%;
        }
        
        .template-item {
            width: 100%;
            padding: 15px;
            border: 2px dashed #d1d5db;
            border-radius: 10px;
            background: #f9fafb;
            text-align: right;
            cursor: pointer;
            transition: all 0.3s;
            display: flex;
            align-items: center;
            gap: 15px;
            border: none;
        }
        
        .template-item:hover {
            border-color: #3b82f6;
            background: #eff6ff;
        }
        
        .template-icon {
            font-size: 20px;
            color: #3b82f6;
            background: #dbeafe;
            width: 40px;
            height: 40px;
            border-radius: 8px;
            display: flex;
            align-items: center;
            justify-content: center;
        }
        
        .template-info {
            flex: 1;
        }
        
        .template-name {
            font-weight: bold;
            color: #1f2937;
            margin-bottom: 5px;
            font-size: 14px;
        }
        
        .template-fields {
            color: #6b7280;
            font-size: 12px;
        }
        
        .tab-navigation {
            display: flex;
            margin-bottom: 20px;
            border-bottom: 2px solid #e5e7eb;
        }
        
        .tab-btn {
            flex: 1;
            padding: 12px;
            background: none;
            border: none;
            cursor: pointer;
            font-size: 16px;
            color: #6b7280;
            border-bottom: 3px solid transparent;
        }
        
        .tab-btn.active {
            color: #3b82f6;
            border-bottom-color: #3b82f6;
            font-weight: bold;
        }
        
        .tab-content {
            display: none;
        }
        
        .tab-content.active {
            display: block;
        }
        
        .section-title {
            margin-bottom: 20px;
            color: #1f2937;
            display: flex;
            align-items: center;
            gap: 10px;
        }
        
        .tools-grid {
            display: flex;
            flex-wrap: wrap;
            gap: 10px;
            margin-top: 15px;
        }
        
        .tool-item {
            padding: 15px;
            border: 2px solid #e5e7eb;
            border-radius: 10px;
            text-align: center;
            cursor: move;
            transition: all 0.3s;
            background: white;
            width: calc(33.333% - 10px);
            min-width: 120px;
        }
        
        .tool-item:hover {
            border-color: #3b82f6;
        }
        
        .tool-icon {
            font-size: 24px;
            margin-bottom: 5px;
        }
        
        .fields-list {
            margin-top: 20px;
        }
        
        .field-item {
            background: #f9fafb;
            border: 2px solid #e5e7eb;
            border-radius: 10px;
            padding: 15px;
            margin-bottom: 10px;
            position: relative;
        }
        
        .field-order {
            position: absolute;
            top: -10px;
            right: -10px;
            background: #3b82f6;
            color: white;
            width: 30px;
            height: 30px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            font-weight: bold;
        }
        
        .field-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 10px;
        }
        
        .field-title {
            font-weight: bold;
            color: #1f2937;
        }
        
        .field-type {
            color: #6b7280;
            font-size: 14px;
        }
        
        .field-actions {
            display: flex;
            gap: 10px;
        }
        
        .btn-small {
            padding: 6px 12px;
            font-size: 14px;
        }
        
        .btn-outline {
            background: white;
            border: 2px solid #3b82f6;
            color: #3b82f6;
        }
        
        .empty-message {
            text-align: center;
            padding: 40px;
            color: #6b7280;
            background: #f9fafb;
            border: 2px dashed #d1d5db;
            border-radius: 10px;
        }
        
        .preview-overlay {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: rgba(0,0,0,0.8);
            z-index: 1000;
            display: none;
        }
        
        .preview-overlay.active {
            display: block;
        }
        
        .preview-container {
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            width: 90%;
            height: 90%;
            background: white;
            border-radius: 15px;
            overflow: hidden;
        }
        
        .preview-header {
            background: #3b82f6;
            color: white;
            padding: 15px 20px;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }
        
        .preview-content {
            height: calc(100% - 60px);
            overflow: auto;
        }
        
        .close-preview {
            background: none;
            border: none;
            color: white;
            font-size: 20px;
            cursor: pointer;
        }
        
        .required-star {
            color: #e53935;
        }
        
        /* Dark Mode Styles */
        body.dark-mode {
            background: #1a1a2e;
            color: #e0e0e0;
        }
        
        body.dark-mode .header {
            background: #16213e;
        }
        
        body.dark-mode .sidebar,
        body.dark-mode .form-builder {
            background: #0f3460;
            color: #e0e0e0;
            box-shadow: 0 5px 15px rgba(0,0,0,0.3);
        }
        
        body.dark-mode .form-control {
            background: #1a1a2e;
            color: #e0e0e0;
            border-color: #2d3748;
        }
        
        body.dark-mode .form-control:focus {
            border-color: #4CAF50;
            background: #1a1a2e;
        }
        
        body.dark-mode .alert-success {
            background: #1b4332;
            color: #b7e4c7;
            border-color: #2d6a4f;
        }
        
        body.dark-mode .alert-danger {
            background: #5a1a1a;
            color: #f8d7da;
            border-color: #852e2e;
        }
        
        body.dark-mode .empty-message {
            background: #1a1a2e;
            color: #a0aec0;
            border-color: #2d3748;
        }
        
        body.dark-mode .field-item {
            background: #1a1a2e;
            border-color: #2d3748;
        }
        
        body.dark-mode .tool-item {
            background: #1a1a2e;
            border-color: #2d3748;
            color: #e0e0e0;
        }
        
        body.dark-mode .tool-item:hover {
            border-color: #3b82f6;
            background: #2d3748;
        }
        
        body.dark-mode .tab-btn {
            color: #a0aec0;
        }
        
        body.dark-mode .tab-btn.active {
            color: #60a5fa;
            border-bottom-color: #60a5fa;
        }
        
        body.dark-mode .section-title {
            color: #e0e0e0;
        }
        
        /* Dark Mode Button */
        .dark-mode-btn {
            background: #374151;
            color: white;
            border: none;
            padding: 10px 15px;
            border-radius: 8px;
            cursor: pointer;
            display: flex;
            align-items: center;
            gap: 8px;
            transition: all 0.3s;
        }
        
        .dark-mode-btn:hover {
            background: #4b5563;
        }
        
        body.dark-mode .dark-mode-btn {
            background: #4CAF50;
        }
        
        body.dark-mode .dark-mode-btn:hover {
            background: #2E7D32;
        }
        
        /* Mobile Menu Toggle */
        .mobile-menu-toggle {
            display: none;
            background: none;
            border: none;
            color: white;
            font-size: 24px;
            cursor: pointer;
            position: absolute;
            top: 20px;
            right: 20px;
        }
        
        .sidebar-overlay {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: rgba(0,0,0,0.5);
            z-index: 999;
        }
        
        .sidebar-overlay.active {
            display: block;
        }
        
        /* تحسينات للاستجابة */
        @media (max-width: 768px) {
            .mobile-menu-toggle {
                display: block;
            }
            
            .sidebar {
                position: fixed;
                top: 0;
                right: -100%;
                width: 300px;
                height: 100vh;
                z-index: 1000;
                transition: right 0.3s ease;
                overflow-y: auto;
            }
            
            .sidebar.active {
                right: 0;
            }
            
            .header-controls {
                position: absolute;
                top: 15px;
                left: 15px;
            }
            
            .header h1 {
                font-size: 1.5rem;
                margin-top: 50px;
            }
            
            .header p {
                font-size: 0.9rem;
            }
            
            .main-content {
                grid-template-columns: 1fr;
                gap: 20px;
            }
            
            .sidebar {
                padding: 15px;
            }
            
            .form-builder {
                padding: 20px;
            }
            
            .tab-navigation {
                flex-direction: column;
                border-bottom: none;
            }
            
            .tab-btn {
                text-align: right;
                border: 1px solid #e5e7eb;
                border-radius: 8px;
                margin-bottom: 5px;
            }
            
            body.dark-mode .tab-btn {
                border-color: #374151;
            }
            
            .tab-btn.active {
                border-bottom: 3px solid #3b82f6;
            }
            
            .tools-grid {
                grid-template-columns: repeat(3, 1fr);
                gap: 8px;
            }
            
            .tool-item {
                padding: 10px;
                font-size: 14px;
            }
            
            .template-item {
                flex-direction: column;
                text-align: center;
                padding: 10px;
            }
            
            .template-info {
                text-align: center;
            }
            
            .form-group {
                margin-bottom: 15px;
            }
            
            .form-control {
                padding: 10px;
            }
            
            .btn {
                padding: 10px 15px;
                font-size: 14px;
            }
            
            .field-header {
                flex-direction: column;
                align-items: flex-start;
                gap: 5px;
            }
            
            .field-actions {
                width: 100%;
                justify-content: space-between;
            }
            
            .preview-container {
                width: 95%;
                height: 95%;
            }
        }
        
        @media (max-width: 480px) {
            .container {
                padding: 10px;
            }
            
            .header {
                padding: 20px 15px;
            }
            
            .header h1 {
                font-size: 1.3rem;
            }
            
            .tools-grid {
                grid-template-columns: repeat(3, 1fr);
            }
            
            .tool-item {
                font-size: 12px;
                padding: 8px;
            }
            
            .tool-icon {
                font-size: 20px;
            }
            
            .templates-grid {
                grid-template-columns: 1fr;
            }
            
            .dark-mode-btn span {
                display: none;
            }
            
            .dark-mode-btn {
                padding: 8px;
                width: 40px;
                height: 40px;
                justify-content: center;
            }
        }

.footer {
  text-align: center;
  margin-top: 30px;
  padding: 20px;
  color: #6b7280;
  border-top: 1px solid #e5e7eb;
}
.footer-content p {
  margin-bottom: 10px;
}
.footer a {
  color: #3b82f6;
  text-decoration: none;
}
.footer-info {
  font-size: 14px;
  opacity: 0.8;
}


