/*
 * با يا جيم — quiz.css
 * ألوان باياجيم المحدّثة
 */

#bjm-test-wrap {
    --bjm-primary:  #1D3D4F;
    --bjm-accent:   #C9614A;
    --bjm-blue:     #7AAEC0;
    --bjm-cream:    #F2EDE2;
    --bjm-sand:     #E8B08A;
    --bjm-dark:     #0d2535;
    --bjm-green:    #27ae60;
    --bjm-red:      #e74c3c;
    --bjm-gray:     #f4f6f9;
    --bjm-white:    #ffffff;
    --bjm-shadow:   0 4px 24px rgba(29,61,79,0.12);
    --bjm-radius:   14px;
    font-family: 'Cairo', 'Tajawal', Arial, sans-serif;
    direction: rtl;
    max-width: 720px;
    margin: 0 auto;
    padding: 20px 16px;
}

/* الشاشات */
.bjm-screen { display: none; }
.bjm-screen.bjm-active { display: block; }

/* شاشة الاسم */
.bjm-name-card {
    max-width: 520px;
    margin: 40px auto;
    background: var(--bjm-white);
    border-radius: var(--bjm-radius);
    box-shadow: var(--bjm-shadow);
    padding: 40px;
    text-align: center;
    border-top: 4px solid var(--bjm-accent);
}
.bjm-logo {
    font-size: 1.8rem;
    font-weight: 900;
    color: var(--bjm-primary);
    margin-bottom: 8px;
}
.bjm-title-ar {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--bjm-dark);
    margin: 0 0 4px;
}
.bjm-title-tr {
    font-size: 1rem;
    color: #888;
    margin: 0 0 20px;
    font-style: italic;
}
.bjm-lang-tabs {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 24px;
}
.bjm-lang-btn {
    padding: 7px 22px;
    border: 2px solid #ddd;
    border-radius: 99px;
    background: none;
    cursor: pointer;
    font-size: 13px;
    font-family: inherit;
    font-weight: 600;
    transition: all .2s;
}
.bjm-lang-btn.active {
    background: var(--bjm-primary);
    border-color: var(--bjm-primary);
    color: white;
}
.bjm-name-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 24px;
}
.bjm-name-form label {
    font-size: 14px;
    font-weight: 600;
    color: var(--bjm-dark);
    text-align: right;
}
.bjm-name-form input {
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-family: inherit;
    font-size: 15px;
    direction: rtl;
    transition: border-color .2s;
}
.bjm-name-form input:focus {
    outline: none;
    border-color: var(--bjm-primary);
    box-shadow: 0 0 0 3px rgba(29,61,79,.08);
}
.bjm-error { font-size: 12px; color: var(--bjm-red); text-align: right; min-height: 16px; }
.bjm-test-info {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 8px;
}
.bjm-info-item {
    background: var(--bjm-cream);
    border-radius: 8px;
    padding: 10px;
    font-size: 13px;
    color: var(--bjm-primary);
    font-weight: 500;
}

/* أزرار */
.bjm-btn {
    padding: 13px 28px;
    border: none;
    border-radius: 99px;
    cursor: pointer;
    font-family: inherit;
    font-size: 15px;
    font-weight: 700;
    transition: all .2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}
.bjm-btn:disabled { opacity: .6; cursor: not-allowed; }
.bjm-btn-primary {
    background: linear-gradient(135deg, var(--bjm-accent), #b8563f);
    color: white;
    width: 100%;
    box-shadow: 0 4px 16px rgba(201,97,74,0.3);
}
.bjm-btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(201,97,74,.4);
}
.bjm-btn-next {
    background: linear-gradient(135deg, var(--bjm-primary), #2a5f8f);
    color: white;
    margin-top: 16px;
    width: 100%;
}
.bjm-btn-next:hover { transform: translateY(-2px); }

/* هيدر الاختبار */
.bjm-quiz-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: var(--bjm-primary);
    color: white;
    padding: 14px 20px;
    border-radius: var(--bjm-radius) var(--bjm-radius) 0 0;
    flex-wrap: wrap;
}
.bjm-student-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 700;
    font-size: 14px;
}
.bjm-progress-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 120px;
}
.bjm-progress-bar {
    flex: 1;
    height: 6px;
    background: rgba(255,255,255,.2);
    border-radius: 99px;
    overflow: hidden;
}
#bjm-progress {
    height: 100%;
    background: var(--bjm-accent);
    border-radius: 99px;
    transition: width .4s ease;
}
#bjm-q-counter { font-size: 12px; white-space: nowrap; opacity: .8; }
.bjm-score-live {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 16px;
    font-weight: 900;
    color: var(--bjm-sand);
}

/* بطاقة السؤال */
.bjm-q-card {
    background: var(--bjm-white);
    border-radius: 0 0 var(--bjm-radius) var(--bjm-radius);
    padding: 24px;
    box-shadow: var(--bjm-shadow);
}
.bjm-q-meta {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.bjm-level-tag {
    padding: 3px 12px;
    border-radius: 99px;
    font-size: 12px;
    font-weight: 700;
    color: white;
}
.bjm-level-a1, .bjm-level-a2 { background: var(--bjm-accent); }
.bjm-level-b1, .bjm-level-b2 { background: var(--bjm-primary); }
.bjm-level-c1, .bjm-level-c2 { background: var(--bjm-blue); }

.bjm-skill-tag {
    padding: 3px 12px;
    border-radius: 99px;
    font-size: 12px;
    background: rgba(29,61,79,.08);
    color: var(--bjm-primary);
    font-weight: 600;
}
.bjm-points-tag {
    padding: 3px 10px;
    border-radius: 99px;
    font-size: 12px;
    background: rgba(201,97,74,.12);
    color: var(--bjm-accent);
    font-weight: 600;
}

/* المقطع */
.bjm-passage {
    background: var(--bjm-cream);
    border: 1px solid rgba(29,61,79,.12);
    border-right: 4px solid var(--bjm-accent);
    border-radius: 8px;
    padding: 14px;
    margin-bottom: 16px;
}
.bjm-passage-label { font-size: 12px; font-weight: 700; color: var(--bjm-accent); margin-bottom: 6px; }
.bjm-passage-text  { font-size: 15px; line-height: 1.9; margin: 0; color: #333; }

/* نص السؤال */
.bjm-q-text {
    font-size: 17px;
    font-weight: 700;
    color: var(--bjm-dark);
    margin-bottom: 18px;
    line-height: 1.6;
}

/* الخيارات */
.bjm-opts-list { display: flex; flex-direction: column; gap: 10px; }
.bjm-opt {
    display: flex;
    align-items: center;
    flex-direction: row-reverse;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bjm-gray);
    border: 2px solid transparent;
    border-radius: 10px;
    cursor: pointer;
    text-align: right;
    font-family: inherit;
    font-size: 15px;
    color: #333;
    width: 100%;
    transition: all .15s;
}
.bjm-opt:hover:not(:disabled) {
    border-color: var(--bjm-primary);
    background: rgba(29,61,79,.05);
    transform: translateX(4px);
}
.bjm-opt:disabled { cursor: default; }
.bjm-opt-letter {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: white;
    border: 2px solid #ccc;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    flex-shrink: 0;
    margin-right: auto;
    transition: all .15s;
}
.bjm-opt-correct { background: rgba(39,174,96,.1) !important; border-color: #27ae60 !important; }
.bjm-opt-correct .bjm-opt-letter { background: #27ae60 !important; border-color: #27ae60 !important; color: white !important; }
.bjm-opt-wrong   { background: rgba(231,76,60,.08) !important; border-color: #e74c3c !important; }
.bjm-opt-wrong .bjm-opt-letter { background: #e74c3c !important; border-color: #e74c3c !important; color: white !important; }

/* الملاحظات */
.bjm-feedback {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 12px 14px;
    border-radius: 8px;
    font-size: 14px;
    margin-top: 14px;
    border: 1px solid;
}
.bjm-fb-correct { background: rgba(39,174,96,.08); border-color: rgba(39,174,96,.3); color: #1e8449; }
.bjm-fb-wrong   { background: rgba(231,76,60,.06); border-color: rgba(231,76,60,.3); color: #c0392b; }
.bjm-exp { font-size: 13px; line-height: 1.7; }

/* التحميل */
.bjm-loading { text-align: center; padding: 60px 20px; color: #888; }
.bjm-spinner {
    width: 40px; height: 40px;
    border: 4px solid #e0e0e0;
    border-top-color: var(--bjm-accent);
    border-radius: 50%;
    animation: bjm-spin 1s linear infinite;
    margin: 0 auto 16px;
}
@keyframes bjm-spin { to { transform: rotate(360deg); } }

/* شاشة الكتابة */
.bjm-writing-card {
    max-width: 640px;
    margin: 40px auto;
    background: white;
    border-radius: var(--bjm-radius);
    box-shadow: var(--bjm-shadow);
    padding: 32px;
    border-top: 4px solid var(--bjm-accent);
}
.bjm-writing-card h3 { color: var(--bjm-dark); margin-bottom: 12px; }
.bjm-writing-card textarea {
    width: 100%;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    padding: 12px;
    font-family: inherit;
    font-size: 15px;
    direction: rtl;
    resize: vertical;
    min-height: 160px;
    transition: border-color .2s;
    box-sizing: border-box;
}
.bjm-writing-card textarea:focus { outline: none; border-color: var(--bjm-accent); }
.bjm-writing-counter { font-size: 12px; color: #999; text-align: left; margin: 4px 0 16px; }

/* شاشة الانتظار */
.bjm-waiting-card {
    max-width: 500px;
    margin: 60px auto;
    background: white;
    border-radius: var(--bjm-radius);
    box-shadow: var(--bjm-shadow);
    padding: 40px;
    text-align: center;
    border-top: 4px solid var(--bjm-blue);
}
.bjm-waiting-icon { font-size: 4rem; margin-bottom: 16px; animation: bjm-bounce 1.5s ease-in-out infinite; }
@keyframes bjm-bounce { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-10px)} }
.bjm-waiting-card h3 { color: var(--bjm-dark); margin-bottom: 8px; }
.bjm-waiting-card p  { color: #666; margin-bottom: 24px; }
.bjm-partial-result {
    display: flex;
    justify-content: center;
    gap: 24px;
    background: var(--bjm-cream);
    padding: 16px;
    border-radius: 10px;
}
.bjm-partial-item { text-align: center; }
.bjm-partial-item span  { display: block; font-size: 13px; color: #888; margin-bottom: 4px; }
.bjm-partial-item strong { font-size: 1.5rem; font-weight: 900; color: var(--bjm-accent); }

.bjm-no-questions, .bjm-error-msg {
    text-align: center; padding: 60px 20px;
    color: var(--bjm-accent); background: #fff5f5;
    border-radius: 8px; margin: 20px;
}

@media (max-width: 600px) {
    .bjm-name-card, .bjm-writing-card, .bjm-waiting-card { margin: 16px; padding: 20px; }
    .bjm-quiz-header { border-radius: 0; }
    .bjm-q-card { padding: 16px; }
    .bjm-test-info { grid-template-columns: 1fr; }
    .bjm-q-text { font-size: 15px; }
}