/*
 * Public auth pages (views/login/view_auth_layout.php): sign in, sign up, forgot / reset password.
 * Soft material, mobile first, PWA-ready (safe areas, 16px inputs so iOS does not zoom, 44px+ touch targets).
 * Program cards: program_cards.css (linked by the layout).
 */
:root {
	--a-primary: #3b82f6;
	--a-primary-d: #2563eb;
	--a-bg: #f3f6fb;
	--a-text: #1f2937;
	--a-muted: #6b7280;
	--a-line: #e5e9f2;
	--a-radius: 14px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body.auth-body {
	margin: 0; color: var(--a-text);
	/* Soft colour wash behind the form (blue / purple / peach, like the soft theme) */
	background:
		radial-gradient(38rem 30rem at 8% 6%, rgba(59, 130, 246, .16), transparent 60%),
		radial-gradient(32rem 28rem at 92% 96%, rgba(168, 85, 247, .13), transparent 60%),
		radial-gradient(26rem 22rem at 70% 30%, rgba(251, 146, 60, .09), transparent 60%),
		radial-gradient(24rem 20rem at 20% 92%, rgba(16, 185, 129, .08), transparent 60%),
		var(--a-bg);
	background-attachment: fixed;
	font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif; font-size: 15px; line-height: 1.5;
	padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
.auth-body a { color: var(--a-primary-d); }
[hidden], .d-none { display: none !important; }

/* Honeypot: off screen for people, still in the DOM for bots */
.ag-hp { position: absolute !important; left: -10000px !important; top: auto; width: 1px; height: 1px; overflow: hidden; }

/* #region Layout */
.auth-body { overflow-x: hidden; }
/* minmax(0, …) + min-width 0: the swipe strip of cards must not widen the page on phones */
.auth-shell { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1fr); }
.auth-main, .auth-side, .auth-main-inner { min-width: 0; }
.auth-main { display: flex; justify-content: center; padding: 22px 16px 10px; }
.auth-main-inner { width: 100%; max-width: 440px; display: flex; flex-direction: column; }
.auth-side { padding: 8px 12px 28px; }

.auth-brand { display: flex; justify-content: center; margin: 4px 0 16px; text-decoration: none; }
.auth-brand img { max-height: 64px; max-width: 220px; object-fit: contain; }
.auth-brand span { font-size: 1.4rem; font-weight: 800; color: var(--a-text); }

.auth-jump { display: flex; align-items: center; gap: 10px; background: #fff; border: 1px solid var(--a-line); border-radius: 999px; padding: 9px 14px; margin-bottom: 14px; text-decoration: none; color: var(--a-text) !important; font-weight: 700; font-size: .86rem; box-shadow: 0 3px 12px rgba(16, 24, 40, .05); min-height: 44px; }
.auth-jump i:first-child { color: var(--a-primary); }
.auth-jump span { flex: 1; }
.auth-jump i:last-child { color: var(--a-muted); }

.auth-card { background: #fff; border-radius: 22px; padding: 26px 22px; box-shadow: 0 10px 30px rgba(16, 24, 40, .08); }
@media (max-width: 400px) { .auth-main { padding: 16px 12px 8px; } .auth-card { padding: 22px 16px; border-radius: 18px; } }
.auth-foot { text-align: center; color: var(--a-muted); font-size: .75rem; margin: 16px 0 0; }
.auth-foot a { color: var(--a-muted); }

/* No cards: the form alone, centred on every screen */
body:not(.has-cards) .auth-main { align-items: center; min-height: 100vh; min-height: 100dvh; }

@media (min-width: 992px) {
	body.has-cards .auth-shell { grid-template-columns: minmax(460px, 5fr) minmax(0, 7fr); }
	.auth-main { align-items: center; padding: 32px; }
	.auth-jump { display: none; }
	.auth-side {
		position: sticky; top: 0; height: 100vh; height: 100dvh; overflow-y: auto; padding: 40px 36px;
		background: linear-gradient(160deg, #e8f0ff 0%, #f5f0ff 55%, #fff4ec 100%);
	}
	.auth-side .pc-wrap { margin: 0 auto; }
}
/* #endregion */


/* #region Form */
.auth-title { font-size: 1.45rem; font-weight: 800; margin: 0 0 4px; }

/* Program chosen on a card (login/program) */
.auth-selected { display: flex; align-items: center; gap: 12px; background: linear-gradient(135deg, #eff6ff, #f5f3ff); border: 1px solid #c7d2fe; border-radius: 14px; padding: 10px 10px 10px 14px; margin-bottom: 16px; animation: auth-in .2s ease-out; }
.auth-selected > i { color: var(--a-primary); font-size: 1.1rem; }
.auth-selected div { flex: 1; min-width: 0; display: grid; line-height: 1.3; }
.auth-selected small { font-size: .68rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--a-muted); }
.auth-selected b { font-size: .92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.auth-selected span { font-size: .8rem; color: var(--a-primary-d); font-weight: 600; }
.auth-selected-x { flex: 0 0 36px; height: 36px; border: 0; border-radius: 10px; background: rgba(255, 255, 255, .8); color: #64748b; cursor: pointer; }
@keyframes auth-in { from { opacity: 0; transform: translateY(-4px); } }
.auth-sub { color: var(--a-muted); margin: 0 0 18px; }

.auth-form { display: grid; gap: 14px; }
.auth-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 380px) { .auth-row { grid-template-columns: 1fr; } }

.auth-field { display: block; margin: 0; }
.auth-field > span { display: flex; justify-content: space-between; align-items: baseline; font-weight: 700; font-size: .85rem; margin-bottom: 6px; }
.auth-field > span em { font-style: normal; font-weight: 500; color: var(--a-muted); }
.auth-hint { display: block; color: var(--a-muted); font-size: .78rem; margin-top: 6px; }

.auth-input { position: relative; }
.auth-input > i { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); color: #9aa5b8; pointer-events: none; }
.auth-input input {
	width: 100%; height: 50px; border: 1.5px solid var(--a-line); border-radius: var(--a-radius); background: #f9fbfe;
	padding: 0 14px 0 42px; font-size: 16px; color: var(--a-text); outline: none; transition: border-color .15s, box-shadow .15s, background .15s;
}
.auth-input input:focus { border-color: var(--a-primary); background: #fff; box-shadow: 0 0 0 4px rgba(59, 130, 246, .14); }
.auth-input input.is-invalid { border-color: #ef4444; box-shadow: 0 0 0 4px rgba(239, 68, 68, .12); }
.auth-input.has-eye input { padding-right: 48px; }
.auth-eye { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; border: 0; background: transparent; color: #9aa5b8; border-radius: 10px; cursor: pointer; }
.auth-eye:hover { color: var(--a-text); }
.auth-code input { letter-spacing: .5em; font-weight: 700; font-size: 20px; }
.auth-phone .auth-cc { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); font-size: .9rem; font-weight: 700; color: #475569; pointer-events: none; padding-right: 10px; border-right: 1px solid var(--a-line); }
.auth-phone input { padding-left: 74px; letter-spacing: .02em; }

.auth-check { display: flex; align-items: center; gap: 10px; font-size: .88rem; color: #374151; cursor: pointer; min-height: 32px; }
.auth-check input { width: 20px; height: 20px; accent-color: var(--a-primary); }

.auth-link-sm { font-size: .8rem; font-weight: 600; background: none; border: 0; padding: 0; color: var(--a-primary-d); cursor: pointer; text-decoration: none; }
.auth-link-sm:hover { text-decoration: underline; }
.auth-link-sm[disabled] { color: var(--a-muted); cursor: default; text-decoration: none; }

.auth-btn {
	display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; min-height: 52px; border: 0; border-radius: var(--a-radius);
	background: linear-gradient(135deg, var(--a-primary), var(--a-primary-d)); color: #fff; font-weight: 800; font-size: 1rem; cursor: pointer;
	box-shadow: 0 8px 18px rgba(37, 99, 235, .25); transition: transform .15s, filter .15s;
}
.auth-btn:hover { filter: brightness(1.04); }
.auth-btn:active { transform: scale(.985); }
.auth-btn.is-busy { pointer-events: none; filter: saturate(.6); }
.auth-btn.is-busy i { animation: auth-spin .8s linear infinite; }
.auth-btn.is-busy i::before { content: '\f110'; }
@keyframes auth-spin { to { transform: rotate(360deg); } }

.auth-or { display: flex; align-items: center; gap: 12px; color: var(--a-muted); font-size: .8rem; margin: 18px 0 14px; }
.auth-or::before, .auth-or::after { content: ''; flex: 1; height: 1px; background: var(--a-line); }
.auth-google { display: flex; justify-content: center; min-height: 44px; }
.auth-google-msg { margin-top: 10px; }

.auth-switch { text-align: center; margin: 20px 0 0; color: var(--a-muted); font-size: .9rem; }
.auth-switch a { font-weight: 700; text-decoration: none; }
/* #endregion */

/* #region Alerts, steps, sent box, strength */
.auth-alerts:empty { display: none; }
.auth-alerts { display: grid; gap: 8px; margin-bottom: 14px; }
.auth-alert { display: flex; gap: 10px; align-items: flex-start; border-radius: 12px; padding: 11px 13px; font-size: .88rem; font-weight: 600; }
.auth-alert i { margin-top: 3px; }
.auth-alert.is-error { background: #fef2f2; color: #b91c1c; }
.auth-alert.is-ok { background: #ecfdf5; color: #047857; }
.auth-alert.is-info { background: #eff6ff; color: #1d4ed8; }
.auth-alert .auth-btn { margin-top: 10px; min-height: 44px; font-size: .9rem; }
.auth-alert-actions { display: flex; gap: 8px; margin-top: 10px; }
.auth-alert-actions .auth-btn { margin: 0; flex: 1; text-decoration: none; color: #fff; box-shadow: none; }
.auth-alert-actions .auth-btn.is-soft { background: #fff; color: var(--a-primary-d); border: 1px solid #bfdbfe; }

.auth-steps { list-style: none; display: flex; gap: 8px; padding: 0; margin: 0 0 16px; }
.auth-steps li { flex: 1; display: flex; align-items: center; gap: 8px; background: #f1f5f9; color: var(--a-muted); border-radius: 999px; padding: 6px 12px 6px 6px; font-size: .8rem; font-weight: 700; }
.auth-steps li span { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: #fff; font-size: .75rem; }
.auth-steps[data-step="1"] .is-1, .auth-steps[data-step="2"] .is-2 { background: #e0ecff; color: #1d4ed8; }
.auth-steps[data-step="2"] .is-1 { background: #dcfce7; color: #166534; }
.auth-steps[data-step="2"] .is-1 span { font-size: 0; }
.auth-steps[data-step="2"] .is-1 span::before { content: '\2713'; font-size: .8rem; }

.auth-sent { display: flex; align-items: center; gap: 12px; background: #eff6ff; border-radius: 14px; padding: 12px 14px; }
.auth-sent > i { font-size: 1.4rem; color: var(--a-primary); }
.auth-sent div { flex: 1; min-width: 0; display: grid; font-size: .85rem; }
.auth-sent b { word-break: break-all; }

.auth-strength { margin-top: 8px; }
.auth-strength-bar { height: 6px; border-radius: 6px; background: #eef2f7; overflow: hidden; }
.auth-strength-bar i { display: block; height: 100%; width: 0; background: #ef4444; transition: width .2s, background .2s; }
.auth-strength ul { list-style: none; padding: 0; margin: 7px 0 0; display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: .76rem; color: var(--a-muted); }
.auth-strength li i { font-size: .45rem; vertical-align: middle; margin-right: 3px; }
.auth-strength li.is-ok { color: #047857; }
.auth-strength li.is-ok i::before { content: '\f00c'; font-size: .7rem; }

.auth-offline { position: sticky; top: 0; z-index: 50; background: #1f2937; color: #fff; text-align: center; font-size: .85rem; font-weight: 600; padding: 9px 14px; }
.auth-offline i { margin-right: 6px; }
/* #endregion */
