/* ATL Smart Checkout with OTP — Frontend Styles
   Scoped under .atl-sco-* to avoid theme collisions. */

.atl-sco-overlay,
.atl-sco-embed,
.atl-sco-modal,
.atl-sco-embed * ,
.atl-sco-overlay * {
	box-sizing: border-box;
}

:root {
	--atl-sco-accent: #5b3df5;
	--atl-sco-accent-2: #14b8a6;
	--atl-sco-radius: 14px;
	--atl-sco-ink: #1c1633;
	--atl-sco-muted: #726c8c;
	--atl-sco-border: #e7e4f4;
	--atl-sco-bg: #ffffff;
	--atl-sco-bg-soft: #faf9ff;
	--atl-sco-danger: #e0365a;
	--atl-sco-success: #17a672;
	--atl-sco-font-display: 'Space Grotesk', 'Inter', sans-serif;
	--atl-sco-font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
	--atl-sco-font-mono: 'JetBrains Mono', ui-monospace, monospace;
}

@media (prefers-color-scheme: dark) {
	.atl-sco-theme-auto {
		--atl-sco-ink: #f1eefc;
		--atl-sco-muted: #a79fc8;
		--atl-sco-border: #35304f;
		--atl-sco-bg: #1a1730;
		--atl-sco-bg-soft: #221e3c;
	}
}
.atl-sco-theme-dark {
	--atl-sco-ink: #f1eefc;
	--atl-sco-muted: #a79fc8;
	--atl-sco-border: #35304f;
	--atl-sco-bg: #1a1730;
	--atl-sco-bg-soft: #221e3c;
}

/* ---------- Overlay + Modal ---------- */

.atl-sco-overlay {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
	background: rgba(20, 16, 40, 0.55);
	backdrop-filter: blur(6px);
	-webkit-backdrop-filter: blur(6px);
	font-family: var(--atl-sco-font-body);
	animation: atl-sco-fade-in 0.18s ease;
}
.atl-sco-overlay[hidden] { display: none; }

@keyframes atl-sco-fade-in {
	from { opacity: 0; }
	to { opacity: 1; }
}

.atl-sco-modal {
	position: relative;
	width: 100%;
	max-width: 420px;
	max-height: 92vh;
	overflow-y: auto;
	background: color-mix(in srgb, var(--atl-sco-bg) 88%, transparent);
	border: 1px solid color-mix(in srgb, var(--atl-sco-border) 80%, transparent);
	border-radius: calc(var(--atl-sco-radius) + 6px);
	box-shadow: 0 24px 60px rgba(28, 22, 51, 0.28);
	padding: 32px 28px 28px;
	animation: atl-sco-pop-in 0.22s cubic-bezier(.2,.8,.3,1.1);
}

@keyframes atl-sco-pop-in {
	from { opacity: 0; transform: translateY(10px) scale(.98); }
	to { opacity: 1; transform: translateY(0) scale(1); }
}

.atl-sco-close {
	position: absolute;
	top: 14px;
	right: 14px;
	width: 32px;
	height: 32px;
	border-radius: 50%;
	border: none;
	background: var(--atl-sco-bg-soft);
	color: var(--atl-sco-muted);
	font-size: 20px;
	line-height: 1;
	cursor: pointer;
	transition: background .15s, color .15s;
}
.atl-sco-close:hover { background: var(--atl-sco-border); color: var(--atl-sco-ink); }

.atl-sco-brand { text-align: center; margin-bottom: 18px; }
.atl-sco-mark {
	display: inline-block;
	width: 40px;
	height: 40px;
	border-radius: 12px;
	background: linear-gradient(135deg, var(--atl-sco-accent), var(--atl-sco-accent-2));
	margin-bottom: 12px;
	position: relative;
}
.atl-sco-mark::after {
	content: '';
	position: absolute;
	inset: 11px;
	border: 2px solid rgba(255,255,255,.85);
	border-radius: 3px;
}
.atl-sco-heading {
	font-family: var(--atl-sco-font-display);
	font-size: 22px;
	font-weight: 700;
	color: var(--atl-sco-ink);
	margin: 0 0 4px;
}
.atl-sco-sub { font-size: 13px; color: var(--atl-sco-muted); margin: 0; }

/* ---------- Tabs ---------- */

.atl-sco-tabs {
	display: flex;
	gap: 4px;
	background: var(--atl-sco-bg-soft);
	border-radius: 999px;
	padding: 4px;
	margin-bottom: 22px;
}
.atl-sco-tab {
	flex: 1;
	border: none;
	background: transparent;
	padding: 9px 6px;
	font-size: 12.5px;
	font-weight: 600;
	color: var(--atl-sco-muted);
	border-radius: 999px;
	cursor: pointer;
	transition: background .18s, color .18s;
	font-family: var(--atl-sco-font-body);
}
.atl-sco-tab.is-active {
	background: var(--atl-sco-bg);
	color: var(--atl-sco-accent);
	box-shadow: 0 2px 8px rgba(28,22,51,.08);
}

.atl-sco-panel { display: none; }
.atl-sco-panel.is-active { display: block; animation: atl-sco-fade-in .15s ease; }

/* ---------- Form elements ---------- */

.atl-sco-step { display: none; }
.atl-sco-step.is-active { display: block; }

.atl-sco-field { display: block; margin-bottom: 14px; }
.atl-sco-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.atl-sco-label {
	display: block;
	font-size: 12.5px;
	font-weight: 600;
	color: var(--atl-sco-ink);
	margin-bottom: 6px;
}
.atl-sco-input,
.atl-sco-cc {
	width: 100%;
	border: 1.5px solid var(--atl-sco-border);
	border-radius: var(--atl-sco-radius);
	padding: 11px 13px;
	font-size: 14px;
	font-family: var(--atl-sco-font-body);
	color: var(--atl-sco-ink);
	background: var(--atl-sco-bg);
	transition: border-color .15s, box-shadow .15s;
}
.atl-sco-input:focus,
.atl-sco-cc:focus {
	outline: none;
	border-color: var(--atl-sco-accent);
	box-shadow: 0 0 0 3px color-mix(in srgb, var(--atl-sco-accent) 18%, transparent);
}
.atl-sco-input-row { display: flex; gap: 8px; }
.atl-sco-cc { flex: 0 0 92px; }
.atl-sco-input-row .atl-sco-input { flex: 1; min-width: 0; }

.atl-sco-checkbox {
	display: flex;
	align-items: flex-start;
	gap: 8px;
	font-size: 12.5px;
	color: var(--atl-sco-muted);
	margin-bottom: 16px;
	cursor: pointer;
}
.atl-sco-checkbox input { margin-top: 2px; accent-color: var(--atl-sco-accent); }

.atl-sco-method-toggle { text-align: right; margin: -6px 0 16px; }
.atl-sco-link {
	background: none;
	border: none;
	padding: 0;
	font-size: 12.5px;
	font-weight: 600;
	color: var(--atl-sco-accent);
	cursor: pointer;
	font-family: var(--atl-sco-font-body);
}
.atl-sco-link:disabled { color: var(--atl-sco-muted); cursor: default; }
.atl-sco-back { display: block; margin: 14px auto 0; }

.atl-sco-btn {
	width: 100%;
	border: none;
	border-radius: var(--atl-sco-radius);
	padding: 13px 16px;
	font-size: 14.5px;
	font-weight: 700;
	font-family: var(--atl-sco-font-body);
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	transition: transform .1s ease, box-shadow .15s ease, opacity .15s;
}
.atl-sco-btn-primary {
	background: linear-gradient(120deg, var(--atl-sco-accent), var(--atl-sco-accent-2));
	color: #fff;
	box-shadow: 0 8px 20px color-mix(in srgb, var(--atl-sco-accent) 35%, transparent);
}
.atl-sco-btn-primary:hover { transform: translateY(-1px); }
.atl-sco-btn:disabled { opacity: .65; cursor: default; transform: none; }

.atl-sco-spinner {
	width: 15px; height: 15px;
	border: 2px solid rgba(255,255,255,.4);
	border-top-color: #fff;
	border-radius: 50%;
	animation: atl-sco-spin .7s linear infinite;
}
@keyframes atl-sco-spin { to { transform: rotate(360deg); } }

.atl-sco-error {
	background: color-mix(in srgb, var(--atl-sco-danger) 10%, transparent);
	color: var(--atl-sco-danger);
	border-radius: 10px;
	padding: 9px 12px;
	font-size: 12.5px;
	margin-bottom: 14px;
}
.atl-sco-note { font-size: 13px; color: var(--atl-sco-muted); }

/* ---------- OTP inputs ---------- */

.atl-sco-otp-sent-to { font-size: 13px; color: var(--atl-sco-muted); margin: 0 0 16px; }
.atl-sco-otp-sent-to strong { color: var(--atl-sco-ink); font-family: var(--atl-sco-font-mono); font-weight: 600; }

.atl-sco-otp-inputs {
	display: flex;
	gap: 8px;
	justify-content: center;
	margin-bottom: 16px;
}
.atl-sco-otp-digit {
	width: 44px;
	height: 52px;
	text-align: center;
	font-family: var(--atl-sco-font-mono);
	font-size: 22px;
	font-weight: 700;
	color: var(--atl-sco-ink);
	border: 1.5px solid var(--atl-sco-border);
	border-radius: 12px;
	background: var(--atl-sco-bg-soft);
	transition: border-color .15s, box-shadow .15s;
}
.atl-sco-otp-digit:focus {
	outline: none;
	border-color: var(--atl-sco-accent);
	box-shadow: 0 0 0 3px color-mix(in srgb, var(--atl-sco-accent) 18%, transparent);
}
.atl-sco-otp-digit.is-filled { border-color: var(--atl-sco-accent-2); }

.atl-sco-otp-meta {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 18px;
	font-size: 12.5px;
}
.atl-sco-timer {
	font-family: var(--atl-sco-font-mono);
	color: var(--atl-sco-muted);
}
.atl-sco-timer.is-ready { color: var(--atl-sco-success); }

/* ---------- Success state ---------- */

.atl-sco-success-check {
	width: 64px; height: 64px;
	margin: 0 auto 16px;
	border-radius: 50%;
	background: color-mix(in srgb, var(--atl-sco-success) 15%, transparent);
	display: flex; align-items: center; justify-content: center;
	animation: atl-sco-pop-in .3s cubic-bezier(.2,.8,.3,1.2);
}
.atl-sco-success-check svg { width: 30px; height: 30px; }

/* ---------- Embedded (account page / checkout) ---------- */

.atl-sco-embed {
	max-width: 460px;
	margin: 0 0 28px;
	padding: 24px;
	border: 1px solid var(--atl-sco-border);
	border-radius: calc(var(--atl-sco-radius) + 4px);
	background: var(--atl-sco-bg-soft);
}
.atl-sco-embed .atl-sco-tabs { margin-bottom: 18px; }

/* ---------- Responsive ---------- */

@media (max-width: 480px) {
	.atl-sco-modal { padding: 26px 18px 22px; }
	.atl-sco-otp-digit { width: 38px; height: 46px; font-size: 19px; }
	.atl-sco-grid-2 { grid-template-columns: 1fr; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
	.atl-sco-overlay, .atl-sco-modal, .atl-sco-panel.is-active, .atl-sco-success-check {
		animation: none !important;
	}
}

/* Accessible focus visibility */
.atl-sco-tab:focus-visible,
.atl-sco-link:focus-visible,
.atl-sco-btn:focus-visible,
.atl-sco-close:focus-visible {
	outline: 2px solid var(--atl-sco-accent);
	outline-offset: 2px;
}
