/**
 * Smart Waitlist - front-end styles.
 *
 * Makes fully-booked time cells visible again (core hides `.minute.disabled`)
 * but visually distinct from bookable slots, plus the join dialog.
 */

/* Reveal fully-booked slots as clickable "waiting list only" chips.
   Keep core's floated-block box model (display:block + core's fixed
   height/line-height) so these cells tile in the 3-column grid exactly like
   bookable slots. Using flex/gap here changed the cell height, which made the
   floated cells snag on each other ("holes" in the grid), and it centred the
   whole [time + icon] group so the time label drifted off-centre. The icon is
   positioned absolutely instead, so it never affects layout or text centring. */
.sln_timepicker .minute.disabled.sbs-waitlist,
.minute.disabled.sbs-waitlist {
	display: block !important;
	box-sizing: border-box;
	pointer-events: auto !important;
	cursor: pointer;
	position: relative;
	opacity: 1;
	text-align: center;
	color: #4b5563;
	background: #f7f7f8;
	/* Match core's exact border geometry (0.15em width, 0.2em radius) so these
	   floated cells are pixel-identical in size to bookable slots — a thinner
	   border made them narrower and the floats snagged ("holes" in the grid). */
	border: 0.15em dashed #6b7280 !important;
	border-radius: 0.2em;
}

.minute.disabled.sbs-waitlist:hover {
	background: #eceef1;
	color: #1f2937;
	border-color: #4b5563 !important;
}

/* Waiting-room icon in the top-right corner, drawn as a pseudo-element gated on
   the exact `.minute.disabled.sbs-waitlist` state. Because it's pure CSS, the
   icon appears only while the cell is BOTH fully-booked (disabled) and tagged,
   and disappears the instant core makes the slot bookable (removes `.disabled`)
   — no JS cleanup timing to get wrong. */
.minute.disabled.sbs-waitlist::after {
	content: "";
	position: absolute;
	top: 5px;
	right: 6px;
	width: 20px;
	height: 20px;
	background: url("../images/waiting-room.png") no-repeat center center;
	background-size: contain;
	pointer-events: none;
	opacity: 1;
}

/* Legacy JS-injected icon element (older versions appended a span). Kept hidden
   so a stale one can never linger on a bookable slot. */
.minute .sbs-wl-ico,
.sbs-wl-ico {
	display: none !important;
}

/* -------- "Hide unavailable slots" toggle bar -------- */

/* Puts the selected date/time header and the toggle on one line, opposite ends.
   box-sizing + max-width keep the toggle from spilling past the container edge. */
.sbs-wl-slotbar {
	display: flex !important;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	flex-wrap: wrap;
	width: 100%;
	max-width: 100%;
	box-sizing: border-box;
}

.sbs-wl-slotbar #sln_timepicker_viewdate {
	margin: 0;
	flex: 1 1 auto;
	min-width: 0;
}

/* Every dimension is forced with !important because the booking form scopes
   generic rules under #sln-salon (e.g. on span/label) that would otherwise
   collapse the track or knock the absolutely-positioned thumb off its anchor
   (making it fly to the container edge). */
.sbs-wl-toggle {
	display: inline-flex !important;
	align-items: center;
	gap: 8px;
	cursor: pointer;
	font-size: 13px;
	line-height: 1.2;
	color: var(--sbs-wl-text-soft, #4b5563);
	user-select: none;
	flex: 0 0 auto;
	max-width: 100%;
}

.sbs-wl-toggle__label {
	white-space: normal;
}

.sbs-wl-toggle__input {
	position: absolute !important;
	opacity: 0 !important;
	width: 1px !important;
	height: 1px !important;
	margin: 0 !important;
	pointer-events: none;
}

.sbs-wl-toggle__track {
	position: relative !important;
	display: inline-block !important;
	flex: 0 0 auto !important;
	width: 40px !important;
	height: 22px !important;
	box-sizing: border-box !important;
	background: #b0b8c4 !important;
	border: 1px solid #94a3b8 !important;
	border-radius: 999px !important;
	transition: background 0.15s ease;
}

.sbs-wl-toggle__thumb {
	position: absolute !important;
	top: 2px !important;
	left: 2px !important;
	width: 16px !important;
	height: 16px !important;
	margin: 0 !important;
	background: #fff !important;
	border-radius: 50% !important;
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
	transition: transform 0.15s ease;
}

.sbs-wl-toggle__input:checked + .sbs-wl-toggle__track {
	background: var(--sbs-wl-primary, #0277bd) !important;
	border-color: var(--sbs-wl-primary, #0277bd) !important;
}

.sbs-wl-toggle__input:checked + .sbs-wl-toggle__track .sbs-wl-toggle__thumb {
	transform: translateX(18px);
}

.sbs-wl-toggle__input:focus-visible + .sbs-wl-toggle__track {
	outline: 2px solid var(--sbs-wl-primary, #0277bd);
	outline-offset: 2px;
}

/* When the toggle is on, hide the revealed waiting-list slots. The #id anchor
   gives this higher specificity than the reveal rules so it wins the cascade. */
#salon-step-date.sbs-wl-hide-unavailable .minute.disabled.sbs-waitlist {
	display: none !important;
}

/* Optional legend hook (themes/integrators can display this). */
.sbs-wl-legend {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-size: 12px;
	color: #4b5563;
	margin: 8px 0;
}

.sbs-wl-legend .swatch {
	width: 14px;
	height: 14px;
	border: 1px dashed #6b7280;
	background: #f7f7f8;
	border-radius: 3px;
}

/* -------- Join dialog -------- */

.sbs-wl-modal {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(15, 23, 42, 0.55);
	padding: 16px;
}

.sbs-wl-dialog {
	position: relative;
	width: 100%;
	max-width: 420px;
	background: #fff;
	border-radius: 14px;
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
	padding: 26px 24px 22px;
	font-family: inherit;
	color: #1f2937;
}

.sbs-wl-close {
	position: absolute;
	top: 10px;
	right: 12px;
	border: 0;
	background: transparent;
	font-size: 26px;
	line-height: 1;
	cursor: pointer;
	color: #9ca3af;
}

.sbs-wl-close:hover {
	color: #4b5563;
}

.sbs-wl-title {
	margin: 0 0 6px;
	font-size: 20px;
	color: var(--sbs-wl-text, #1f2937);
}

.sbs-wl-intro {
	margin: 0 0 10px;
	font-size: 14px;
	color: var(--sbs-wl-text-soft, #4b5563);
	line-height: 1.5;
}

.sbs-wl-when {
	margin: 0 0 16px;
	font-weight: 600;
	color: var(--sbs-wl-primary, #0277bd);
	background: #f2f6fb;
	background: color-mix(in srgb, var(--sbs-wl-primary, #0277bd) 10%, #fff);
	padding: 8px 12px;
	border-radius: 8px;
	font-size: 14px;
}

.sbs-wl-field {
	display: block;
	margin-bottom: 12px;
}

.sbs-wl-field span {
	display: block;
	font-size: 13px;
	margin-bottom: 4px;
	color: #374151;
}

.sbs-wl-field input {
	width: 100%;
	box-sizing: border-box;
	padding: 10px 12px;
	border: 1px solid #d1d5db;
	border-radius: 8px;
	font-size: 15px;
}

.sbs-wl-consent {
	display: flex;
	align-items: flex-start;
	gap: 8px;
	font-size: 13px;
	color: #4b5563;
	margin: 4px 0 14px;
	line-height: 1.4;
}

.sbs-wl-actions {
	display: flex;
	justify-content: flex-end;
	gap: 10px;
}

.sbs-wl-cancel,
.sbs-wl-submit,
.sbs-wl-done {
	padding: 10px 18px;
	border-radius: 8px;
	font-size: 14px;
	cursor: pointer;
	border: 1px solid transparent;
}

.sbs-wl-cancel {
	background: #f3f4f6;
	border-color: #e5e7eb;
	color: #374151;
}

.sbs-wl-submit,
.sbs-wl-done {
	background: var(--sbs-wl-primary, #0277bd);
	color: var(--sbs-wl-on-primary, #fff);
	transition: background 0.15s ease, filter 0.15s ease;
}

.sbs-wl-submit:hover,
.sbs-wl-done:hover {
	background: var(--sbs-wl-primary-hover, #01579b);
	filter: brightness(0.96);
}

.sbs-wl-submit:disabled {
	opacity: 0.6;
	cursor: default;
}

.sbs-wl-msg {
	margin: 12px 0 0;
	font-size: 14px;
	min-height: 1em;
}

.sbs-wl-msg--error {
	color: #b42318;
}

.sbs-wl-msg--success {
	color: #1a7f37;
}

/* -------- Success confirmation state -------- */

.sbs-wl-success {
	text-align: center;
	padding: 6px 4px 2px;
}

.sbs-wl-success-check {
	width: 66px;
	height: 66px;
	margin: 4px auto 16px;
	border-radius: 50%;
	background: #dcfce7;
	display: flex;
	align-items: center;
	justify-content: center;
	animation: sbs-wl-pop 0.32s cubic-bezier(0.18, 0.9, 0.32, 1.28);
}

.sbs-wl-success-check svg {
	width: 34px;
	height: 34px;
	stroke: #16a34a;
	stroke-width: 3.2;
	fill: none;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.sbs-wl-success-check svg path {
	stroke-dasharray: 40;
	stroke-dashoffset: 40;
	animation: sbs-wl-draw 0.4s 0.16s ease forwards;
}

.sbs-wl-success-title {
	margin: 0 0 6px;
	font-size: 20px;
	color: var(--sbs-wl-text, #1f2937);
}

.sbs-wl-success-body {
	margin: 0 auto 14px;
	max-width: 320px;
	font-size: 14px;
	line-height: 1.5;
	color: var(--sbs-wl-text-soft, #6b7280);
}

.sbs-wl-success-when {
	display: inline-block;
	margin: 0 0 18px;
	font-weight: 600;
	font-size: 14px;
	color: var(--sbs-wl-primary, #0277bd);
	background: #f2f6fb;
	background: color-mix(in srgb, var(--sbs-wl-primary, #0277bd) 10%, #fff);
	padding: 8px 14px;
	border-radius: 8px;
}

.sbs-wl-success .sbs-wl-done {
	display: block;
	width: 100%;
}

.sbs-wl-redirect {
	margin: 12px 0 0;
	font-size: 12px;
	line-height: 1.4;
	color: var(--sbs-wl-text-soft, #6b7280);
	opacity: 0.85;
}

@keyframes sbs-wl-pop {
	from { transform: scale(0.5); opacity: 0; }
	to   { transform: scale(1); opacity: 1; }
}

@keyframes sbs-wl-draw {
	to { stroke-dashoffset: 0; }
}
