        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            min-height: 100vh;
            direction: rtl;
        }

        .header {
            background: rgba(255, 255, 255, 0.95);
            backdrop-filter: blur(10px);
            padding: 20px;
            margin: 20px auto;
            max-width: 1200px;
            border-radius: 15px;
            box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .header h1 {
            color: #333;
            text-align: left;
            margin: 0;
            transition: all 0.3s ease;
        }

        .header h1:hover {
            color: #667eea;
            transform: scale(1.05);
        }

        .nav-buttons {
            display: flex;
            justify-content: center;
            gap: 15px;
            flex-wrap: wrap;
        }

        .hamburger-menu {
            background: none;
            border: none;
            cursor: pointer;
            display: flex;
            flex-direction: column;
            gap: 4px;
            padding: 8px;
            border-radius: 4px;
            transition: all 0.3s ease;
        }

        .hamburger-menu:hover {
            background: rgba(102, 126, 234, 0.1);
        }

        .hamburger-line {
            width: 25px;
            height: 3px;
            background: #333;
            transition: all 0.3s ease;
            border-radius: 2px;
        }

        .mobile-nav {
            position: fixed;
            top: 0;
            left: -300px;
            width: 300px;
            height: 100vh;
            background: white;
            box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
            transition: left 0.3s ease;
            z-index: 1000;
            overflow-y: auto;
        }

        .mobile-nav.active {
            left: 0;
        }

        .mobile-nav-item {
            display: block;
            width: 100%;
            padding: 15px 25px;
            text-decoration: none;
            color: #333;
            font-weight: 500;
            border: none;
            background: none;
            text-align: right;
            font-size: 16px;
            transition: all 0.3s ease;
            border-bottom: 1px solid #f0f0f0;
            cursor: pointer;
        }

        .mobile-nav-item:hover {
            background: linear-gradient(45deg, rgba(102, 126, 234, 0.1), rgba(118, 75, 162, 0.1));
            padding-right: 35px;
        }

        /* רקע שקוף למגירה */
        .mobile-nav-overlay {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.5);
            z-index: 999;
            opacity: 0;
            visibility: hidden;
            transition: all 0.3s ease;
        }

        .mobile-nav-overlay.active {
            opacity: 1;
            visibility: visible;
        }

        .mobile-nav-close {
            position: absolute;
            top: 20px;
            left: 20px;
            background: none;
            border: none;
            color: white;
            font-size: 24px;
            cursor: pointer;
        }

        .mobile-nav-header {
            padding: 20px;
            border-bottom: 1px solid #eee;
            display: flex;
            justify-content: space-between;
            align-items: center;
            background: linear-gradient(45deg, #667eea, #764ba2);
            color: white;
        }

        .mobile-nav-header h3 {
            margin: 0;
            font-size: 18px;
        }

        .mobile-nav-content {
            padding: 20px 0;
        }

        .nav-btn {
            background: rgba(255, 255, 255, 0.2);
            color: white;
            border: none;
            padding: 10px 20px;
            border-radius: 8px;
            cursor: pointer;
            transition: all 0.3s ease;
            text-decoration: none;
        }

        .nav-btn:hover,
        .nav-btn.active {
            background: rgba(255, 255, 255, 0.3);
            transform: translateY(-2px);
        }

        .container {
            max-width: 1200px;
            margin: 0 auto;
            padding: 0 20px 20px;
        }

        .section {
            background: rgba(255, 255, 255, 0.95);
            border-radius: 15px;
            padding: 30px;
            margin-bottom: 20px;
            box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
        }

        .form-grid {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 20px;
            margin-bottom: 20px;
        }

        .form-group {
            margin-bottom: 20px;
        }

        .form-group.full-width {
            grid-column: 1 / -1;
        }

        label {
            display: block;
            margin-bottom: 8px;
            font-weight: bold;
            color: #333;
        }

        input,
        select,
        textarea {
            width: 100%;
            padding: 12px;
            border: 2px solid #ddd;
            border-radius: 8px;
            font-size: 16px;
            transition: border-color 0.3s ease;
            font-family: inherit;
            direction: rtl;
        }

        input:focus,
        select:focus,
        textarea:focus {
            outline: none;
            border-color: #667eea;
        }

        textarea {
            resize: vertical;
            min-height: 80px;
        }

        /* סגנונות לשדות עריכה מתקדמים */
        .editable-field {
            width: 100%;
            min-height: 80px;
            padding: 12px;
            border: 2px solid #ddd;
            border-radius: 8px;
            font-size: 16px;
            line-height: 1.5;
            background: white;
            resize: vertical;
            overflow-y: auto;
            font-family: inherit;
            direction: rtl;
            text-align: right;
        }

        .editable-field:focus {
            outline: none;
            border-color: #667eea;
            box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2);
        }

        .editable-field[contenteditable="true"]:empty:before {
            content: attr(data-placeholder);
            color: #999;
        }

        /* סגנונות מיוחדים לשדות תשובות */
        .editable-option {
            min-height: 40px;
            font-size: 14px;
        }

        /* תמיכה בכתב עילי ותחתי בשדות העריכה */
        .editable-field sub {
            vertical-align: sub;
            font-size: smaller;
        }

        .editable-field sup {
            vertical-align: super;
            font-size: smaller;
        }

        .btn {
            background: linear-gradient(45deg, #667eea, #764ba2);
            color: white;
            border: none;
            padding: 15px 30px;
            border-radius: 8px;
            font-size: 16px;
            font-weight: bold;
            cursor: pointer;
            transition: all 0.3s ease;
        }

        .btn:hover {
            transform: translateY(-2px);
            box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
        }

        .btn-danger {
            background: linear-gradient(45deg, #ff416c, #ff4b2b);
        }

        .btn-secondary {
            background: #6c757d;
        }

        /* כפתור הוספת שאלה מהסינון */
        #add-question-with-filters-btn {
            background: linear-gradient(45deg, #28a745, #20c997);
            font-size: 14px;
            padding: 12px 20px;
            white-space: nowrap;
            display: none; /* מוסתר בברירת מחדל */
        }

        #add-question-with-filters-btn:hover {
            background: linear-gradient(45deg, #20c997, #17a2b8);
        }

        .questions-grid {
            display: grid;
            gap: 20px;
        }

        .question-card {
            background: #f8f9fa;
            border: 2px solid #e9ecef;
            border-radius: 10px;
            padding: 20px;
            position: relative;
        }

        .question-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 15px;
        }

        .question-info {
            color: #666;
            font-size: 14px;
        }

        .question-actions {
            display: flex;
            gap: 10px;
        }

        .btn-small {
            padding: 8px 15px;
            font-size: 14px;
        }

        .question-text {
            font-weight: bold;
            margin-bottom: 10px;
            color: #333;
        }

        .options-list {
            margin-bottom: 10px;
        }

        .option {
            padding: 5px 0;
        }

        .option.correct {
            background: rgba(40, 167, 69, 0.1);
            color: #28a745;
            font-weight: bold;
            padding: 5px 10px;
            border-radius: 5px;
        }

        .explanation {
            background: rgba(0, 123, 255, 0.1);
            padding: 10px;
            border-radius: 5px;
            margin-top: 10px;
            font-style: italic;
        }

        .alert {
            padding: 15px;
            border-radius: 8px;
            margin-bottom: 20px;
            font-weight: bold;
        }

        .alert-success {
            background: rgba(40, 167, 69, 0.1);
            color: #28a745;
            border: 1px solid #28a745;
        }

        .alert-error {
            background: rgba(220, 53, 69, 0.1);
            color: #dc3545;
            border: 1px solid #dc3545;
        }

        .loading {
            text-align: center;
            padding: 40px;
            color: #666;
        }

        .spinner {
            border: 3px solid #f3f3f3;
            border-top: 3px solid #667eea;
            border-radius: 50%;
            width: 40px;
            height: 40px;
            animation: spin 1s linear infinite;
            margin: 0 auto 20px;
        }

        @keyframes spin {
            0% {
                transform: rotate(0deg);
            }

            100% {
                transform: rotate(360deg);
            }
        }

        .modal {
            display: none;
            position: fixed;
            z-index: 1000;
            left: 0;
            top: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.5);
        }

        .modal-content {
            background: white;
            margin: 2% auto;
            padding: 30px;
            border-radius: 15px;
            width: 95%;
            max-width: 1200px;
            max-height: 95vh;
            overflow-y: auto;
        }

        .modal-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 20px;
        }

        .close {
            font-size: 24px;
            font-weight: bold;
            cursor: pointer;
            color: #999;
        }

        .close:hover {
            color: #000;
        }

        /* הסתרת תפריט רגיל */
        .nav-buttons {
            display: none;
        }

        @media (max-width: 768px) {
            .form-grid {
                grid-template-columns: 1fr;
            }

            .container {
                padding: 10px;
            }

            .section {
                padding: 20px;
            }

            .question-header {
                flex-direction: column;
                align-items: flex-start;
                gap: 10px;
            }

            .topic-header {
                flex-direction: column;
                align-items: flex-start;
                gap: 10px;
            }
        }

        /* סגנונות להוספת תמונה לשאלות */
        .image-controls {
            display: flex;
            flex-direction: row;
            align-items: center;
            gap: 10px;
            flex-wrap: wrap;
        }

        .image-controls .btn-secondary {
            white-space: nowrap;
            flex-shrink: 0;
            width: auto !important;
            max-width: 200px;
        }

        /* סגנונות לסרגל הכלים של עיצוב טקסט */
        .text-toolbar {
            display: flex;
            gap: 5px;
            margin-top: 5px;
            margin-bottom: 10px;
            flex-wrap: wrap;
        }

        .text-toolbar button {
            background-color: #f8f9fa;
            border: 1px solid #dee2e6;
            border-radius: 3px;
            padding: 5px 8px;
            cursor: pointer;
            font-size: 12px;
            min-width: 30px;
            height: 28px;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .text-toolbar button:hover {
            background-color: #e9ecef;
            border-color: #adb5bd;
        }

        .text-toolbar button:active {
            background-color: #dee2e6;
        }

        .btn-secondary {
            background-color: #6c757d;
            color: white;
            border: none;
            padding: 8px 16px;
            border-radius: 5px;
            cursor: pointer;
            font-size: 14px;
            display: inline-block;
            width: auto;
        }

        .btn-secondary:hover {
            background-color: #5a6268;
        }

        #questionImagePreviewContainer {
            display: none;
            margin-top: 20px;
        }

        .image-controls-section {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 30px;
            margin-bottom: 20px;
        }

        .controls-column {
            display: flex;
            flex-direction: column;
            gap: 15px;
        }

        .form-group {
            margin-bottom: 15px;
        }

        .form-group label {
            display: block;
            margin-bottom: 8px;
            font-weight: bold;
            color: #333;
        }

        .alignment-buttons {
            display: flex;
            gap: 15px;
            flex-wrap: wrap;
        }

        .alignment-buttons input[type="radio"] {
            margin-left: 5px;
        }

        .alignment-buttons label {
            display: flex;
            align-items: center;
            font-weight: normal;
            margin-bottom: 0;
            cursor: pointer;
        }

        #questionImageDisplay,
        #editQuestionImageDisplay {
            border-radius: 5px;
            box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
        }

        .alignment-buttons {
            display: flex;
            gap: 15px;
            margin: 10px 0;
        }

        .alignment-buttons input[type="radio"] {
            margin-left: 5px;
        }

        .image-preview-box {
            border: 2px dashed #ccc;
            padding: 20px;
            background: #f9f9f9;
            border-radius: 5px;
            min-height: 300px;
            display: block;
            width: 100%;
            position: relative;
            overflow: auto; /* חשוב לפלואטים */
        }

        #questionImagePreviewImg {
            max-width: 100%;
            max-height: 400px;
            border-radius: 8px;
            box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
            width: auto;
            height: auto;
            /* margin ו-display ייקבעו דינמית ב-JavaScript */
        }

        .btn-small {
            padding: 5px 10px;
            font-size: 12px;
            margin-top: 10px;
        }

        .modal-footer {
            border-top: 1px solid #eee;
            padding-top: 15px;
        }

        /* פילטרים */
        .filters-section {
            background: #f8f9fa;
            padding: 20px;
            margin-bottom: 20px;
            border-radius: 8px;
            border: 1px solid #e9ecef;
        }

        .filters-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
            gap: 15px;
            align-items: end;
        }

        .filter-group {
            display: flex;
            flex-direction: column;
        }

        .filter-group label {
            font-weight: bold;
            margin-bottom: 5px;
            color: #333;
        }

        .filter-group select {
            padding: 8px 12px;
            border: 1px solid #ccc;
            border-radius: 4px;
            font-size: 14px;
        }

        .filter-group button {
            padding: 8px 16px;
            border: none;
            border-radius: 4px;
            cursor: pointer;
            font-size: 14px;
        }

        /* קטע השאלות הקיימות בשיעור */
        .current-lesson-info {
            background: #e3f2fd;
            padding: 15px;
            border-radius: 8px;
            margin-bottom: 20px;
            border-left: 4px solid #2196f3;
        }

        .lesson-questions-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 15px;
            padding: 10px;
            background: #f5f5f5;
            border-radius: 6px;
        }

        .lesson-questions-controls {
            display: flex;
            gap: 10px;
        }

        .question-item {
            background: white;
            border: 1px solid #ddd;
            border-radius: 8px;
            margin-bottom: 15px;
            overflow: hidden;
        }

        .question-header {
            background: #f8f9fa;
            padding: 10px 15px;
            border-bottom: 1px solid #ddd;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .question-number {
            font-weight: bold;
            color: #007bff;
            margin-left: 10px;
        }

        .question-text {
            flex-grow: 1;
            font-weight: bold;
        }

        .question-actions button {
            margin-right: 5px;
        }

        .question-options {
            padding: 15px;
        }

        .option {
            padding: 8px 12px;
            margin: 5px 0;
            border-radius: 4px;
            background: #f8f9fa;
        }

        .option.correct {
            background: #d4edda;
            border-left: 4px solid #28a745;
            font-weight: bold;
        }

        .explanation {
            padding: 10px 15px;
            background: #fff3cd;
            border-top: 1px solid #ddd;
            font-style: italic;
        }

        .order-info {
            padding: 5px 15px;
            color: #666;
            font-size: 12px;
            background: #f8f9fa;
            border-top: 1px solid #ddd;
        }

        .no-questions {
            text-align: center;
            padding: 40px;
            color: #666;
        }

        /* עיצוב לאזור השאלות הקיימות בהוספת שאלה */
        .existing-questions-section {
            background: #f8f9fa;
            border: 2px solid #e9ecef;
            border-radius: 10px;
            padding: 20px;
            margin: 20px 0;
        }

        .existing-questions-section h3 {
            color: #495057;
            margin-bottom: 15px;
            font-size: 18px;
        }

        .existing-questions-info {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 15px;
        }

        .existing-questions-info span {
            font-weight: bold;
            color: #6c757d;
        }

        .toggle-btn {
            background: #17a2b8;
            color: white;
            border: none;
            padding: 8px 15px;
            border-radius: 5px;
            cursor: pointer;
            font-size: 12px;
            transition: background 0.3s ease;
        }

        .toggle-btn:hover {
            background: #138496;
        }

        .existing-questions-list {
            max-height: 400px;
            overflow-y: auto;
            border: 1px solid #dee2e6;
            border-radius: 5px;
            background: white;
        }

        .existing-question-item {
            padding: 15px;
            border-bottom: 1px solid #dee2e6;
        }

        .existing-question-item:last-child {
            border-bottom: none;
        }

        .existing-question-header {
            display: flex;
            justify-content: space-between;
            align-items: flex-start;
            margin-bottom: 8px;
        }

        .existing-question-text {
            font-weight: bold;
            color: #333;
            font-size: 14px;
            flex: 1;
            margin-left: 10px;
        }

        .existing-question-actions {
            display: flex;
            gap: 5px;
            flex-shrink: 0;
        }

        .existing-question-actions .btn-small {
            padding: 4px 8px;
            font-size: 12px;
            border: none;
            border-radius: 3px;
            cursor: pointer;
            min-width: 28px;
            height: 28px;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .existing-question-actions .btn-edit {
            background-color: #007bff;
            color: white;
        }

        .existing-question-actions .btn-edit:hover {
            background-color: #0056b3;
        }

        .existing-question-actions .btn-delete {
            background-color: #dc3545;
            color: white;
        }

        .existing-question-actions .btn-delete:hover {
            background-color: #c82333;
        }

        /* responsive עבור מובייל */
        @media (max-width: 768px) {
            .existing-question-header {
                flex-direction: column;
                align-items: stretch;
            }
            
            .existing-question-text {
                margin-left: 0;
                margin-bottom: 8px;
            }
            
            .existing-question-actions {
                justify-content: flex-end;
            }
        }

        .existing-question-options {
            font-size: 12px;
            color: #666;
        }

        .existing-question-options .correct-option {
            color: #28a745;
            font-weight: bold;
        }
