/**
 * Travel packages: the purchase in 3 steps (Simona, "modifica simona", Oct 2026).
 *
 *   1  Seleziona posto a sedere   seat map | tickets, passengers, extras
 *   2  Configura il tuo viaggio   trip form | activities, then hotel and coupon
 *   3  Concludi ordine            total and button
 *
 * Loaded only while "Pacchetti di viaggio: acquisto in 3 step" is ON, and the markup
 * only exists on customer pages (WBTM_Functions::use_tour_steps_layout()), so nothing
 * here can reach the classic layout or a staff screen.
 */

.wbtm_steps_layout {
	--wbtm-steps-done: #2f9a4b;
	--wbtm-steps-ring: rgba(47, 154, 75, 0.2);
	--wbtm-steps-line: #2b2724;
	--wbtm-steps-ink: #2b2724;
	--wbtm-steps-muted: #7a7068;
	--wbtm-steps-paper: #f7f4f0;
	--wbtm-steps-card: #e6e0d8;
	--wbtm-steps-tab: #fff;
	--wbtm-steps-tab-active: #5e4a35;
	--wbtm-steps-display: Forum, Georgia, "Times New Roman", serif;
}

/* ---- Progress bar ------------------------------------------------------- */

.wbtm_steps_bar {
	max-width: 560px;
	margin: 36px auto 22px;
	text-align: center;
}

.wbtm_steps_layout > .wbtm_steps_bar:first-child {
	margin-top: 6px;
}

.wbtm_steps_bar .wbtm_steps_heading {
	margin: 0 0 18px;
	padding: 0;
	background: none;
	font-family: var(--wbtm-steps-display);
	font-size: 26px;
	font-weight: 400;
	line-height: 1.2;
	letter-spacing: 0.03em;
	text-transform: uppercase;
	text-wrap: balance;
	color: var(--wbtm-steps-ink);
}

.wbtm_steps_bar .wbtm_steps {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	margin: 0;
	padding: 0;
	list-style: none;
}

.wbtm_steps_bar .wbtm_steps_item {
	position: relative;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 8px;
	margin: 0;
	padding: 0 6px;
	list-style: none;
}

/* The line from the previous step to this one: green once this step is reached. */
.wbtm_steps_bar .wbtm_steps_item + .wbtm_steps_item::before {
	content: "";
	position: absolute;
	top: 9px;
	right: 50%;
	width: 100%;
	height: 2px;
	background: var(--wbtm-steps-line);
}

.wbtm_steps_bar .wbtm_steps_dot {
	position: relative;
	z-index: 1;
	box-sizing: border-box;
	width: 20px;
	height: 20px;
	border: 2px solid var(--wbtm-steps-ink);
	border-radius: 50%;
	background: #fff;
}

.wbtm_steps_bar .wbtm_steps_item.is-done .wbtm_steps_dot {
	background: var(--wbtm-steps-done);
}

.wbtm_steps_bar .wbtm_steps_item.is-current .wbtm_steps_dot {
	box-shadow: 0 0 0 5px var(--wbtm-steps-ring);
}

.wbtm_steps_bar .wbtm_steps_label {
	font-family: var(--wbtm-steps-display);
	font-size: 14px;
	line-height: 1.15;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: var(--wbtm-steps-ink);
}

.wbtm_steps_bar .wbtm_steps_line {
	display: block;
}

.wbtm_steps_bar .screen-reader-text {
	position: absolute !important;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* ---- Step 2: "Configura il tuo viaggio" beside "Attività disponibili" -------- */

.wbtm_step_panel_2 {
	box-sizing: border-box;
	padding: 22px;
	border: 1px solid var(--wbtm-steps-card);
	border-radius: 8px;
	background: #fff;
}

.wbtm_step_panel_2.has-columns {
	display: grid;
	grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
	gap: 24px;
	align-items: start;
}

/* Hotel, coupon and anything else an add-on prints here run full width below. */
.wbtm_step_panel_2.has-columns > * {
	grid-column: 1 / -1;
	min-width: 0;
}

.wbtm_step_panel_2.has-columns > .wbtm_tour_form_wrapper {
	grid-column: 1;
	grid-row: 1;
	margin-top: 0;
}

.wbtm_step_panel_2.has-columns > .wbtm_package_activity_wrapper {
	grid-column: 2;
	grid-row: 1;
	margin-top: 0;
}

/* ---- Step 3: total and button ------------------------------------------- */

.wbtm_step_panel_3 {
	max-width: 560px;
	margin: 0 auto 8px;
}

.wbtm_step_panel_3 .wbtm_step_3_hint {
	margin: 0;
	padding: 14px 18px;
	border: 1px dashed var(--wbtm-steps-line);
	border-radius: 6px;
	background: var(--wbtm-steps-paper);
	font-size: 15px;
	line-height: 1.5;
	text-align: center;
	color: var(--wbtm-steps-muted);
}

.wbtm_step_panel_3.has-total .wbtm_step_3_hint {
	display: none;
}

/* ---- Step 1: more room for the train ------------------------------------- */

/*
 * The classic layout gives the seat map a third of the row and leaves an empty gap
 * before the tickets. Here the train takes 46%, so its carriages fit one row of tabs
 * (client, 9 Oct 2026: "si può allargare la colonna del treno"), and the two columns
 * stay side by side down to tablets: below 1000px the grid used to drop the tickets
 * under the whole carriage, next to empty space. Under 800px: one column, as before.
 */
@media (min-width: 801px) {
	.wbtm_steps_layout .wbtm_step_panel_1 > .col_4 {
		width: 46%;
	}

	.wbtm_steps_layout .wbtm_step_panel_1 > .col_7 {
		width: 51%;
	}
}

@media (max-width: 800px) {
	.wbtm_steps_layout .wbtm_step_panel_1 > .col_7 {
		width: 100%;
	}
}

/*
 * Tablets: beside the train the tickets column is narrower than the full width it had
 * below it, and two passenger fields per row no longer hold their labels ("Cognome Nome
 * Passeggero *" needs 189px, half the column is 162px at 820px). One field per row.
 */
@media (min-width: 801px) and (max-width: 1000px) {
	.wbtm_steps_layout .wbtm_step_panel_1 div.wbtm_attendee_area .mp_form_item {
		width: 100%;
	}

	/*
	 * wbtm.css fixes the ticket table at 45/15/25/15%: at 820px "Azione" (the bin column)
	 * gets 55px, less than its heading. Each heading fits these; the ticket name wraps.
	 */
	.wbtm_steps_layout .wbtm_step_panel_1 .wbtm_selected_seat_details table th:nth-child(1),
	.wbtm_steps_layout .wbtm_step_panel_1 .wbtm_selected_seat_details table td:nth-child(1) {
		width: 38% !important;
	}

	.wbtm_steps_layout .wbtm_step_panel_1 .wbtm_selected_seat_details table th:nth-child(2),
	.wbtm_steps_layout .wbtm_step_panel_1 .wbtm_selected_seat_details table td:nth-child(2) {
		width: 17% !important;
	}

	.wbtm_steps_layout .wbtm_step_panel_1 .wbtm_selected_seat_details table th:nth-child(3),
	.wbtm_steps_layout .wbtm_step_panel_1 .wbtm_selected_seat_details table td:nth-child(3) {
		width: 23% !important;
	}

	.wbtm_steps_layout .wbtm_step_panel_1 .wbtm_selected_seat_details table th:nth-child(4),
	.wbtm_steps_layout .wbtm_step_panel_1 .wbtm_selected_seat_details table td:nth-child(4) {
		width: 22% !important;
	}
}

/* ---- Carriages as tabs, one open at a time -------------------------------- */

/*
 * One row, every carriage the same width, however many the train has (client, 9 Oct
 * 2026: the fifth carriage alone on a second row "non è accettabile"). "CARROZZA 5"
 * measures 68px at 12px, so a desktop tab holds it and the arrow on one line; a
 * narrower tab breaks the name between its words and never lets it overflow.
 */
.wbtm_cabin_tabs_mode .wbtm_cabin_tabs {
	display: grid;
	grid-auto-flow: column;
	grid-auto-columns: minmax(0, 1fr);
	gap: 4px;
	margin: 12px 0 14px;
}

/*
 * Open vs closed must read at a glance (client, 12 Oct 2026, mock-up with "CARROZZA 4"
 * filled and the others white): closed = white, dark border, dark text; open = solid
 * dark, white text. The name grows with its tab (12px for five carriages at 1440px, up
 * to 16px when there is room) and never past what fits beside the arrow.
 */
.wbtm_cabin_tabs_mode .wbtm_cabin_tab {
	container-type: inline-size;
	display: flex;
	min-width: 0;
	align-items: center;
	justify-content: center;
	gap: 4px;
	margin: 0;
	padding: 8px 2px 7px;
	border: 2px solid var(--wbtm-steps-tab-active);
	border-radius: 4px;
	background: var(--wbtm-steps-tab);
	color: var(--wbtm-steps-ink);
	font-family: var(--wbtm-steps-display);
	font-size: 12px;
	font-weight: 400;
	line-height: 1.15;
	letter-spacing: 0.02em;
	text-align: center;
	text-transform: uppercase;
	white-space: normal;
	cursor: pointer;
	transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.wbtm_cabin_tabs_mode .wbtm_cabin_tab_name {
	min-width: 0;
	font-size: clamp(12px, calc((100cqi - 14px) / 5.6), 16px);
}

/*
 * The plugin's button rules (.wbtm_style button:hover/:focus, and their "span") would turn
 * the text white at 80%: white on white on a closed carriage.
 */
.wbtm_cabin_tabs_mode .wbtm_cabin_tab:hover,
.wbtm_cabin_tabs_mode .wbtm_cabin_tab:focus {
	opacity: 1;
	background: var(--wbtm-steps-paper);
	color: var(--wbtm-steps-ink);
}

.wbtm_cabin_tabs_mode .wbtm_cabin_tab .wbtm_cabin_tab_name,
.wbtm_cabin_tabs_mode .wbtm_cabin_tab .wbtm_cabin_tab_arrow {
	color: inherit;
}

.wbtm_cabin_tabs_mode .wbtm_cabin_tab:focus-visible {
	outline: 2px solid var(--wbtm-steps-ink);
	outline-offset: 2px;
}

.wbtm_cabin_tabs_mode .wbtm_cabin_tab.is-active {
	background: var(--wbtm-steps-tab-active);
	color: #fff;
	box-shadow: 0 2px 6px rgba(43, 39, 36, 0.35);
}

.wbtm_cabin_tabs_mode .wbtm_cabin_tab_arrow {
	flex: none;
	font-size: clamp(7px, calc((100cqi - 11px) / 9.5), 9px);
	line-height: 1;
}

/* Sized on each tab's own width, so four or five carriages both come out right. */
@container (max-width: 79px) {
	/* "CARROZZA" over "5": the arrow would sit beside two lines. */
	.wbtm_cabin_tabs_mode .wbtm_cabin_tab_arrow {
		display: none;
	}
}

/*
 * Too narrow for "CARROZZA 5" on one line (fits in 68px, not in 65px): every name breaks
 * after its first word, so the row never mixes one-line and two-line tabs (960px, phones
 * with 4 carriages).
 */
@container (max-width: 67px) {
	.wbtm_cabin_tabs_mode .wbtm_cabin_tab_name {
		width: min-content;
	}
}

@container (max-width: 56px) {
	.wbtm_cabin_tabs_mode .wbtm_cabin_tab_name {
		font-size: 10px;
		letter-spacing: 0.02em;
	}
}

/* Only the chosen carriage is drawn; the accordion header gives way to the tabs. */
.wbtm_cabin_tabs_mode > .wbtm_cabin_section {
	display: none !important;
}

.wbtm_cabin_tabs_mode > .wbtm_cabin_section.is-active {
	display: block !important;
}

.wbtm_cabin_tabs_mode > .wbtm_cabin_section > .wbtm_cabin_header,
.wbtm_cabin_tabs_mode > .wbtm_cabin_section > .wbtm_cabin_separator {
	display: none !important;
}

.wbtm_cabin_tabs_mode > .wbtm_cabin_section.is-active > .wbtm_cabin_seat_plan {
	display: block !important;
}

/* ---- Narrow screens --------------------------------------------------------- */

@media (max-width: 900px) {
	.wbtm_step_panel_2.has-columns {
		grid-template-columns: minmax(0, 1fr);
	}

	.wbtm_step_panel_2.has-columns > .wbtm_tour_form_wrapper,
	.wbtm_step_panel_2.has-columns > .wbtm_package_activity_wrapper {
		grid-column: 1;
		grid-row: auto;
	}
}

@media (max-width: 600px) {
	.wbtm_steps_bar {
		margin: 26px auto 14px;
	}

	.wbtm_steps_bar .wbtm_steps_heading {
		font-size: 19px;
	}

	.wbtm_steps_bar .wbtm_steps_label {
		font-size: 11px;
		letter-spacing: 0.03em;
	}

	.wbtm_step_panel_2 {
		padding: 14px;
	}

	/* Five carriages still fit one row on a phone, each name on two lines. */
	.wbtm_cabin_tabs_mode .wbtm_cabin_tabs {
		gap: 3px;
	}

	.wbtm_cabin_tabs_mode .wbtm_cabin_tab {
		padding: 6px 1px 5px;
	}
}

@media (max-width: 360px) {
	.wbtm_cabin_tabs_mode .wbtm_cabin_tab_arrow {
		display: none;
	}
}

@media (prefers-reduced-motion: reduce) {
	.wbtm_cabin_tabs_mode .wbtm_cabin_tab {
		transition: none;
	}
}
