/**
 * Mantapp WA Login Frontend Styles
 */

/* Main form container */
.mwa-login-form {
	max-width: 400px;
	margin: 0 auto;
	padding: 20px;
	background: #fff;
	border-radius: 8px;
	box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.mwa-login-logo {
	text-align: center;
	margin-bottom: 30px;
}

.mwa-login-logo img {
	max-width: 200px;
	height: auto;
}

.mwa-login-logo h2 {
	margin: 0;
	color: #1d2327;
	font-size: 24px;
	font-weight: 400;
}

/* Form styles */
.mwa-form {
	width: 100%;
}

.mwa-form-row {
	margin-bottom: 20px;
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.mwa-form-row:has(.mwa-country-select) {
	flex-direction: row;
	align-items: stretch;
}

.mwa-country-select {
	flex: 0 0 120px;
}

.mwa-phone-input {
	flex: 1;
}

/* Input styles following WordPress patterns */
.mwa-input {
	width: 100%;
	padding: 8px 12px;
	font-size: 16px;
	line-height: 1.5;
	border: 1px solid #8c8f94;
	border-radius: 4px;
	background-color: #fff;
	transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.mwa-input:focus {
	border-color: #2271b1;
	outline: none;
	box-shadow: 0 0 0 1px #2271b1;
}

.mwa-input-error {
	border-color: #d63638;
}

.mwa-input-error:focus {
	border-color: #d63638;
	box-shadow: 0 0 0 1px #d63638;
}

/* OTP specific input */
.mwa-otp-input {
	font-size: 24px;
	text-align: center;
	letter-spacing: 0.5em;
	font-weight: 500;
	padding: 16px 12px;
}

/* Button styles using WordPress classes */
.mwa-submit-btn {
	width: 100%;
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
}

.mwa-submit-btn:disabled {
	opacity: 0.6;
	cursor: not-allowed;
}

/* Spinner */
.mwa-spinner {
	width: 20px;
	height: 20px;
	border: 2px solid #f3f3f3;
	border-top: 2px solid #2271b1;
	border-radius: 50%;
	animation: mwa-spin 1s linear infinite;
}

@keyframes mwa-spin {
	0% { transform: rotate(0deg); }
	100% { transform: rotate(360deg); }
}

/* Timer and countdown */
.mwa-otp-timer {
	text-align: center;
	color: #646970;
	font-size: 14px;
}

#mwa-timer-display {
	font-weight: 600;
	color: #2271b1;
}

/* Resend button */
#mwa-resend-otp {
	width: 100%;
}

#mwa-resend-countdown {
	color: #646970;
}

/* Error messages */
.mwa-error {
	color: #d63638;
	font-size: 14px;
	margin-top: 4px;
	padding: 8px 12px;
	background-color: #fcf2f2;
	border: 1px solid #f0b7b8;
	border-radius: 4px;
}

/* Links */
.mwa-link {
	color: #2271b1;
	text-decoration: none;
	font-size: 14px;
	text-align: center;
	display: block;
}

.mwa-link:hover {
	color: #135e96;
	text-decoration: underline;
}

/* Modal styles */
.mwa-modal {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background-color: rgba(0, 0, 0, 0.5);
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
}

.mwa-modal-content {
	background: #fff;
	border-radius: 8px;
	box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
	max-width: 400px;
	width: 100%;
	max-height: 90vh;
	overflow-y: auto;
}

.mwa-modal-header {
	padding: 20px 20px 0;
	border-bottom: 1px solid #dcdcde;
}

.mwa-modal-header h4 {
	margin: 0 0 10px;
	font-size: 18px;
	color: #1d2327;
}

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

.mwa-modal-footer {
	padding: 0 20px 20px;
	display: flex;
	gap: 10px;
	justify-content: flex-end;
}

/* Modal overlay for login */
.mwa-modal-overlay {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background-color: rgba(0, 0, 0, 0.5);
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
}

.mwa-modal-container {
	background: #fff;
	border-radius: 8px;
	box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
	max-width: 500px;
	width: 100%;
	max-height: 90vh;
	overflow-y: auto;
	position: relative;
}

.mwa-modal-close {
	position: absolute;
	top: 10px;
	right: 15px;
	background: none;
	border: none;
	font-size: 24px;
	cursor: pointer;
	color: #646970;
	padding: 0;
	width: 30px;
	height: 30px;
	display: flex;
	align-items: center;
	justify-content: center;
}

.mwa-modal-close:hover {
	color: #d63638;
}

/* Login page tabs */
.mwa-login-tabs {
	display: flex;
	background: #f0f0f1;
	border-radius: 4px;
	padding: 4px;
	margin-bottom: 20px;
}

.mwa-tab {
	flex: 1;
	padding: 12px 16px;
	text-align: center;
	background: transparent;
	border: none;
	border-radius: 2px;
	color: #646970;
	text-decoration: none;
	font-size: 14px;
	font-weight: 500;
	transition: all 0.15s ease-in-out;
	cursor: pointer;
}

.mwa-tab.active {
	background: #2271b1;
	color: #fff;
}

.mwa-tab:not(.active):hover {
	background: rgba(34, 113, 177, 0.1);
	color: #2271b1;
	text-decoration: none;
}

/* Country search dropdown */
.mwa-country-search {
	position: relative;
}

.mwa-country-search[size] {
	position: absolute;
	top: 100%;
	left: 0;
	right: 0;
	z-index: 1000;
	background: #fff;
	border: 1px solid #8c8f94;
	border-top: none;
	max-height: 200px;
	overflow-y: auto;
}

/* Login method containers */
.mwa-login-method {
	width: 100%;
}

/* User profile phone field */
.user-whatsapp-number-wrap {
	margin-bottom: 20px;
}

/* Responsive design */
@media (max-width: 480px) {
	.mwa-login-form {
		margin: 10px;
		padding: 15px;
	}
	
	.mwa-form-row:has(.mwa-country-select) {
		flex-direction: column;
		gap: 8px;
	}
	
	.mwa-country-select {
		flex: none;
	}
	
	.mwa-input {
		font-size: 16px; /* Prevent zoom on iOS */
	}
	
	.mwa-modal {
		padding: 10px;
	}
	
	.mwa-modal-content,
	.mwa-modal-container {
		max-width: none;
		width: 100%;
	}
}

/* Loading state for buttons */
.mwa-submit-btn.loading .mwa-btn-text {
	opacity: 0;
}

.mwa-submit-btn.loading .mwa-spinner {
	display: block;
}

/* Focus management for accessibility */
.mwa-input:focus-visible {
	outline: 2px solid #2271b1;
	outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
	.mwa-input {
		border-width: 2px;
	}
	
	.mwa-error {
		border-width: 2px;
	}
}

/* Dark mode considerations */
@media (prefers-color-scheme: dark) {
	.mwa-login-form {
		background: #1e1e1e;
		color: #fff;
	}
	
	.mwa-input {
		background: #2a2a2a;
		border-color: #555;
		color: #fff;
	}
	
	.mwa-input:focus {
		border-color: #4f94cd;
	}
	
	.mwa-login-logo h2 {
		color: #fff;
	}
	
	.mwa-modal-content,
	.mwa-modal-container {
		background: #1e1e1e;
		color: #fff;
	}
	
	.mwa-modal-header {
		border-bottom-color: #444;
	}
}