/* ============================================================
   iToll Login — Modal
   Scoped under .itoll-modal-overlay
   ============================================================ */

/* ── Overlay ── */
.itoll-modal-overlay {
	position: fixed;
	inset: 0;
	z-index: 99999;
	display: flex;
	align-items: flex-end;
	justify-content: center;
	background: rgba(0, 0, 0, 0.5);
	height: 100vh;
	height: var(--itoll-modal-vh, 100dvh);
	padding: 0 env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
	transform: translateY(var(--itoll-modal-vtop, 0px));
	box-sizing: border-box;
	overflow: hidden;
	overscroll-behavior: contain;
}

.itoll-modal-overlay[hidden] {
	display: none;
}

/* ── Card ── */
.itoll-modal {
	position: relative;
	background: #ffffff;
	border-radius: 24px 24px 0 0;
	padding: 2rem 1.5rem calc(2rem + env(safe-area-inset-bottom));
	width: 100%;
	max-width: 480px;
	box-shadow: 0 -4px 40px rgba(0, 0, 0, 0.15);
	animation: itollSlideUp 0.28s cubic-bezier(0.34, 1.2, 0.64, 1);
	max-height: 95vh;
	max-height: min(95dvh, calc(var(--itoll-modal-vh, 100vh) - env(safe-area-inset-top)));
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
	box-sizing: border-box;
	overscroll-behavior: contain;
}

@media (min-width: 600px) {
	.itoll-modal-overlay {
		align-items: center;
		padding: 1rem;
	}
	.itoll-modal {
		border-radius: 20px;
		padding: 2.5rem 2rem;
	}
}

.itoll-modal-overlay--keyboard .itoll-modal {
	max-height: calc(var(--itoll-modal-vh, 100vh) - 8px);
	padding-top: 1rem;
	padding-bottom: calc(1rem + env(safe-area-inset-bottom));
}

@keyframes itollSlideUp {
	from { transform: translateY(60px); opacity: 0; }
	to   { transform: translateY(0);    opacity: 1; }
}

/* ── Close button (only shown when dismissable, e.g. admin test) ── */
.itoll-modal__close {
	position: absolute;
	top: 12px;
	left: 16px;
	background: none;
	border: none;
	font-size: 1.75rem;
	line-height: 1;
	color: #98a2b3;
	cursor: pointer;
	padding: 0;
}

.itoll-modal__close[hidden] { display: none; }
.itoll-modal__close:hover { color: #475467; }

/* ── Steps ── */
.itoll-modal__step[hidden] { display: none; }

/* ── Brand / logo ── */
.itoll-modal__brand {
	text-align: center;
	margin-bottom: 1.75rem;
}

.itoll-modal__logo {
	height: 36px;
	width: auto;
}

/* ── Step 1 headline ── */
.itoll-modal__headline {
	font-size: 0.95rem;
	color: #333;
	text-align: right;
	margin: 0 0 1.25rem;
	line-height: 1.6;
}

/* ── Field ── */
.itoll-modal__field-wrap { margin-bottom: 1rem; }

.itoll-modal__label {
	display: block;
	font-size: 0.875rem;
	font-weight: 600;
	color: #333;
	margin-bottom: 0.4rem;
	text-align: right;
}

.itoll-modal__input {
	display: block;
	width: 100%;
	padding: 0.8rem 1rem;
	font-size: 16px;
	border: 1.5px solid #D0D5DD;
	border-radius: 10px;
	outline: none;
	transition: border-color 0.15s, box-shadow 0.15s;
	box-sizing: border-box;
	text-align: left;
	letter-spacing: 0.04em;
	background: #FAFAFA;
}

.itoll-modal__input,
.itoll-modal__otp-box {
	touch-action: manipulation;
	-webkit-appearance: none;
	appearance: none;
}

.itoll-modal__input:focus {
	border-color: #1B5E94;
	box-shadow: 0 0 0 3px rgba(27, 94, 148, 0.12);
	background: #fff;
}

/* ── Notice (error / success) ── */
.itoll-modal__notice {
	padding: 0.6rem 0.9rem;
	border-radius: 8px;
	font-size: 0.8125rem;
	margin-bottom: 0.85rem;
	text-align: right;
}

.itoll-modal__notice[hidden] { display: none; }

.itoll-modal__notice--error {
	background: #FEF3F2;
	color: #B42318;
	border: 1px solid #FEE4E2;
}

.itoll-modal__notice--success {
	background: #ECFDF3;
	color: #027A48;
	border: 1px solid #ABEFC6;
}

/* ── Primary button ── */
.itoll-modal__btn {
	display: block;
	width: 100%;
	padding: 0.85rem 1rem;
	font-size: 1rem;
	font-weight: 700;
	border: none;
	border-radius: 12px;
	cursor: pointer;
	transition: background-color 0.15s, opacity 0.15s, transform 0.1s;
	margin-top: 0.75rem;
	letter-spacing: 0.01em;
}

.itoll-modal__btn--primary { background: #1B5E94; color: #fff; }
.itoll-modal__btn--primary:hover { background: #154d7a; }
.itoll-modal__btn--primary:active { transform: scale(0.98); }
.itoll-modal__btn--primary:disabled { opacity: 0.55; cursor: not-allowed; }

/* ── OTP step — icon ── */
.itoll-modal__otp-icon { text-align: center; margin-bottom: 1rem; }
.itoll-modal__otp-icon svg { width: 72px; height: 72px; }

/* ── OTP description ── */
.itoll-modal__otp-desc {
	font-size: 0.9rem;
	color: #444;
	text-align: center;
	line-height: 1.7;
	margin: 0 0 0.5rem;
}

.itoll-modal__otp-desc strong { color: #1B5E94; font-weight: 700; }

/* ── Top action row (change number) ── */
.itoll-modal__otp-actions-top {
	display: flex;
	justify-content: flex-end;
	margin-bottom: 1.25rem;
}

.itoll-modal__link-btn {
	background: none;
	border: none;
	color: #1B5E94;
	font-size: 0.875rem;
	font-weight: 600;
	cursor: pointer;
	padding: 0;
	display: flex;
	align-items: center;
	gap: 2px;
}

.itoll-modal__link-btn:hover { text-decoration: underline; }
.itoll-modal__link-arrow { font-size: 1.1rem; line-height: 1; }

/* ── OTP input ── */
.itoll-modal__otp-boxes {
	position: relative;
	display: flex;
	gap: clamp(6px, 2.2vw, 12px);
	justify-content: center;
	margin-bottom: 0.75rem;
}

.itoll-modal__otp-input {
	position: absolute;
	inset: 0;
	z-index: 2;
	width: 100%;
	height: 100%;
	border: 0;
	outline: 0;
	opacity: 0.01;
	background: transparent;
	color: transparent;
	font-size: 16px;
	caret-color: transparent;
}

.itoll-modal__otp-box {
	width: clamp(48px, 14vw, 64px);
	height: clamp(48px, 14vw, 64px);
	border: 1.5px solid #D0D5DD;
	border-radius: 12px;
	font-size: 1.6rem;
	font-weight: 700;
	text-align: center;
	outline: none;
	background: #FAFAFA;
	color: #1B5E94;
	transition: border-color 0.15s, box-shadow 0.15s;
	caret-color: transparent;
	pointer-events: none;
}

.itoll-modal-overlay--keyboard .itoll-modal__brand {
	margin-bottom: 1rem;
}

.itoll-modal-overlay--keyboard .itoll-modal__headline {
	margin-bottom: 0.85rem;
}

.itoll-modal-overlay--keyboard .itoll-modal__otp-icon {
	display: none;
}

.itoll-modal-overlay--keyboard .itoll-modal__otp-actions-top {
	margin-bottom: 0.85rem;
}

.itoll-modal__otp-boxes--focused .itoll-modal__otp-box {
	border-color: #1B5E94;
	box-shadow: 0 0 0 3px rgba(27, 94, 148, 0.14);
	background: #fff;
}

.itoll-modal__otp-box--error {
	border-color: #B42318;
	box-shadow: 0 0 0 3px rgba(180, 35, 24, 0.1);
}

/* ── Countdown ── */
.itoll-modal__countdown-wrap {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 4px;
	margin: 0.5rem 0 0.25rem;
	font-size: 0.85rem;
	color: #667085;
}

.itoll-modal__countdown {
	font-weight: 700;
	color: #1B5E94;
	min-width: 1.5rem;
	text-align: center;
}

/* ── Success step ── */
.itoll-modal__success-icon { text-align: center; margin-bottom: 1rem; }
.itoll-modal__success-icon svg { width: 80px; height: 80px; }

.itoll-modal__success-msg {
	font-size: 1.1rem;
	font-weight: 700;
	color: #027A48;
	text-align: center;
	margin: 0 0 0.4rem;
}

.itoll-modal__success-sub {
	font-size: 0.875rem;
	color: #667085;
	text-align: center;
	margin: 0 0 1rem;
}

/* ── Profile dump (admin test mode) ── */
.itoll-modal__profile-dump {
	background: #1d2327;
	color: #a8c7fa;
	padding: 12px;
	border-radius: 8px;
	font-size: 11px;
	font-family: monospace;
	max-height: 240px;
	overflow: auto;
	white-space: pre-wrap;
	word-break: break-all;
	text-align: left;
	direction: ltr;
	margin: 0 0 1rem;
}

.itoll-modal__profile-dump[hidden] { display: none; }

/* ── Spinner ── */
.itoll-modal__spinner {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(255, 255, 255, 0.8);
	border-radius: inherit;
}

.itoll-modal__spinner[hidden] { display: none; }

.itoll-modal__spinner-ring {
	display: block;
	width: 40px;
	height: 40px;
	border: 4px solid #e0e0e0;
	border-top-color: #1B5E94;
	border-radius: 50%;
	animation: itollSpin 0.7s linear infinite;
}

@keyframes itollSpin { to { transform: rotate(360deg); } }

/* ============================================================
   Guard mode keeps iToll available, but the native WooCommerce
   login/register forms must remain visible as a fallback.
   ============================================================ */

/* ============================================================
   Admin test panel (My Account dashboard)
   ============================================================ */

.itoll-test-panel {
	margin: 1.5rem 0;
	padding: 1rem 1.25rem;
	border: 1px dashed #2271b1;
	border-radius: 8px;
	background: #f6fbff;
}

.itoll-test-panel__hint {
	margin: 0 0 0.75rem;
	font-size: 0.85rem;
	color: #475467;
}

.itoll-test-panel__btn { cursor: pointer; }

.itoll-test-panel__result {
	margin-top: 1rem;
	background: #1d2327;
	color: #a8c7fa;
	padding: 12px;
	border-radius: 8px;
	font-size: 11px;
	font-family: monospace;
	max-height: 320px;
	overflow: auto;
	white-space: pre-wrap;
	word-break: break-all;
	text-align: left;
	direction: ltr;
}

.itoll-test-panel__result[hidden] { display: none; }
