/**
 * الحقول والنماذج (UI::field)
 * (جزء من المكونات المركزية: تُحمّل كلها عبر المقبض tnt-components)
 */

.tnt .tnt-form-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 18px 16px; }
.tnt .tnt-field { grid-column: span 6; min-width: 0; }
.tnt .tnt-field--half { grid-column: span 3; }
.tnt .tnt-field--third { grid-column: span 2; }
.tnt .tnt-field__label { display: block; font-size: 13.5px; font-weight: 600; margin-bottom: 7px; color: var(--tnt-text); }
.tnt .tnt-field__req { color: var(--tnt-danger); margin-inline-start: 2px; }
.tnt .tnt-field__control { position: relative; }
.tnt .tnt-field__icon { position: absolute; inset-inline-start: 12px; top: 50%; transform: translateY(-50%); color: var(--tnt-muted); display: flex; pointer-events: none; }
.tnt .tnt-field__control.has-icon .tnt-input { padding-inline-start: 40px; }
.tnt .tnt-input {
	width: 100%; max-width: none; min-height: 44px; padding: 10px 14px; font: 500 14.5px/1.5 var(--tnt-font); color: var(--tnt-text);
	background: var(--tnt-surface); border: 1px solid var(--tnt-border-strong); border-radius: var(--tnt-radius-sm); box-shadow: var(--tnt-shadow-xs);
	transition: border-color .15s, box-shadow .15s; margin: 0;
}
/*
 * 16px في أجهزة اللمس: Safari في الآيفون يكبّر الصفحة عند لمس أي حقل أو قائمة خطها أقل من 16px،
 * وتبقى مكبّرة فتنقص الحقول والقوائم عن الشاشة (النوع، المؤهل، تاريخ الميلاد...)
 */
@media (pointer: coarse) { .tnt input.tnt-input, .tnt select.tnt-input, .tnt textarea.tnt-input { font-size: 16px; } }
.tnt textarea.tnt-input { min-height: 110px; resize: vertical; }
.tnt .tnt-input:focus { outline: none; border-color: var(--tnt-primary); box-shadow: var(--tnt-ring); }
.tnt .tnt-input::placeholder { color: #a5adc3; }
.tnt .tnt-field.has-error .tnt-input { border-color: var(--tnt-danger); }
.tnt .tnt-field__error { color: var(--tnt-danger); font-size: 12.5px; margin-top: 6px; font-weight: 500; }
.tnt .tnt-field__help { color: var(--tnt-muted); font-size: 12.5px; margin-top: 6px; }
.tnt .tnt-form-actions { display: flex; gap: 10px; justify-content: flex-start; margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--tnt-border); flex-wrap: wrap; }


/* حقول الاسم الرباعي عربي/إنجليزي (partials/trainee-names.php) */
.tnt .tnt-names { grid-column: 1 / -1; border: 0; margin: 0; padding: 0; min-width: 0; }
.tnt .tnt-names > legend { padding: 0; margin-bottom: 8px; }
.tnt .tnt-names { container-type: inline-size; }
.tnt .tnt-names__row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
/* 4 حقول في سطر، أو 2×2 عندما تضيق المساحة الفعلية (لا 3+1) */
@container (max-width: 620px) { .tnt .tnt-names__row { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.tnt .tnt-names__row > .tnt-field { grid-column: auto; margin: 0; }
.tnt .tnt-names__row .tnt-field__label { font-size: 12.5px; color: var(--tnt-muted); }
/* كل حقل إنجليزي تحت مقابله العربي، والكتابة داخله من اليسار */
.tnt .tnt-names__row--en .tnt-input { direction: ltr; text-align: left; }


/* نتيجة التحقق الفوري تحت الحقل (assets/js/admin/trainee-check.js) */
.tnt .tnt-field__live { margin: 6px 0 0; font-size: 12.5px; font-weight: 600; }
.tnt .tnt-field__live.is-success { color: var(--tnt-success); }
.tnt .tnt-field__live.is-info { color: var(--tnt-info); }
.tnt .tnt-field__live.is-danger { color: var(--tnt-danger); }
.tnt .tnt-field__live.is-pending { color: var(--tnt-muted); }
.tnt .tnt-field.is-valid .tnt-input { border-color: var(--tnt-success); }

/* حقل الجوال: مفتاح الدولة بعلمها + الرقم (components/phone.php و js/components/phone.js) */
.tnt .tnt-phone { position: relative; display: flex; align-items: stretch; gap: 0; }
.tnt .tnt-phone__select { flex: 0 0 auto; width: auto; border-start-end-radius: 0; border-end-end-radius: 0; }
.tnt .tnt-phone__btn {
	flex: 0 0 auto; display: inline-flex; align-items: center; gap: 8px; padding: 0 12px; cursor: pointer;
	border: 1px solid var(--tnt-border-strong); border-inline-end: 0; border-radius: var(--tnt-radius-sm) 0 0 var(--tnt-radius-sm);
	background: var(--tnt-surface-2); color: var(--tnt-text); font: inherit; font-weight: 700; font-size: 14px;
}
.tnt .tnt-phone__btn:focus-visible { outline: none; box-shadow: var(--tnt-ring); }
.tnt .tnt-phone__btn .tnt-icon { color: var(--tnt-muted); transition: transform .15s var(--tnt-ease); }
.tnt .tnt-phone.is-open .tnt-phone__btn .tnt-icon { transform: rotate(180deg); }
.tnt .tnt-phone__flag, .tnt .tnt-phone__list img { width: 22px; height: 16px; border-radius: 3px; object-fit: cover; box-shadow: 0 0 0 1px rgba(0, 0, 0, .08); }
.tnt .tnt-phone__code { font-family: ui-monospace, Consolas, monospace; }
.tnt .tnt-phone__number { flex: 1; min-width: 0; border-radius: 0 var(--tnt-radius-sm) var(--tnt-radius-sm) 0; text-align: left; }
.tnt .tnt-phone__select + .tnt-phone__btn + .tnt-phone__list + .tnt-phone__number { border-radius: 0 var(--tnt-radius-sm) var(--tnt-radius-sm) 0; }
.tnt .tnt-phone__list {
	position: absolute; z-index: 30; top: calc(100% + 6px); left: 0; min-width: 220px; margin: 0; padding: 6px; list-style: none;
	background: var(--tnt-surface); border: 1px solid var(--tnt-border); border-radius: var(--tnt-radius); box-shadow: var(--tnt-shadow-lg);
}
.tnt .tnt-phone__list li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; cursor: pointer; direction: rtl; }
.tnt .tnt-phone__list li:hover, .tnt .tnt-phone__list li:focus { outline: none; background: var(--tnt-primary-50); }
.tnt .tnt-phone__list li[aria-selected="true"] { background: var(--tnt-primary-50); color: var(--tnt-primary); font-weight: 700; }
.tnt .tnt-phone__name { flex: 1; }
.tnt .tnt-phone__dial { font-family: ui-monospace, Consolas, monospace; color: var(--tnt-muted); direction: ltr; }
.tnt .tnt-field.has-error .tnt-phone__btn { border-color: var(--tnt-danger); }
