/**
 * Alkasim Form — Universal Frontend Form Stylesheet
 * Provided by Alkasim &bull; Developed by Muhammad Husnain
 */

/* Container */
.af-form-container {
	box-sizing: border-box;
	max-width: 100%;
	margin: 20px 0;
	font-family: inherit;
	line-height: 1.5;
}

.af-form-container *,
.af-form-container *::before,
.af-form-container *::after {
	box-sizing: border-box;
}

/* Alert Notification Boxes */
.af-alert-box {
	padding: 14px 18px;
	border-radius: 6px;
	margin-bottom: 20px;
	font-size: 14px;
	line-height: 1.5;
}

.af-alert-box.af-alert-success {
	display: none !important;
}

.af-alert-box.af-alert-error {
	background-color: #fef2f2;
	border: 1px solid #fecaca;
	color: #991b1b;
}

.af-form-notice {
	padding: 16px 20px;
	border-radius: 8px;
	margin: 20px 0;
	font-size: 14px;
}

.af-notice-warning {
	background: #fffbeb;
	border: 1px solid #fde68a;
	color: #92400e;
}

.af-notice-inactive {
	background: #f8fafc;
	border: 1px solid #e2e8f0;
	color: #64748b;
}

/* Grid System */
.af-grid {
	display: flex;
	flex-wrap: wrap;
	margin: -10px;
}

.af-field-wrapper {
	padding: 10px;
	width: 100%;
}

.af-col-12 { width: 100%; }
.af-col-6  { width: 50%; }
.af-col-4  { width: 33.333%; }
.af-col-3  { width: 25%; }

/* Labels & Descriptions */
.af-field-label {
	display: block;
	margin-bottom: 6px;
	font-size: 14px;
	font-weight: 600;
	color: #1e293b;
}

.af-required-mark {
	color: #ef4444;
}

.af-field-description {
	margin: 6px 0 0;
	font-size: 12px;
	color: #64748b;
}

/* Input Elements */
.af-input {
	width: 100%;
	padding: 10px 14px;
	font-size: 14px;
	line-height: 1.4;
	color: #1e293b;
	background-color: #ffffff;
	border: 1px solid #cbd5e1;
	border-radius: 6px;
	outline: none;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
	font-family: inherit;
}

.af-input:focus {
	border-color: #2563eb;
	box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.af-input.af-textarea {
	min-height: 100px;
	resize: vertical;
}

.af-input-group {
	display: flex;
	align-items: center;
	position: relative;
}

.af-input-prefix {
	padding: 10px 12px;
	background: #f1f5f9;
	border: 1px solid #cbd5e1;
	border-right: none;
	border-radius: 6px 0 0 6px;
	color: #64748b;
	font-weight: 600;
	font-size: 14px;
}

.af-input-group .af-input {
	border-top-left-radius: 0;
	border-bottom-left-radius: 0;
}

/* Choices (Radio & Checkbox) */
.af-choice-list {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.af-choice-item {
	display: flex;
	align-items: center;
	gap: 8px;
	font-size: 14px;
	cursor: pointer;
	color: #334155;
}

.af-choice-item input[type="radio"],
.af-choice-item input[type="checkbox"] {
	width: 16px;
	height: 16px;
	margin: 0;
	cursor: pointer;
}

/* Button Group */
.af-button-group {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
}

.af-btn-radio {
	display: none;
}

.af-btn-choice {
	padding: 8px 16px;
	border: 1px solid #cbd5e1;
	border-radius: 6px;
	font-size: 13px;
	cursor: pointer;
	background: #ffffff;
	transition: all 0.15s ease;
}

.af-btn-radio:checked + .af-btn-choice {
	background: #2563eb;
	color: #ffffff;
	border-color: #2563eb;
}

/* Range Slider */
.af-range-wrap {
	display: flex;
	align-items: center;
	gap: 12px;
}

.af-range-slider {
	flex: 1;
	cursor: pointer;
}

.af-range-badge {
	min-width: 40px;
	padding: 4px 8px;
	background: #f1f5f9;
	border: 1px solid #cbd5e1;
	border-radius: 4px;
	font-weight: 600;
	font-size: 13px;
	text-align: center;
}

/* File Upload Dropzone */
.af-upload-dropzone {
	border: 2px dashed #cbd5e1;
	border-radius: 8px;
	padding: 24px;
	text-align: center;
	background: #f8fafc;
	cursor: pointer;
	position: relative;
	transition: all 0.2s ease;
}

.af-upload-dropzone:hover {
	border-color: #2563eb;
	background: #eff6ff;
}

.af-upload-prompt {
	margin: 6px 0 0;
	font-size: 13px;
	color: #64748b;
}

.af-file-input {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	opacity: 0;
	cursor: pointer;
}

.af-upload-filename {
	margin-top: 8px;
	font-size: 12px;
	font-weight: 600;
	color: #2563eb;
}

/* Signature Pad */
.af-signature-wrapper {
	border: 1px solid #cbd5e1;
	border-radius: 6px;
	background: #ffffff;
	padding: 10px;
	display: inline-block;
	max-width: 100%;
}

.af-signature-canvas {
	border: 1px dashed #e2e8f0;
	border-radius: 4px;
	background: #ffffff;
	cursor: crosshair;
	touch-action: none;
	max-width: 100%;
	height: auto;
}

.af-signature-actions {
	margin-top: 6px;
	text-align: right;
}

/* Star Rating */
.af-stars-rating {
	display: inline-flex;
	flex-direction: row-reverse;
	gap: 4px;
	font-size: 28px;
}

.af-stars-rating input {
	display: none;
}

.af-stars-rating label {
	color: #cbd5e1;
	cursor: pointer;
	transition: color 0.15s ease;
}

.af-stars-rating label:hover,
.af-stars-rating label:hover ~ label,
.af-stars-rating input:checked ~ label {
	color: #f59e0b;
}

/* Emoji Rating */
.af-emoji-rating {
	display: flex;
	gap: 12px;
	font-size: 26px;
}

.af-emoji-item input {
	display: none;
}

.af-emoji-glyph {
	cursor: pointer;
	filter: grayscale(80%);
	transition: filter 0.15s ease, transform 0.15s ease;
	display: inline-block;
}

.af-emoji-item input:checked + .af-emoji-glyph,
.af-emoji-glyph:hover {
	filter: grayscale(0%);
	transform: scale(1.2);
}

/* NPS Scale */
.af-nps-bar {
	display: flex;
	border: 1px solid #cbd5e1;
	border-radius: 6px;
	overflow: hidden;
	background: #ffffff;
}

.af-nps-item {
	flex: 1;
	text-align: center;
	cursor: pointer;
	border-right: 1px solid #cbd5e1;
}

.af-nps-item:last-child {
	border-right: none;
}

.af-nps-item input {
	display: none;
}

.af-nps-item span {
	display: block;
	padding: 10px 4px;
	font-size: 13px;
	font-weight: 600;
	transition: background 0.15s ease;
}

.af-nps-item input:checked + span,
.af-nps-item:hover span {
	background: #2563eb;
	color: #ffffff;
}

.af-nps-labels {
	display: flex;
	justify-content: space-between;
	font-size: 11px;
	color: #64748b;
	margin-top: 4px;
}

/* Math CAPTCHA */
.af-math-captcha {
	display: flex;
	align-items: center;
	gap: 10px;
}

.af-math-problem {
	font-size: 16px;
	font-weight: 700;
	background: #f1f5f9;
	padding: 8px 14px;
	border-radius: 6px;
	border: 1px solid #cbd5e1;
	user-select: none;
}

.af-captcha-input {
	max-width: 120px;
}

/* Submit Button */
.af-submit-wrapper {
	margin-top: 10px;
	width: auto;
	max-width: 100%;
	display: inline-flex;
	align-items: center;
}

.af-submit-btn {
	display: inline-flex !important;
	align-items: center;
	justify-content: center;
	width: auto !important;
	max-width: 100%;
	padding: 12px 28px;
	font-size: 15px;
	font-weight: 600;
	color: #ffffff;
	background-color: #2563eb;
	border: none;
	border-radius: 6px;
	cursor: pointer;
	white-space: nowrap;
	box-sizing: border-box;
	transition: background 0.2s ease, opacity 0.2s ease, transform 0.15s ease;
}

.af-submit-btn:hover {
	background-color: #1d4ed8;
}

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

/* Responsive Breakpoints & Mobile Optimization */
@media (max-width: 768px) {
	.af-grid {
		margin: -6px;
	}
	.af-field-wrapper {
		padding: 6px;
	}
	.af-col-6,
	.af-col-4,
	.af-col-3 {
		width: 100% !important;
	}
	.af-nps-bar {
		flex-wrap: wrap;
	}
	.af-nps-item {
		flex: 0 0 20%;
		border-bottom: 1px solid #cbd5e1;
	}
}

@media (max-width: 600px) {
	.af-form-wrapper {
		padding: 16px 12px !important;
		margin: 0 !important;
		max-width: 100% !important;
		box-sizing: border-box !important;
	}
	.af-grid {
		margin: 0 !important;
	}
	.af-field-wrapper {
		padding: 6px 0 !important;
		width: 100% !important;
	}
	.af-input {
		font-size: 16px !important; /* Prevents auto-zoom on iOS Safari */
		padding: 10px 12px;
	}
	.af-submit-wrapper {
		width: auto;
		max-width: 100%;
	}
	.af-submit-btn {
		width: auto !important;
		max-width: 100%;
		padding: 12px 24px;
		font-size: 15px;
	}
	.af-signature-canvas-wrap canvas {
		max-width: 100% !important;
		height: auto !important;
	}
	.af-nps-item {
		flex: 0 0 33.333%;
	}
}

/* ====================================================
 * Form Header: Site Logo & Dynamic Form Name Heading
 * ==================================================== */
.af-form-header {
	margin-bottom: 24px;
	padding-bottom: 16px;
	border-bottom: 1px solid #e2e8f0;
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.af-form-header.af-logo-align-center {
	text-align: center;
}
.af-form-header.af-logo-align-right {
	text-align: right;
}

/* Logo Wrapper */
.af-form-container .af-form-logo-wrap,
.af-form-header .af-form-logo-wrap,
.af-form-logo-wrap {
	display: flex !important;
	width: 100% !important;
	line-height: 1 !important;
	margin: 0 0 10px 0 !important;
	padding: 0 !important;
}

.af-form-logo-wrap.af-logo-align-left {
	justify-content: flex-start !important;
}
.af-form-logo-wrap.af-logo-align-center {
	justify-content: center !important;
}
.af-form-logo-wrap.af-logo-align-right {
	justify-content: flex-end !important;
}

/* Bulletproof Standard Logo Dimensions */
.af-form-container img.af-form-logo,
.af-form-header img.af-form-logo,
.af-form-logo-wrap img.af-form-logo,
img.af-form-logo {
	max-height: 50px !important;
	max-width: 200px !important;
	width: auto !important;
	height: auto !important;
	object-fit: contain !important;
	display: inline-block !important;
	vertical-align: middle !important;
	border: none !important;
	border-radius: 0 !important;
	box-shadow: none !important;
	background: transparent !important;
	padding: 0 !important;
	margin: 0 !important;
}

/* Standard Size Variations */
.af-form-container img.af-form-logo.af-logo-size-small,
img.af-form-logo.af-logo-size-small {
	max-height: 36px !important;
	max-width: 150px !important;
}

.af-form-container img.af-form-logo.af-logo-size-standard,
img.af-form-logo.af-logo-size-standard {
	max-height: 50px !important;
	max-width: 200px !important;
}

.af-form-container img.af-form-logo.af-logo-size-large,
img.af-form-logo.af-logo-size-large {
	max-height: 68px !important;
	max-width: 260px !important;
}

.af-form-container img.af-form-logo.af-logo-size-xlarge,
img.af-form-logo.af-logo-size-xlarge {
	max-height: 85px !important;
	max-width: 320px !important;
}

.af-form-heading-wrap {
	flex: 1;
}

.af-form-title {
	margin: 0;
	font-size: 24px;
	font-weight: 700;
	line-height: 1.3;
	color: #0f172a;
	word-break: break-word;
}

.af-form-subtitle {
	margin: 4px 0 0;
	font-size: 14px;
	color: #64748b;
	line-height: 1.5;
}

/* Thank-You Popup Logo */
.af-thankyou-logo-wrap {
	display: flex !important;
	justify-content: center !important;
	width: 100% !important;
	margin: 10px 0 14px !important;
}

.af-thankyou-card img.af-thankyou-logo,
img.af-thankyou-logo {
	max-height: 48px !important;
	max-width: 180px !important;
	width: auto !important;
	height: auto !important;
	object-fit: contain !important;
	display: inline-block !important;
	border: 0 !important;
	box-shadow: none !important;
	background: transparent !important;
	margin: 0 auto !important;
}

/* ====================================================
 * Advanced Thank-You Popup Modal (10s Auto-Close)
 * ==================================================== */
body.af-modal-open {
	overflow: hidden !important;
}

.af-thankyou-overlay {
	position: fixed !important;
	inset: 0 !important;
	top: 0 !important;
	left: 0 !important;
	right: 0 !important;
	bottom: 0 !important;
	width: 100vw !important;
	height: 100vh !important;
	z-index: 99999999 !important;
	display: flex !important;
	align-items: center !important;
	justify-content: center !important;
	padding: 20px !important;
	box-sizing: border-box !important;
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

.af-thankyou-overlay.af-visible {
	opacity: 1 !important;
	pointer-events: auto !important;
}

.af-thankyou-overlay.af-closing {
	opacity: 0 !important;
	pointer-events: none !important;
}

.af-thankyou-backdrop {
	position: absolute;
	inset: 0;
	background: rgba(15, 23, 42, 0.65);
	backdrop-filter: blur(8px);
	-webkit-backdrop-filter: blur(8px);
}

.af-thankyou-card {
	position: relative;
	z-index: 2;
	width: 100%;
	max-width: 480px;
	max-height: 90vh;
	overflow-y: auto;
	background: #ffffff;
	border-radius: 20px;
	padding: 36px 30px 28px;
	text-align: center;
	box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(0, 0, 0, 0.06);
	transform: scale(0.92) translateY(16px);
	transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
	box-sizing: border-box;
}

.af-thankyou-overlay.af-visible .af-thankyou-card {
	transform: scale(1) translateY(0);
}

.af-thankyou-overlay.af-closing .af-thankyou-card {
	transform: scale(0.95) translateY(8px);
	opacity: 0;
}

.af-thankyou-close-btn {
	position: absolute;
	top: 14px;
	right: 14px;
	width: 34px;
	height: 34px;
	border-radius: 50%;
	background: #f1f5f9;
	border: none;
	color: #64748b;
	font-size: 24px;
	line-height: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	transition: all 0.2s ease;
	z-index: 5;
	padding: 0;
}

.af-thankyou-close-btn:hover {
	background: #e2e8f0;
	color: #0f172a;
	transform: rotate(90deg);
}

.af-thankyou-icon-wrap {
	margin: 0 auto 16px;
	display: flex;
	justify-content: center;
}

.af-thankyou-icon-circle {
	width: 64px;
	height: 64px;
	border-radius: 50%;
	background: #dcfce7;
	color: #16a34a;
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: 0 0 0 8px rgba(34, 197, 94, 0.12);
	animation: afCheckmarkPulse 2s infinite;
}

@keyframes afCheckmarkPulse {
	0% {
		box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.35);
	}
	70% {
		box-shadow: 0 0 0 14px rgba(34, 197, 94, 0);
	}
	100% {
		box-shadow: 0 0 0 0 rgba(34, 197, 94, 0);
	}
}

.af-thankyou-logo-wrap {
	margin-bottom: 12px;
	display: flex;
	justify-content: center;
}

.af-thankyou-logo {
	max-height: 38px;
	max-width: 150px;
	height: auto;
	width: auto;
	object-fit: contain;
	display: inline-block;
}

.af-thankyou-title {
	font-size: 20px;
	font-weight: 700;
	color: #0f172a;
	margin: 0 0 10px;
	line-height: 1.35;
	word-break: break-word;
}

.af-thankyou-message {
	font-size: 15px;
	color: #475569;
	line-height: 1.6;
	margin: 0 0 22px;
	word-break: break-word;
}

.af-thankyou-timer-wrap {
	margin: 0 0 20px;
}

.af-thankyou-progress-track {
	width: 100%;
	height: 5px;
	background: #e2e8f0;
	border-radius: 9999px;
	overflow: hidden;
	margin-bottom: 8px;
}

.af-thankyou-progress-bar {
	height: 100%;
	width: 100%;
	background: linear-gradient(90deg, #2563eb, #38bdf8);
	border-radius: 9999px;
	transition: width 10s linear;
}

.af-thankyou-timer-text {
	font-size: 12px;
	color: #64748b;
}

.af-thankyou-timer-text strong {
	color: #2563eb;
	font-weight: 700;
}

.af-thankyou-actions {
	display: flex;
	justify-content: center;
}

.af-thankyou-dismiss-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 120px;
	padding: 10px 24px;
	font-size: 14px;
	font-weight: 600;
	color: #ffffff;
	background: #2563eb;
	border: none;
	border-radius: 8px;
	cursor: pointer;
	transition: background 0.2s ease, transform 0.15s ease;
}

.af-thankyou-dismiss-btn:hover {
	background: #1d4ed8;
	transform: translateY(-1px);
}

/* Dark theme modal styling adaptation */
.af-thankyou-overlay.af-template-dark-luxury .af-thankyou-card {
	background: #0f172a;
	border: 1px solid #1e293b;
	color: #f8fafc;
	box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
}

.af-thankyou-overlay.af-template-dark-luxury .af-thankyou-title {
	color: #ffffff;
}

.af-thankyou-overlay.af-template-dark-luxury .af-thankyou-message {
	color: #94a3b8;
}

.af-thankyou-overlay.af-template-dark-luxury .af-thankyou-close-btn {
	background: #1e293b;
	color: #94a3b8;
}

.af-thankyou-overlay.af-template-dark-luxury .af-thankyou-close-btn:hover {
	background: #334155;
	color: #ffffff;
}

.af-thankyou-overlay.af-template-dark-luxury .af-thankyou-progress-track {
	background: #1e293b;
}

.af-thankyou-overlay.af-template-dark-luxury .af-thankyou-progress-bar {
	background: linear-gradient(90deg, #d97706, #f59e0b);
}

.af-thankyou-overlay.af-template-dark-luxury .af-thankyou-dismiss-btn {
	background: #d97706;
}

.af-thankyou-overlay.af-template-dark-luxury .af-thankyou-dismiss-btn:hover {
	background: #b45309;
}

/* Mobile Responsiveness for Thank-You Popup */
@media (max-width: 600px) {
	.af-thankyou-card {
		padding: 28px 20px 22px;
		border-radius: 16px;
		max-width: 94vw;
	}

	.af-thankyou-icon-circle {
		width: 54px;
		height: 54px;
	}

	.af-thankyou-icon-circle svg {
		width: 28px;
		height: 28px;
	}

	.af-thankyou-title {
		font-size: 18px;
	}

	.af-thankyou-message {
		font-size: 14px;
		line-height: 1.5;
	}

	.af-thankyou-close-btn {
		width: 36px;
		height: 36px;
		font-size: 26px;
	}

	.af-form-header {
		margin-bottom: 18px;
		padding-bottom: 12px;
	}

	.af-form-logo {
		max-height: 44px;
		max-width: 170px;
	}

	.af-form-title {
		font-size: 20px;
	}
}

/* ============================================================
   ADVANCED INPUT FIELD VALIDATION & FORMATTING STYLES
   ============================================================ */
.af-input.af-input-invalid,
.af-select.af-input-invalid,
.af-textarea.af-input-invalid {
	border-color: #ef4444 !important;
	background-color: #fef2f2 !important;
	box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15) !important;
}

.af-field-error {
	color: #ef4444;
	font-size: 12px;
	margin-top: 5px;
	font-weight: 500;
	line-height: 1.4;
	display: flex;
	align-items: center;
	gap: 5px;
	animation: afErrorFadeIn 0.2s ease;
}

.af-field-error svg {
	flex-shrink: 0;
}

@keyframes afErrorFadeIn {
	from { opacity: 0; transform: translateY(-3px); }
	to { opacity: 1; transform: translateY(0); }
}

/* Character counter for textareas */
.af-char-counter {
	font-size: 11px;
	color: #64748b;
	text-align: right;
	margin-top: 4px;
	font-variant-numeric: tabular-nums;
	transition: color 0.15s ease;
}

.af-char-counter.af-char-limit-reached {
	color: #ef4444;
	font-weight: 600;
}

/* Single Checkbox Hyperlink */
.af-checkbox-link {
	color: #2563eb;
	text-decoration: underline;
	font-weight: 600;
	cursor: pointer;
	position: relative;
	z-index: 2;
	transition: color 0.15s ease, text-decoration-color 0.15s ease;
}

.af-checkbox-link:hover {
	color: #1d4ed8;
	text-decoration: underline;
}

/* CNIC & Numeric formatting tweaks */
.af-cnic-input {
	letter-spacing: 0.8px;
	font-variant-numeric: tabular-nums;
}
