/* دریافت اطلاعات گروه استانی — ویراتیچ / اسمارتایز v2 */

.srf-form-wrapper {
	--srf-bg: #e8e4df;
	--srf-card: #f5f1eb;
	--srf-border: #c4b8a8;
	--srf-shadow-dark: #a89b8a;
	--srf-shadow-light: #ffffff;
	--srf-accent: #2d6a4f;
	--srf-accent-dark: #1b4332;
	--srf-text: #2c2416;
	--srf-muted: #6b5e4e;
	--srf-error: #c0392b;
	--srf-ok: #2d6a4f;
	font-family: "Vazirmatn", "Tahoma", "Segoe UI", sans-serif;
	direction: rtl;
	max-width: 480px;
	width: 100%;
	margin: 1.5rem auto;
	padding: 0.75rem;
	box-sizing: border-box;
	-webkit-text-size-adjust: 100%;
}

.srf-form-wrapper *,
.srf-form-wrapper *::before,
.srf-form-wrapper *::after {
	box-sizing: border-box;
}

.srf-form-card {
	background: linear-gradient(145deg, #f8f4ee, #ebe5db);
	border: 1px solid var(--srf-border);
	border-radius: 18px;
	padding: 1.75rem 1.5rem;
	box-shadow:
		8px 8px 16px var(--srf-shadow-dark),
		-6px -6px 14px var(--srf-shadow-light),
		inset 0 1px 0 rgba(255, 255, 255, 0.7);
	position: relative;
}

.srf-form-card::before {
	content: "";
	position: absolute;
	inset: 6px;
	border-radius: 14px;
	border: 1px solid rgba(255, 255, 255, 0.4);
	pointer-events: none;
}

.srf-form-header {
	text-align: center;
	margin-bottom: 1.5rem;
}

.srf-icon {
	font-size: 2.25rem;
	line-height: 1;
	margin-bottom: 0.4rem;
	filter: drop-shadow(2px 2px 2px rgba(0, 0, 0, 0.15));
}

.srf-title {
	margin: 0 0 0.35rem;
	font-size: clamp(1.05rem, 4.2vw, 1.35rem);
	font-weight: 700;
	color: var(--srf-text);
	line-height: 1.45;
	text-shadow: 1px 1px 0 rgba(255, 255, 255, 0.6);
}

.srf-subtitle {
	margin: 0;
	font-size: 0.88rem;
	color: var(--srf-muted);
}

/* Fields */
.srf-field {
	margin-bottom: 1.1rem;
	position: relative;
}

.srf-field label {
	display: block;
	margin-bottom: 0.35rem;
	font-size: 0.9rem;
	font-weight: 600;
	color: var(--srf-text);
}

.srf-field .required { color: var(--srf-error); }

.srf-field input[type="text"],
.srf-field input[type="tel"],
.srf-field select {
	width: 100%;
	padding: 0.8rem 1rem;
	font-size: 16px; /* prevent iOS zoom */
	font-family: inherit;
	color: var(--srf-text);
	background: linear-gradient(180deg, #f0ebe3, #faf6f0);
	border: 1px solid #b8ab9a;
	border-radius: 10px;
	box-shadow:
		inset 3px 3px 6px rgba(168, 155, 138, 0.45),
		inset -2px -2px 5px rgba(255, 255, 255, 0.8);
	outline: none;
	transition: box-shadow 0.2s, border-color 0.2s;
	-webkit-appearance: none;
	appearance: none;
	min-height: 48px;
}

.srf-field input:focus,
.srf-field select:focus {
	border-color: var(--srf-accent);
	box-shadow:
		inset 3px 3px 6px rgba(168, 155, 138, 0.35),
		inset -2px -2px 5px rgba(255, 255, 255, 0.9),
		0 0 0 3px rgba(45, 106, 79, 0.2);
}

.srf-field select {
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%236b5e4e' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: left 1rem center;
	padding-left: 2.5rem;
	cursor: pointer;
}

.srf-field select:disabled {
	opacity: 0.65;
	cursor: not-allowed;
}

/* Instant feedback states */
.srf-field.is-valid input,
.srf-field.is-valid select {
	border-color: var(--srf-ok);
}

.srf-field.is-invalid input,
.srf-field.is-invalid select {
	border-color: var(--srf-error);
	animation: srf-shake 0.35s ease;
}

@keyframes srf-shake {
	0%, 100% { transform: translateX(0); }
	25% { transform: translateX(-4px); }
	75% { transform: translateX(4px); }
}

.srf-field-hint {
	display: block;
	font-size: 0.78rem;
	margin-top: 0.3rem;
	min-height: 1.1em;
	color: var(--srf-muted);
}

.srf-field.is-invalid .srf-field-hint {
	color: var(--srf-error);
}

.srf-field.is-valid .srf-field-hint {
	color: var(--srf-ok);
}

.srf-field-ok {
	display: none;
	position: absolute;
	left: 12px;
	top: 38px;
	width: 22px;
	height: 22px;
	border-radius: 50%;
	background: var(--srf-ok);
	color: #fff;
	font-size: 12px;
	line-height: 22px;
	text-align: center;
	font-weight: bold;
}

.srf-field.is-valid .srf-field-ok {
	display: block;
}

.srf-field[data-field="mobile"].is-valid .srf-field-ok,
.srf-field[data-field="otp"] .srf-field-ok {
	/* LTR fields: tick on the right visually via left in RTL is ok */
}

/* Buttons */
.srf-actions { margin-top: 1.35rem; }

.srf-submit-btn {
	width: 100%;
	padding: 0.95rem 1.25rem;
	font-size: 1.05rem;
	font-weight: 700;
	font-family: inherit;
	color: #fff;
	background: linear-gradient(180deg, #40916c 0%, #2d6a4f 45%, #1b4332 100%);
	border: 1px solid #1b4332;
	border-radius: 12px;
	cursor: pointer;
	box-shadow:
		0 4px 0 #0d2818,
		0 6px 12px rgba(0, 0, 0, 0.25),
		inset 0 1px 0 rgba(255, 255, 255, 0.25);
	text-shadow: 0 1px 1px rgba(0, 0, 0, 0.3);
	transition: transform 0.1s, box-shadow 0.1s;
	min-height: 52px;
	-webkit-tap-highlight-color: transparent;
}

.srf-submit-btn:hover {
	background: linear-gradient(180deg, #52b788 0%, #40916c 45%, #2d6a4f 100%);
}

.srf-submit-btn:active {
	transform: translateY(3px);
	box-shadow: 0 1px 0 #0d2818, 0 2px 6px rgba(0, 0, 0, 0.2);
}

.srf-submit-btn:disabled {
	opacity: 0.7;
	cursor: not-allowed;
	transform: none;
}

/* OTP step */
.srf-otp-step { text-align: center; }

.srf-otp-desc {
	font-size: 0.95rem;
	color: var(--srf-text);
	line-height: 1.6;
	margin-bottom: 1.25rem;
}

.srf-otp-field input {
	text-align: center;
	letter-spacing: 0.35em;
	font-size: 1.35rem !important;
	font-weight: 700;
}

.srf-otp-footer {
	margin-top: 1rem;
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
	align-items: center;
}

.srf-link-btn {
	background: none;
	border: none;
	color: var(--srf-accent);
	font-family: inherit;
	font-size: 0.9rem;
	cursor: pointer;
	text-decoration: underline;
	padding: 0.4rem;
	min-height: 44px;
}

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

/* Popup — strong */
.srf-popup-overlay {
	position: fixed;
	inset: 0;
	background: rgba(40, 30, 20, 0.6);
	backdrop-filter: blur(5px);
	-webkit-backdrop-filter: blur(5px);
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 99999;
	padding: 1rem;
	animation: srf-fade-in 0.25s ease;
}

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

.srf-popup {
	background: linear-gradient(145deg, #f8f4ee, #ebe5db);
	border: 1px solid var(--srf-border);
	border-radius: 18px;
	padding: 1.75rem 1.35rem;
	max-width: 400px;
	width: 100%;
	text-align: center;
	box-shadow: 10px 10px 28px rgba(0, 0, 0, 0.35), -4px -4px 12px rgba(255, 255, 255, 0.5);
	animation: srf-pop 0.32s cubic-bezier(0.34, 1.56, 0.64, 1);
	max-height: 90vh;
	overflow-y: auto;
}

@keyframes srf-pop {
	from { transform: scale(0.88); opacity: 0; }
	to { transform: scale(1); opacity: 1; }
}

.srf-popup-icon {
	width: 68px;
	height: 68px;
	margin: 0 auto 1rem;
	background: linear-gradient(180deg, #52b788, #2d6a4f);
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 2.1rem;
	color: #fff;
	box-shadow: 0 4px 0 #1b4332, 0 6px 12px rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.srf-popup-content {
	font-size: 1.02rem;
	line-height: 1.75;
	color: var(--srf-text);
	margin-bottom: 1.25rem;
	white-space: pre-wrap;
	word-break: break-word;
}

.srf-popup-actions {
	display: flex;
	flex-direction: column;
	gap: 0.65rem;
	margin-bottom: 1rem;
}

.srf-btn-group {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	padding: 0.9rem 1rem;
	font-size: 1.05rem;
	font-weight: 700;
	font-family: inherit;
	color: #fff;
	text-decoration: none;
	background: linear-gradient(180deg, #40916c, #1b4332);
	border-radius: 12px;
	box-shadow: 0 4px 0 #0d2818, 0 6px 12px rgba(0, 0, 0, 0.2);
	min-height: 52px;
	-webkit-tap-highlight-color: transparent;
}

.srf-btn-group:active {
	transform: translateY(2px);
	box-shadow: 0 1px 0 #0d2818;
}

.srf-btn-copy {
	width: 100%;
	padding: 0.7rem;
	font-size: 0.92rem;
	font-family: inherit;
	font-weight: 600;
	color: var(--srf-text);
	background: linear-gradient(180deg, #f0ebe3, #d9d0c4);
	border: 1px solid #b8ab9a;
	border-radius: 10px;
	cursor: pointer;
	min-height: 46px;
}

.srf-popup-close {
	padding: 0.65rem 2rem;
	font-size: 0.95rem;
	font-weight: 600;
	font-family: inherit;
	color: var(--srf-text);
	background: linear-gradient(180deg, #f0ebe3, #d9d0c4);
	border: 1px solid #b8ab9a;
	border-radius: 10px;
	cursor: pointer;
	box-shadow: 0 3px 0 #a89b8a;
	min-height: 44px;
}

.srf-popup-close:active {
	transform: translateY(2px);
	box-shadow: 0 1px 0 #a89b8a;
}

/* Mobile */
@media (max-width: 480px) {
	.srf-form-wrapper {
		padding: 0.5rem;
		margin: 0.75rem auto;
	}
	.srf-form-card {
		padding: 1.35rem 1.1rem;
		border-radius: 14px;
	}
	.srf-title {
		font-size: 1.1rem;
	}
	.srf-popup {
		padding: 1.4rem 1.1rem;
		border-radius: 14px;
	}
	.srf-field-ok {
		top: 36px;
	}
}

@media (max-width: 360px) {
	.srf-form-card {
		padding: 1.15rem 0.9rem;
	}
	.srf-submit-btn {
		font-size: 0.98rem;
	}
}

/* Safe area for notched phones */
@supports (padding: max(0px)) {
	.srf-popup-overlay {
		padding: max(1rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right)) max(1rem, env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
	}
}
