/* UIX-034: Scoped 6-digit OTP input, verifying wave, and verified celebration styles (400/500 weights). */

.tc-otp-field-box {
	display: grid;
	gap: 0.65rem;
}

.tc-otp-field-box [hidden] {
	display: none !important;
}

/* Single-row 6-digit segmented grid (overrides legacy 3-column mobile wrap cleanly) */
.tc-otp-grid.tc-auth-otp {
	position: relative;
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(40px, 1fr));
	align-items: center;
	gap: 0.5rem;
	max-width: 100%;
	width: 100%;
}

.tc-otp-grid.tc-otp-grid--six {
	grid-template-columns: repeat(3, minmax(0, 1fr)) 10px repeat(3, minmax(0, 1fr));
	gap: 0.45rem;
}

.tc-otp-divider {
	width: 5px;
	height: 5px;
	margin: 0 auto;
	border-radius: 999px;
	background: #cbd8ce;
	transition: background-color 0.2s ease, transform 0.2s ease;
}

.tc-otp-grid.is-complete .tc-otp-divider {
	background: #0aad0b;
	transform: scale(1.25);
}

.tc-otp-grid.is-error .tc-otp-divider {
	background: #dc2626;
}

.tc-otp-slot-wrap {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	min-width: 0;
}

.tc-otp-slot-wrap .tc-auth-otp-slot.tc-otp-slot {
	width: 100%;
	min-width: 0;
	height: 54px;
	padding: 0;
	border-radius: 14px;
	border: 1.5px solid #dde3dc;
	background: #fafdf9;
	color: #1f2937;
	font-family: inherit;
	font-size: 1.32rem;
	font-weight: 500;
	font-variant-numeric: tabular-nums;
	line-height: 1;
	text-align: center;
	caret-color: #0aad0b;
	transition:
		border-color 0.18s ease,
		background-color 0.18s ease,
		box-shadow 0.2s ease,
		transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1),
		color 0.15s ease;
	-webkit-appearance: none;
	appearance: none;
}

.tc-otp-slot-wrap .tc-auth-otp-slot.tc-otp-slot:hover:not(:disabled) {
	border-color: #b7ceb9;
	background: #ffffff;
}

.tc-otp-slot-wrap .tc-auth-otp-slot.tc-otp-slot:focus,
.tc-otp-slot-wrap .tc-auth-otp-slot.tc-otp-slot:focus-visible {
	outline: none;
	border-color: #0aad0b;
	background: #ffffff;
	box-shadow: 0 6px 16px -6px rgba(10, 173, 11, 0.24), 0 0 0 3.5px rgba(10, 173, 11, 0.14);
	transform: translateY(-2px);
}

.tc-otp-slot-wrap.is-filled .tc-auth-otp-slot.tc-otp-slot {
	border-color: #84d685;
	background: #f3fbf3;
	color: #14532d;
}

.tc-otp-slot-wrap.is-filled .tc-auth-otp-slot.tc-otp-slot:focus {
	border-color: #0aad0b;
	background: #ffffff;
}

.tc-otp-slot-wrap.is-popping .tc-auth-otp-slot.tc-otp-slot {
	animation: tc-otp-digit-pop 0.22s cubic-bezier(0.34, 1.56, 0.64, 1) both;
	animation-delay: calc(var(--tc-slot-delay, 0) * 1ms);
}

.tc-otp-slot-bar {
	position: absolute;
	left: 30%;
	right: 30%;
	bottom: 5px;
	height: 2px;
	border-radius: 999px;
	background: #0aad0b;
	opacity: 0;
	transform: scaleX(0);
	transition: transform 0.2s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.16s ease;
	pointer-events: none;
}

.tc-otp-slot-wrap .tc-auth-otp-slot:focus ~ .tc-otp-slot-bar {
	opacity: 0.9;
	transform: scaleX(1);
}

.tc-otp-slot-wrap.is-filled .tc-otp-slot-bar {
	opacity: 0.45;
	transform: scaleX(0.65);
}

.tc-otp-slot-wrap.is-filled .tc-auth-otp-slot:focus ~ .tc-otp-slot-bar {
	opacity: 1;
	transform: scaleX(1);
}

/* Complete subtle confirmation ring across all 6 tiles */
.tc-otp-grid.is-complete .tc-otp-slot-wrap.is-filled .tc-auth-otp-slot.tc-otp-slot {
	border-color: #0aad0b;
	background: #f1faf1;
}

/* Error shake state */
.tc-otp-grid.is-error {
	animation: tc-otp-shake 0.42s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

.tc-otp-grid.is-error .tc-auth-otp-slot.tc-otp-slot {
	border-color: #dc2626;
	background: #fff5f5;
	color: #9d2828;
	box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

.tc-otp-grid.is-error .tc-otp-slot-bar {
	background: #dc2626;
	opacity: 0.85;
	transform: scaleX(0.7);
}

/* Verifying state: clear input values stay hidden for security while wave dots animate cleanly */
.tc-otp-slot-pulse {
	position: absolute;
	width: 10px;
	height: 10px;
	border-radius: 999px;
	background: #0aad0b;
	opacity: 0;
	transform: scale(0.5);
	pointer-events: none;
}

.tc-otp-grid.is-verifying .tc-auth-otp-slot.tc-otp-slot {
	border-color: #84d685;
	background: #f4fbf4;
	color: transparent;
	text-shadow: none;
	box-shadow: 0 2px 10px rgba(10, 173, 11, 0.08);
	cursor: wait;
}

.tc-otp-grid.is-verifying .tc-otp-slot-bar {
	opacity: 0;
}

.tc-otp-grid.is-verifying .tc-otp-slot-pulse {
	opacity: 1;
	animation: tc-otp-verify-wave 1.05s ease-in-out infinite;
	animation-delay: calc(var(--tc-slot-i, 0) * 95ms);
}

.tc-otp-grid.is-verifying::after {
	content: "";
	position: absolute;
	inset: 0;
	border-radius: 14px;
	background: linear-gradient(
		105deg,
		transparent 25%,
		rgba(10, 173, 11, 0.12) 48%,
		rgba(10, 173, 11, 0.18) 52%,
		transparent 75%
	);
	background-size: 220% 100%;
	animation: tc-otp-scan-sweep 1.3s ease-in-out infinite;
	pointer-events: none;
}

/* Verifying pill indicator */
.tc-otp-verifying-pill {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.5rem;
	padding: 0.45rem 0.85rem;
	border-radius: 999px;
	background: #f1faf1;
	border: 1px solid #cce9cd;
	color: #166534;
	font-size: 0.84rem;
	font-weight: 500;
	justify-self: center;
	animation: tc-verified-copy-in 0.22s ease both;
}

.tc-otp-orbital {
	width: 15px;
	height: 15px;
	border-radius: 999px;
	border: 2px solid rgba(10, 173, 11, 0.22);
	border-top-color: #0aad0b;
	animation: tc-otp-orbital-spin 0.72s linear infinite;
	flex: 0 0 auto;
}

.tc-otp-orbital--light {
	border-color: rgba(255, 255, 255, 0.34);
	border-top-color: #ffffff;
}

/* Verify submit button verifying transition */
.tc-otp-verify-btn {
	position: relative;
	overflow: hidden;
	display: inline-flex;
	align-items: center;
	justify-content: center;
}

.tc-otp-verify-btn .tc-btn-verifying {
	display: none;
	align-items: center;
	justify-content: center;
	gap: 0.55rem;
}

.tc-otp-verify-btn.is-verifying {
	opacity: 1 !important;
	cursor: wait;
	background: #088a09 !important;
	border-color: #088a09 !important;
}

.tc-otp-verify-btn.is-verifying .tc-btn-label,
.tc-otp-verify-btn.is-verifying .tc-spinner {
	display: none !important;
}

.tc-otp-verify-btn.is-verifying .tc-btn-verifying {
	display: inline-flex;
}

.tc-otp-verify-btn.is-verifying::after {
	content: "";
	position: absolute;
	inset: 0;
	background: linear-gradient(110deg, transparent 20%, rgba(255, 255, 255, 0.22) 50%, transparent 80%);
	transform: translateX(-100%);
	animation: tc-btn-sheen 1.25s ease-in-out infinite;
	pointer-events: none;
}

/* Dribbble-style Verified Celebration Stage */
.tc-otp-verified-stage {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	text-align: center;
	padding: 1.5rem 0.75rem 1.25rem;
	gap: 1rem;
	border-radius: 18px;
	background: radial-gradient(circle at 50% 24%, #f2fbf2 0%, #ffffff 74%);
	border: 1px solid #d9eed9;
}

.tc-otp-verified-stage.is-active {
	animation: tc-verified-stage-in 0.34s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.tc-verified-visual {
	position: relative;
	width: 112px;
	height: 112px;
	display: flex;
	align-items: center;
	justify-content: center;
}

.tc-verified-emblem {
	position: relative;
	z-index: 2;
	width: 72px;
	height: 72px;
	border-radius: 999px;
	display: flex;
	align-items: center;
	justify-content: center;
	background: linear-gradient(145deg, #16c617 0%, #0aad0b 55%, #088a09 100%);
	box-shadow:
		0 14px 30px -6px rgba(10, 173, 11, 0.4),
		0 0 0 6px rgba(10, 173, 11, 0.1);
}

.tc-otp-verified-stage.is-active .tc-verified-emblem {
	animation: tc-verified-badge-pop 0.52s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.tc-verified-check-path {
	stroke-dasharray: 48;
	stroke-dashoffset: 48;
}

.tc-otp-verified-stage.is-active .tc-verified-check-path {
	animation: tc-verified-check-draw 0.38s cubic-bezier(0.65, 0, 0.35, 1) 0.18s forwards;
}

.tc-verified-ring {
	position: absolute;
	inset: 20px;
	border-radius: 999px;
	border: 2px solid rgba(10, 173, 11, 0.42);
	opacity: 0;
	pointer-events: none;
}

.tc-otp-verified-stage.is-active .tc-verified-ring--1 {
	animation: tc-verified-ring 0.95s cubic-bezier(0.16, 1, 0.3, 1) 0.14s forwards;
}

.tc-otp-verified-stage.is-active .tc-verified-ring--2 {
	border-color: rgba(255, 126, 21, 0.35);
	animation: tc-verified-ring 1.05s cubic-bezier(0.16, 1, 0.3, 1) 0.28s forwards;
}

/* Radial confetti / botanical micro-sparkles */
.tc-verified-spark {
	position: absolute;
	top: 50%;
	left: 50%;
	width: 8px;
	height: 8px;
	margin-top: -4px;
	margin-left: -4px;
	border-radius: 999px;
	background: #0aad0b;
	opacity: 0;
	pointer-events: none;
}

.tc-verified-spark--1 { --tc-sx: 0px; --tc-sy: -64px; background: #0aad0b; }
.tc-verified-spark--2 { --tc-sx: 48px; --tc-sy: -46px; width: 7px; height: 11px; background: #ff7e15; }
.tc-verified-spark--3 { --tc-sx: 64px; --tc-sy: 2px; background: #34d399; }
.tc-verified-spark--4 { --tc-sx: 46px; --tc-sy: 48px; width: 7px; height: 7px; background: #0aad0b; }
.tc-verified-spark--5 { --tc-sx: -2px; --tc-sy: 64px; width: 10px; height: 6px; background: #ff7e15; }
.tc-verified-spark--6 { --tc-sx: -48px; --tc-sy: 45px; background: #34d399; }
.tc-verified-spark--7 { --tc-sx: -64px; --tc-sy: -3px; width: 10px; height: 6px; background: #0aad0b; }
.tc-verified-spark--8 { --tc-sx: -45px; --tc-sy: -47px; background: #ff7e15; }

.tc-otp-verified-stage.is-active .tc-verified-spark {
	animation: tc-verified-spark 0.78s cubic-bezier(0.16, 1, 0.3, 1) 0.2s forwards;
}

.tc-otp-verified-stage.is-active .tc-verified-spark--2,
.tc-otp-verified-stage.is-active .tc-verified-spark--6 {
	animation-delay: 0.24s;
}

.tc-otp-verified-stage.is-active .tc-verified-spark--4,
.tc-otp-verified-stage.is-active .tc-verified-spark--8 {
	animation-delay: 0.28s;
}

.tc-verified-copy {
	display: grid;
	gap: 0.42rem;
	justify-items: center;
}

.tc-verified-pill {
	display: inline-flex;
	align-items: center;
	gap: 0.35rem;
	padding: 0.28rem 0.72rem;
	border-radius: 999px;
	background: #e9f8ea;
	border: 1px solid #bfe6c0;
	color: #14532d;
	font-size: 0.78rem;
	font-weight: 500;
	letter-spacing: 0.01em;
}

.tc-otp-verified-stage.is-active .tc-verified-pill {
	animation: tc-verified-copy-in 0.34s cubic-bezier(0.22, 1, 0.36, 1) 0.24s both;
}

.tc-verified-title {
	margin: 0;
	font-size: 1.24rem;
	font-weight: 500;
	line-height: 1.25;
	letter-spacing: -0.015em;
	color: #14532d;
}

.tc-otp-verified-stage.is-active .tc-verified-title {
	animation: tc-verified-copy-in 0.36s cubic-bezier(0.22, 1, 0.36, 1) 0.3s both;
}

.tc-verified-subtitle {
	margin: 0;
	max-width: 34ch;
	font-size: 0.9rem;
	font-weight: 400;
	line-height: 1.5;
	color: #506156;
}

.tc-otp-verified-stage.is-active .tc-verified-subtitle {
	animation: tc-verified-copy-in 0.36s cubic-bezier(0.22, 1, 0.36, 1) 0.36s both;
}

.tc-verified-progress {
	width: min(210px, 82%);
	height: 4px;
	margin-top: 0.15rem;
	border-radius: 999px;
	background: #e5efe5;
	overflow: hidden;
}

.tc-verified-progress-bar {
	display: block;
	width: 100%;
	height: 100%;
	border-radius: 999px;
	background: linear-gradient(90deg, #0aad0b 0%, #34d399 100%);
	transform-origin: left center;
	transform: scaleX(0);
}

.tc-otp-verified-stage.is-active .tc-verified-progress-bar {
	animation: tc-verified-progress 1.15s cubic-bezier(0.25, 0.8, 0.25, 1) 0.16s forwards;
}

.tc-verified-reset-btn {
	margin-top: 0.25rem;
}

/* Keep screen-reader status live while preventing duplicate green notice beneath Verified card */
[data-otp-verified="true"] .tc-channel-status[data-kind="status"] {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
	border: 0;
}

[data-otp-verified="true"][data-flow="login"] .tc-channel-password-wrap,
[data-otp-verified="true"] .tc-channel-actions--utility {
	display: none;
}

@keyframes tc-otp-digit-pop {
	0% { transform: scale(0.84); }
	58% { transform: scale(1.07) translateY(-1px); }
	100% { transform: scale(1) translateY(0); }
}

@keyframes tc-otp-shake {
	0%, 100% { transform: translateX(0); }
	18% { transform: translateX(-7px); }
	36% { transform: translateX(7px); }
	54% { transform: translateX(-5px); }
	72% { transform: translateX(4px); }
	88% { transform: translateX(-2px); }
}

@keyframes tc-otp-verify-wave {
	0%, 100% {
		transform: translateY(0) scale(0.78);
		opacity: 0.42;
	}
	45% {
		transform: translateY(-5px) scale(1.16);
		opacity: 1;
	}
}

@keyframes tc-otp-scan-sweep {
	0% { background-position: 180% 0; }
	100% { background-position: -80% 0; }
}

@keyframes tc-otp-orbital-spin {
	to { transform: rotate(360deg); }
}

@keyframes tc-btn-sheen {
	0% { transform: translateX(-110%); }
	100% { transform: translateX(110%); }
}

@keyframes tc-verified-stage-in {
	0% {
		opacity: 0;
		transform: translateY(8px) scale(0.97);
	}
	100% {
		opacity: 1;
		transform: translateY(0) scale(1);
	}
}

@keyframes tc-verified-badge-pop {
	0% {
		opacity: 0;
		transform: scale(0.28) rotate(-14deg);
	}
	58% {
		opacity: 1;
		transform: scale(1.11) rotate(3deg);
	}
	82% {
		transform: scale(0.96) rotate(-1deg);
	}
	100% {
		opacity: 1;
		transform: scale(1) rotate(0deg);
	}
}

@keyframes tc-verified-check-draw {
	to { stroke-dashoffset: 0; }
}

@keyframes tc-verified-ring {
	0% {
		opacity: 0.55;
		transform: scale(0.75);
	}
	100% {
		opacity: 0;
		transform: scale(1.85);
	}
}

@keyframes tc-verified-spark {
	0% {
		opacity: 0;
		transform: translate(0, 0) scale(0.2);
	}
	30% {
		opacity: 1;
		transform: translate(calc(var(--tc-sx) * 0.65), calc(var(--tc-sy) * 0.65)) scale(1.15);
	}
	65% {
		opacity: 0.9;
		transform: translate(calc(var(--tc-sx) * 0.92), calc(var(--tc-sy) * 0.92)) scale(0.85);
	}
	100% {
		opacity: 0;
		transform: translate(var(--tc-sx), var(--tc-sy)) scale(0);
	}
}

@keyframes tc-verified-copy-in {
	0% {
		opacity: 0;
		transform: translateY(7px);
	}
	100% {
		opacity: 1;
		transform: translateY(0);
	}
}

@keyframes tc-verified-progress {
	0% { transform: scaleX(0); }
	100% { transform: scaleX(1); }
}

@media (max-width: 480px) {
	.tc-otp-grid.tc-otp-grid--six {
		grid-template-columns: repeat(3, minmax(0, 1fr)) 6px repeat(3, minmax(0, 1fr));
		gap: 0.34rem;
	}

	.tc-otp-slot-wrap .tc-auth-otp-slot.tc-otp-slot {
		height: 48px;
		border-radius: 12px;
		font-size: 1.18rem;
	}

	.tc-verified-visual {
		width: 96px;
		height: 96px;
	}

	.tc-verified-emblem {
		width: 64px;
		height: 64px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.tc-otp-slot-wrap .tc-auth-otp-slot.tc-otp-slot,
	.tc-otp-slot-bar,
	.tc-otp-divider {
		transition: none !important;
	}

	.tc-otp-slot-wrap.is-popping .tc-auth-otp-slot.tc-otp-slot,
	.tc-otp-grid.is-error,
	.tc-otp-grid.is-verifying::after,
	.tc-otp-grid.is-verifying .tc-otp-slot-pulse,
	.tc-otp-verify-btn.is-verifying::after,
	.tc-otp-verified-stage.is-active,
	.tc-otp-verified-stage.is-active .tc-verified-emblem,
	.tc-otp-verified-stage.is-active .tc-verified-check-path,
	.tc-otp-verified-stage.is-active .tc-verified-ring,
	.tc-otp-verified-stage.is-active .tc-verified-spark,
	.tc-otp-verified-stage.is-active .tc-verified-pill,
	.tc-otp-verified-stage.is-active .tc-verified-title,
	.tc-otp-verified-stage.is-active .tc-verified-subtitle,
	.tc-otp-verified-stage.is-active .tc-verified-progress-bar {
		animation: none !important;
	}

	.tc-otp-verified-stage.is-active .tc-verified-check-path {
		stroke-dashoffset: 0;
	}

	.tc-otp-verified-stage.is-active .tc-verified-progress-bar {
		transform: scaleX(1);
	}
}
