/**
 * Eduplayify Template: true_false (صح أو خطأ)
 * تنسيقات قالب صح أو خطأ مع تصميم متجاوب لجميع الشاشات وألوان جذابة عشوائية
 */

.tf-wrap {
    width: 100%;
    max-width: 820px;
    margin: 0 auto;
    text-align: center;
    padding: clamp(6px, 1.5vh, 16px) 0;
}

/* صورة السؤال إن وجدت */
.tf-wrap .ws-image {
    max-height: clamp(140px, 24vh, 260px);
    max-width: 92%;
    display: block;
    margin: 0 auto clamp(14px, 2.5vh, 22px);
    border-radius: clamp(12px, 2vw, 18px);
    object-fit: contain;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    border: 1.5px solid #e2e8f0;
    background: #ffffff;
    padding: 6px;
}

/* بطاقة نص العبارة / السؤال - واضحة ومميزة وبارزة */
.tf-prompt,
.tf-question-text {
    font-size: clamp(1.3rem, 2.8vw + 0.2rem, 1.95rem);
    font-weight: 800;
    color: #0f172a;
    text-align: center;
    margin: 0 auto clamp(18px, 3vh, 32px);
    line-height: 1.55;
    max-width: 780px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    border: 2px solid #e2e8f0;
    border-radius: clamp(14px, 2vw, 20px);
    padding: clamp(16px, 2.2vw, 24px) clamp(18px, 3vw, 32px);
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
}

/* حاوية أزرار الإجابة - مرنة ومتجاوبة */
.tf-row,
.tf-choices {
    display: flex;
    gap: clamp(16px, 3vw, 32px);
    justify-content: center;
    align-items: stretch;
    width: 100%;
    max-width: 620px;
    margin: 0 auto clamp(14px, 2.5vh, 24px);
}

/* زر الاختيار الأساسي */
.tf-btn,
.tf-choice-btn {
    flex: 1;
    min-height: clamp(110px, 16vh, 165px);
    padding: clamp(18px, 2.2vh, 28px) clamp(18px, 3vw, 36px);
    font-size: clamp(1.25rem, 2.5vw, 1.7rem);
    font-weight: 800;
    border-radius: clamp(16px, 2vw, 24px);
    border: 3px solid transparent;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: clamp(8px, 1.5vh, 14px);
    position: relative;
    user-select: none;
    outline: none;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.06);
    overflow: hidden;
}

/* أيقونة الاختيار */
.tf-choice-icon {
    font-size: clamp(2.2rem, 4.5vw, 3.4rem);
    line-height: 1;
    transition: transform 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    filter: drop-shadow(0 2px 5px rgba(0, 0, 0, 0.1));
    display: inline-block;
}

.tf-choice-text {
    font-size: clamp(1.3rem, 2.6vw, 1.75rem);
    font-weight: 900;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* ========================================================
   الثيمات اللونية العشوائية لصح وخطأ (True/False Theme Pairs)
   ======================================================== */

/* 1. الثيم الكلاسيكي الأخضر والأحمر (Classic Emerald / Crimson) */
.tf-theme-classic .tf-opt-true,
.tf-wrap:not([class*="tf-theme-"]) .tf-btn-true,
.tf-wrap:not([class*="tf-theme-"]) .tf-choices > .tf-choice-btn:first-child:not(.is-false) {
    background: linear-gradient(145deg, #f0fdf4 0%, #dcfce7 100%);
    color: #166534;
    border-color: #86efac;
    box-shadow: 0 4px 16px rgba(22, 163, 74, 0.12);
}
.tf-theme-classic .tf-opt-true:hover:not(:disabled),
.tf-wrap:not([class*="tf-theme-"]) .tf-btn-true:hover:not(:disabled) {
    background: linear-gradient(145deg, #dcfce7 0%, #bbf7d0 100%);
    border-color: #22c55e;
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 10px 26px rgba(22, 163, 74, 0.25);
}

.tf-theme-classic .tf-opt-false,
.tf-wrap:not([class*="tf-theme-"]) .tf-btn-false,
.tf-wrap:not([class*="tf-theme-"]) .tf-choices > .tf-choice-btn:last-child:not(.is-true) {
    background: linear-gradient(145deg, #fff1f2 0%, #ffe4e6 100%);
    color: #9f1239;
    border-color: #fecdd3;
    box-shadow: 0 4px 16px rgba(225, 29, 72, 0.12);
}
.tf-theme-classic .tf-opt-false:hover:not(:disabled),
.tf-wrap:not([class*="tf-theme-"]) .tf-btn-false:hover:not(:disabled) {
    background: linear-gradient(145deg, #ffe4e6 0%, #fecdd3 100%);
    border-color: #f43f5e;
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 10px 26px rgba(225, 29, 72, 0.25);
}

/* 2. الثيم المشرق: سماوي وبرتقالي (Vibrant Sky & Coral) */
.tf-theme-vibrant .tf-opt-true {
    background: linear-gradient(145deg, #f0f9ff 0%, #e0f2fe 100%);
    color: #0369a1;
    border-color: #7dd3fc;
    box-shadow: 0 4px 16px rgba(2, 132, 199, 0.14);
}
.tf-theme-vibrant .tf-opt-true:hover:not(:disabled) {
    background: linear-gradient(145deg, #e0f2fe 0%, #bae6fd 100%);
    border-color: #0284c7;
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 10px 26px rgba(2, 132, 199, 0.25);
}

.tf-theme-vibrant .tf-opt-false {
    background: linear-gradient(145deg, #fff7ed 0%, #ffedd5 100%);
    color: #c2410c;
    border-color: #fdba74;
    box-shadow: 0 4px 16px rgba(234, 88, 12, 0.14);
}
.tf-theme-vibrant .tf-opt-false:hover:not(:disabled) {
    background: linear-gradient(145deg, #ffedd5 0%, #fed7aa 100%);
    border-color: #ea580c;
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 10px 26px rgba(234, 88, 12, 0.25);
}

/* 3. الثيم الملكي: نيلي وذهبي (Royal Indigo & Amber) */
.tf-theme-royal .tf-opt-true {
    background: linear-gradient(145deg, #eef2ff 0%, #e0e7ff 100%);
    color: #3730a3;
    border-color: #a5b4fc;
    box-shadow: 0 4px 16px rgba(79, 70, 229, 0.14);
}
.tf-theme-royal .tf-opt-true:hover:not(:disabled) {
    background: linear-gradient(145deg, #e0e7ff 0%, #c7d2fe 100%);
    border-color: #4f46e5;
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 10px 26px rgba(79, 70, 229, 0.25);
}

.tf-theme-royal .tf-opt-false {
    background: linear-gradient(145deg, #fffbeb 0%, #fef3c7 100%);
    color: #92400e;
    border-color: #fde68a;
    box-shadow: 0 4px 16px rgba(217, 119, 6, 0.14);
}
.tf-theme-royal .tf-opt-false:hover:not(:disabled) {
    background: linear-gradient(145deg, #fef3c7 0%, #fde047 100%);
    border-color: #d97706;
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 10px 26px rgba(217, 119, 6, 0.25);
}

/* 4. الثيم العصري: فيروزي وكرزي (Modern Teal & Rose) */
.tf-theme-modern .tf-opt-true {
    background: linear-gradient(145deg, #f0fdfa 0%, #ccfbf1 100%);
    color: #115e59;
    border-color: #5eead4;
    box-shadow: 0 4px 16px rgba(13, 148, 136, 0.14);
}
.tf-theme-modern .tf-opt-true:hover:not(:disabled) {
    background: linear-gradient(145deg, #ccfbf1 0%, #99f6e4 100%);
    border-color: #0d9488;
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 10px 26px rgba(13, 148, 136, 0.25);
}

.tf-theme-modern .tf-opt-false {
    background: linear-gradient(145deg, #fff1f2 0%, #ffe4e6 100%);
    color: #9f1239;
    border-color: #fda4af;
    box-shadow: 0 4px 16px rgba(225, 29, 72, 0.14);
}
.tf-theme-modern .tf-opt-false:hover:not(:disabled) {
    background: linear-gradient(145deg, #ffe4e6 0%, #fecdd3 100%);
    border-color: #e11d48;
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 10px 26px rgba(225, 29, 72, 0.25);
}

/* تكبير الأيقونة عند التحويم */
.tf-choice-btn:hover:not(:disabled) .tf-choice-icon {
    transform: scale(1.18);
}

/* تأثير النقر */
.tf-choice-btn:active:not(:disabled) {
    transform: scale(0.98);
}

/* ========================================================
   حالات التغذية الراجعة (الإجابة الصحيحة والخاطئة)
   ======================================================== */

@keyframes tfCorrectPop {
    0% { transform: scale(1); }
    50% { transform: scale(1.06); }
    100% { transform: scale(1.04); }
}

@keyframes tfIncorrectShake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-8px); }
    40%, 80% { transform: translateX(8px); }
}

.tf-choice-btn.correct,
.tf-choice-btn.is-correct {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
    color: #ffffff !important;
    border-color: #047857 !important;
    box-shadow: 0 0 0 5px rgba(16, 185, 129, 0.35), 0 12px 28px rgba(16, 185, 129, 0.4) !important;
    animation: tfCorrectPop 0.35s ease-out forwards;
}
.tf-choice-btn.correct .tf-choice-text,
.tf-choice-btn.is-correct .tf-choice-text {
    color: #ffffff !important;
}

.tf-choice-btn.incorrect,
.tf-choice-btn.is-incorrect {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%) !important;
    color: #ffffff !important;
    border-color: #b91c1c !important;
    box-shadow: 0 0 0 5px rgba(239, 68, 68, 0.3), 0 12px 28px rgba(239, 68, 68, 0.4) !important;
    animation: tfIncorrectShake 0.4s ease-in-out forwards;
    opacity: 0.8;
}
.tf-choice-btn.incorrect .tf-choice-text,
.tf-choice-btn.is-incorrect .tf-choice-text {
    color: #ffffff !important;
}

.tf-choice-btn:disabled {
    cursor: default;
}

/* ========================================================
   وضع ملء الشاشة والشاشات الكبيرة (Fullscreen & Large Displays)
   ======================================================== */
.gpa-fullscreen .tf-wrap {
    max-width: 960px;
}
.gpa-fullscreen .tf-prompt,
.gpa-fullscreen .tf-question-text {
    font-size: clamp(1.7rem, 3.5vw, 2.4rem);
    padding: 26px 40px;
    margin-bottom: 36px;
}
.gpa-fullscreen .tf-choices {
    max-width: 760px;
    gap: 36px;
}
.gpa-fullscreen .tf-choice-btn {
    min-height: 180px;
}
.gpa-fullscreen .tf-choice-icon {
    font-size: 4rem;
}
.gpa-fullscreen .tf-choice-text {
    font-size: 2rem;
}

/* التجاوب مع شاشات الجوال */
@media (max-width: 500px) {
    .tf-row,
    .tf-choices {
        flex-direction: column;
        gap: 14px;
        max-width: 300px;
    }

    .tf-btn,
    .tf-choice-btn {
        min-height: 80px;
        flex-direction: row;
        gap: 16px;
        padding: 16px 24px;
    }

    .tf-prompt,
    .tf-question-text {
        font-size: 1.25rem;
        padding: 14px 18px;
        margin-bottom: 20px;
    }

    .tf-choice-icon {
        font-size: 2rem;
    }

    .tf-choice-text {
        font-size: 1.25rem;
    }
}

/* مصيدة غير بديهية: flex-gap غائب في Safari<14.1/IE — هوامش بديلة فقط عند الغياب */
@supports not (gap: 16px) {
    .tf-choices > * { margin: 0 8px; }
    .tf-choice-btn > * { margin: 4px 0; }
    .tf-prompt > *, .tf-question-text > * { margin: 0 5px; }
}