/* TMS front end – Etihad Pioneers branding for the attendance form and trainer app. */
:root {
	--tms-dark: #0B3D2C;
	--tms-brand: #007D70;
	--tms-green: #00885B;
	--tms-ink: #383838;
	--tms-muted: #6B7470;
	--tms-line: #DDE5E2;
	--tms-bg: #F3F6F5;
	--tms-tint: #E6F2EF;
	--tms-card: #FFFFFF;
	--tms-danger: #B42318;
	--tms-warn: #B54708;
	--tms-radius: 16px;
	--tms-font: "Montserrat", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
	--tms-font-ar: "Noto Kufi Arabic", "Segoe UI", Tahoma, sans-serif;
}

/* ---------- App layout (templates/app.php) ---------- */
body.tms-app { margin: 0; background: var(--tms-bg); color: var(--tms-ink); font-family: var(--tms-font); -webkit-font-smoothing: antialiased; }
.tms-appbar { background: var(--tms-dark); color: #fff; position: sticky; top: 0; z-index: 50; border-bottom: 4px solid var(--tms-green); padding-top: env(safe-area-inset-top); }
.tms-appbar-inner { max-width: 600px; margin: 0 auto; padding: 12px 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 40px; }
.tms-logo { max-height: 36px; width: auto; display: block; }
.tms-wordmark { display: flex; flex-direction: column; line-height: 1.1; color: #fff; }
.tms-wordmark strong { font-size: 16px; letter-spacing: .02em; }
.tms-wordmark small { font-size: 11px; opacity: .75; letter-spacing: .08em; text-transform: uppercase; }
.tms-appbar-actions { display: flex; gap: 6px; align-items: center; }
.tms-appbar-actions a { color: #fff; text-decoration: none; font-size: 13px; font-weight: 600; padding: 7px 11px; border-radius: 999px; background: rgba(255,255,255,.1); }
.tms-appbar-actions .tms-lang { font-family: var(--tms-font-ar); }
.tms-appmain { padding: 16px 16px 8px; }
.tms-appfoot { max-width: 600px; margin: 0 auto; padding: 18px 16px calc(28px + env(safe-area-inset-bottom)); display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; font-size: 12px; color: var(--tms-muted); }
.tms-appfoot [lang="ar"] { font-family: var(--tms-font-ar); }

/* ---------- Base ---------- */
.tms-wrap { max-width: 560px; margin: 0 auto; padding: 4px 0 24px; color: var(--tms-ink); font-family: var(--tms-font); font-size: 16px; line-height: 1.5; -webkit-text-size-adjust: 100%; }
.tms-wrap *, .tms-wrap *::before, .tms-wrap *::after { box-sizing: border-box; }
.tms-wrap h1, .tms-wrap h2, .tms-wrap h3, .tms-wrap h4 { font-family: var(--tms-font); color: var(--tms-dark); letter-spacing: -.01em; }
.tms-wrap .tms-h1 { font-size: 1.5rem; line-height: 1.25; margin: .15em 0 .35em; font-weight: 700; }
.tms-wrap h2 { font-size: 1.15rem; line-height: 1.3; margin: 0 0 .4em; font-weight: 700; }
.tms-wrap h3 { font-size: 1.15rem; line-height: 1.3; margin: .4em 0 .15em; font-weight: 700; }
.tms-wrap h4 { font-size: .95rem; margin: 0; font-weight: 700; }
.tms-wrap p { margin: 0 0 .5em; }
.tms-wrap [lang="ar"], .tms-ar { font-family: var(--tms-font-ar); }
.tms-wrap[dir="rtl"] { font-family: var(--tms-font-ar); }
.tms-wrap[dir="rtl"] h1, .tms-wrap[dir="rtl"] h2, .tms-wrap[dir="rtl"] h3, .tms-wrap[dir="rtl"] h4 { font-family: var(--tms-font-ar); }

.tms-card { background: var(--tms-card); border: 1px solid var(--tms-line); border-radius: var(--tms-radius); padding: 20px; margin: 0 0 14px; box-shadow: 0 1px 2px rgba(11,61,44,.04), 0 4px 16px rgba(11,61,44,.04); }
.tms-card--notice { text-align: center; }
.tms-eyebrow { display: inline-block; font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: var(--tms-brand); font-weight: 700; }
.tms-muted { color: var(--tms-muted); }
.tms-small { font-size: .85rem; }
.tms-ar { font-weight: 400; color: var(--tms-muted); font-size: .88em; margin-inline-start: .35em; }

/* Session header on the form */
.tms-session { border-top: 5px solid var(--tms-brand); }
.tms-session-meta { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.tms-session-meta li { background: var(--tms-tint); color: var(--tms-dark); border-radius: 999px; padding: 4px 11px; font-size: .82rem; font-weight: 600; }

/* ---------- ID scan ---------- */
.tms-scan { display: grid; grid-template-columns: auto 1fr; gap: 14px; background: linear-gradient(180deg, #fff, var(--tms-tint)); border-color: #c9e2dc; }
.tms-step span, .tms-step--inline span { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--tms-dark); color: #fff; font-weight: 700; font-size: .95rem; }
.tms-step--inline { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--tms-dark); margin-bottom: 2px; }
.tms-scan h2 { margin-bottom: .2em; }
.tms-scan .tms-btn { margin-top: 10px; }
.tms-scan-status { min-height: 1.2em; margin: 10px 0 0 !important; font-weight: 600; color: var(--tms-brand); }
.tms-scan.is-error .tms-scan-status { color: var(--tms-danger); }
.tms-scan.is-done .tms-scan-status { color: var(--tms-green); }
.tms-scan.is-busy .tms-btn { pointer-events: none; opacity: .85; }
.tms-scan.is-busy .tms-btn::after { content: ""; width: 18px; height: 18px; border: 2.5px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: tms-spin .8s linear infinite; }
@keyframes tms-spin { to { transform: rotate(360deg); } }
.tms-privacy { display: flex; gap: 8px; align-items: flex-start; color: var(--tms-muted); margin: 10px 0 0 !important; }
.tms-privacy svg { width: 16px; height: 16px; flex: 0 0 16px; margin-top: 2px; color: var(--tms-green); }

/* ---------- Form ---------- */
.tms-form { display: grid; gap: 18px; }
.tms-field { display: grid; gap: 6px; border: 0; padding: 0; margin: 0; min-width: 0; }
.tms-field label, .tms-field legend { font-weight: 600; font-size: .92rem; padding: 0; color: var(--tms-ink); }
.tms-field input[type="text"], .tms-field input[type="email"], .tms-field input[type="tel"], .tms-field input[type="date"] {
	width: 100%; min-height: 52px; padding: 12px 14px; font-size: 16px; font-family: var(--tms-font);
	border: 1.5px solid var(--tms-line); border-radius: 12px; background: #fff; color: var(--tms-ink);
	-webkit-appearance: none; appearance: none; transition: border-color .15s, box-shadow .15s;
}
.tms-field input:focus { outline: none; border-color: var(--tms-brand); box-shadow: 0 0 0 4px rgba(0,125,112,.15); }
.tms-field--name input { font-size: 18px; font-weight: 600; letter-spacing: .01em; }
.tms-field input.is-filled { background: var(--tms-tint); border-color: var(--tms-green); }
.tms-hint { font-size: .8rem; color: var(--tms-muted); }
.tms-field.has-error input { border-color: var(--tms-danger); background: #FEF3F2; }
.tms-field-error { color: var(--tms-danger); font-size: .84rem; font-weight: 600; }
.tms-row { display: grid; gap: 18px; }
@media (min-width: 480px) { .tms-row { grid-template-columns: 1fr 1fr; } }

.tms-segment { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tms-segment--3 { grid-template-columns: repeat(3, 1fr); }
.tms-segment label { position: relative; font-weight: 500; }
.tms-segment input { position: absolute; opacity: 0; inset: 0; }
.tms-segment span { display: grid; place-items: center; min-height: 54px; padding: 6px; text-align: center; border: 1.5px solid var(--tms-line); border-radius: 12px; cursor: pointer; font-size: .88rem; font-weight: 600; line-height: 1.2; background: #fff; }
.tms-segment small { display: block; font-family: var(--tms-font-ar); font-weight: 400; font-size: .76rem; color: var(--tms-muted); margin-top: 2px; }
.tms-segment input:checked + span { border-color: var(--tms-brand); background: var(--tms-tint); color: var(--tms-dark); box-shadow: inset 0 0 0 1px var(--tms-brand); }
.tms-segment input:focus-visible + span { box-shadow: 0 0 0 4px rgba(0,125,112,.25); }

.tms-consent label { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; font-size: .88rem; color: var(--tms-muted); }
.tms-consent input { width: 22px; height: 22px; flex: 0 0 22px; margin-top: 1px; accent-color: var(--tms-brand); }
.tms-hp { position: absolute !important; left: -9999px !important; height: 1px; overflow: hidden; }
.tms-alert { background: #FEF3F2; color: var(--tms-danger); border: 1px solid #FECDCA; border-radius: 12px; padding: 12px 14px; margin: 0 0 14px; font-size: .9rem; font-weight: 600; }

/* ---------- Buttons ---------- */
.tms-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 50px; padding: 10px 18px; border-radius: 12px; border: 1.5px solid transparent; font-family: var(--tms-font); font-size: 1rem; font-weight: 700; line-height: 1.2; text-decoration: none; cursor: pointer; position: relative; overflow: hidden; -webkit-tap-highlight-color: transparent; transition: filter .15s, transform .05s; }
.tms-btn:active { transform: scale(.985); }
.tms-btn--primary { background: var(--tms-brand); color: #fff; }
.tms-btn--primary:hover, .tms-btn--primary:focus { color: #fff; filter: brightness(1.08); }
.tms-btn--secondary { background: var(--tms-dark); color: #fff; }
.tms-btn--ghost { background: #fff; color: var(--tms-brand); border-color: var(--tms-line); }
.tms-btn--block { width: 100%; min-height: 58px; font-size: 1.05rem; }
.tms-btn--sm { min-height: 40px; padding: 6px 14px; font-size: .9rem; }
.tms-btn input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; font-size: 0; }
.tms-btn--camera::before { content: ""; width: 20px; height: 16px; border: 2px solid currentColor; border-radius: 4px; background: radial-gradient(circle at 50% 55%, currentColor 0 3px, transparent 3.5px); flex: 0 0 auto; }
.tms-linkbtn { background: none; border: 0; color: var(--tms-brand); font: inherit; font-weight: 600; text-decoration: underline; cursor: pointer; padding: 8px; }

/* ---------- Confirm sheet ---------- */
.tms-sheet { position: fixed; inset: 0; z-index: 9999; background: rgba(11,61,44,.55); display: flex; align-items: flex-end; justify-content: center; padding: 12px; }
.tms-sheet[hidden] { display: none; }
.tms-sheet-panel { width: 100%; max-width: 520px; background: #fff; border-radius: 20px; padding: 24px 20px calc(20px + env(safe-area-inset-bottom)); box-shadow: 0 -10px 40px rgba(0,0,0,.2); animation: tms-up .22s ease-out; font-family: var(--tms-font); color: var(--tms-ink); }
@keyframes tms-up { from { transform: translateY(30px); opacity: 0; } }
@media (min-width: 600px) { .tms-sheet { align-items: center; } }
.tms-sheet-panel h2 { margin: 0 0 4px; font-size: 1.2rem; color: var(--tms-dark); }
.tms-cert-preview { margin: 16px 0 12px; padding: 22px 16px; border-radius: 12px; text-align: center; background: #fff; border: 2px solid var(--tms-green); outline: 6px solid var(--tms-tint); }
.tms-cert-preview-label { display: block; font-size: .75rem; letter-spacing: .1em; text-transform: uppercase; color: var(--tms-muted); }
.tms-cert-preview strong { display: block; font-size: 1.45rem; line-height: 1.25; color: var(--tms-dark); margin: 8px 0; word-break: break-word; font-weight: 700; }
.tms-sheet-actions { display: grid; grid-template-columns: 1fr 1.4fr; gap: 10px; margin-top: 14px; }
@media (prefers-reduced-motion: reduce) { .tms-sheet-panel { animation: none; } }

/* ---------- Success ---------- */
.tms-card--success { text-align: center; padding: 34px 22px; border-top: 5px solid var(--tms-green); }
.tms-check svg { width: 76px; height: 76px; stroke: var(--tms-green); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.tms-check circle { stroke-dasharray: 160; stroke-dashoffset: 160; animation: tms-draw .6s ease-out forwards; }
.tms-check path { stroke-dasharray: 40; stroke-dashoffset: 40; animation: tms-draw .35s .5s ease-out forwards; }
@keyframes tms-draw { to { stroke-dashoffset: 0; } }
@media (prefers-reduced-motion: reduce) { .tms-check circle, .tms-check path { animation: none; stroke-dashoffset: 0; } }
.tms-cert-name { font-size: 1.25rem; font-weight: 700; color: var(--tms-dark); margin: 10px 0 2px !important; }
.tms-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 18px 0; text-align: start; }
.tms-meta div { background: var(--tms-tint); border-radius: 12px; padding: 10px 12px; }
.tms-meta dt { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--tms-muted); }
.tms-meta dd { margin: 2px 0 0; font-weight: 700; color: var(--tms-dark); }
.tms-meta code { background: none; padding: 0; font-size: .95rem; }

/* ---------- Trainer app ---------- */
.tms-dash-head { margin: 4px 0 14px; }
.tms-section-title { display: flex; align-items: center; gap: 8px; font-size: .8rem !important; text-transform: uppercase; letter-spacing: .08em; color: var(--tms-muted) !important; margin: 22px 4px 10px !important; }
.tms-section-count { background: var(--tms-line); color: var(--tms-dark); border-radius: 999px; padding: 1px 8px; font-size: .75rem; }
.tms-guide { background: var(--tms-dark); color: #E6F2EF; border: 0; }
.tms-guide h2 { color: #fff !important; }
.tms-guide ol { margin: 0 0 14px; padding-inline-start: 20px; display: grid; gap: 8px; font-size: .92rem; }
.tms-guide .tms-btn--primary { background: var(--tms-green); }
.tms-session-card.is-today { border: 2px solid var(--tms-brand); box-shadow: 0 6px 22px rgba(0,125,112,.14); }
.tms-session-top { display: flex; justify-content: space-between; align-items: center; }
.tms-badge { display: inline-block; font-size: .76rem; font-weight: 700; padding: 4px 11px; border-radius: 999px; background: var(--tms-bg); color: var(--tms-muted); }
.tms-badge--live { background: var(--tms-green); color: #fff; }
.tms-badge--live::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #fff; margin-inline-end: 6px; vertical-align: 1px; animation: tms-pulse 1.6s infinite; }
@keyframes tms-pulse { 50% { opacity: .3; } }
.tms-actions { display: grid; grid-template-columns: 2fr 1fr; gap: 8px; margin: 14px 0 6px; }
.tms-btn--qr { min-height: 58px; font-size: 1.05rem; }
.tms-btn--qr::before { content: ""; width: 20px; height: 20px; background: linear-gradient(currentColor 0 0) 0 0/8px 8px no-repeat, linear-gradient(currentColor 0 0) 100% 0/8px 8px no-repeat, linear-gradient(currentColor 0 0) 0 100%/8px 8px no-repeat, linear-gradient(currentColor 0 0) 70% 70%/5px 5px no-repeat; }
.tms-attendee-toggle { display: flex; align-items: center; gap: 6px; width: 100%; margin: 8px 0 0; padding: 12px 0; background: none; border: 0; border-top: 1px solid var(--tms-line); color: var(--tms-ink); font: inherit; cursor: pointer; text-align: start; }
.tms-count-pill { display: inline-flex; align-items: baseline; gap: 6px; font-size: .95rem; }
.tms-count { font-size: 1.5rem; color: var(--tms-brand); }
.tms-chev { margin-inline-start: auto; width: 9px; height: 9px; border-right: 2px solid var(--tms-muted); border-bottom: 2px solid var(--tms-muted); transform: rotate(45deg); transition: transform .2s; }
.tms-attendee-toggle[aria-expanded="true"] .tms-chev { transform: rotate(-135deg); }
.tms-attendees { margin: 0 0 8px; padding-inline-start: 22px; max-height: 300px; overflow: auto; }
.tms-attendees li { padding: 6px 0; border-bottom: 1px dashed var(--tms-line); }
.tms-attendees li span:last-child { float: inline-end; }
.tms-photos { border-top: 1px solid var(--tms-line); margin-top: 6px; padding-top: 14px; }
.tms-photos-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.tms-upload { display: grid; grid-template-columns: 1.4fr 1fr; gap: 8px; }
.tms-progress { height: 6px; border-radius: 3px; background: var(--tms-bg); overflow: hidden; margin: 10px 0 0; }
.tms-progress span { display: block; height: 100%; width: 0; background: var(--tms-green); transition: width .2s; }
.tms-upload-msg { min-height: 1.2em; margin: 8px 0 0 !important; color: var(--tms-green); font-weight: 600; }
.tms-upload-msg.is-error { color: var(--tms-danger); }
.tms-grid { list-style: none; margin: 8px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 6px; }
.tms-grid li { position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: var(--tms-bg); }
.tms-grid img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tms-del { position: absolute; top: 4px; inset-inline-end: 4px; width: 28px; height: 28px; border-radius: 50%; border: 0; background: rgba(0,0,0,.6); color: #fff; font-size: 18px; line-height: 1; cursor: pointer; }
.tms-help-link { text-align: center; }

/* Full-screen QR */
.tms-qr-overlay { position: fixed; inset: 0; z-index: 999999; background: var(--tms-dark); color: #fff; display: grid; place-items: center; padding: 24px; overflow: auto; font-family: var(--tms-font); }
.tms-qr-overlay[hidden] { display: none; }
.tms-qr-inner { width: 100%; max-width: 560px; text-align: center; }
.tms-qr-logo { max-height: 44px; margin: 0 auto 14px; display: block; }
.tms-qr-inner .tms-wordmark { align-items: center; margin-bottom: 14px; }
.tms-qr-title { font-size: 1.35rem; font-weight: 700; margin: 0 0 16px; }
.tms-qr-code { background: #fff; border-radius: 20px; padding: 18px; display: inline-block; box-shadow: 0 0 0 6px var(--tms-green); }
.tms-qr-code svg { width: min(78vw, 62vh, 460px); height: auto; display: block; }
.tms-qr-hint { font-size: 1.05rem; margin: 20px 0 6px; color: #CFE5DF; }
.tms-qr-hint [lang="ar"] { font-family: var(--tms-font-ar); }
.tms-qr-count { font-size: 1.6rem; font-weight: 700; color: #fff; margin: 10px 0 0; }
.tms-qr-close { position: absolute; top: 14px; right: 14px; width: 52px; height: 52px; border-radius: 50%; border: 0; background: rgba(255,255,255,.15); color: #fff; font-size: 30px; line-height: 1; cursor: pointer; }
html.tms-noscroll, html.tms-noscroll body { overflow: hidden; }

/* Login form inside dashboard */
.tms-login #loginform p { margin-bottom: 12px; }
.tms-login #loginform label { font-weight: 600; font-size: .9rem; }
.tms-login #loginform input[type="text"], .tms-login #loginform input[type="password"] { width: 100%; min-height: 50px; padding: 10px 12px; font-size: 16px; border: 1.5px solid var(--tms-line); border-radius: 12px; }
.tms-login #loginform .button-primary { width: 100%; min-height: 52px; border-radius: 12px; background: var(--tms-brand); border: 0; color: #fff; font-weight: 700; font-size: 1rem; font-family: var(--tms-font); }

/* Session facts on trainer cards */
.tms-facts { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.tms-fact { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; font-size: .88rem; color: var(--tms-ink); }
.tms-fact::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--tms-brand); margin-inline-end: 6px; flex: 0 0 auto; }
.tms-fact--time { font-weight: 700; color: var(--tms-dark); }
.tms-fact--outside::before { background: var(--tms-warn); }
.tms-fact--online::before { background: #2E6FB7; }
.tms-fact a { color: var(--tms-brand); font-weight: 700; }
