/* ============================================================
   SlashBooking — Public booking widget
   ============================================================ */

.sb-widget {
	--sb-c-primary:        #2563eb;
	--sb-c-primary-hover:  #1d4ed8;
	--sb-c-primary-soft:   #dbeafe;
	--sb-c-accent:         #10b981;
	--sb-c-accent-soft:    #d1fae5;
	--sb-c-cta:            #f97316;
	--sb-c-cta-hover:      #ea580c;
	--sb-c-bg:             #ffffff;
	--sb-c-surface-alt:    #f8fafc;
	--sb-c-border:         #e2e8f0;
	--sb-c-border-strong:  #cbd5e1;
	--sb-c-text:           #0f172a;
	--sb-c-text-soft:      #475569;
	--sb-c-text-muted:     #94a3b8;
	--sb-c-danger:         #dc2626;
	--sb-c-danger-soft:    #fee2e2;

	--sb-radius-sm:  8px;
	--sb-radius:     12px;
	--sb-radius-lg:  16px;

	--sb-shadow-sm:  0 1px 2px rgba(15, 23, 42, .06);
	--sb-shadow:     0 4px 12px rgba(15, 23, 42, .08);

	font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
	font-size: 16px;
	line-height: 1.5;
	color: var(--sb-c-text);
	max-width: 640px;
	margin: 32px auto;
	padding: 0;
	box-sizing: border-box;
}

/* Mobile width safety net : if the parent (theme content area) is narrower
   than expected, shrink margins and respect viewport width. */
@media (max-width: 520px) {
	.sb-widget {
		margin: 16px 0;
		max-width: 100%;
	}
}

.sb-widget *,
.sb-widget *::before,
.sb-widget *::after { box-sizing: border-box; }

/* ============================================================
   Header — trust signals
   ============================================================ */
.sb-widget__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 12px 16px;
	background: var(--sb-c-surface-alt);
	border: 1px solid var(--sb-c-border);
	border-radius: var(--sb-radius);
	margin-bottom: 16px;
	font-size: 13px;
	color: var(--sb-c-text-soft);
}

.sb-widget__trust {
	display: flex;
	align-items: center;
	gap: 6px;
}

.sb-widget__trust svg {
	width: 16px;
	height: 16px;
	color: var(--sb-c-accent);
	flex-shrink: 0;
}

/* ============================================================
   Step indicator
   ============================================================ */
.sb-steps {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 16px 4px;
	margin-bottom: 8px;
}

.sb-steps__item {
	display: flex;
	align-items: center;
	gap: 8px;
	flex: 1;
	min-width: 0;
}

.sb-steps__dot {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 28px;
	height: 28px;
	border-radius: 999px;
	background: var(--sb-c-surface-alt);
	color: var(--sb-c-text-muted);
	border: 2px solid var(--sb-c-border);
	font-size: 13px;
	font-weight: 600;
	flex-shrink: 0;
	transition: background-color 200ms, color 200ms, border-color 200ms;
}

.sb-steps__label {
	font-size: 13px;
	font-weight: 500;
	color: var(--sb-c-text-muted);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	transition: color 200ms;
}

.sb-steps__line {
	flex: 1;
	height: 2px;
	background: var(--sb-c-border);
	border-radius: 999px;
}

.sb-steps__item--active .sb-steps__dot {
	background: var(--sb-c-primary);
	color: #fff;
	border-color: var(--sb-c-primary);
}

.sb-steps__item--active .sb-steps__label {
	color: var(--sb-c-text);
}

.sb-steps__item--done .sb-steps__dot {
	background: var(--sb-c-accent);
	color: #fff;
	border-color: var(--sb-c-accent);
}

.sb-steps__item--done .sb-steps__label {
	color: var(--sb-c-text-soft);
}

@media (max-width: 480px) {
	.sb-steps__label { display: none; }
	.sb-steps__line  { min-width: 16px; }
}

/* ============================================================
   Step card
   ============================================================ */
.sb-step {
	background: var(--sb-c-bg);
	border: 1px solid var(--sb-c-border);
	border-radius: var(--sb-radius);
	padding: 20px;
	margin-bottom: 16px;
	box-shadow: var(--sb-shadow-sm);
	/* Leave 100px clear above when scrollIntoView lands on this element —
	   prevents sticky site headers from covering the heading. */
	scroll-margin-top: 100px;
}

/* Same offset for the whole widget (used by renderSuccess scroll-to-top). */
.sb-widget {
	scroll-margin-top: 100px;
}

/* Hidden steps before a service has been picked (multi-service shortcode). */
.sb-step--hidden { display: none; }

@media (max-width: 480px) {
	.sb-step { padding: 14px; }
}

.sb-step h3 {
	margin: 0 0 4px;
	font-size: 17px;
	font-weight: 600;
	letter-spacing: -0.005em;
	color: var(--sb-c-text);
}

.sb-step__hint {
	margin: 0 0 16px;
	font-size: 14px;
	color: var(--sb-c-text-soft);
}

/* ============================================================
   Service picker (pills)
   ============================================================ */
.sb-services {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
	gap: 10px;
}

.sb-service-pill {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	padding: 14px 18px;
	font: inherit;
	font-size: 15px;
	font-weight: 600;
	color: var(--sb-c-text);
	background: var(--sb-c-bg);
	border: 1.5px solid var(--sb-c-border-strong);
	border-radius: var(--sb-radius-sm);
	cursor: pointer;
	transition: background-color 150ms, border-color 150ms, color 150ms, transform 100ms;
}

.sb-service-pill:hover {
	border-color: var(--sb-c-primary);
	color: var(--sb-c-primary);
	background: var(--sb-c-primary-soft);
}

.sb-service-pill:focus-visible {
	outline: 2px solid var(--sb-c-primary);
	outline-offset: 2px;
}

.sb-service-pill:active { transform: scale(0.99); }

.sb-service-pill.is-selected {
	background: var(--sb-c-primary);
	color: #fff;
	border-color: var(--sb-c-primary);
}

.sb-service-pill__duration {
	font-weight: 500;
	font-size: 13px;
	opacity: .85;
	font-variant-numeric: tabular-nums;
}

/* ============================================================
   Calendar
   ============================================================ */
.sb-cal {
	background: var(--sb-c-bg);
}

.sb-cal__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 12px;
}

.sb-cal__month {
	flex: 1;
	text-align: center;
	font-size: 16px;
	font-weight: 600;
	color: var(--sb-c-text);
}

.sb-cal__nav {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	font: inherit;
	color: var(--sb-c-text-soft);
	background: var(--sb-c-bg);
	border: 1px solid var(--sb-c-border-strong);
	border-radius: var(--sb-radius-sm);
	cursor: pointer;
	transition: background-color 150ms, color 150ms, border-color 150ms;
}
.sb-cal__nav svg { width: 18px; height: 18px; }

.sb-cal__nav:hover {
	background: var(--sb-c-surface-alt);
	color: var(--sb-c-text);
	border-color: var(--sb-c-primary);
}

.sb-cal__nav:focus-visible {
	outline: 2px solid var(--sb-c-primary);
	outline-offset: 2px;
}

.sb-cal__dows {
	display: grid;
	grid-template-columns: repeat(7, 1fr);
	gap: 4px;
	margin-bottom: 6px;
}
.sb-cal__dow {
	text-align: center;
	font-size: 11px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: var(--sb-c-text-muted);
	padding: 4px 0;
}

.sb-cal__grid {
	display: grid;
	grid-template-columns: repeat(7, 1fr);
	gap: 4px;
}

@media (max-width: 480px) {
	.sb-cal__grid, .sb-cal__dows { gap: 2px; }
}

.sb-cal-day {
	aspect-ratio: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	/* min-width: 0 is required on grid items to allow the 7 columns to shrink
	   below their min-content size on very narrow viewports — otherwise the
	   button's intrinsic min-content (digit + UA padding) inflates the column
	   track and makes the grid overflow the step container. */
	min-width: 0;
	/* Strip user-agent <button> padding so a 2-digit number stays centered
	   within the aspect-ratio square instead of bleeding beyond it. */
	padding: 0;
	/* Numbers don't need the widget's 1.5 line-height — collapsing to 1
	   removes vertical overflow risk inside the small square. */
	line-height: 1;
	overflow: hidden;
	font: inherit;
	font-size: 14px;
	font-weight: 600;
	color: var(--sb-c-text);
	background: var(--sb-c-surface-alt);
	border: 1px solid transparent;
	border-radius: var(--sb-radius-sm);
	cursor: pointer;
	transition: background-color 150ms, border-color 150ms, transform 100ms;
}

.sb-cal-day--blank   { background: transparent; cursor: default; pointer-events: none; }
.sb-cal-day--loading { background: var(--sb-c-surface-alt); color: var(--sb-c-text-muted); cursor: progress; }

.sb-cal-day--available {
	background: var(--sb-c-accent);
	color: #fff;
}
.sb-cal-day--available:hover {
	background: #059669;
	transform: scale(1.04);
}

.sb-cal-day--partial {
	background: var(--sb-c-accent-soft);
	color: #065f46;
}
.sb-cal-day--partial:hover {
	background: #a7f3d0;
	transform: scale(1.04);
}

.sb-cal-day--full {
	background: var(--sb-c-danger-soft);
	color: #991b1b;
	cursor: not-allowed;
}

.sb-cal-day--closed {
	background: transparent;
	color: var(--sb-c-text-muted);
	cursor: not-allowed;
}

.sb-cal-day:focus-visible {
	outline: 2px solid var(--sb-c-primary);
	outline-offset: 2px;
}

.sb-cal-day.is-selected {
	background: var(--sb-c-primary);
	color: #fff;
	border-color: var(--sb-c-primary);
	box-shadow: 0 0 0 3px var(--sb-c-primary-soft);
}

.sb-cal-day:disabled {
	transform: none;
}

.sb-cal__legend {
	display: flex;
	flex-wrap: wrap;
	gap: 12px 16px;
	margin-top: 16px;
	padding-top: 12px;
	border-top: 1px solid var(--sb-c-border);
	font-size: 12px;
	color: var(--sb-c-text-soft);
}

.sb-cal__legend-item {
	display: inline-flex;
	align-items: center;
	gap: 6px;
}

.sb-cal__legend-swatch {
	width: 16px;
	height: 16px;
	border-radius: 4px;
	display: inline-block;
	flex-shrink: 0;
}

@media (max-width: 480px) {
	.sb-cal-day  { font-size: 13px; border-radius: 6px; }
	.sb-cal__dow { font-size: 10px; padding: 2px 0; }
	.sb-cal__month { font-size: 15px; }
	.sb-cal__nav   { width: 32px; height: 32px; }
	.sb-cal__nav svg { width: 16px; height: 16px; }
	.sb-cal__legend { gap: 8px 12px; font-size: 11px; }
}

/* Very narrow viewports (iPhone SE ≈ 320 px, Galaxy A03 ≈ 360 px, also any
   theme that wraps content in a padded sidebar): tighten the step padding
   and downshift the day-number font so two-digit dates never visually exceed
   their square. Without this, themes that add ~16 px of side padding leave
   each cell at ~36 px square, and a bold 13 px digit ends up touching or
   crossing the cell border. */
@media (max-width: 380px) {
	.sb-step      { padding: 12px 10px; }
	.sb-cal-day   { font-size: 12px; }
	.sb-cal__dow  { font-size: 9px; }
	.sb-cal__grid,
	.sb-cal__dows { gap: 1px; }
}

/* Slot list also needs an overflow safety net on very narrow screens. */
@media (max-width: 480px) {
	.sb-slot-list {
		grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
		gap: 6px;
	}
	.sb-slot { padding: 10px 6px; font-size: 14px; }
}

/* ============================================================
   Slot list
   ============================================================ */
.sb-slot-list {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(108px, 1fr));
	gap: 8px;
}

.sb-slot-empty {
	padding: 16px;
	background: var(--sb-c-surface-alt);
	border: 1px dashed var(--sb-c-border-strong);
	border-radius: var(--sb-radius-sm);
	color: var(--sb-c-text-soft);
	font-size: 14px;
	text-align: center;
}

.sb-slot {
	padding: 12px 8px;
	border: 1px solid var(--sb-c-border-strong);
	background: var(--sb-c-bg);
	border-radius: var(--sb-radius-sm);
	cursor: pointer;
	font: inherit;
	font-size: 15px;
	font-weight: 500;
	font-variant-numeric: tabular-nums;
	color: var(--sb-c-text);
	text-align: center;
	transition: background-color 150ms, border-color 150ms, color 150ms, transform 100ms;
}

.sb-slot:hover {
	border-color: var(--sb-c-primary);
	background: var(--sb-c-primary-soft);
	color: var(--sb-c-primary);
}

.sb-slot:focus-visible {
	outline: 2px solid var(--sb-c-primary);
	outline-offset: 2px;
}

.sb-slot:active { transform: scale(0.98); }

.sb-slot.is-selected {
	background: var(--sb-c-primary);
	color: #fff;
	border-color: var(--sb-c-primary);
}

/* ============================================================
   Form fields
   ============================================================ */
.sb-field {
	display: block;
	margin-bottom: 14px;
}

.sb-field label {
	display: block;
	font-size: 13px;
	font-weight: 600;
	color: var(--sb-c-text);
	margin-bottom: 6px;
}

.sb-field label .sb-required {
	color: var(--sb-c-danger);
	margin-left: 2px;
}

.sb-field input,
.sb-field textarea {
	width: 100%;
	padding: 12px 14px;
	font: inherit;
	font-size: 15px;
	color: var(--sb-c-text);
	background: var(--sb-c-bg);
	border: 1px solid var(--sb-c-border-strong);
	border-radius: var(--sb-radius-sm);
	transition: border-color 150ms, box-shadow 150ms;
}

.sb-field input:focus,
.sb-field textarea:focus {
	outline: none;
	border-color: var(--sb-c-primary);
	box-shadow: 0 0 0 3px var(--sb-c-primary-soft);
}

.sb-field input::placeholder,
.sb-field textarea::placeholder {
	color: var(--sb-c-text-muted);
}

.sb-field textarea {
	min-height: 88px;
	resize: vertical;
}

.sb-field--consent {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	padding: 12px;
	background: var(--sb-c-surface-alt);
	border-radius: var(--sb-radius-sm);
}

.sb-field--consent input { width: 18px; height: 18px; flex-shrink: 0; margin-top: 2px; }
.sb-field--consent label { font-weight: 400; font-size: 14px; color: var(--sb-c-text-soft); margin: 0; line-height: 1.5; }
.sb-field--consent label a { color: var(--sb-c-primary); }

.sb-honeypot { position: absolute; left: -9999px; }

.sb-turnstile {
	margin: 16px 0 8px;
	display: flex;
	justify-content: center;
	/* Reserve space so the form doesn't jump when the widget renders. */
	min-height: 65px;
}

.sb-form-disclaimer {
	margin: 12px 0 16px;
	padding: 12px 14px;
	background: var(--sb-c-surface-alt);
	border-left: 3px solid var(--sb-c-primary);
	border-radius: 6px;
	font-size: 13px;
	line-height: 1.5;
	color: var(--sb-c-text-soft);
}

/* ============================================================
   Button (submit)
   ============================================================ */
.sb-button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	width: 100%;
	padding: 14px 24px;
	font: inherit;
	font-size: 16px;
	font-weight: 600;
	color: #fff;
	background: var(--sb-c-cta);
	border: 0;
	border-radius: var(--sb-radius-sm);
	cursor: pointer;
	transition: background-color 150ms, transform 100ms, box-shadow 150ms;
	box-shadow: var(--sb-shadow-sm);
}

.sb-button:hover:not(:disabled) {
	background: var(--sb-c-cta-hover);
	box-shadow: var(--sb-shadow);
}

.sb-button:focus-visible {
	outline: 2px solid var(--sb-c-cta);
	outline-offset: 2px;
}

.sb-button:active:not(:disabled) { transform: scale(0.99); }

.sb-button:disabled {
	background: var(--sb-c-border-strong);
	cursor: not-allowed;
	box-shadow: none;
}

.sb-button__spinner {
	width: 16px;
	height: 16px;
	border: 2px solid rgba(255,255,255,.4);
	border-top-color: #fff;
	border-radius: 50%;
	animation: sb-spin 700ms linear infinite;
}

@keyframes sb-spin {
	to { transform: rotate(360deg); }
}

/* ============================================================
   Feedback (error / success)
   ============================================================ */
.sb-feedback { margin: 16px 0; }

.sb-error {
	display: flex;
	align-items: flex-start;
	gap: 8px;
	padding: 12px 14px;
	background: var(--sb-c-danger-soft);
	border-left: 3px solid var(--sb-c-danger);
	border-radius: var(--sb-radius-sm);
	color: #991b1b;
	font-size: 14px;
}

.sb-success {
	display: flex;
	align-items: flex-start;
	gap: 8px;
	padding: 16px;
	background: var(--sb-c-accent-soft);
	border-left: 3px solid var(--sb-c-accent);
	border-radius: var(--sb-radius-sm);
	color: #065f46;
	font-size: 15px;
}

.sb-success svg, .sb-error svg {
	width: 20px;
	height: 20px;
	flex-shrink: 0;
	margin-top: 1px;
}

.sb-success strong {
	display: block;
	margin-bottom: 4px;
	font-size: 16px;
}

/* ============================================================
   Loading state
   ============================================================ */
.sb-loading { opacity: .6; pointer-events: none; }

/* ============================================================
   Legal link
   ============================================================ */
.sb-legal-link {
	color: var(--sb-c-primary);
	text-decoration: underline;
}
.sb-legal-link:hover { color: var(--sb-c-primary-hover); }

/* ============================================================
   Reduced motion
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
	.sb-widget *, .sb-widget *::before, .sb-widget *::after {
		animation-duration: 0.01ms !important;
		transition-duration: 0.01ms !important;
	}
}
