/* =====================================================
   أداة مسابقة تفاعلية - تنسيقات لوحة الإعداد
   ===================================================== */

/* حركة دوران العجلة في المعاينة */
@keyframes slow-spin { 
    100% { transform: rotate(360deg); } 
}

@keyframes slide-down {
    from { opacity: 0; transform: translateY(-12px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes pop-in {
    0%   { opacity: 0; transform: scale(0.92); }
    70%  { transform: scale(1.02); }
    100% { opacity: 1; transform: scale(1); }
}

/* ----------------------------------
   بطاقة السؤال الجديدة
---------------------------------- */
.question-card {
    background: #fff;
    border: 2px solid #e2e8f0;
    border-radius: 16px;
    padding: 0;
    overflow: hidden;
    animation: slide-down 0.3s ease-out;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.question-card:hover {
    border-color: #a5b4fc;
    box-shadow: 0 6px 20px rgba(99,102,241,0.08);
}

/* شريط علوي ملون حسب نوع السؤال */
.question-card .q-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    border-bottom: 2px solid #f1f5f9;
}

.question-card .q-header.type-open   { background: #f0fdf4; border-bottom-color: #bbf7d0; }
.question-card .q-header.type-tf     { background: #eff6ff; border-bottom-color: #bfdbfe; }
.question-card .q-header.type-mcq    { background: #fdf4ff; border-bottom-color: #e9d5ff; }

.question-card .q-type-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 800;
    font-size: 0.8rem;
    padding: 4px 10px;
    border-radius: 999px;
}

.question-card .q-type-badge.type-open  { background: #dcfce7; color: #16a34a; }
.question-card .q-type-badge.type-tf    { background: #dbeafe; color: #2563eb; }
.question-card .q-type-badge.type-mcq  { background: #f3e8ff; color: #9333ea; }

.question-card .q-body {
    padding: 14px 16px;
}

/* حقل نص السؤال */
.question-card textarea.q-text-input {
    width: 100%;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 0.95rem;
    font-weight: 700;
    font-family: 'Cairo', sans-serif;
    resize: vertical;
    min-height: 72px;
    transition: border-color 0.2s;
    direction: rtl;
    line-height: 1.7;
}
.question-card textarea.q-text-input:focus {
    outline: none;
    border-color: #818cf8;
    box-shadow: 0 0 0 3px rgba(129,140,248,0.15);
}

/* خيارات MCQ */
.mcq-option-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 10px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    transition: background 0.2s, border-color 0.2s;
    margin-bottom: 8px;
}
.mcq-option-row:last-child { margin-bottom: 0; }

.mcq-option-row:has(input[type=radio]:checked) {
    background: #f0fdf4;
    border-color: #86efac;
}

.mcq-option-row input[type=radio] {
    width: 18px;
    height: 18px;
    accent-color: #10b981;
    cursor: pointer;
    flex-shrink: 0;
}

.mcq-option-row input[type=text] {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 0.9rem;
    font-family: 'Cairo', sans-serif;
    font-weight: 600;
    direction: rtl;
    padding: 2px 0;
}
.mcq-option-row input[type=text]:focus { outline: none; }

/* خيار صحيح/خطأ */
.tf-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 10px;
}
.tf-option-label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 700;
    font-size: 0.9rem;
    transition: all 0.2s;
    user-select: none;
}
.tf-option-label:has(input:checked).tf-true {
    background: #f0fdf4;
    border-color: #4ade80;
    color: #16a34a;
}
.tf-option-label:has(input:checked).tf-false {
    background: #fef2f2;
    border-color: #fca5a5;
    color: #dc2626;
}
.tf-option-label:not(:has(input:checked)) {
    background: #f8fafc;
    color: #64748b;
}
.tf-option-label input[type=radio] { display: none; }

/* زر إضافة نوع السؤال */
.add-q-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 12px 8px;
    border: 2px dashed #d1d5db;
    border-radius: 14px;
    background: #f9fafb;
    cursor: pointer;
    transition: all 0.2s;
    font-family: 'Cairo', sans-serif;
    font-weight: 700;
    font-size: 0.8rem;
    color: #6b7280;
    flex: 1;
}
.add-q-btn:hover {
    border-color: #818cf8;
    background: #eef2ff;
    color: #4f46e5;
    transform: translateY(-2px);
}
.add-q-btn .btn-icon { font-size: 1.6rem; }

/* حالة التحميل بالذكاء الاصطناعي */
.ai-loading-bar {
    background: linear-gradient(90deg, #6366f1, #8b5cf6, #a855f7, #6366f1);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    height: 4px;
    border-radius: 9999px;
}
@keyframes shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* حالة إضافة المشاركين */
.participant-item {
    animation: slide-down 0.2s ease-out;
    display: flex;
    gap: 8px;
    align-items: center;
}

/* ردود فعل مرئية */
.q-counter-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    color: white;
    border-radius: 999px;
    padding: 3px 10px;
    font-size: 0.78rem;
    font-weight: 800;
}

.font-tajawal {
    font-family: 'Cairo', sans-serif;
}

/* Responsive: Mobile adjustments */
@media (max-width: 640px) {
    .tf-options { grid-template-columns: 1fr 1fr; }
    .question-card .q-body { padding: 12px; }
}
