/**
 * OTP Login Styles
 *
 * @package Onviqa
 * @since 1.0.0
 */

/* ==========================================================================
   Login Tabs
   ========================================================================== */

.ksq-login-tabs {
	display: flex;
	border-bottom: 2px solid #e5e7eb;
	margin-bottom: 25px;
}

.ksq-login-tab {
	flex: 1;
	padding: 12px 20px;
	background: none;
	border: none;
	font-size: 15px;
	font-weight: 500;
	color: #6b7280;
	cursor: pointer;
	position: relative;
	transition: color 0.2s ease;
}

.ksq-login-tab:hover {
	color: #374151;
}

.ksq-login-tab.active {
	color: #111;
}

.ksq-login-tab.active::after {
	content: '';
	position: absolute;
	bottom: -2px;
	left: 0;
	right: 0;
	height: 2px;
	background: #2563eb;
}

/* Registration Tabs - Same styles as login tabs */
.ksq-register-tabs {
	display: flex;
	border-bottom: 2px solid #e5e7eb;
	margin-bottom: 25px;
}

.ksq-register-tab {
	flex: 1;
	padding: 12px 20px;
	background: none;
	border: none;
	font-size: 15px;
	font-weight: 500;
	color: #6b7280;
	cursor: pointer;
	position: relative;
	transition: color 0.2s ease;
}

.ksq-register-tab:hover {
	color: #374151;
}

.ksq-register-tab.active {
	color: #111;
}

.ksq-register-tab.active::after {
	content: '';
	position: absolute;
	bottom: -2px;
	left: 0;
	right: 0;
	height: 2px;
	background: #2563eb;
}

/* ==========================================================================
   Phone Input
   ========================================================================== */

.ksq-phone-input-wrapper {
	display: flex;
	gap: 0;
	position: relative;
	align-items: stretch;
	width: 100%;
	border: 2px solid #2563eb;
	border-radius: 8px;
	overflow: visible;
	background: #fff;
	transition: all 0.2s ease;
}

.ksq-phone-input-wrapper:focus-within {
	border-color: #2563eb;
	box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.ksq-country-code {
	width: 90px;
	flex-shrink: 0;
}

.ksq-phone-input-wrapper input[type="tel"] {
	flex: 1;
	min-width: 0;
	padding: 14px 16px;
	border: none;
	border-radius: 0;
	font-size: 16px;
	transition: none;
	background: transparent;
	outline: none;
}

.ksq-phone-input-wrapper input[type="tel"]::placeholder {
	color: #9ca3af;
}

/* ==========================================================================
   Country Selector
   ========================================================================== */

.ksq-country-selector {
	position: relative;
	width: 85px;
	flex-shrink: 0;
	min-width: 85px;
	border-right: 1px solid #e5e7eb;
}

.ksq-country-trigger {
	width: 100%;
	height: 100%;
	min-height: 44px;
	padding: 0 8px;
	background: transparent;
	border: none;
	border-radius: 0;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 4px;
	font-size: 14px;
	transition: background 0.2s ease;
	box-sizing: border-box;
}

.ksq-country-trigger:hover {
	background: #f9fafb;
}

.ksq-country-trigger:hover {
	border-color: #2563eb;
}

.ksq-country-trigger:focus {
	outline: none;
	border-color: #2563eb;
	box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.ksq-country-flag {
	font-size: 18px;
	line-height: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 22px;
	flex-shrink: 0;
}

.ksq-country-dial {
	font-weight: 600;
	color: #1f2937;
	font-size: 13px;
	letter-spacing: 0.3px;
	display: flex;
	align-items: center;
}

.ksq-country-arrow {
	font-size: 10px;
	color: #6b7280;
	transition: transform 0.2s ease;
	margin-left: 2px;
	flex-shrink: 0;
	display: flex;
	align-items: center;
}

.ksq-country-selector.open .ksq-country-arrow {
	transform: rotate(180deg);
}

.ksq-country-dropdown {
	position: absolute;
	top: calc(100% + 2px);
	left: 0;
	min-width: 140px;
	background: #fff;
	border: 1px solid #d1d5db;
	border-radius: 6px;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
	z-index: 100000;
	max-height: 200px;
	overflow: hidden;
	display: flex;
	flex-direction: column;
}

.ksq-country-search-wrapper {
	padding: 4px;
	border-bottom: 1px solid #e5e7eb;
	background: #fff;
}

.ksq-country-search-input {
	width: 100%;
	padding: 4px 8px;
	border: 1px solid #e5e7eb;
	border-radius: 4px;
	font-size: 12px;
	transition: all 0.2s ease;
	background: #fff;
	box-sizing: border-box;
	height: 28px;
}

.ksq-country-search-input:focus {
	outline: none;
	border-color: #2563eb;
	box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}

.ksq-country-list {
	overflow-y: auto;
	max-height: 160px;
	padding: 0;
}

.ksq-country-item {
	display: flex;
	align-items: center;
	gap: 6px;
	padding: 5px 8px;
	cursor: pointer;
	transition: all 0.15s ease;
	border-bottom: 1px solid #f3f4f6;
	height: 28px;
	box-sizing: border-box;
}

.ksq-country-item:last-child {
	border-bottom: none;
}

.ksq-country-item:hover {
	background: #f3f4f6;
}

.ksq-country-item .ksq-country-flag {
	font-size: 14px;
	width: 18px;
	text-align: center;
	flex-shrink: 0;
}

.ksq-country-item .ksq-country-code {
	font-size: 11px;
	font-weight: 600;
	color: #374151;
	min-width: 20px;
}

.ksq-country-item .ksq-country-name {
	flex: 1;
	font-size: 12px;
	color: #374151;
}

.ksq-country-item .ksq-country-dial {
	font-size: 11px;
	color: #6b7280;
	font-weight: 500;
}

.ksq-country-no-results {
	padding: 20px;
	text-align: center;
	color: #6b7280;
	font-size: 14px;
}

/* ==========================================================================
   OTP Input
   ========================================================================== */

.ksq-otp-inputs-container {
	display: flex;
	gap: 12px;
	justify-content: center;
	margin: 30px 0;
}

.ksq-otp-digit {
	width: 60px;
	height: 65px;
	text-align: center;
	font-size: 28px;
	font-weight: 600;
	border: 2px solid #e5e7eb;
	border-radius: 12px;
	transition: all 0.2s ease;
	background: #fff;
}

.ksq-otp-digit:focus {
	border-color: #2563eb;
	outline: none;
	box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.ksq-otp-digit.filled {
	border-color: #22c55e;
	background: #f0fdf4;
}

.ksq-otp-digit.error {
	border-color: #ef4444;
	background: #fef2f2;
	animation: shake 0.4s ease;
}

@keyframes shake {
	0%, 100% { transform: translateX(0); }
	25% { transform: translateX(-5px); }
	75% { transform: translateX(5px); }
}

/* ==========================================================================
   OTP Steps
   ========================================================================== */

.ksq-otp-step h4 {
	text-align: center;
	margin-bottom: 20px;
}

.ksq-otp-sent-msg {
	text-align: center;
	color: #374151;
	margin-bottom: 10px;
}

.ksq-otp-sent-msg strong {
	color: #111;
}

/* ==========================================================================
   Resend Row
   ========================================================================== */

.ksq-resend-row {
	display: flex;
	justify-content: center;
	gap: 20px;
	margin-top: 15px;
	text-align: center;
}

.ksq-resend-btn,
.ksq-change-phone-btn {
	background: none;
	border: none;
	color: #2563eb;
	font-size: 14px;
	cursor: pointer;
	padding: 5px;
}

.ksq-resend-btn:disabled {
	color: #9ca3af;
	cursor: not-allowed;
}

.ksq-resend-btn:not(:disabled):hover,
.ksq-change-phone-btn:hover {
	text-decoration: underline;
}

/* ==========================================================================
   Messages
   ========================================================================== */

.ksq-otp-message {
	padding: 12px 16px;
	border-radius: 8px;
	margin-top: 15px;
	font-size: 14px;
	text-align: center;
}

.ksq-otp-message.success {
	background: #f0fdf4;
	border: 1px solid #22c55e;
	color: #166534;
}

.ksq-otp-message.error {
	background: #fef2f2;
	border: 1px solid #ef4444;
	color: #991b1b;
}

.ksq-otp-message.loading {
	background: #f0f9ff;
	border: 1px solid #0ea5e9;
	color: #0369a1;
}

/* ==========================================================================
   Loading State
   ========================================================================== */

.ksq-btn-loading {
	position: relative;
	pointer-events: none;
}

.ksq-btn-loading::after {
	content: '';
	position: absolute;
	right: 15px;
	top: 50%;
	transform: translateY(-50%);
	width: 16px;
	height: 16px;
	border: 2px solid rgba(255, 255, 255, 0.3);
	border-top-color: #fff;
	border-radius: 50%;
	animation: spin 0.8s linear infinite;
}

@keyframes spin {
	to { transform: translateY(-50%) rotate(360deg); }
}

/* ==========================================================================
   Responsive
   ========================================================================== */

/* ==========================================================================
   Account Switch Link
   ========================================================================== */

.ksq-account-switch {
	margin-top: 20px;
	text-align: center;
	padding-top: 20px;
	border-top: 1px solid #e5e7eb;
}

.ksq-switch-text {
	margin: 0;
	font-size: 14px;
	color: #6b7280;
}

.ksq-switch-link {
	color: #2563eb;
	text-decoration: none;
	font-weight: 500;
	transition: color 0.2s ease;
}

.ksq-switch-link:hover {
	color: #1d4ed8;
	text-decoration: underline;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

/* ==========================================================================
   Email OTP Login
   ========================================================================== */

.ksq-email-otp-login {
	margin-top: 20px;
	padding: 20px;
	background: #f9fafb;
	border: 1px solid #e5e7eb;
	border-radius: 8px;
}

.ksq-email-otp-message {
	margin-bottom: 15px;
	font-size: 14px;
	color: #374151;
}

.ksq-email-otp-message p {
	margin: 5px 0;
}

.ksq-email-otp-message strong {
	color: #111;
}

.ksq-email-otp-step {
	text-align: center;
}

.ksq-password-login-link {
	color: #2563eb;
	text-decoration: none;
	font-size: 14px;
	display: inline-block;
	margin-top: 10px;
}

.ksq-password-login-link:hover {
	text-decoration: underline;
}

/* Hide password fields by default on registration form - will be shown via JS when needed */
.woocommerce-form-register .form-row-password,
.woocommerce-form-register .form-row-password-confirm {
	display: none;
}

/* Show password fields when needed */
.woocommerce-form-register.show-password .form-row-password,
.woocommerce-form-register.show-password .form-row-password-confirm {
	display: block;
}

@media (max-width: 480px) {
	.ksq-otp-digit {
		width: 42px;
		height: 48px;
		font-size: 20px;
	}

	.ksq-otp-inputs-container {
		gap: 6px;
	}

	.ksq-phone-input-wrapper {
		flex-direction: column;
	}

	.ksq-country-code {
		width: 100%;
	}
}

