/**
 * Premium Stylesheet for Multi-Branch Quotation Form
 */

:root {
	--fm-primary-color: #0170B9;
	--fm-primary-hover: #005a96;
	--fm-text-color: #3a3a3a;
	--fm-label-color: #4b4f58;
	--fm-border-color: #e5e5e5;
	--fm-bg-color: #ffffff;
	--fm-focus-shadow: rgba(1, 112, 185, 0.15);
	--fm-font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	--fm-transition-speed: 0.3s;
}

.fm-quotation-form-wrapper {
	font-family: var(--fm-font-family);
	color: var(--fm-text-color);
	line-height: 1.6;
	width: 100%;
	max-width: 100%; /* เปลี่ยนเป็น 100% เพื่อให้ฟอร์มกว้างเต็มภาชนะที่ครอบอยู่ (Full Width) */
	margin: 0 auto;
	padding: 20px 0;
	box-sizing: border-box;
}

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

.fm-form-container {
	background: #ffffff!important;
	border: none!important;
	border-radius: 12px;
	padding: 40px;

}

.fm-form-container:hover {
/* 	box-shadow: 0 15px 40px rgba(0, 0, 0, 0.05); */
}

/* Header section mirroring Elementor demo 100% */
.fm-form-header {
	margin-bottom: 35px;
	text-align: left;
}

.fm-form-title {
	font-size: 32px !important;
	font-weight: 700 !important;
	color: #2c3e50 !important;
	margin: 0 0 12px 0 !important;
	padding: 0 !important;
	line-height: 1.2 !important;
	letter-spacing: -0.5px !important;
}

.fm-form-description {
	font-size: 15px !important;
	color: #424143!important;
	margin: 0 !important;
	line-height: 1.6 !important;
}

/* Grid Layout */
.fm-grid-wrapper {
	display: flex;
	flex-wrap: wrap;
	margin-left: -12px;
	margin-right: -12px;
}

.fm-field-group {
	padding-left: 12px;
	padding-right: 12px;
	margin-bottom: 24px;
	display: flex;
	flex-direction: column;
}

.fm-col-100 {
	width: 100%;
}

.fm-col-50 {
	width: 100%; /* Collapsed on mobile */
}

@media (min-width: 768px) {
	.fm-col-50 {
		width: 50%;
	}
}

/* Field styling */
.fm-label {
	font-size: 14px;
	font-weight: 600;
	color: var(--fm-label-color);
	margin-bottom: 8px;
	text-transform: none;
	display: inline-block;
}

.fm-input,
.fm-select,
.fm-textarea {
	width: 100%;
	height: 48px;
	background-color: #fcfcfc;
	border: 1px solid var(--fm-border-color);
	border-radius: 8px;
	padding: 10px 16px;
	font-size: 15px;
	color: var(--fm-text-color);
	font-family: inherit;
	transition: all var(--fm-transition-speed) ease;
	outline: none;
	-webkit-appearance: none;
	appearance: none;
}

.fm-textarea {
	height: auto;
	resize: vertical;
	padding: 14px 16px;
}

/* Field state classes */
.fm-input:hover,
.fm-select:hover,
.fm-textarea:hover {
	border-color: #cbd5e1;
}

.fm-input:focus,
.fm-select:focus,
.fm-textarea:focus {
	border-color: var(--fm-primary-color);
	background-color: #ffffff;
	box-shadow: 0 0 0 4px var(--fm-focus-shadow);
}

.fm-input.fm-error-field,
.fm-select.fm-error-field,
.fm-textarea.fm-error-field {
	border-color: #e74c3c !important;
	box-shadow: 0 0 0 4px rgba(231, 76, 60, 0.1) !important;
}

/* Select element modifications */
.fm-select-wrapper {
	position: relative;
	width: 100%;
}

.fm-select-wrapper::after {
	content: "";
	position: absolute;
	right: 18px;
	top: 50%;
	transform: translateY(-50%);
	width: 0;
	height: 0;
	border-left: 5px solid transparent;
	border-right: 5px solid transparent;
	border-top: 6px solid #8e95a5;
	pointer-events: none;
	transition: transform var(--fm-transition-speed) ease;
}

.fm-select-wrapper:focus-within::after {
	transform: translateY(-50%) rotate(180deg);
	border-top-color: var(--fm-primary-color);
}

select.fm-select {
	padding-right: 40px !important; /* Add room for the arrow */
	cursor: pointer !important;
	-webkit-appearance: none !important; /* ซ่อนลูกศรดีฟอลต์ใน Safari/Chrome */
	-moz-appearance: none !important;    /* ซ่อนลูกศรดีฟอลต์ใน Firefox */
	appearance: none !important;         /* ซ่อนลูกศรดีฟอลต์มาตรฐาน */
}

select.fm-select::-ms-expand {
	display: none !important;             /* ซ่อนลูกศรใน Internet Explorer / Edge */
}

.fm-select option {
	color: var(--fm-text-color);
	background: #ffffff;
}

/* Checkbox & Acceptance inputs */
.fm-checkbox-group,
.fm-acceptance-group {
	flex-direction: row;
	align-items: flex-start;
	margin-bottom: 18px;
}

.fm-checkbox-label,
.fm-acceptance-label {
	display: inline-flex;
	align-items: flex-start;
	font-size: 14px;
	color: #555c68;
	cursor: pointer;
	user-select: none;
}

.fm-checkbox {
	margin: 4px 10px 0 0;
	width: 18px;
	height: 18px;
	border: 1px solid var(--fm-border-color);
	border-radius: 4px;
	outline: none;
	cursor: pointer;
	-webkit-appearance: checkbox;
	appearance: checkbox;
	flex-shrink: 0;
}

.fm-checkbox-label span,
.fm-acceptance-label span {
	line-height: 1.4;
}

/* Submit Section */
.fm-submit-container {
	margin-top: 15px;
	margin-bottom: 0;
	align-items: flex-start; /* จัดเรียงปุ่มชิดซ้าย (Left aligned) */
}

.fm-submit-button {
	width: auto; /* ไม่เป็นบล็อกเต็มความกว้าง */
	min-width: 160px; /* กำหนดความกว้างปุ่มกำลังพอดี */
	height: 48px;
	background: #5cc8a6; /* สีเขียวมิ้นท์พาสเทลตามรูปที่ 2 */
	border: none;
	border-radius: 100px; /* ดีไซน์เป็นรูปยาแคปซูล/โค้งมนสมบูรณ์ (Pill-shaped) */
	color: #ffffff;
	font-size: 16px;
	font-weight: 600;
	padding: 10px 36px;
	cursor: pointer;
	display: inline-flex;
	justify-content: center;
	align-items: center;
	gap: 10px;
	box-shadow: 0 4px 12px rgba(92, 200, 166, 0.2);
	transition: all var(--fm-transition-speed) ease;
}

.fm-submit-button:hover:not(:disabled) {
	background: #4ab896; /* สีเขียวเข้มขึ้นเล็กน้อยเวลาเมาส์ชี้ */
	box-shadow: 0 6px 20px rgba(92, 200, 166, 0.35);
	transform: translateY(-1px);
}

.fm-submit-button:active:not(:disabled) {
	transform: translateY(0);
}

.fm-submit-button:disabled {
	opacity: 0.6;
	cursor: not-allowed;
}

/* Elegant Spinner */
.fm-spinner {
	width: 20px;
	height: 20px;
	border: 2px solid rgba(255, 255, 255, 0.3);
	border-radius: 50%;
	border-top-color: #ffffff;
	animation: fm-spin 0.8s linear infinite;
}

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

/* Premium modal styles utilizing backdrop filters */
.fm-modal {
	position: fixed;
	top: 0;
	left: 0;
	width: 100vw;
	height: 100vh;
	display: flex;
	justify-content: center;
	align-items: center;
	z-index: 99999;
}

.fm-modal-backdrop {
	position: absolute;
	width: 100%;
	height: 100%;
	background: rgba(15, 23, 42, 0.4);
	backdrop-filter: blur(8px);
	-webkit-backdrop-filter: blur(8px);
	animation: fm-fade-in 0.3s ease forwards;
}

.fm-modal-content {
	position: relative;
	background: #ffffff;
	border-radius: 16px;
	padding: 40px;
	width: 90%;
	max-width: 440px;
	box-shadow: 0 20px 50px rgba(15, 23, 42, 0.15);
	text-align: center;
	z-index: 2;
	transform: scale(0.9);
	opacity: 0;
	animation: fm-modal-pop 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.fm-modal-close {
	position: absolute;
	top: 15px;
	right: 20px;
	background: none;
	border: none;
	font-size: 28px;
	color: #94a3b8;
	cursor: pointer;
	transition: color 0.2s ease;
	line-height: 1;
}

.fm-modal-close:hover {
	color: #334155;
}

.fm-modal-icon-container {
	margin-bottom: 25px;
	display: flex;
	justify-content: center;
}

/* Success SVG Checkmark Animation */
.fm-checkmark-svg, .fm-error-svg {
	width: 80px;
	height: 80px;
	display: block;
}

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

.fm-checkmark-check {
	transform-origin: 50% 50%;
	stroke-dasharray: 48;
	stroke-dashoffset: 48;
	stroke-width: 3;
	stroke: #2ecc71;
	fill: none;
	animation: fm-stroke 0.3s cubic-bezier(0.65, 0, 0.45, 1) 0.6s forwards;
}

/* Error Cross Animation */
.fm-error-circle {
	stroke-dasharray: 166;
	stroke-dashoffset: 166;
	stroke-width: 2;
	stroke: #e74c3c;
	fill: none;
	animation: fm-stroke 0.6s cubic-bezier(0.65, 0, 0.45, 1) forwards;
}

.fm-error-cross {
	stroke-width: 3;
	stroke: #e74c3c;
	fill: none;
	stroke-dasharray: 48;
	stroke-dashoffset: 48;
	animation: fm-stroke 0.3s cubic-bezier(0.65, 0, 0.45, 1) 0.6s forwards;
}

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

.fm-modal-title {
	font-size: 22px !important;
	font-weight: 700 !important;
	color: #0f172a !important;
	margin: 0 0 10px 0 !important;
}

.fm-modal-description {
	font-size: 14.5px !important;
	color: #64748b !important;
	margin: 0 0 25px 0 !important;
	line-height: 1.5 !important;
}

.fm-modal-button {
	background: #0f172a;
	color: #ffffff;
	border: none;
	border-radius: 8px;
	padding: 12px 30px;
	font-size: 15px;
	font-weight: 600;
	cursor: pointer;
	width: 100%;
	transition: background 0.2s ease;
}

.fm-modal-button:hover {
	background: #1e293b;
}

@keyframes fm-fade-in {
	to { opacity: 1; }
}

@keyframes fm-modal-pop {
	to {
		transform: scale(1);
		opacity: 1;
	}
}

/* Validation error text labels under inputs */
.fm-error-msg {
	color: #e74c3c;
	font-size: 12px;
	margin-top: 6px;
	font-weight: 500;
	display: block;
	animation: fm-fade-in 0.2s ease forwards;
}

/* Required Asterisk */
.fm-required {
	color: #e74c3c;
}

/* Radio groups styling */
.fm-radio-group {
	margin-bottom: 24px;
}

.fm-radio-options {
	display: flex;
	gap: 24px;
	margin-top: 8px;
	flex-wrap: wrap;
}

.fm-radio-label {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	font-size: 15px;
	color: var(--fm-label-color);
	cursor: pointer;
	user-select: none;
	transition: color var(--fm-transition-speed) ease;
}

.fm-radio-label:hover {
	color: var(--fm-primary-color);
}

.fm-radio {
	-webkit-appearance: none;
	appearance: none;
	width: 20px;
	height: 20px;
	border: 2px solid var(--fm-border-color);
	border-radius: 50%;
	outline: none;
	cursor: pointer;
	position: relative;
	transition: all var(--fm-transition-speed) ease;
	background-color: #ffffff;
	flex-shrink: 0;
	margin: 0;
}

.fm-radio:hover {
	border-color: #cbd5e1;
}

.fm-radio:checked {
	border-color: var(--fm-primary-color);
}

.fm-radio:checked::after {
	content: "";
	position: absolute;
	width: 10px;
	height: 10px;
	background-color: var(--fm-primary-color);
	border-radius: 50%;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	animation: fm-radio-pop 0.2s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes fm-radio-pop {
	0% { transform: translate(-50%, -50%) scale(0); }
	100% { transform: translate(-50%, -50%) scale(1); }
}

/* Animations for sliding elements in dynamically */
.fm-field-group {
	opacity: 1;
	transform: translateY(0);
	transition: opacity 0.35s ease, transform 0.35s ease;
}

.fm-field-group-hidden {
	display: none !important;
	opacity: 0 !important;
	transform: translateY(-10px) !important;
}

