/**
 * WebMaxBooking Frontend Styles
 * Namespaced to safe-guard against theme conflicts.
 */

/* =========================
   Design Tokens
========================= */
:root {
	--webmax-primary: #20C7CA;
	--webmax-primary-hover: #1AB0B3;
	--webmax-secondary: #64748B;
	--webmax-secondary-hover: #475569;
	--webmax-accent: #06B6D4;
	--webmax-success: #16A34A;
	--webmax-warning: #F59E0B;
	--webmax-error: #EF4444;

	--webmax-bg: #F8FAFC;
	--webmax-card-bg: #FFFFFF;
	--webmax-text: #0F172A;
	--webmax-text-muted: #64748B;
	--webmax-border: #E2E8F0;

	--webmax-radius: 12px;
	--webmax-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
	--webmax-font: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

/* =========================
   Global Safety (Scoped)
========================= */
.webmaxbooking-container {
	font-family: var(--webmax-font);
	color: var(--webmax-text);
	max-width: 1200px;
	margin: 0 auto;
	padding: 20px;
	box-sizing: border-box;
}

.webmaxbooking-container *,
.webmaxbooking-container *::before,
.webmaxbooking-container *::after {
	box-sizing: inherit;
}

/* SPA-lite transitions */
#webmaxbooking-step-categories,
#webmaxbooking-step-services {
	transition: opacity .15s ease, transform .15s ease;
}

/* =========================
   Headings / Titles
========================= */
.webmaxbooking-title {
	font-size: 2rem;
	font-weight: 700;
	color: black;
	margin: 0 0 24px;
	line-height: 1.2;
}

/* =========================
   Breadcrumb / Back Button
========================= */
.webmaxbooking-breadcrumb {
	margin-bottom: 20px;
}

/* =========================
   Grid System
========================= */
.webmaxbooking-grid {
	display: grid;
	gap: 24px;
	width: 100%;
}

/* IMPORTANT FIX:
   Prevent CSS grid from forcing equal heights on CATEGORY cards */
/* Category Grid */
.webmaxbooking-grid--categories {
	grid-template-columns: 1fr;
	/* align-items removed to allow stretch (equal height) */
}

.webmaxbooking-grid--services {
	grid-template-columns: 1fr;
	/* Perf Optimization */
	content-visibility: auto;
	contain-intrinsic-size: 800px;
}

@media (min-width: 768px) {

	.webmaxbooking-grid--categories,
	.webmaxbooking-grid--services {
		grid-template-columns: repeat(2, 1fr);
	}
}

@media (min-width: 1024px) {
	.webmaxbooking-grid--categories {
		grid-template-columns: repeat(3, 1fr);
	}

	.webmaxbooking-grid--services {
		grid-template-columns: repeat(3, 1fr);
	}
}

/* =========================
   Cards (Base)
========================= */
.webmaxbooking-card {
	background-color: var(--webmax-card-bg);
	border: 1px solid var(--webmax-primary);
	border-radius: var(--webmax-radius);
	box-shadow: var(--webmax-shadow);
	transition: transform 0.2s, box-shadow 0.2s;
	display: flex;
	flex-direction: column;
	position: relative;
	overflow: hidden;
	padding: 24px;
	/* Perf Optimization */
	contain: layout paint;
}

/* Hover */
.webmaxbooking-card:hover {
	transform: translateY(-2px);
	box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1);
	will-change: transform;
}

/* =========================
   CATEGORY Cards
========================= */

/* Category cards equal height */
.webmaxbooking-grid--categories .webmaxbooking-card {
	height: 100%;
}

/* Category variant uses inner wrapper */
.webmaxbooking-card--category {
	padding: 0;
}

/* Background image category card */
.webmaxbooking-card--has-bg {
	background-size: cover;
	background-position: center;
	background-repeat: no-repeat;
	padding: 0;
	border: 1px solid var(--webmax-primary);
}

/* Overlay for readability */
.webmaxbooking-card__overlay {
	position: absolute;
	inset: 0;
	background: linear-gradient(to top, rgba(15, 23, 42, 0.85), rgba(15, 23, 42, 0.35));
	z-index: 1;
	opacity: 0;
	transition: opacity 0.25s ease;
}

.webmaxbooking-card--has-bg .webmaxbooking-card__overlay {
	opacity: 1;
}

/* Inner content wrapper */
.webmaxbooking-card__content {
	position: relative;
	z-index: 2;
	display: flex;
	flex-direction: column;
	justify-content: center;
	/* Vertically center content */
	flex-grow: 1;
	/* Fill available space */
	padding: 24px;
}

/* Text color on bg */
.webmaxbooking-card--has-bg .webmaxbooking-card__title,
.webmaxbooking-card--has-bg .webmaxbooking-card__description,
.webmaxbooking-card--has-bg .webmaxbooking-card__helper {
	color: #fff;
	text-shadow: 0 2px 4px rgba(0, 0, 0, 0.45);
}

/* =========================
   SERVICES Cards (can be equal height)
========================= */
.webmaxbooking-grid--services .webmaxbooking-card {
	height: 100%;
}

/* =========================
   Card Typography
========================= */
.webmaxbooking-card__title {
	font-size: 1.25rem;
	font-weight: 700;
	margin: 0 0 10px;
	color: var(--webmax-text);
	line-height: 1.25;

	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	min-height: calc(1.25em * 2);
	width: 100%;
	padding-right: 110px;
	/* space for price badge */
}

.webmaxbooking-card__price {
	background-color: var(--webmax-bg);
	color: var(--webmax-primary);
	padding: 6px 12px;
	border-radius: 9999px;
	font-size: 0.875rem;
	font-weight: 800;
	white-space: nowrap;

	position: absolute;
	top: 24px;
	right: 24px;
	z-index: 3;
}

.webmaxbooking-card__description {
	color: var(--webmax-text-muted);
	font-size: 0.95rem;
	line-height: 1.6;
	margin: 0 0 16px;

	display: -webkit-box;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.webmaxbooking-card__helper {
	color: var(--webmax-text-muted);
	font-size: 0.875rem;
	margin: 0 0 16px;
}

/* =========================
   Buttons
========================= */
.webmaxbooking-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 12px 16px;
	background-color: var(--webmax-primary);
	color: #fff;
	border: none;
	border-radius: 10px;
	font-weight: 800;
	text-decoration: none;
	cursor: pointer;
	transition: background-color 0.2s, transform 0.05s;
	width: 100%;
	font-size: 0.95rem;
	line-height: 1.2;
}

.webmaxbooking-btn:hover,
.webmaxbooking-btn:focus {
	background-color: var(--webmax-primary-hover);
	color: #fff;
	outline: none;
}

.webmaxbooking-btn:active {
	transform: translateY(1px);
}

/* Ensure the category button does NOT create bottom dead space */
.webmaxbooking-grid--categories .webmaxbooking-btn {
	margin-top: 18px;
}

/* For services cards: keep button pinned bottom */
.webmaxbooking-grid--services .webmaxbooking-card .webmaxbooking-btn {
	margin-top: auto;
}

/* Secondary */
.webmaxbooking-btn--secondary {
	background-color: transparent;
	color: var(--webmax-secondary);
	border: 1px solid var(--webmax-border);
	padding: 10px 14px;
	font-size: 0.9rem;
	font-weight: 700;
	width: auto;
}

.webmaxbooking-btn--secondary:hover,
.webmaxbooking-btn--secondary:focus {
	background-color: var(--webmax-bg);
	color: var(--webmax-secondary-hover);
	border-color: var(--webmax-secondary);
}

/* Submit wrapper */
.webmaxbooking-actions {
	width: 100%;
	grid-column: 1 / -1;
	display: flex;
	justify-content: center;
	margin-top: 10px;
}

/* Submit full width */
.webmaxbooking-btn--submit {
	width: 100%;
	padding: 14px;
	font-size: 1rem;
	display: flex;
	justify-content: center;
	align-items: center;
	margin-top: 0;
}

/* =========================
   Summary
========================= */
.webmaxbooking-summary {
	display: flex;
	flex-wrap: wrap;
	gap: 16px;
	margin: 6px 0 16px;
	justify-content: center;
}

.webmaxbooking-summary__item {
	display: flex;
	flex-direction: column;
	align-items: center;
}

.webmaxbooking-summary__item strong {
	font-size: 0.72rem;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: var(--webmax-text-muted);
	margin-bottom: 3px;
}

.webmaxbooking-summary__item span {
	font-weight: 700;
	color: var(--webmax-text);
}

/* =========================
   Form (Compact + Responsive)
========================= */
.webmaxbooking-form {
	width: 100%;
	display: grid;
	grid-template-columns: 1fr;
	gap: 12px;
	margin: 0;
}

@media (min-width: 768px) {
	.webmaxbooking-form {
		grid-template-columns: 1fr 1fr;
	}

	.webmaxbooking-field--full {
		grid-column: 1 / -1;
	}
}

.webmaxbooking-field,
.webmaxbooking-form__group {
	display: flex;
	flex-direction: column;
	margin: 0;
	min-width: 0;
	width: 100%;
}

.webmaxbooking-label {
	display: block;
	font-weight: 700;
	margin-bottom: 4px;
	color: var(--webmax-text);
	font-size: 0.85rem;
	word-wrap: break-word;
}

.webmaxbooking-label__required {
	color: var(--webmax-error);
	margin-left: 4px;
}

.webmaxbooking-input {
	width: 100%;
	max-width: 100%;
	min-width: 0;
	padding: 10px 12px;
	border: 1px solid var(--webmax-border);
	border-radius: 8px;
	font-size: 0.95rem;
	color: var(--webmax-text);
	background-color: #fff;
	transition: border-color 0.2s, box-shadow 0.2s;
	box-sizing: border-box;
}

.webmaxbooking-input:focus {
	outline: none;
	border-color: var(--webmax-primary);
	box-shadow: 0 0 0 3px rgba(32, 199, 202, 0.2);
}

.webmaxbooking-input--readonly {
	background-color: var(--webmax-bg);
	color: var(--webmax-text-muted);
	cursor: not-allowed;
}

.webmaxbooking-form textarea.webmaxbooking-input {
	min-height: 90px;
	resize: vertical;
}

/* =========================
   Alerts / Messages
========================= */
.webmaxbooking-alert {
	margin-top: 14px;
	padding: 12px;
	border-radius: 8px;
	font-weight: 600;
	display: none;
}

.webmaxbooking-alert--success {
	background-color: #E0F7F8;
	color: #158385;
	border: 1px solid #B2EBEB;
	display: block;
}

.webmaxbooking-alert--error {
	background-color: #FEE2E2;
	color: #991B1B;
	border: 1px solid #FECACA;
	display: block;
}

/* =========================
   Modal
========================= */
/* =========================
   Modal
========================= */
body.webmaxbooking-modal-open {
	overflow: hidden;
}

.webmaxbooking-modal[hidden] {
	display: none !important;
}

.webmaxbooking-modal {
	position: fixed;
	inset: 0;
	z-index: 2147483647;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
	box-sizing: border-box;
}

.webmaxbooking-modal *,
.webmaxbooking-modal *::before,
.webmaxbooking-modal *::after {
	box-sizing: border-box;
}

.webmaxbooking-modal__overlay {
	position: absolute;
	inset: 0;
	background: rgba(15, 23, 42, 0.65);
	/* Removed backdrop-filter to reduce repaint cost */
}

.webmaxbooking-modal__dialog {
	position: relative;
	z-index: 1;
	width: 100%;
	max-width: 620px;
	background-color: #ffffff;
	background: #ffffff;
	border-radius: 14px;
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);

	/* FIXED HEIGHT WITHOUT SCROLL */
	height: auto;
	max-height: min(700px, 90vh);

	/* SCROLL REMOVED */
	overflow: hidden;

	padding: 20px 24px;
}

.webmaxbooking-modal__close {
	position: absolute;
	top: 10px;
	right: 10px;
	width: 36px;
	height: 36px;
	border: 1px solid var(--webmax-border);
	background: #fff;
	border-radius: 9999px;
	cursor: pointer;
	font-size: 20px;
	line-height: 1;
	color: var(--webmax-text-muted);
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0;
}

.webmaxbooking-modal__title {
	margin: 0 0 6px;
	font-size: 1.5rem;
	color: var(--webmax-text);
	word-wrap: break-word;
	text-align: center;
}

.webmaxbooking-modal__summary {
	margin-bottom: 25px !important;
}

/* =========================================================
   FORCE WEBMAX BUTTON COLORS (Prevent Elementor/Theme override)
   Put this at the VERY END of the CSS file.
========================================================= */

/* Ensure plugin variables can be overridden per container later */
.webmaxbooking-container {
	--webmax-btn-bg: var(--webmax-primary);
	--webmax-btn-bg-hover: var(--webmax-primary-hover);
	--webmax-btn-text: #ffffff;
	--webmax-btn-border: var(--webmax-primary);
	--webmax-card-border: var(--webmax-primary);
	--webmax-card-bg: #FFFFFF;
}

/* Force card border + bg to follow variables */
.webmaxbooking-container .webmaxbooking-card {
	border-color: var(--webmax-card-border) !important;
	background-color: var(--webmax-card-bg) !important;
}

/* Force ALL primary buttons (anchors + buttons) */
.webmaxbooking-container .webmaxbooking-btn,
.webmaxbooking-container a.webmaxbooking-btn,
.webmaxbooking-container button.webmaxbooking-btn,
.webmaxbooking-container .webmaxbooking-book-btn,
.webmaxbooking-container a.webmaxbooking-book-btn,
.webmaxbooking-container button.webmaxbooking-book-btn {
	background: var(--webmax-btn-bg) !important;
	color: var(--webmax-btn-text) !important;
	border: 1px solid var(--webmax-btn-border) !important;
	text-decoration: none !important;
	box-shadow: none !important;
}

/* Hover */
.webmaxbooking-container .webmaxbooking-btn:hover,
.webmaxbooking-container a.webmaxbooking-btn:hover,
.webmaxbooking-container button.webmaxbooking-btn:hover,
.webmaxbooking-container .webmaxbooking-book-btn:hover,
.webmaxbooking-container a.webmaxbooking-book-btn:hover,
.webmaxbooking-container button.webmaxbooking-book-btn:hover {
	background: var(--webmax-btn-bg-hover) !important;
	color: var(--webmax-btn-text) !important;
	border-color: var(--webmax-btn-border) !important;
}

/* Back button must also be forced (it often becomes pink from theme) */
.webmaxbooking-container .webmaxbooking-btn--secondary,
.webmaxbooking-container a.webmaxbooking-btn--secondary,
.webmaxbooking-container button.webmaxbooking-btn--secondary {
	background: transparent !important;
	color: var(--webmax-btn-border) !important;
	border: 1px solid var(--webmax-btn-border) !important;
}

/* Modal close button border should match primary */
.webmaxbooking-container .webmaxbooking-modal__close {
	border-color: var(--webmax-btn-border) !important;
	color: var(--webmax-btn-border) !important;
}

/* =========================================================
   MODAL SPACING (space between header and form)
========================================================= */
.webmaxbooking-container .webmaxbooking-modal__title {
	margin-bottom: 18px !important;
}

.webmaxbooking-container .webmaxbooking-summary {
	margin-top: 10px !important;
	margin-bottom: 18px !important;
}

/* Extra breathing room before the first form row */
.webmaxbooking-container .webmaxbooking-modal__dialog .webmaxbooking-form {
	margin-top: 6px !important;
}

/* Disable old inline message per request */
#webmax-booking-message,
.webmaxbooking-alert--success,
.webmaxbooking-alert--error {
	display: none !important;
}

/* Floating Toast Positioning */
.webmaxbooking-toast {
	position: absolute;
	top: 20px;
	left: 50%;
	transform: translateX(-50%);
	z-index: 10000;
	background: var(--webmax-primary);
	color: #fff;
	padding: 12px 24px;
	border-radius: 8px;
	box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
	font-weight: 600;
	text-align: center;
	margin: 0;
	width: auto;
	min-width: 250px;
	max-width: 90%;
	animation: webmaxToastIn 0.3s ease forwards;
	pointer-events: none;
}

.webmaxbooking-toast--error {
	background: #d63638;
}

.webmaxbooking-toast--fade-out {
	animation: webmaxToastOut 0.4s ease forwards;
}

@keyframes webmaxToastIn {
	from {
		opacity: 0;
		transform: translateX(-50%) translateY(-10px);
	}

	to {
		opacity: 1;
		transform: translateX(-50%) translateY(0);
	}
}

@keyframes webmaxToastOut {
	from {
		opacity: 1;
		transform: translateX(-50%) translateY(0);
	}

	to {
		opacity: 0;
		transform: translateX(-50%) translateY(-10px);
	}
}