/* This widget gets embedded into arbitrary WordPress themes, so it can't
   assume the host page resets the box model — without this, an element with
   both `width: 100%` and a border (e.g. .caredal-cal__date-table) renders a
   couple px wider than its container in the browser's default content-box
   model. */
.caredal-calendar,
.caredal-calendar *,
.caredal-calendar *::before,
.caredal-calendar *::after {
	box-sizing: border-box;
}

/* Same reasoning, but for <button>: the host theme's own stylesheet can
   (and often does) give bare `button` elements a default margin — that's
   what actually made the edge-nav/show-more overlays look like they had an
   unexplained gap on their right/bottom, not the box model above. Reset
   once here instead of patching `margin: 0` onto every button class one at
   a time as each one happens to get noticed. */
.caredal-calendar button {
	margin: 0;
}

.caredal-calendar {
	--caredal-accent: #2563eb;
	--caredal-accent-contrast: #ffffff;
	--caredal-border: #e2e8f0;
	--caredal-text: #0f172a;
	--caredal-muted: #64748b;
	--caredal-danger: #dc2626;
	--caredal-surface: #f8fafc;
	--caredal-radius: 10px;

	width: 100%;
	max-width: 100%;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	color: var(--caredal-text);
}

.caredal-cal h3 {
	margin: 0 0 12px;
	font-size: 1.1rem;
}

.caredal-cal__specialist-header {
	display: flex;
	gap: 12px;
	align-items: center;
	padding-bottom: 16px;
	margin-bottom: 16px;
	border-bottom: 1px solid var(--caredal-border);
}

.caredal-cal__specialist-avatar {
	flex-shrink: 0;
	border-radius: 50%;
	overflow: hidden;
	background: #f1f5f9;
	display: flex;
	align-items: center;
	justify-content: center;
}

.caredal-cal__specialist-avatar--small {
	width: 64px;
	height: 64px;
}

.caredal-cal__specialist-avatar--medium {
	width: 128px;
	height: 128px;
}

.caredal-cal__specialist-avatar--large {
	width: 256px;
	height: 256px;
}

.caredal-cal__specialist-avatar img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.caredal-cal__specialist-avatar-fallback {
	font-size: 1.25rem;
	font-weight: 700;
	color: var(--caredal-muted);
}

.caredal-cal__specialist-info h3 {
	margin: 0 0 4px;
}

.caredal-cal__specialist-specialization {
	margin: 0;
	font-size: 0.875rem;
	color: var(--caredal-muted);
}

/* view_mode="mini" drops the header, so the flow has to sit flush under
   whatever heading the theme renders above it. */
.caredal-cal--view-mini .caredal-cal {
	margin-top: 0;
	padding-top: 0;
}

.caredal-cal__profile {
	padding-bottom: 16px;
	margin-bottom: 16px;
	border-bottom: 1px solid var(--caredal-border);
}

@media (min-width: 960px) {
	.caredal-cal--view-full.caredal-cal--has-full-profile {
		display: grid;
		grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
		gap: 32px;
		align-items: start;
	}

	.caredal-cal--view-full.caredal-cal--has-full-profile > .caredal-cal__profile {
		padding-bottom: 0;
		margin-bottom: 0;
		border-bottom: 0;
	}

	.caredal-cal--view-full.caredal-cal--has-full-profile > .caredal-cal {
		min-width: 0;
	}
}

/* Location stays in the compact column beside the avatar. The longer
   description is rendered below the whole header. */
.caredal-cal__profile-head {
	display: flex;
	flex-wrap: wrap;
	gap: 16px;
	align-items: flex-start;
}

.caredal-cal__profile-body {
	flex: 1 1 260px;
	min-width: 0;
}

.caredal-cal__profile-identity h3 {
	margin: 0 0 4px;
	font-size: 1.25rem;
}

.caredal-cal__profile-specialization {
	margin: 0;
	font-size: 0.9375rem;
	color: var(--caredal-muted);
}

.caredal-cal__profile-bio {
	margin: 0;
	font-size: 0.9375rem;
	line-height: 1.5;
}

.caredal-cal__profile-description {
	margin-top: 20px;
}

.caredal-cal__profile-certifications {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin: 12px 0 0;
	padding: 0;
	list-style: none;
}

.caredal-cal__chip {
	padding: 3px 10px;
	border: 1px solid var(--caredal-border);
	border-radius: 999px;
	font-size: 0.8125rem;
	color: var(--caredal-muted);
}

.caredal-calendar .caredal-cal__profile-certifications > .caredal-cal__chip {
	margin-left: 0;
}

.caredal-cal__profile-details {
	margin-top: 20px;
}

.caredal-cal__profile-body > .caredal-cal__profile-locations {
	margin-top: 10px;
	padding: 8px 10px;
	background: var(--caredal-surface);
	border: 1px solid var(--caredal-border);
	border-radius: var(--caredal-radius);
}

/* Each block reads as its own panel — the label alone was not enough
   separation once the profile carries bio and certifications above it. */
.caredal-cal__profile-details > section {
	padding: 14px 16px;
	background: var(--caredal-surface);
	border: 1px solid var(--caredal-border);
	border-radius: var(--caredal-radius);
}

.caredal-cal__profile-details h4,
.caredal-cal__profile-locations h4 {
	margin: 0 0 10px;
	font-size: 0.75rem;
	font-weight: 600;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--caredal-muted);
}

.caredal-cal__profile-details ul {
	margin: 0;
	padding: 0;
	list-style: none;
	font-size: 0.875rem;
}

.caredal-cal__profile-details li + li {
	border-top: 1px solid var(--caredal-border);
}

.caredal-cal__profile-hours-list li {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	gap: 16px;
	padding: 6px 0;
}

.caredal-cal__profile-hours-list li span:first-child {
	color: var(--caredal-muted);
}

.caredal-cal__profile-hours-list li span + span {
	text-align: right;
	font-variant-numeric: tabular-nums;
}

.caredal-cal__profile-location-list {
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.caredal-cal__profile-location {
	display: flex;
	flex-direction: column;
	gap: 1px;
	color: var(--caredal-muted);
	font-size: 0.8125rem;
}

.caredal-cal__profile-location strong {
	color: var(--caredal-text);
	font-weight: 600;
}

/* No dead space between the panel padding and its first/last row. */
.caredal-cal__profile-details li:first-child {
	padding-top: 0;
}

.caredal-cal__profile-details li:last-child {
	padding-bottom: 0;
}

.caredal-cal__profile-empty {
	margin: 0;
	font-size: 0.875rem;
	color: var(--caredal-muted);
}

.caredal-cal__error {
	background: #fef2f2;
	color: var(--caredal-danger);
	border: 1px solid #fecaca;
	border-radius: var(--caredal-radius);
	padding: 8px 12px;
	font-size: 0.9rem;
	margin-bottom: 12px;
}

.caredal-cal__loading {
	color: var(--caredal-muted);
}

.caredal-cal__services {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.caredal-cal__service {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 12px;
	padding: 12px 16px;
	border: 1px solid var(--caredal-border);
	border-radius: var(--caredal-radius);
	background: #fff;
	cursor: pointer;
	text-align: left;
	font: inherit;
}

.caredal-cal__service:hover {
	border-color: var(--caredal-accent);
}

.caredal-cal__service-name {
	font-weight: 600;
}

.caredal-cal__service-meta {
	color: var(--caredal-muted);
	font-size: 0.85rem;
	white-space: nowrap;
}

.caredal-cal__back {
	background: none;
	border: none;
	color: var(--caredal-accent);
	cursor: pointer;
	padding: 0;
	margin-bottom: 12px;
	font: inherit;
}

.caredal-cal__empty {
	margin: 0 0 12px;
	color: var(--caredal-muted);
	font-size: 0.9rem;
}

.caredal-cal__table-scroll {
	width: 100%;
	/* Owns the visible border/corners (moved here from .caredal-cal__date-table)
	   and clips its content, instead of letting the table scroll horizontally.
	   table-layout: fixed already guarantees the table can't need that scroll —
	   it forces columns to fit the table's own 100% width — so the old
	   `overflow-x: auto` was only ever one stray subpixel away from silently
	   reserving scrollbar space on the right/bottom, which is exactly what
	   made the fade/nav-overlay/show-more overlays (anchored to this box)
	   look like they had a margin they didn't actually have in the CSS.
	   `overflow: hidden` removes that possibility outright. Also anchors the
	   fade + the prev/next/show-more overlays across the whole table;
	   min-height keeps them visible even on an empty page (0 days but
	   pageIndex > 0, where this box holds no <table>). */
	position: relative;
	min-height: 48px;
	border: 1px solid var(--caredal-border);
	border-radius: var(--caredal-radius);
	overflow: hidden;
}

.caredal-cal__date-table {
	width: 100%;
	min-width: 100%;
	border-spacing: 0;
	border-collapse: separate;
	table-layout: fixed;
}

.caredal-cal__date-table th,
.caredal-cal__date-table td {
	border-right: 1px solid var(--caredal-border);
	vertical-align: top;
}

.caredal-cal__date-table th:last-child,
.caredal-cal__date-table td:last-child {
	border-right: 0;
}

/* No padding — .caredal-cal__slots/.caredal-cal__slot already carry the
   exact row math (see there); td padding on top would be unaccounted extra
   height nobody's budget knows about. */
.caredal-cal__date-table td {
	padding: 0;
}

.caredal-cal__date-table th {
	height: 40px; /* same row unit as .caredal-cal__slot and the skeleton */
	padding: 0 6px;
	vertical-align: middle;
	background: #f8fafc;
	color: var(--caredal-muted);
	text-align: center;
	text-transform: capitalize;
}

.caredal-cal__date-weekday,
.caredal-cal__date-value {
	display: block;
}

.caredal-cal__date-weekday {
	color: var(--caredal-text);
	font-size: 0.72rem;
	font-weight: 700;
	line-height: 1.2;
}

.caredal-cal__date-value {
	margin-top: 2px;
	font-size: 0.68rem;
	font-variant-numeric: tabular-nums;
	line-height: 1.2;
}

.caredal-cal__slots {
	/* No max-height/overflow here — capping a descendant inside a <td>
	   isn't reliably enforced by table layout in every browser. The cap
	   lives on .caredal-cal__table-scroll (a plain div) instead. */
	display: flex;
	flex-direction: column;
	min-height: 40px;
}

/* One fading bar across the whole table (not per column), shown when at
   least one column has slots clipped by the current height budget — same
   #f8fafc as the table header, so it reads as "more rows below the fold"
   rather than "content ending". `pointer-events: none` so it never blocks a
   click on a fully-visible slot button in a shorter, unclipped column. No
   `display` here on purpose: a <div> is block-level by default, and
   declaring `display` on an element also carrying the `hidden` attribute
   overrides the browser's own `[hidden] { display: none }` rule (author
   styles win over the user-agent stylesheet at equal specificity). */
.caredal-cal__slots-fade {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	height: 40px;
	background: linear-gradient(to bottom, rgba(248, 250, 252, 0), #f8fafc 85%);
	pointer-events: none;
}

/* Overlay inside the table (not a row underneath it) that grows the shared
   height budget so every clipped column reveals more slots at once — sits
   over the fade, one button for every column at once, not per-column.
   Same reveal-on-hover principle as .caredal-cal__date-nav-overlay (invisible
   until you get close, then fades in) — but this stays a compact button, not
   a full-height/full-width hover zone like prev/next are. `hidden` (toggled
   by updateSlotsOverflow()) still decides whether it exists at all; opacity
   here only decides whether it's visible right now. */
.caredal-cal__show-more {
	position: absolute;
	left: 50%;
	bottom: 10px;
	transform: translateX(-50%);
	padding: 6px 16px;
	border: 1px solid var(--caredal-border);
	border-radius: 999px;
	background: #fff;
	color: var(--caredal-accent);
	cursor: pointer;
	font: inherit;
	font-size: 0.85rem;
	box-shadow: 0 1px 3px rgba(15, 23, 42, 0.12);
	opacity: 0;
	transition: opacity 0.15s ease;
}

.caredal-cal__show-more:hover,
.caredal-cal__show-more:focus-visible {
	opacity: 1;
	border-color: var(--caredal-accent);
}

/* "Reveal nav" — a full-height hover zone flush against the table's own
   left/right edge, like the prev/next curtains carousels use (Netflix-style
   edge peek). Invisible (opacity: 0, but still hoverable/clickable) until
   the cursor gets close to that edge; then the gradient + arrow fade in.
   Light blue scrim (#ebf3fa, max opacity at the edge) with the same accent
   blue as the rest of the widget's buttons for the arrow — kept readable
   against this light gradient specifically, not against arbitrary host-page
   background, since the gradient itself provides the contrast backdrop. */
.caredal-cal__date-nav-overlay {
	position: absolute;
	top: 0;
	bottom: 0;
	display: flex;
	align-items: center;
	width: 48px;
	border: none;
	background: none;
	color: var(--caredal-accent);
	font-size: 1.3rem;
	line-height: 1;
	cursor: pointer;
	opacity: 0;
	transition: opacity 0.15s ease;
}

.caredal-cal__date-nav-overlay:hover,
.caredal-cal__date-nav-overlay:focus-visible {
	opacity: 1;
}

.caredal-cal__date-nav-overlay--prev {
	left: 0;
	justify-content: flex-start;
	padding-left: 8px;
	background: linear-gradient(to right, #ebf3fa, rgba(235, 243, 250, 0));
}

.caredal-cal__date-nav-overlay--next {
	right: 0;
	justify-content: flex-end;
	padding-right: 8px;
	background: linear-gradient(to left, #ebf3fa, rgba(235, 243, 250, 0));
}

/* Fixed placeholder while a page of dates loads: 4 columns, SKELETON_ROWS
   shimmering 40px blocks each (see renderSlotsSkeleton() in the JS) — no
   attempt to match the real content's exact height. */
.caredal-cal__slots-loading {
	/* Explicit height (not auto) so box-sizing: border-box folds the border
	   into these 400px, exactly like .caredal-cal__table-scroll's own
	   inline max-height does for the real table — without this, the border
	   was adding 2px on top of the natural content height instead of being
	   included in it, and that 2px is what nudged the page below down a
	   notch whenever the skeleton was showing. */
	height: 400px; /* ROW_HEIGHT_PX + ROWS_PER_BLOCK * ROW_HEIGHT_PX, see the JS */
	display: flex;
	flex-direction: column;
	border: 1px solid var(--caredal-border);
	border-radius: var(--caredal-radius);
	overflow: hidden;
}

/* Explicit height (ROWS_PER_BLOCK * ROW_HEIGHT_PX, not "whatever the
   content naturally adds up to") on both this and the column below —
   nothing here depends on flex's natural/fit-content sizing math, which is
   exactly what was quietly leaving the skeleton pills short of their full
   40px row. */
.caredal-cal__skeleton-body {
	height: 360px;
	display: flex;
}

/* No gap — real columns touch too, divided only by border-right (see
   .caredal-cal__date-table th/td) with no border on the last one. */
.caredal-cal__skeleton-column {
	height: 360px;
	flex: 1;
	min-width: 0;
	display: flex;
	flex-direction: column;
	border-right: 1px solid var(--caredal-border);
}

.caredal-cal__skeleton-column:last-child {
	border-right: 0;
}

/* One flat color (same as the border everywhere else in the widget) that
   pulses, instead of a sweeping gradient — simpler, and now that sizing
   is solid (.caredal-cal__slot-wrapper decides it, not this), there's no
   need for the shimmer to also be doing visual work to look "alive". */
.caredal-cal__skeleton-thead,
.caredal-cal__skeleton-row {
	background: var(--caredal-border);
	animation: caredal-cal-pulse 1.4s ease-in-out infinite;
}

.caredal-cal__skeleton-thead {
	height: 40px;
	flex-shrink: 0;
	border-radius: 8px;
}

.caredal-cal__skeleton-row {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 100%; /* .caredal-cal__slot-wrapper decides the actual size */
	border: 1px solid var(--caredal-border);
	border-radius: 1rem;
}

/* "00:00" — same shape as a real time label ("09:00", "14:30" …) so this
   reserves the exact width/height real content would, but color matches
   .caredal-cal__skeleton-row's own (now flat) background so it reads as
   blank space, not placeholder text someone might try to read. */
.caredal-cal__skeleton-row-text {
	height: 19px;
	line-height: 19px;
	font: inherit;
	font-size: 0.875rem;
	color: var(--caredal-border);
}

@keyframes caredal-cal-pulse {
	0%,
	100% {
		opacity: 1;
	}
	50% {
		opacity: 0.5;
	}
}

@media (prefers-reduced-motion: reduce) {
	.caredal-cal__skeleton-thead,
	.caredal-cal__skeleton-row {
		animation: none;
	}
}

/* The 40px row unit (thead, this, the skeleton) — carries the fixed height
   and the 4px padding, so the pill inside (.caredal-cal__slot or
   .caredal-cal__skeleton-row, both height: 100%) renders visibly inset
   instead of stretching edge-to-edge. flex-shrink: 0 matters: .caredal-cal__slots
   is a flex column with a capped max-height, and without this the browser
   shrinks wrappers below their own height to cram more in before
   overflow:hidden kicks in. No gap on .caredal-cal__slots — N wrappers
   stack to exactly N * 40px, full stop. */
.caredal-cal__slot-wrapper {
	height: 40px;
	min-height: 0;
	flex-shrink: 0;
	padding: 4px;
}

.caredal-cal__slot {
	/* min-height: 0 is load-bearing: as a flex item, a <button> defaults to
	   min-height: auto, which per spec means it won't shrink below its own
	   UA-stylesheet content-derived minimum size — even with an explicit,
	   smaller `height` set. That's the whole reason this rendered taller
	   than .caredal-cal__skeleton-row (a plain <div>, no such default
	   minimum) despite both declaring the same height. */
	min-height: 0;
	display: flex;
	width: 100%;
	height: 100%; /* .caredal-cal__slot-wrapper decides the actual size */
	flex-direction: column;
	justify-content: center;
	border: 1px solid var(--caredal-border);
	border-radius: 1rem;
	background: #fff;
	cursor: pointer;
	font: inherit;
	font-size: 0.875rem;
	text-align: center;
}


.caredal-cal__slot:hover {
	border-color: var(--caredal-accent);
	color: var(--caredal-accent);
}

.caredal-cal__slot-time {
	/* Fixed, same as .caredal-cal__skeleton-row-text — a flex item's box
	   respects height even as a <span>, so this stops font metrics (which
	   vary by font stack/browser) from deciding how tall the label reads. */
	height: 19px;
	line-height: 19px;
	font-weight: 700;
}

.caredal-cal__selection {
	display: flex;
	flex-direction: column;
	gap: 2px;
	padding: 12px;
	border: 1px solid var(--caredal-border);
	border-radius: var(--caredal-radius);
	background: #f8fafc;
}

.caredal-cal__selection span {
	color: var(--caredal-muted);
	font-size: 0.85rem;
}

.caredal-cal__form {
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.caredal-cal__field {
	display: flex;
	flex-direction: column;
	gap: 4px;
	font-size: 0.85rem;
	color: var(--caredal-muted);
}

.caredal-cal__field input {
	padding: 8px 10px;
	border: 1px solid var(--caredal-border);
	border-radius: 8px;
	font: inherit;
	color: var(--caredal-text);
}

.caredal-cal__consent {
	display: flex;
	align-items: flex-start;
	gap: 8px;
	font-size: 0.85rem;
	cursor: pointer;
}

.caredal-cal__consent input {
	margin-top: 3px;
}

.caredal-cal__submit {
	margin-top: 8px;
	padding: 12px 16px;
	border: none;
	border-radius: var(--caredal-radius);
	background: var(--caredal-accent);
	color: var(--caredal-accent-contrast);
	font: inherit;
	font-weight: 600;
	cursor: pointer;
}

.caredal-cal__submit:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

.caredal-cal__success {
	text-align: center;
	padding: 24px 12px;
}

.caredal-cal__payment-return {
	padding: 24px 12px;
	text-align: center;
}

.caredal-cal__payment-return p {
	margin: 0 0 12px;
}

.caredal-cal__payment-return .caredal-cal__error {
	text-align: left;
}

.caredal-cal__payment-action {
	margin-top: 8px;
}

.caredal-cal__payment-refreshing {
	display: block;
	color: var(--caredal-muted);
	font-size: 0.85rem;
}

.caredal-cal__transfer-notice {
	margin: 0 0 12px;
	padding: 10px 12px;
	background: var(--caredal-surface);
	border: 1px solid var(--caredal-border);
	border-radius: var(--caredal-radius);
	color: var(--caredal-muted);
	font-size: 0.9rem;
}

.caredal-cal__transfer {
	margin: 16px 0 0;
	padding: 12px;
	text-align: left;
	background: var(--caredal-surface);
	border: 1px solid var(--caredal-border);
	border-radius: var(--caredal-radius);
	display: grid;
	grid-template-columns: minmax(0, auto) minmax(0, 1fr);
	gap: 6px 12px;
}

.caredal-cal__transfer dt {
	margin: 0;
	color: var(--caredal-muted);
	font-size: 0.85rem;
}

.caredal-cal__transfer dd {
	margin: 0;
	min-width: 0;
	overflow-wrap: anywhere;
	font-weight: 600;
}

.caredal-cal__transfer-iban-row {
	display: flex;
	align-items: center;
	gap: 8px;
	flex-wrap: wrap;
}

.caredal-cal__transfer-iban {
	font-variant-numeric: tabular-nums;
}

.caredal-cal__transfer-copy {
	padding: 2px 8px;
	background: transparent;
	border: 1px solid var(--caredal-border);
	border-radius: 6px;
	color: var(--caredal-accent);
	font: inherit;
	font-size: 0.8rem;
	font-weight: 600;
	cursor: pointer;
}

@media (max-width: 480px) {
	.caredal-cal__transfer {
		grid-template-columns: minmax(0, 1fr);
		gap: 2px;
	}

	.caredal-cal__transfer dd {
		margin-bottom: 8px;
	}
}
