/* ============ Afaqtawjih Test Plug — Frontend Styles ============ */
.afaq-wrap {
	--afaq-blue: #0d4fa8;
	--afaq-blue-dark: #093b7d;
	--afaq-gold: #f5b843;
	--afaq-bg: #f7f9fc;
	--afaq-text: #1e2a3a;
	--afaq-border: #e2e8f0;
	max-width: 780px;
	margin: 30px auto;
	background: var(--afaq-bg);
	border-radius: 18px;
	padding: 30px;
	box-shadow: 0 10px 40px rgba(13, 79, 168, 0.08);
	font-family: 'Tajawal', 'Cairo', 'Segoe UI', Tahoma, sans-serif;
	color: var(--afaq-text);
	box-sizing: border-box;
}
.afaq-wrap * { box-sizing: border-box; }

.afaq-header { text-align: center; margin-bottom: 26px; }
.afaq-logo { max-width: 180px; height: auto; margin-bottom: 10px; }
.afaq-title { font-size: 26px; margin: 8px 0 6px; color: var(--afaq-blue-dark); font-weight: 800; }
.afaq-subtitle { color: #5a6b81; font-size: 15px; margin: 0; }

.afaq-screen {
	background: #fff;
	border-radius: 14px;
	padding: 24px;
	border: 1px solid var(--afaq-border);
}

.afaq-screen h3 { margin-top: 0; color: var(--afaq-blue-dark); font-size: 20px; }

.afaq-field { margin-bottom: 16px; }
.afaq-field label { display: block; margin-bottom: 6px; font-weight: 600; font-size: 14px; }

.afaq-input {
	width: 100%;
	padding: 12px 14px;
	border: 1.5px solid var(--afaq-border);
	border-radius: 10px;
	font-size: 15px;
	background: #fbfcfe;
	transition: border-color .15s ease;
	font-family: inherit;
}
.afaq-input:focus { outline: none; border-color: var(--afaq-blue); background: #fff; }

.afaq-btn {
	display: inline-block;
	padding: 13px 26px;
	border-radius: 10px;
	border: none;
	font-size: 15px;
	font-weight: 700;
	cursor: pointer;
	transition: transform .12s ease, opacity .12s ease;
	font-family: inherit;
}
.afaq-btn:hover { transform: translateY(-1px); }
.afaq-btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }

.afaq-btn-primary { background: var(--afaq-blue); color: #fff; width: 100%; }
.afaq-btn-primary:hover:not(:disabled) { background: var(--afaq-blue-dark); }

.afaq-btn-secondary { background: #eef2f7; color: var(--afaq-text); }

.afaq-error { color: #d1373f; font-weight: 600; margin-top: 10px; }

/* ---- تقدّم الاختبار ---- */
.afaq-progress-wrap { margin-bottom: 22px; }
.afaq-progress-bar { background: #e6ebf3; border-radius: 20px; height: 10px; overflow: hidden; margin-bottom: 8px; }
.afaq-progress-fill { background: linear-gradient(90deg, var(--afaq-blue), var(--afaq-gold)); height: 100%; width: 0%; transition: width .3s ease; }
#afaq-progress-text { font-size: 13px; color: #5a6b81; font-weight: 600; }

.afaq-question-text { font-size: 18px; font-weight: 700; margin-bottom: 20px; line-height: 1.6; min-height: 55px; }

.afaq-likert { display: flex; flex-direction: column; gap: 10px; }
.afaq-likert-btn {
	padding: 14px 16px;
	border: 1.5px solid var(--afaq-border);
	background: #fbfcfe;
	border-radius: 10px;
	text-align: center;
	cursor: pointer;
	font-size: 15px;
	font-family: inherit;
	transition: all .15s ease;
}
.afaq-likert-btn:hover { border-color: var(--afaq-blue); background: #eef4fd; }
.afaq-likert-btn.afaq-selected { background: var(--afaq-blue); color: #fff; border-color: var(--afaq-blue); }

.afaq-quiz-nav { display: flex; justify-content: space-between; gap: 12px; margin-top: 24px; }
.afaq-quiz-nav .afaq-btn { flex: 1; width: auto; }

/* ---- تحميل ---- */
#afaq-screen-loading { text-align: center; padding: 50px 24px; }
.afaq-loader {
	width: 54px; height: 54px; margin: 0 auto 20px;
	border: 5px solid #e6ebf3; border-top-color: var(--afaq-blue);
	border-radius: 50%; animation: afaq-spin 0.9s linear infinite;
}
@keyframes afaq-spin { to { transform: rotate(360deg); } }

/* ---- النتيجة ---- */
.afaq-result-actions { display: flex; gap: 12px; margin-top: 20px; }
.afaq-result-actions .afaq-btn { flex: 1; width: auto; }

/* ---- التقرير ---- */
.afaq-pdf-report { background: #fff; border-radius: 14px; padding: 10px; }
.afaq-report-header { display: flex; align-items: center; gap: 16px; border-bottom: 3px solid var(--afaq-gold); padding-bottom: 16px; margin-bottom: 20px; }
.afaq-report-logo { width: 70px; height: auto; }
.afaq-report-header h1 { font-size: 21px; margin: 0 0 4px; color: var(--afaq-blue-dark); }
.afaq-report-date { font-size: 13px; color: #5a6b81; margin: 0; }

.afaq-report-student-box {
	background: #eef4fd; border-radius: 10px; padding: 14px 18px;
	display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 20px; font-size: 14px;
}

.afaq-report-section-title { color: var(--afaq-blue-dark); font-size: 18px; border-right: 5px solid var(--afaq-gold); padding-right: 12px; margin: 26px 0 12px; }

.afaq-traits-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-bottom: 10px; }
.afaq-trait-card { background: #fbfcfe; border: 1px solid var(--afaq-border); border-radius: 10px; padding: 14px; }
.afaq-trait-card h4 { margin: 0 0 6px; color: var(--afaq-blue); font-size: 15px; }
.afaq-trait-card p { margin: 0; font-size: 13px; color: #46566b; }

.afaq-scores-bars { margin: 16px 0; }
.afaq-score-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.afaq-score-label { width: 140px; font-size: 13px; font-weight: 600; flex-shrink: 0; }
.afaq-score-bar-bg { flex: 1; background: #e6ebf3; border-radius: 20px; height: 12px; overflow: hidden; }
.afaq-score-bar-fill { background: linear-gradient(90deg, var(--afaq-blue), var(--afaq-gold)); height: 100%; }
.afaq-score-value { width: 40px; font-size: 12px; color: #5a6b81; flex-shrink: 0; }

.afaq-list-check, .afaq-list-dot { padding-right: 22px; margin: 0 0 10px; }
.afaq-list-check li { margin-bottom: 8px; }
.afaq-list-check li::marker { content: "✔ "; color: var(--afaq-blue); }
.afaq-list-dot li { margin-bottom: 8px; }

.afaq-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.afaq-tag { background: var(--afaq-blue); color: #fff; padding: 6px 14px; border-radius: 20px; font-size: 13px; font-weight: 600; }

.afaq-spec-card { border: 1px solid var(--afaq-border); border-right: 4px solid var(--afaq-blue); border-radius: 8px; padding: 12px 16px; margin-bottom: 10px; background: #fbfcfe; }
.afaq-spec-card h4 { margin: 0 0 4px; font-size: 15px; color: var(--afaq-blue-dark); }
.afaq-spec-card p { margin: 0; font-size: 13px; color: #46566b; }

.afaq-report-footer { margin-top: 30px; padding-top: 14px; border-top: 1px solid var(--afaq-border); font-size: 12px; color: #8393a8; text-align: center; }

/* ============ عرض الطباعة / حفظ PDF ============ */
@media print {
	body * { visibility: hidden; }
	.afaq-pdf-report, .afaq-pdf-report * { visibility: visible; }
	.afaq-pdf-report { position: absolute; top: 0; right: 0; left: 0; width: 100%; padding: 0; box-shadow: none; }
	@page { margin: 14mm; }
}

/* ============ الاستجابة للهاتف ============ */
@media (max-width: 600px) {
	.afaq-wrap { margin: 0; border-radius: 0; padding: 16px; }
	.afaq-title { font-size: 21px; }
	.afaq-screen { padding: 16px; }
	.afaq-report-student-box { grid-template-columns: 1fr; }
	.afaq-quiz-nav, .afaq-result-actions { flex-direction: column; }
	.afaq-score-label { width: 105px; font-size: 12px; }
}
