/*
 * WP Booking Engine — Public Quote Form
 *
 * Intentionally theme-agnostic. All colours and radii are driven by CSS custom
 * properties so operators can override them from their theme without touching
 * plugin files.
 *
 * BEM naming: .wbe-quote-form__[element]--[modifier]
 */

/* ─── Custom properties (overridable from theme) ────────────────────────── */

.wbe-quote-form {
	--wbe-font:              inherit;

	--wbe-color-bg:          #ffffff;
	--wbe-color-border:      #e2e8f0;
	--wbe-color-text:        #1a202c;
	--wbe-color-label:       #4a5568;
	--wbe-color-input-bg:    #f7fafc;
	--wbe-color-input-focus: #3182ce;

	--wbe-color-btn-bg:      #2b6cb0;
	--wbe-color-btn-text:    #ffffff;
	--wbe-color-btn-hover:   #2c5282;

	--wbe-color-ok-bg:       #f0fff4;
	--wbe-color-ok-border:   #68d391;
	--wbe-color-ok-text:     #22543d;
	--wbe-color-ok-accent:   #276749;

	--wbe-color-warn-bg:     #fffaf0;
	--wbe-color-warn-border: #f6ad55;
	--wbe-color-warn-text:   #7b341e;

	--wbe-color-err-bg:      #fff5f5;
	--wbe-color-err-border:  #fc8181;
	--wbe-color-err-text:    #742a2a;

	--wbe-radius:            8px;
	--wbe-radius-sm:         6px;
	--wbe-gap:               0.75rem;
	--wbe-transition:        160ms ease;

	box-sizing: border-box;
	font-family: var(--wbe-font);
	max-width: 680px;
}

.wbe-quote-form *,
.wbe-quote-form *::before,
.wbe-quote-form *::after {
	box-sizing: inherit;
}

/* ─── Form layout ───────────────────────────────────────────────────────── */

.wbe-quote-form__form {
	display: flex;
	flex-direction: column;
	gap: var(--wbe-gap);
}

.wbe-quote-form__fields {
	display: flex;
	flex-wrap: wrap;
	gap: var(--wbe-gap);
}

/* ─── Field (label wraps input for native accessibility) ────────────────── */

.wbe-quote-form__field {
	display: flex;
	flex-direction: column;
	gap: 0.3rem;
	flex: 1 1 160px;
	cursor: pointer;
}

.wbe-quote-form__field--guests {
	flex: 0 1 110px;
}

.wbe-quote-form__label {
	font-size: 0.8125rem;
	font-weight: 600;
	letter-spacing: 0.02em;
	text-transform: uppercase;
	color: var(--wbe-color-label);
	user-select: none;
}

/* ─── Inputs ────────────────────────────────────────────────────────────── */

.wbe-quote-form__input {
	appearance: none;
	-webkit-appearance: none;
	width: 100%;
	padding: 0.5rem 0.625rem;
	background: var(--wbe-color-input-bg);
	border: 1.5px solid var(--wbe-color-border);
	border-radius: var(--wbe-radius-sm);
	color: var(--wbe-color-text);
	font: inherit;
	font-size: 0.9375rem;
	line-height: 1.4;
	transition: border-color var(--wbe-transition), box-shadow var(--wbe-transition);
}

.wbe-quote-form__input:focus {
	outline: none;
	border-color: var(--wbe-color-input-focus);
	box-shadow: 0 0 0 3px color-mix(in srgb, var(--wbe-color-input-focus) 20%, transparent);
}

.wbe-quote-form__input--number {
	text-align: center;
}

/* ─── Submit button ─────────────────────────────────────────────────────── */

.wbe-quote-form__submit {
	align-self: flex-start;
	padding: 0.55rem 1.4rem;
	background: var(--wbe-color-btn-bg);
	border: none;
	border-radius: var(--wbe-radius-sm);
	color: var(--wbe-color-btn-text);
	font: inherit;
	font-size: 0.9375rem;
	font-weight: 600;
	cursor: pointer;
	transition: background var(--wbe-transition), transform var(--wbe-transition);
	white-space: nowrap;
}

.wbe-quote-form__submit:hover {
	background: var(--wbe-color-btn-hover);
}

.wbe-quote-form__submit:active {
	transform: translateY(1px);
}

.wbe-quote-form__submit:disabled {
	opacity: 0.6;
	cursor: not-allowed;
	transform: none;
}

/* ─── Result panel ──────────────────────────────────────────────────────── */

.wbe-quote-form__result {
	border-radius: var(--wbe-radius);
	padding: 0.875rem 1rem;
	font-size: 0.9375rem;
	line-height: 1.5;
}

.wbe-quote-form__result[hidden] {
	display: none;
}

/* Loading */

.wbe-quote-form__result--loading {
	background: var(--wbe-color-input-bg);
	border: 1.5px solid var(--wbe-color-border);
	color: var(--wbe-color-label);
}

.wbe-quote-form__loading {
	display: flex;
	align-items: center;
	gap: 0.5rem;
}

.wbe-quote-form__loading::before {
	content: '';
	display: inline-block;
	width: 1em;
	height: 1em;
	border: 2px solid var(--wbe-color-border);
	border-top-color: var(--wbe-color-input-focus);
	border-radius: 50%;
	flex-shrink: 0;
	animation: wbe-spin 0.7s linear infinite;
}

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

/* Available */

.wbe-quote-form__result--available {
	background: var(--wbe-color-ok-bg);
	border: 1.5px solid var(--wbe-color-ok-border);
	color: var(--wbe-color-ok-text);
}

.wbe-quote-form__quote {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 0.5rem 1rem;
}

.wbe-quote-form__quote-status {
	font-weight: 700;
	font-size: 0.9375rem;
	color: var(--wbe-color-ok-accent);
	text-transform: uppercase;
	letter-spacing: 0.04em;
}

.wbe-quote-form__quote-nights {
	color: var(--wbe-color-ok-text);
	font-size: 0.875rem;
}

.wbe-quote-form__quote-total {
	margin-left: auto;
	text-align: right;
}

.wbe-quote-form__quote-total-label {
	display: block;
	font-size: 0.75rem;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: var(--wbe-color-ok-accent);
	opacity: 0.8;
}

.wbe-quote-form__quote-total-amount {
	display: block;
	font-size: 1.5rem;
	font-weight: 700;
	line-height: 1.1;
	color: var(--wbe-color-ok-accent);
}

/* Unavailable */

.wbe-quote-form__result--unavailable {
	background: var(--wbe-color-warn-bg);
	border: 1.5px solid var(--wbe-color-warn-border);
	color: var(--wbe-color-warn-text);
}

/* Error */

.wbe-quote-form__result--error {
	background: var(--wbe-color-err-bg);
	border: 1.5px solid var(--wbe-color-err-border);
	color: var(--wbe-color-err-text);
}

/* ─── Select ────────────────────────────────────────────────────────────── */

.wbe-quote-form__input--select {
	cursor: pointer;
	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='%234a5568' d='M6 8 0 0h12z'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 0.7rem center;
	padding-right: 2rem;
}

.wbe-quote-form__field--resource {
	flex: 1 1 100%;
}

/* ─── Contact step ──────────────────────────────────────────────────────── */

.wbe-quote-form__contact {
	margin-top: 0.5rem;
	padding-top: 1rem;
	border-top: 1.5px solid var(--wbe-color-border);
	display: flex;
	flex-direction: column;
	gap: var(--wbe-gap);
}

.wbe-quote-form__contact[hidden] {
	display: none;
}

.wbe-quote-form__contact-intro {
	margin: 0;
	font-size: 0.9375rem;
	color: var(--wbe-color-label);
}

.wbe-quote-form__field--message {
	flex: 1 1 100%;
	cursor: auto;
}

.wbe-quote-form__textarea {
	resize: vertical;
	min-height: 3.5rem;
	font-size: 0.9375rem;
}

/* ─── Request button ────────────────────────────────────────────────────── */

.wbe-quote-form__request {
	align-self: flex-start;
	padding: 0.55rem 1.4rem;
	background: var(--wbe-color-btn-bg);
	border: none;
	border-radius: var(--wbe-radius-sm);
	color: var(--wbe-color-btn-text);
	font: inherit;
	font-size: 0.9375rem;
	font-weight: 600;
	cursor: pointer;
	transition: background var(--wbe-transition), transform var(--wbe-transition);
	white-space: nowrap;
}

.wbe-quote-form__request:hover {
	background: var(--wbe-color-btn-hover);
}

.wbe-quote-form__request:active {
	transform: translateY(1px);
}

.wbe-quote-form__request:disabled {
	opacity: 0.6;
	cursor: not-allowed;
	transform: none;
}

/* ─── Request result + success ──────────────────────────────────────────── */

.wbe-quote-form__request-result {
	border-radius: var(--wbe-radius);
	padding: 0.75rem 1rem;
	font-size: 0.9375rem;
	line-height: 1.5;
}

.wbe-quote-form__request-result[hidden] {
	display: none;
}

.wbe-quote-form__request-result--loading {
	background: var(--wbe-color-input-bg);
	border: 1.5px solid var(--wbe-color-border);
	color: var(--wbe-color-label);
}

.wbe-quote-form__request-result--error {
	background: var(--wbe-color-err-bg);
	border: 1.5px solid var(--wbe-color-err-border);
	color: var(--wbe-color-err-text);
}

.wbe-quote-form__success {
	background: var(--wbe-color-ok-bg);
	border: 1.5px solid var(--wbe-color-ok-border);
	color: var(--wbe-color-ok-text);
	border-radius: var(--wbe-radius);
	padding: 1.25rem 1.5rem;
	font-size: 1rem;
	line-height: 1.55;
}

/* ─── Calendar ──────────────────────────────────────────────────────────── */

.wbe-quote-form__calendar {
	border: 1.5px solid var(--wbe-color-border);
	border-radius: var(--wbe-radius);
	padding: 0.75rem;
}

.wbe-quote-form__calendar-hint {
	display: block;
	padding: 1rem;
	text-align: center;
	color: var(--wbe-color-label);
	font-size: 0.9375rem;
}

.wbe-cal__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 0.5rem;
}

.wbe-cal__title {
	font-weight: 700;
	font-size: 0.9375rem;
	color: var(--wbe-color-text);
	text-transform: capitalize;
}

.wbe-cal__nav {
	width: 2rem;
	height: 2rem;
	display: flex;
	align-items: center;
	justify-content: center;
	background: var(--wbe-color-input-bg);
	border: 1.5px solid var(--wbe-color-border);
	border-radius: var(--wbe-radius-sm);
	color: var(--wbe-color-text);
	font-size: 1.1rem;
	line-height: 1;
	cursor: pointer;
	transition: background var(--wbe-transition);
}

.wbe-cal__nav:hover:not(:disabled) {
	background: var(--wbe-color-border);
}

.wbe-cal__nav:disabled {
	opacity: 0.35;
	cursor: not-allowed;
}

.wbe-cal__grid {
	display: grid;
	grid-template-columns: repeat(7, 1fr);
	gap: 2px;
}

.wbe-cal__grid--weekdays {
	margin-bottom: 2px;
}

.wbe-cal__weekday {
	text-align: center;
	font-size: 0.6875rem;
	font-weight: 600;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: var(--wbe-color-label);
	padding: 0.25rem 0;
}

.wbe-cal__day {
	aspect-ratio: 1 / 1;
	display: flex;
	align-items: center;
	justify-content: center;
	background: var(--wbe-color-input-bg);
	border: none;
	border-radius: var(--wbe-radius-sm);
	color: var(--wbe-color-text);
	font: inherit;
	font-size: 0.875rem;
	cursor: pointer;
	transition: background var(--wbe-transition), color var(--wbe-transition);
}

.wbe-cal__day:hover:not(:disabled):not(.wbe-cal__day--past):not(.wbe-cal__day--unavailable) {
	background: var(--wbe-color-border);
}

.wbe-cal__day--empty {
	background: transparent;
	cursor: default;
}

.wbe-cal__day--past {
	color: var(--wbe-color-border);
	background: transparent;
	cursor: not-allowed;
}

.wbe-cal__day--unavailable {
	color: var(--wbe-color-label);
	background: repeating-linear-gradient(
		-45deg,
		var(--wbe-color-input-bg),
		var(--wbe-color-input-bg) 4px,
		var(--wbe-color-border) 4px,
		var(--wbe-color-border) 5px
	);
	text-decoration: line-through;
	cursor: not-allowed;
	opacity: 0.7;
}

.wbe-cal__day--in-range {
	background: var(--wbe-color-ok-bg);
	color: var(--wbe-color-ok-text);
	border-radius: 0;
}

.wbe-cal__day--start,
.wbe-cal__day--end {
	background: var(--wbe-color-btn-bg);
	color: var(--wbe-color-btn-text);
	font-weight: 700;
}

/* ─── Responsive ────────────────────────────────────────────────────────── */

@media (max-width: 480px) {
	.wbe-quote-form__fields {
		flex-direction: column;
	}

	.wbe-quote-form__field,
	.wbe-quote-form__field--guests {
		flex: 1 1 auto;
	}

	.wbe-quote-form__submit {
		align-self: stretch;
		text-align: center;
	}

	.wbe-quote-form__quote-total {
		margin-left: 0;
		text-align: left;
	}
}

/* ─── Reduced motion ────────────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
	.wbe-quote-form__loading::before {
		animation: none;
		border-top-color: var(--wbe-color-border);
	}

	.wbe-quote-form__submit,
	.wbe-quote-form__input {
		transition: none;
	}
}

/* Privacy consent checkbox (contact step) */
.wbe-quote-form__field--consent {
	display: flex;
	flex-direction: row;
	align-items: flex-start;
	gap: 8px;
	margin-top: 4px;
}

.wbe-quote-form__field--consent .wbe-quote-form__consent {
	width: auto;
	margin: 3px 0 0;
	flex: 0 0 auto;
}

.wbe-quote-form__consent-text {
	font-size: 0.85em;
	line-height: 1.4;
}

.wbe-quote-form__consent-link {
	text-decoration: underline;
}
