/**
 * WooCommerce Firebase Phone OTP - Styles
 *
 * Clean, flat styling for OTP verification components matching WordPress core design.
 *
 * @package WooFireOTP
 */

/* ═══════════════════════════════════════════
   CSS Custom Properties (Design Tokens)
   ═══════════════════════════════════════════ */

:root {
	--wfop-primary: #2271b1;
	--wfop-primary-hover: #135e96;
	--wfop-primary-light: #f0f6fc;
	--wfop-success: #008a20;
	--wfop-success-light: #edfaef;
	--wfop-error: #d63638;
	--wfop-error-light: #fcf0f1;
	--wfop-warning: #dba617;
	--wfop-text-primary: #1d2327;
	--wfop-text-secondary: #4c525a;
	--wfop-text-muted: #8c8f94;
	--wfop-border: #d0d4d9;
	--wfop-border-focus: #2271b1;
	--wfop-bg: #ffffff;
	--wfop-bg-subtle: #f6f7f7;
	--wfop-radius: 4px;
	--wfop-radius-lg: 4px;
	--wfop-shadow: none;
	--wfop-shadow-lg: 0 2px 4px rgba(0, 0, 0, 0.05);
	--wfop-transition: 0.1s ease-in-out;
	--wfop-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* ═══════════════════════════════════════════
   Brand Logo
   ═══════════════════════════════════════════ */

.wfop-brand-logo-container {
	text-align: center;
	margin: 0 auto 20px auto;
	padding-bottom: 5px;
	display: flex;
	justify-content: center;
	align-items: center;
	width: 100%;
}

.wfop-brand-logo {
	max-height: 50px;
	max-width: 100%;
	height: auto;
	display: block;
	object-fit: contain;
}

/* ═══════════════════════════════════════════
   OTP Container
   ═══════════════════════════════════════════ */

.wfop-otp-container {
	font-family: var(--wfop-font);
	margin: 16px 0;
	padding: 20px;
	background: var(--wfop-bg);
	border: 1px solid var(--wfop-border);
	border-radius: var(--wfop-radius-lg);
	transition: all var(--wfop-transition);
}

.wfop-otp-container:hover {
	border-color: #9ca3af;
}

/* Checkout specific */
.wfop-checkout-otp {
	margin-top: 20px;
	background: var(--wfop-bg-subtle);
	border: 1px dashed var(--wfop-border);
}

.wfop-checkout-header h4 {
	margin: 0 0 6px 0;
	font-size: 15px;
	font-weight: 600;
	color: var(--wfop-text-primary);
}

.wfop-checkout-desc {
	margin: 0 0 16px 0;
	font-size: 13px;
	color: var(--wfop-text-secondary);
	line-height: 1.5;
}

/* ═══════════════════════════════════════════
   Labels
   ═══════════════════════════════════════════ */

.wfop-label {
	display: block;
	margin-bottom: 6px;
	font-size: 14px;
	font-weight: 600;
	color: var(--wfop-text-primary);
}

.wfop-label .required {
	color: var(--wfop-error);
}

/* ═══════════════════════════════════════════
   Phone Input Group
   ═══════════════════════════════════════════ */

.wfop-phone-input-group {
	display: flex;
	gap: 8px;
	margin-bottom: 12px;
}

.wfop-country-code {
	flex: 0 0 auto;
	width: 160px;
	padding: 10px 12px;
	border: 1px solid var(--wfop-border);
	border-radius: var(--wfop-radius);
	font-size: 14px;
	color: var(--wfop-text-primary);
	background-color: var(--wfop-bg);
	cursor: pointer;
	transition: border-color var(--wfop-transition);
	appearance: none;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%234c525a' d='M3 5l3 3 3-3'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 12px center;
	padding-right: 32px;
}

.wfop-country-code:focus {
	outline: none;
	border-color: var(--wfop-border-focus);
	box-shadow: 0 0 0 2px rgba(34, 113, 177, 0.3);
}

.wfop-phone-input {
	flex: 1;
	padding: 10px 14px;
	border: 1px solid var(--wfop-border);
	border-radius: var(--wfop-radius);
	font-size: 16px;
	color: var(--wfop-text-primary);
	transition: border-color var(--wfop-transition);
}

.wfop-phone-input:focus {
	outline: none;
	border-color: var(--wfop-border-focus);
	box-shadow: 0 0 0 2px rgba(34, 113, 177, 0.3);
}

.wfop-phone-input::placeholder {
	color: var(--wfop-text-muted);
}

/* ═══════════════════════════════════════════
   OTP Digit Inputs
   ═══════════════════════════════════════════ */

.wfop-otp-digits {
	display: flex;
	gap: 8px;
	justify-content: center;
	margin: 16px 0;
}

.wfop-otp-digit {
	width: 48px;
	height: 56px;
	border: 2px solid var(--wfop-border);
	border-radius: var(--wfop-radius);
	text-align: center;
	font-size: 22px;
	font-weight: 700;
	color: var(--wfop-text-primary);
	caret-color: var(--wfop-primary);
	transition: all var(--wfop-transition);
}

.wfop-otp-digit:focus {
	outline: none;
	border-color: var(--wfop-primary);
	box-shadow: 0 0 0 2px rgba(34, 113, 177, 0.3);
}

.wfop-otp-digit.wfop-filled {
	border-color: var(--wfop-primary);
	background-color: var(--wfop-primary-light);
}

.wfop-otp-digit.wfop-error {
	border-color: var(--wfop-error);
	animation: wfop-shake 0.5s ease-in-out;
}

@keyframes wfop-shake {
	0%, 100% { transform: translateX(0); }
	20% { transform: translateX(-4px); }
	40% { transform: translateX(4px); }
	60% { transform: translateX(-4px); }
	80% { transform: translateX(4px); }
}

/* ═══════════════════════════════════════════
   OTP Hint Text
   ═══════════════════════════════════════════ */

.wfop-otp-hint {
	text-align: center;
	font-size: 13px;
	color: var(--wfop-text-secondary);
	margin: 0 0 4px 0;
}

/* ═══════════════════════════════════════════
   Buttons
   ═══════════════════════════════════════════ */

.wfop-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	width: 100%;
	padding: 12px 24px;
	border: none;
	border-radius: var(--wfop-radius);
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
	transition: all var(--wfop-transition);
	line-height: 1.4;
}

.wfop-btn-send {
	background: var(--wfop-primary);
	color: #fff;
}

.wfop-btn-send:hover {
	background: var(--wfop-primary-hover);
}

.wfop-btn-verify {
	background: var(--wfop-success);
	color: #fff;
}

.wfop-btn-verify:hover {
	background: #00701a;
}

.wfop-btn-checkout {
	width: auto;
	padding: 10px 20px;
}

.wfop-btn:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

.wfop-btn-text {
	display: inline;
}

.wfop-btn-spinner {
	display: inline-flex;
	align-items: center;
	gap: 6px;
}

/* ═══════════════════════════════════════════
   Spinner
   ═══════════════════════════════════════════ */

.wfop-spinner {
	display: inline-block;
	width: 16px;
	height: 16px;
	border: 2px solid rgba(255, 255, 255, 0.3);
	border-top-color: #fff;
	border-radius: 50%;
	animation: wfop-spin 0.6s linear infinite;
}

@keyframes wfop-spin {
	to { transform: rotate(360deg); }
}

/* ═══════════════════════════════════════════
   OTP Actions (Verify + Timer)
   ═══════════════════════════════════════════ */

.wfop-otp-actions {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 12px;
}

.wfop-otp-actions .wfop-btn {
	width: 100%;
}

.wfop-timer {
	text-align: center;
	font-size: 13px;
	color: var(--wfop-text-secondary);
}

.wfop-timer-text {
	font-variant-numeric: tabular-nums;
}

.wfop-resend-link {
	color: var(--wfop-primary);
	text-decoration: none;
	font-weight: 500;
	transition: color var(--wfop-transition);
}

.wfop-resend-link:hover {
	color: var(--wfop-primary-hover);
	text-decoration: underline;
}

/* ═══════════════════════════════════════════
   Success State
   ═══════════════════════════════════════════ */

.wfop-verified-badge {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 12px 16px;
	background: var(--wfop-success-light);
	border: 1px solid var(--wfop-success);
	border-radius: var(--wfop-radius);
	animation: wfop-fade-in 0.4s ease-out;
}

.wfop-verified-icon {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 20px;
	height: 20px;
	background: var(--wfop-success);
	color: #fff;
	border-radius: 50%;
	font-size: 12px;
	font-weight: 700;
	flex-shrink: 0;
}

.wfop-verified-text {
	font-size: 14px;
	font-weight: 600;
	color: var(--wfop-success);
}

.wfop-verified-number {
	font-size: 13px;
	color: var(--wfop-success);
	margin-left: auto;
}

@keyframes wfop-fade-in {
	from {
		opacity: 0;
		transform: translateY(-8px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

/* ═══════════════════════════════════════════
   Success Checkmark Animation (Login)
   ═══════════════════════════════════════════ */

.wfop-step-success {
	text-align: center;
	padding: 20px;
}

.wfop-success-icon {
	margin: 0 auto 12px;
	width: 52px;
	height: 52px;
}

.wfop-checkmark {
	width: 52px;
	height: 52px;
	border-radius: 50%;
	stroke-width: 2;
	stroke: var(--wfop-success);
	stroke-miterlimit: 10;
	animation: wfop-scale 0.3s ease-in-out 0.3s both;
}

.wfop-checkmark-circle {
	stroke-dasharray: 166;
	stroke-dashoffset: 166;
	stroke-width: 2;
	stroke-miterlimit: 10;
	stroke: var(--wfop-success);
	fill: none;
	animation: wfop-stroke 0.6s cubic-bezier(0.65, 0, 0.45, 1) forwards;
}

.wfop-checkmark-check {
	transform-origin: 50% 50%;
	stroke-dasharray: 48;
	stroke-dashoffset: 48;
	stroke-width: 3;
	animation: wfop-stroke 0.3s cubic-bezier(0.65, 0, 0.45, 1) 0.5s forwards;
}

@keyframes wfop-stroke {
	100% { stroke-dashoffset: 0; }
}

@keyframes wfop-scale {
	0%, 100% { transform: none; }
	50% { transform: scale3d(1.1, 1.1, 1); }
}

.wfop-success-text {
	font-size: 15px;
	font-weight: 600;
	color: var(--wfop-success);
}

/* ═══════════════════════════════════════════
   Error Message
   ═══════════════════════════════════════════ */

.wfop-error-message {
	padding: 10px 14px;
	margin-top: 12px;
	background: var(--wfop-error-light);
	border: 1px solid #fca5a5;
	border-radius: var(--wfop-radius);
	color: var(--wfop-error);
	font-size: 13px;
	animation: wfop-fade-in 0.3s ease-out;
}

/* ═══════════════════════════════════════════
   Login Toggle Links
   ═══════════════════════════════════════════ */

.wfop-login-toggle {
	text-align: center;
	margin-top: 12px;
}

.wfop-toggle-link {
	color: var(--wfop-primary);
	text-decoration: none;
	font-size: 14px;
	font-weight: 500;
	transition: all var(--wfop-transition);
}

.wfop-toggle-link:hover {
	color: var(--wfop-primary-hover);
	text-decoration: underline;
}

/* ═══════════════════════════════════════════
   Phone Login Section
   ═══════════════════════════════════════════ */

.wfop-phone-login-section {
	margin-bottom: 20px;
}

.wfop-phone-login-section h2 {
	font-size: 18px;
	margin-bottom: 16px;
}

/* ═══════════════════════════════════════════
   Step Transitions
   ═══════════════════════════════════════════ */

.wfop-step {
	transition: all 0.2s ease-in-out;
}

.wfop-step[style*="display: none"] {
	opacity: 0;
	max-height: 0;
	overflow: hidden;
}

/* ═══════════════════════════════════════════
   Responsive Design
   ═══════════════════════════════════════════ */

@media (max-width: 600px) {
	.wfop-phone-input-group {
		flex-direction: column;
	}

	.wfop-country-code {
		width: 100%;
	}

	.wfop-otp-digits {
		gap: 6px;
	}

	.wfop-otp-digit {
		width: 42px;
		height: 48px;
		font-size: 18px;
	}

	.wfop-otp-container {
		padding: 16px;
	}

	.wfop-status-container {
		padding: 28px 18px;
	}

	.wfop-status-container h3 {
		font-size: 19px;
	}

	.wfop-verified-number-badge {
		font-size: 15px;
		padding: 10px 18px;
	}

	.wfop-btn-change {
		width: 100%;
		justify-content: center;
	}
}

@media (max-width: 380px) {
	.wfop-otp-digit {
		width: 36px;
		height: 44px;
		font-size: 16px;
	}

	.wfop-otp-digits {
		gap: 4px;
	}
}

/* ═══════════════════════════════════════════
   Checkout Verification Popup Modal
   ═══════════════════════════════════════════ */

.wfop-modal {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 999999;
	font-family: var(--wfop-font);
}

.wfop-modal-backdrop {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: rgba(17, 24, 39, 0.4);
}

.wfop-modal-wrapper {
	position: relative;
	z-index: 10;
	background: #ffffff;
	border-radius: var(--wfop-radius-lg);
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
	width: 92%;
	max-width: 440px;
	overflow: hidden;
	animation: wfop-modal-slide 0.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes wfop-modal-slide {
	from {
		opacity: 0;
		transform: translateY(10px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

.wfop-modal-header {
	padding: 16px 20px;
	border-bottom: 1px solid var(--wfop-border);
	display: flex;
	justify-content: space-between;
	align-items: center;
}

.wfop-modal-header h3 {
	margin: 0;
	font-size: 16px;
	font-weight: 600;
	color: var(--wfop-text-primary);
}

.wfop-modal-close {
	background: none;
	border: none;
	font-size: 24px;
	line-height: 1;
	color: var(--wfop-text-muted);
	cursor: pointer;
	padding: 4px;
	transition: color var(--wfop-transition);
}

.wfop-modal-close:hover {
	color: var(--wfop-error);
}

.wfop-modal-body {
	padding: 20px;
}

.wfop-modal-body .wfop-otp-container {
	margin: 0;
	padding: 0;
	border: none;
	box-shadow: none;
}

/* Disabled styling helper */
.wfop-disabled {
	opacity: 0.55 !important;
	cursor: not-allowed !important;
}

/* ═══════════════════════════════════════════
   My Account Mobile Tab Layout
   ═══════════════════════════════════════════ */

.wfop-myaccount-wrapper {
	max-width: 640px;
}

.wfop-status-container {
	background: #ffffff;
	border: 1px solid var(--wfop-border);
	border-radius: 10px;
	padding: 40px 32px;
	text-align: center;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

/* Soft top accent strip per state */
.wfop-status-container.verified {
	border-top: 3px solid var(--wfop-success);
}

.wfop-status-container.unverified {
	border-top: 3px solid var(--wfop-primary);
}

.wfop-status-container .wfop-status-icon {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 76px;
	height: 76px;
	margin: 0 auto 18px auto;
	border-radius: 50%;
	color: var(--wfop-text-primary);
}

.wfop-status-container.verified .wfop-status-icon {
	background: var(--wfop-success-light);
}

.wfop-status-container.unverified .wfop-status-icon {
	background: var(--wfop-primary-light);
}

.wfop-status-svg {
	display: block;
}

.wfop-status-svg.verified {
	stroke: var(--wfop-success);
}

.wfop-status-svg.unverified {
	stroke: var(--wfop-primary);
}

.wfop-status-container h3 {
	margin: 0 0 10px 0;
	font-size: 22px;
	font-weight: 600;
	line-height: 1.3;
	color: var(--wfop-text-primary);
}

.wfop-status-container p {
	color: var(--wfop-text-secondary);
	font-size: 14.5px;
	line-height: 1.6;
	margin: 0 auto 26px auto;
	max-width: 420px;
}

.wfop-verified-number-badge {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	padding: 12px 22px;
	background: var(--wfop-success-light);
	border: 1px solid var(--wfop-success);
	border-radius: 30px;
	font-size: 17px;
	font-weight: 600;
	letter-spacing: 0.4px;
	color: var(--wfop-success);
}

.wfop-checkmark-badge {
	width: 22px;
	height: 22px;
	background: var(--wfop-success);
	color: #ffffff;
	border-radius: 50%;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-size: 13px;
	font-weight: bold;
	flex-shrink: 0;
}

/* Verified actions row (Change Mobile Number) */
.wfop-verified-actions {
	margin-top: 24px;
	display: flex;
	justify-content: center;
}

.wfop-btn-change {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 10px 22px;
	background: transparent;
	color: var(--wfop-primary);
	border: 1.5px solid var(--wfop-primary);
	border-radius: 30px;
	font-size: 14px;
	font-weight: 600;
	line-height: 1.4;
	cursor: pointer;
	transition: all var(--wfop-transition);
}

.wfop-btn-change svg {
	flex-shrink: 0;
}

.wfop-btn-change:hover {
	background: var(--wfop-primary);
	color: #ffffff;
}

/* Inline verification details for checkout (injected after the phone field) */
.wfop-inline-verification-wrapper {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	margin-top: 10px;
	gap: 10px;
}

.wfop-inline-verify-btn {
	display: inline-flex !important;
	align-items: center;
	gap: 7px;
	width: auto !important;
	background-color: var(--wfop-primary) !important;
	color: #ffffff !important;
	border: none !important;
	border-radius: var(--wfop-radius) !important;
	padding: 9px 18px !important;
	font-size: 13px !important;
	font-weight: 600 !important;
	line-height: 1.4 !important;
	cursor: pointer;
	box-shadow: var(--wfop-shadow);
	transition: background-color var(--wfop-transition) !important;
}

.wfop-inline-verify-btn .wfop-verify-pin {
	display: inline-flex;
	align-items: center;
}

.wfop-inline-verify-btn:hover {
	background-color: var(--wfop-primary-hover) !important;
}

/* Inline verified badge sits inline (not full-width) next to / after phone */
.wfop-inline-badge {
	margin-top: 0;
	width: fit-content;
	padding: 8px 14px;
	align-items: center;
	gap: 7px;
}

/* Mobile: stack the verify button / badge full-width under the phone field */
@media (max-width: 600px) {
	.wfop-inline-verification-wrapper {
		flex-direction: column;
		align-items: stretch;
	}

	.wfop-inline-verify-btn {
		width: 100% !important;
		justify-content: center;
	}

	.wfop-inline-badge {
		width: 100%;
		justify-content: center;
	}
}

.wfop-disabled {
	opacity: 0.55 !important;
	cursor: not-allowed !important;
	pointer-events: none !important;
}

/* ═══════════════════════════════════════════
   Fallback (WhatsApp / Email) Row
   ═══════════════════════════════════════════ */

.wfop-fallback-row {
	text-align: center;
	margin-top: 10px;
	font-size: 13px;
	color: var(--wfop-text-secondary);
}

.wfop-fallback-btn {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	background: transparent;
	border: 1px solid var(--wfop-border);
	border-radius: 6px;
	padding: 6px 12px;
	margin: 6px 4px 0;
	font-size: 13px;
	font-weight: 600;
	color: var(--wfop-primary);
	cursor: pointer;
	transition: all 0.12s ease-in-out;
}

.wfop-fallback-btn:hover {
	background: var(--wfop-primary);
	color: #fff;
	border-color: var(--wfop-primary);
}

.wfop-inline-note {
	display: block;
	text-align: center;
	margin-top: 8px;
	font-size: 12px;
	color: var(--wfop-text-secondary);
}
