/**
 * Frontend Booking UI — Product Page Styles
 *
 * Styles the 3-step booking flow on WooCommerce product pages:
 *   - Session selector dropdown
 *   - Quantity stepper
 *   - Participant accordion forms
 *   - Booking summary panel
 *
 * @package RaceAndEventBooking
 */

/* =============================================================================
   Booking UI container
   ============================================================================= */
.reb-booking-ui {
	margin: 20px 0;
}

/* =============================================================================
   Steps
   ============================================================================= */
.reb-step {
	margin-bottom: 24px;
}

.reb-step-title {
	font-size: 1.1em;
	font-weight: 600;
	margin: 0 0 12px;
	display: flex;
	align-items: center;
	gap: 10px;
}

.reb-step-num {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 28px;
	height: 28px;
	border-radius: 50%;
	background: #0073aa;
	color: #fff;
	font-size: 14px;
	font-weight: bold;
	flex-shrink: 0;
	line-height: 1;
}

/* =============================================================================
   Session selector
   ============================================================================= */
.reb-sessions-loading {
	color: #777;
	font-style: italic;
}

.reb-session-select {
	width: 100%;
	cursor: pointer;
	font-size: 16px;
	padding: 8px 10px;
	border: 1px solid #ddd;
	border-radius: 4px;
	background: #fff;
	box-sizing: border-box;
	-webkit-appearance: none;
	appearance: none;
}

/* =============================================================================
   Quantity stepper
   ============================================================================= */
.reb-qty-stepper {
	display: inline-flex;
	align-items: stretch;
}

.reb-qty-minus,
.reb-qty-plus,
.reb-extras-minus,
.reb-extras-plus {
	width: 36px;
	height: 36px;
	border: 1px solid #ddd;
	background: #f7f7f7;
	cursor: pointer;
	font-size: 1.2em;
	line-height: 1;
	border-radius: 4px;
	padding: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background-color 0.1s ease;
}

.reb-qty-minus:hover,
.reb-qty-plus:hover,
.reb-extras-minus:hover,
.reb-extras-plus:hover {
	background: #e9e9e9;
}

.reb-qty-stepper input[type="number"] {
	width: 60px;
	text-align: center;
	border-top: 1px solid #ddd;
	border-bottom: 1px solid #ddd;
	border-left: none;
	border-right: none;
	height: 36px;
	margin: 0;
	padding: 0 4px;
	-moz-appearance: textfield;
}

.reb-qty-stepper input[type="number"]::-webkit-inner-spin-button,
.reb-qty-stepper input[type="number"]::-webkit-outer-spin-button {
	-webkit-appearance: none;
	margin: 0;
}


/* "Choose your tickets" step — stacked ticket rows (Date / Start hour / Price /
   Quantity / Available seats). The row gap is configurable in Settings. */
.reb-ticket-rows {
	display: flex;
	flex-direction: column;
	gap: 8px;
	margin: 8px 0;
}

.reb-ticket-row {
	margin: 0;
}

.reb-ticket-label {
	color: #777;
	font-size: 0.85em;
	margin-right: 8px;
}

/* Inline SVG icon in front of the Date / Start hour rows (no icon library). */
.reb-ticket-icon {
	width: 1em;
	height: 1em;
	margin-right: 8px;
	color: #777;
	vertical-align: -0.125em;
	flex-shrink: 0;
}

.reb-ticket-value {
	font-weight: 500;
}

.reb-ticket-price {
	font-size: 1.15em;
	font-weight: 600;
}

.reb-ticket-price-unit {
	font-size: 0.75em;
	font-weight: 400;
	color: #777;
}

/* =============================================================================
   Participant accordion blocks
   ============================================================================= */
.reb-participant-block {
	border: 1px solid #e0e0e0;
	border-radius: 6px;
	margin-bottom: 10px;
	overflow: hidden;
}

.reb-participant-header {
	display: flex;
	align-items: center;
	padding: 12px 16px;
	background: #f9f9f9;
	gap: 10px;
	user-select: none;
}

.reb-participant-label {
	font-weight: 600;
	flex: 1;
}

.reb-p-status {
	font-size: 0.8em;
	color: #777;
}

.reb-participant-toggle {
	background: none;
	border: none;
	cursor: pointer;
	font-size: 0.95em;
	margin-left: auto;
	padding: 0 4px;
	color: #555;
}

.reb-participant-body {
	padding: 16px;
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 12px;
}

/* =============================================================================
   Form fields
   ============================================================================= */
.reb-field-group {
	display: flex;
	flex-direction: column;
	gap: 4px;
}

/* Academy/Championship: the Dates selector spans the full width of the
   participant details grid so the input fields start on the next row. */
.reb-academy-dates {
	grid-column: 1 / -1;
}

.reb-label {
	font-size: 0.9em;
	font-weight: 500;
}

.reb-required {
	color: #dc3232;
	margin-left: 2px;
}

.reb-input {
	width: 100%;
	padding: 8px 10px;
	border: 1px solid #ddd;
	border-radius: 4px;
	font-size: 16px;
	background: #fff;
	box-sizing: border-box;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
	-webkit-appearance: none;
	appearance: none;
}

/* Date inputs: keep appearance:none for consistent sizing (the native
   picker still opens on tap on iOS/Android). Style the value text so
   the field doesn't collapse when empty or filled. */
input[type="date"].reb-input {
	height: 40px;
	min-height: 40px;
	line-height: 24px;
	max-width: 100%;
	-webkit-padding-end: 10px;
	-webkit-padding-start: 10px;
}

input[type="date"].reb-input::-webkit-date-and-time-value {
	text-align: left;
}

/* Placeholder-like color when no date is selected (WebKit). */
input[type="date"].reb-input:invalid {
	color: #999;
}

.reb-input:focus {
	border-color: #0073aa;
	outline: none;
	box-shadow: 0 0 0 2px rgba( 0, 115, 170, 0.15 );
}

.reb-input.reb-error,
.reb-input.reb-input-invalid {
	border-color: #dc3232;
}

.reb-field-error {
	display: block;
	color: #dc3232;
	font-size: 0.82em;
	margin-top: 4px;
	line-height: 1.3;
}

textarea.reb-input {
	resize: vertical;
	min-height: 70px;
}

.reb-checkbox-label {
	display: flex;
	align-items: center;
	gap: 6px;
	font-size: 0.9em;
	cursor: pointer;
}

.reb-checkbox-label input[type="checkbox"] {
	width: auto;
	margin: 0;
}

/* Non-selectable academy/championship dates: fully booked or finished. */
.reb-academy-date-option.reb-full,
.reb-academy-date-option.reb-finished {
	color: #999;
	cursor: not-allowed;
}

.reb-academy-date-option.reb-full input[type="checkbox"],
.reb-academy-date-option.reb-finished input[type="checkbox"] {
	cursor: not-allowed;
}

/* Finished (past) championship dates are struck through. */
.reb-academy-date-option.reb-finished {
	text-decoration: line-through;
	text-decoration-color: #bbb;
}

/* =============================================================================
   Booking summary
   ============================================================================= */
.reb-booking-summary {
	margin-top: 20px;
	padding: 16px 20px;
	background: #f8f8f8;
	border: 1px solid #e0e0e0;
	border-radius: 6px;
}

.reb-booking-summary h4 {
	margin: 0 0 10px;
	font-size: 1em;
	font-weight: 600;
}

.reb-booking-summary p {
	margin: 0 0 4px;
	font-size: 0.9em;
}

/* =============================================================================
   Utility
   ============================================================================= */
.reb-muted {
	color: #777;
}

/* Explanatory suffix after a field label, e.g. "For confirmations and updates". */
.reb-label-suffix {
	color: #777;
	font-weight: normal;
	font-size: 0.85em;
}

/* =============================================================================
   Fully booked notice

   #reb-sessions-message gains this class when every race is full (by bookings
   or by the "Fully booked" checkbox on the Course tab) and the rest of the form
   has been hidden — see showFullyBooked() in frontend-booking.js. Single class,
   no !important, so a theme rule of equal specificity declared later wins.
   ============================================================================= */

.reb-fully-booked-notice {
	background: #fdecea;
	border: 1px solid #f5b5ae;
	border-radius: 4px;
	padding: 12px 16px;
	margin: 8px 0;
	color: #7a1c14;
	font-weight: 600;
	line-height: 1.4;
}

/* =============================================================================
   Session range notification
   ============================================================================= */
.reb-range-notification {
	background: #fff3cd;
	border: 1px solid #ffc107;
	border-radius: 4px;
	padding: 10px 14px;
	margin: 8px 0;
	font-size: 0.9em;
	color: #856404;
	line-height: 1.4;
}

.reb-session-range-picker {
	margin-bottom: 12px;
}

/* =============================================================================
   Selects — custom appearance
   ============================================================================= */
.reb-field-group select {
	width: 100%;
	box-sizing: border-box;
	padding: 8px 10px;
	border: 1px solid #ddd;
	border-radius: 4px;
	font-size: 16px;
	background: #fff;
	height: 40px;
	min-height: 40px;
	line-height: 24px;
	-webkit-appearance: none;
	-moz-appearance: none;
	appearance: none;
}

.reb-field-group select:focus {
	border-color: #0073aa;
	outline: none;
	box-shadow: 0 0 0 2px rgba( 0, 115, 170, 0.15 );
}

/* =============================================================================
   Responsive — stack to single column on small screens
   ============================================================================= */
@media ( max-width: 600px ) {
	.reb-participant-body {
		grid-template-columns: 1fr;
	}
}

/* Championship full-series discount note + summary line. */
.reb-championship-note {
	background: #eef7ee;
	border: 1px solid #cfe8cf;
	border-radius: 4px;
	padding: 8px 12px;
	margin: 0 0 12px;
	font-size: 14px;
	color: #2c5a2c;
}

.reb-academy-discount {
	color: #2c5a2c;
	margin: 2px 0;
}

/* =============================================================================
   Shortcode: self-contained booking form ([reb_booking_form])
   ============================================================================= */
.reb-booking-form {
	margin: 20px 0;
}

.reb-booking-form .reb-add-to-cart-button,
.reb-booking-form .single_add_to_cart_button {
	cursor: pointer;
}

/* -----------------------------------------------------------------------------
   Horizontal style — a grid of three columns:
       [count] | participant blocks (2-up) | right column
   The right column stacks the summary above the Add to Cart button. Each
   participant's detail fields are kept in ONE column, and a lone participant
   spans the full width of the participant area.

   The inner UI wrapper (.reb-booking-ui / .reb-academy-ui / .reb-package-ui)
   uses display:contents so its children (steps + summary) become grid items of
   the form itself, allowing the Add to Cart button — a sibling of that wrapper —
   to share the grid.
   ----------------------------------------------------------------------------- */
.reb-style-horizontal {
	display: grid;
	grid-template-columns: fit-content( 260px ) minmax( 0, 1fr ) minmax( 170px, max-content );
	align-items: start;
	column-gap: 24px;
	row-gap: 16px;
}

.reb-style-horizontal .reb-booking-ui,
.reb-style-horizontal .reb-academy-ui,
.reb-style-horizontal .reb-package-ui {
	display: contents;
}

/* Session selector and the championship note take their own full-width row
   above the strip. */
.reb-style-horizontal .reb-step-session,
.reb-style-horizontal .reb-championship-note {
	grid-column: 1 / -1;
	margin: 0;
}

/* Participant-count stepper — compact left column, top row of the body. */
.reb-style-horizontal .reb-step-quantity {
	grid-column: 1;
	margin: 0;
}

/* Participant blocks — middle column. */
.reb-style-horizontal .reb-step-participants {
	grid-column: 2;
	min-width: 0;
	margin: 0;
}

/* Extras belong under the participant blocks, in the same column. Without an
   explicit column it auto-places into whichever cell is free — the wrapper is
   display:contents, so every step is a grid item of the form itself. */
.reb-style-horizontal .reb-step-extras {
	grid-column: 2;
	min-width: 0;
	margin: 0;
}

.reb-style-horizontal #reb-participants-container,
.reb-style-horizontal #reb-academy-children {
	display: grid;
	grid-template-columns: repeat( 2, minmax( 0, 1fr ) );
	gap: 12px;
}

/* A lone participant spans the full width of the participant area. Because it
   is then much wider than a 2-up block, it also becomes a query container so
   its own fields can go 2-up — see the @container rule below. */
.reb-style-horizontal #reb-participants-container .reb-participant-block:only-child,
.reb-style-horizontal #reb-academy-children .reb-academy-child:only-child {
	grid-column: 1 / -1;
	container-type: inline-size;
}

/* Detail input fields are a single column in this style: with two participant
   blocks side by side there is no room for more. */
.reb-style-horizontal .reb-participant-body {
	grid-template-columns: 1fr;
}

/* ...but a lone participant block is full-width, which leaves its fields
   uncomfortably wide. Give that block two columns of fields, collapsing back to
   one as soon as a column would drop below 350px.

   744px = two 350px columns + the 12px grid gap + the body's 2 x 16px padding.
   The query is on the block's own inline size, not the viewport, so the
   collapse follows the real space available inside the horizontal grid — which
   the viewport width does not predict. Browsers without container-query support
   simply keep the single-column rule above. */
@container ( min-width: 744px ) {
	.reb-style-horizontal .reb-participant-body {
		grid-template-columns: 1fr 1fr;
	}
}

/* Right column: an aside (built by the shortcode's inline JS) holding the
   summary with the Add to Cart button directly beneath it. The summary and
   button rules below are the pre-JS fallback (before they are moved). */
.reb-style-horizontal .reb-booking-aside {
	grid-column: 3;
	align-self: start;
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.reb-style-horizontal .reb-booking-aside .reb-booking-summary {
	margin: 0;
}

.reb-style-horizontal .reb-booking-aside .single_add_to_cart_button,
.reb-style-horizontal .reb-booking-aside .reb-add-to-cart-button {
	width: 100%;
	margin: 0;
}

.reb-style-horizontal .reb-booking-summary {
	grid-column: 3;
	margin-top: 0;
}

.reb-style-horizontal .reb-add-to-cart-button,
.reb-style-horizontal .single_add_to_cart_button {
	grid-column: 3;
	align-self: start;
}

/* Hidden-input holders must not consume a grid cell. */
.reb-style-horizontal #reb-participant-inputs,
.reb-style-horizontal #reb-academy-inputs,
.reb-style-horizontal #reb-package-inputs {
	display: none;
}

/* Stack everything on narrow screens (undo display:contents / grid). */
@media ( max-width: 782px ) {
	.reb-style-horizontal {
		display: block;
	}
	.reb-style-horizontal .reb-booking-ui,
	.reb-style-horizontal .reb-academy-ui,
	.reb-style-horizontal .reb-package-ui {
		display: block;
	}
	.reb-style-horizontal .reb-step,
	.reb-style-horizontal .reb-booking-summary {
		margin-bottom: 20px;
	}
	/* The horizontal layout zeroes the note's margin and relies on the grid
	   gap for spacing; once the grid collapses to blocks here, that gap is gone
	   and the note would sit flush against the date list below it. */
	.reb-style-horizontal .reb-championship-note {
		margin-bottom: 20px;
	}
	.reb-style-horizontal #reb-participants-container,
	.reb-style-horizontal #reb-academy-children {
		grid-template-columns: 1fr;
	}
}

/* =============================================================================
   Extra reservations
   Sits between the participant block and the booking summary. Single-class
   selectors and no !important, so a theme rule of equal specificity declared
   later still wins — consistent with the rest of this stylesheet.
   ============================================================================= */

.reb-step-extras {
	margin-top: 16px;
}

/* Everything under the heading is one card, so the block reads as a sibling of
   the participant blocks above it rather than as loose text under a title.
   Same border, radius and padding as .reb-participant-block plus
   .reb-participant-body — keep the two in step if either is restyled. */
.reb-extras-body {
	display: flex;
	flex-direction: column;
	border: 1px solid #e0e0e0;
	border-radius: 6px;
	padding: 16px;
	gap: 8px!important;
}

/* .reb-extras-description and .reb-extras-included are spans sharing one
   paragraph, so neither takes a margin — .reb-extras-intro itself is left to the
   theme's paragraph spacing, deliberately unstyled. */
.reb-extras-included {
	
}

/* The price line is the quantity field's <label>, so it needs to behave as a
   block rather than inline the way labels do by default. Its typography is not
   set here on purpose: the template nests .reb-ticket-price and
   .reb-ticket-price-unit inside, so the amount and the "per <label>" suffix
   match the ticket price in step 1 and follow the same layout settings. */
.reb-extras-price {
	display: block;
	margin: 0 0 8px;
}

.reb-extras-row {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 12px;
}

.reb-extras-max-note {
	margin: 8px 0 0;
	font-size: 0.9em;
	opacity: 0.75;
}
