/* Scoped, self-contained defaults: keep host theme/page-builder CSS from
   leaking in (and avoid this widget's own rules leaking out) by resetting
   box-sizing for everything inside .loga-ebw and always filling whatever
   container it's placed in instead of assuming a narrow context. */
.loga-ebw,
.loga-ebw *,
.loga-ebw *::before,
.loga-ebw *::after {
	box-sizing: border-box;
}

.loga-ebw {
	width: 100%;
}

.loga-ebw__form {
	width: 100%;
	max-width: 100%;
}

.loga-ebw__field {
	margin: 0 0 12px;
}

/* flex (not the old block) so an icon prepended before the label text —
   e.g. the date field's icon, see booking-widget.php — gets a real gap
   instead of sitting glued to the text; a label with no icon just has one
   child and looks identical to before. */
.loga-ebw__field label {
	display: flex;
	align-items: center;
	gap: 6px;
	font-weight: 600;
	margin-bottom: 4px;
}

.loga-ebw__field select,
.loga-ebw__field input[type="number"] {
	width: 100%;
}

/* The theme/Elementor's own global styles routinely apply a default
   position, or a default link/button hover/active color, to plain <p>/
   <button> tags at a specificity this widget's own single-class selectors
   don't beat — every rule below that carries !important exists because of
   a confirmed, reproduced instance of exactly that (see CLAUDE.md). Colors
   are read from CSS custom properties that Elementor's controls set (see
   BookingStyleControlsTrait) rather than set directly: Elementor's own
   generated CSS doesn't reliably keep an inline "!important" written inside
   a control's selector template, but it never fails to set a plain custom
   property, and *this* file's own !important — guaranteed to survive,
   since it's static, not dynamically generated — is what actually wins. */
.loga-ebw__date-toggle {
	display: block !important;
	width: 100% !important;
	text-align: left !important;
	padding: 8px 10px !important;
	cursor: pointer !important;
	font: inherit !important;
	border-style: solid !important;
	border-width: 1px !important;
	border-radius: 4px !important;
	background-color: var( --loga-ebw-date-bg, #fff ) !important;
	color: var( --loga-ebw-date-color, inherit ) !important;
	border-color: var( --loga-ebw-date-border, #ccc ) !important;
}

.loga-ebw__date-toggle:hover,
.loga-ebw__date-toggle:focus,
.loga-ebw__date-toggle:active,
.loga-ebw__date-toggle[aria-expanded="true"] {
	background-color: var( --loga-ebw-date-bg-hover, var( --loga-ebw-date-bg, #fff ) ) !important;
	color: var( --loga-ebw-date-color-hover, var( --loga-ebw-date-color, inherit ) ) !important;
	border-color: var( --loga-ebw-date-border-hover, var( --loga-ebw-date-border, #ccc ) ) !important;
	outline: none;
}

/* No position/top/left/width here on purpose — event-booking-widget.js's
   positionCalendar() computes those from the toggle button's real on-screen
   position every time the panel opens, and sets them as inline styles with
   `!important` (via setProperty), which no stylesheet can override. That
   replaced an earlier `position: absolute` here that assumed the nearest
   positioned ancestor was .loga-ebw__field--date — it wasn't, reliably,
   across every Elementor/theme combination, so this panel would render
   anchored to whatever ancestor Elementor's own markup happened to make
   "positioned" instead, sometimes far from the actual date field. */
.loga-ebw__calendar {
	z-index: 100000;
	background: #fff;
	border: 1px solid #ddd;
	border-radius: 6px;
	box-shadow: 0 4px 16px rgba( 0, 0, 0, 0.15 );
	padding: 10px;
}

.loga-ebw__calendar-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 8px;
	font-weight: 600;
	text-transform: capitalize;
}

.loga-ebw__calendar-nav {
	background: none;
	border: none;
	cursor: pointer;
	font-size: 1.2em;
	line-height: 1;
	padding: 4px 8px;
	border-radius: 4px;
	color: inherit;
}

.loga-ebw__calendar-nav:hover {
	background: rgba( 0, 0, 0, 0.06 );
}

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

.loga-ebw__calendar-weekdays {
	margin-bottom: 4px;
	font-size: 0.8em;
	font-weight: 600;
	color: #777;
	text-align: center;
}

.loga-ebw__calendar-day {
	aspect-ratio: 1 / 1;
	display: flex;
	align-items: center;
	justify-content: center;
	border: none;
	border-radius: 4px;
	background: #f4f4f4;
	cursor: pointer;
	font: inherit;
	font-size: 0.85em;
	padding: 0;
	color: inherit;
}

.loga-ebw__calendar-day.is-outside-month {
	visibility: hidden;
}

.loga-ebw__calendar-day.is-available {
	background: #eaf6ea;
	color: #1e5e1e;
}

.loga-ebw__calendar-day.is-available:hover {
	background: #d3ecd3;
}

.loga-ebw__calendar-day.is-blocked {
	background: transparent;
	color: #ccc;
	cursor: not-allowed;
}

.loga-ebw__calendar-day.is-full {
	background: transparent;
	color: #b00;
	cursor: not-allowed;
}

/* A day can be both genuinely available *and* flagged here — it has an
   admin-set price or capacity override active (see the Calendar's own edit
   screen), which doesn't change whether it's bookable, only that it isn't
   "business as usual". Layered as a border so it doesn't fight is-available's
   own background/text color — both can show at once. */
.loga-ebw__calendar-day.is-restricted {
	box-shadow: inset 0 0 0 2px #c98a1f;
}

.loga-ebw__calendar-tooltip {
	background: #222;
	color: #fff;
	font-size: 0.8em;
	line-height: 1.4;
	padding: 6px 10px;
	border-radius: 4px;
	box-shadow: 0 2px 8px rgba( 0, 0, 0, 0.25 );
	z-index: 100001;
	pointer-events: none;
	white-space: nowrap;
}

.loga-ebw__calendar-day.is-today {
	box-shadow: inset 0 0 0 1px #999;
}

.loga-ebw__calendar-day.is-selected {
	background: #2271b1;
	color: #fff;
}

.loga-ebw__quantities {
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
}

.loga-ebw__field--qty {
	flex: 1 1 120px;
	min-width: 120px;
}

.loga-ebw__availability-message {
	color: #a00;
	min-height: 1.2em;
}

.loga-ebw__summary {
	margin: 8px 0 16px;
	padding: 10px 12px;
	background: #f7f7f7;
	border-radius: 4px;
}

.loga-ebw__breakdown-list {
	margin: 0 0 6px;
	padding: 0;
	list-style: none;
	font-size: 0.9em;
	color: #555;
}

.loga-ebw__breakdown-row {
	display: flex;
	justify-content: space-between;
	gap: 8px;
}

.loga-ebw__price {
	margin: 0;
	font-size: 1.2em;
	font-weight: 700;
}

/* display MUST resolve to a flex/grid value for `gap` to do anything at
   all — a theme/WooCommerce default of `display: inline-block` (or similar)
   on `.button` silently makes gap a no-op with no warning anywhere, which
   is exactly what was happening before this carried !important. */
.loga-ebw__submit {
	display: inline-flex !important;
	align-items: center;
	justify-content: center;
	gap: 8px;
	background-color: var( --loga-ebw-btn-bg, #333 ) !important;
	color: var( --loga-ebw-btn-color, #fff ) !important;
}

.loga-ebw__submit:hover:not( :disabled ) {
	background-color: var( --loga-ebw-btn-bg-hover, var( --loga-ebw-btn-bg, #333 ) ) !important;
	color: var( --loga-ebw-btn-color-hover, var( --loga-ebw-btn-color, #fff ) ) !important;
}

/* WooCommerce/the active theme ship their own `.button.alt:disabled` rule
   (Storefront's default is the well-known WooCommerce purple, #7f54b3) that
   otherwise overrides this widget's own colors while the button is
   disabled — !important here is deliberate and necessary, not a hack:
   without it, the button visibly (and confusingly) changes brand color
   depending on form state. */
.loga-ebw__submit:disabled {
	opacity: 0.5;
	cursor: not-allowed;
	background-color: var( --loga-ebw-btn-bg-disabled, #555 ) !important;
	border-color: var( --loga-ebw-btn-bg-disabled, #555 ) !important;
	color: var( --loga-ebw-btn-color-disabled, #fff ) !important;
}

/* WooCommerce's own add-to-cart.js inserts this link right after our submit
   button on a successful add (see event-booking-widget.js) — its markup
   isn't ours, so give it sane defaults here; Elementor's Style tab overrides
   color/background/border per widget instance on top of this. */
.loga-ebw .added_to_cart.wc-forward {
	display: inline-flex !important;
	align-items: center;
	margin: 0 0 0 10px;
	padding: 0.55em 1.1em;
	border-style: solid;
	border-width: 1px;
	border-radius: 4px;
	font-size: 0.95em;
	font-weight: 600;
	line-height: 1.2;
	text-decoration: none !important;
	white-space: nowrap;
	transition: opacity 0.15s ease;
	background-color: var( --loga-ebw-viewcart-bg, transparent ) !important;
	color: var( --loga-ebw-viewcart-color, inherit ) !important;
	border-color: var( --loga-ebw-viewcart-border, currentColor ) !important;
}

.loga-ebw .added_to_cart.wc-forward:hover {
	background-color: var( --loga-ebw-viewcart-bg-hover, var( --loga-ebw-viewcart-bg, transparent ) ) !important;
	color: var( --loga-ebw-viewcart-color-hover, var( --loga-ebw-viewcart-color, inherit ) ) !important;
	border-color: var( --loga-ebw-viewcart-border-hover, var( --loga-ebw-viewcart-border, currentColor ) ) !important;
}

/* Below this width, wrapping/shrinking in place stops being enough — the
   quantity fields and the CTA go full-width and stack. The calendar popover
   doesn't need a rule here: positionCalendar() in event-booking-widget.js
   checks the same 480px threshold itself and sets full-width-with-margins
   inline, since it controls this element's position/width outright. */
@media ( max-width: 480px ) {
	.loga-ebw__quantities {
		flex-direction: column;
	}

	.loga-ebw__field--qty {
		flex-basis: auto;
		min-width: 0;
	}

	.loga-ebw__submit {
		width: 100%;
	}

	.loga-ebw .added_to_cart.wc-forward {
		width: 100%;
		justify-content: center;
		margin: 8px 0 0;
	}
}
