/*
 * Agenda Rápida para Dentalink: estilos de la agenda pública.
 * Todo vive dentro de .ard-agenda y se adapta al ancho del espacio donde está puesta
 * (una columna angosta, un teléfono o una página completa), no al ancho de la pantalla.
 */
.ard-agenda {
	--ard-primary: #172fb0;
	--ard-primary-hover: #0e1d6c;
	--ard-text: #353842;
	--ard-surface: #eff4f5;
	--ard-accent: #64cecd;
	--ard-radius: 3px;
	--ard-line: color-mix(in srgb, var(--ard-text) 22%, #fff);
	--ard-tint: color-mix(in srgb, var(--ard-accent) 20%, #fff);
	--ard-muted: color-mix(in srgb, var(--ard-text) 78%, #fff);
	container-type: inline-size;
	box-sizing: border-box;
	width: 100%;
	max-width: 880px;
	margin: 0 auto;
	color: var(--ard-text);
	font-size: 16px;
	line-height: 1.45;
	text-align: left;
}

.ard-agenda *,
.ard-agenda *::before,
.ard-agenda *::after {
	box-sizing: border-box;
}

.ard-agenda [hidden] {
	display: none !important;
}

.ard-agenda h2,
.ard-agenda h3 {
	margin: 0;
	color: var(--ard-text);
	line-height: 1.2;
}

.ard-agenda h2 {
	font-size: clamp(1.35em, 5cqi, 2em);
	font-weight: 700;
	text-wrap: balance;
}

.ard-agenda h3 {
	font-size: 1.15em;
	font-weight: 600;
}

.ard-agenda p {
	margin: 0;
}

.ard-icon {
	flex: 0 0 auto;
	width: 1.25em;
	height: 1.25em;
	fill: currentColor;
}

.ard-muted {
	color: var(--ard-muted);
}

.ard-accent {
	color: var(--ard-primary);
}

/* Pasos */
.ard-steps {
	display: flex;
	gap: 8px 14px;
	align-items: center;
	justify-content: center;
	margin: 0 0 14px;
	padding: 0;
	list-style: none;
	font-size: 0.9375em;
}

.ard-steps li {
	display: flex;
	gap: 8px;
	align-items: center;
	margin: 0;
	color: var(--ard-muted);
}

.ard-steps li + li::before {
	content: "";
	width: clamp(16px, 8cqi, 56px);
	height: 2px;
	background: var(--ard-line);
}

.ard-step-number {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 28px;
	height: 28px;
	background: var(--ard-surface);
	border: 1.5px solid var(--ard-line);
	border-radius: 50%;
	font-weight: 600;
}

.ard-steps li.is-current {
	color: var(--ard-text);
	font-weight: 600;
}

.ard-steps li.is-current .ard-step-number,
.ard-steps li.is-done .ard-step-number {
	background: var(--ard-primary);
	border-color: var(--ard-primary);
	color: #fff;
}

.ard-header {
	margin-bottom: 16px;
	text-align: center;
}

.ard-header p {
	margin-top: 6px;
	color: var(--ard-muted);
}

.ard-loading {
	padding: 16px;
	background: var(--ard-surface);
	border-radius: var(--ard-radius);
	text-align: center;
}

/* Sucursal */
.ard-branch {
	margin-bottom: 18px;
	padding: 12px 14px;
	background: var(--ard-tint);
	border-radius: var(--ard-radius);
}

.ard-branch-main {
	display: flex;
	gap: 10px;
	align-items: center;
}

.ard-branch-main > .ard-icon {
	width: 1.6em;
	height: 1.6em;
}

.ard-branch-text {
	display: flex;
	flex: 1 1 auto;
	flex-direction: column;
	min-width: 0;
}

.ard-branch-text span {
	color: var(--ard-muted);
	font-size: 0.9375em;
}

.ard-branch-options {
	display: grid;
	gap: 8px;
	margin-top: 10px;
}

.ard-branch-option {
	display: flex;
	flex-direction: column;
	gap: 2px;
	min-height: 44px;
	padding: 10px 12px;
	background: #fff;
	border: 1.5px solid var(--ard-line);
	border-radius: var(--ard-radius);
	color: var(--ard-text);
	font: inherit;
	text-align: left;
	cursor: pointer;
}

.ard-branch-option:hover {
	border-color: var(--ard-text);
}

.ard-textbutton {
	display: inline-flex;
	flex: 0 0 auto;
	gap: 6px;
	align-items: center;
	min-height: 44px;
	padding: 4px 6px;
	background: none;
	border: 0;
	color: var(--ard-primary);
	font: inherit;
	font-weight: 600;
	text-decoration: underline;
	text-underline-offset: 3px;
	cursor: pointer;
}

/* Días */
.ard-row-head {
	display: flex;
	flex-wrap: wrap;
	gap: 4px 12px;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 8px;
}

.ard-days {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(86px, 1fr));
	gap: 10px;
}

.ard-day {
	position: relative;
	display: flex;
	flex-direction: column;
	gap: 2px;
	align-items: center;
	min-height: 84px;
	padding: 12px 6px;
	background: #fff;
	border: 1.5px solid var(--ard-line);
	border-radius: var(--ard-radius);
	color: var(--ard-text);
	font: inherit;
	cursor: pointer;
}

.ard-day-name {
	font-weight: 500;
}

.ard-day-number {
	font-size: 1.2em;
	font-weight: 700;
	white-space: nowrap;
}

.ard-day-count {
	color: var(--ard-muted);
	font-size: 0.875em;
}

.ard-day:hover {
	border-color: var(--ard-text);
}

.ard-day.is-selected {
	background: var(--ard-tint);
	border-color: var(--ard-primary);
	border-width: 2px;
}

.ard-day-check {
	position: absolute;
	top: 6px;
	right: 6px;
	display: inline-flex;
	padding: 2px;
	background: var(--ard-primary);
	border-radius: 50%;
	color: #fff;
	font-size: 0.75em;
}

/* Horas */
.ard-slots {
	margin-top: 20px;
}

.ard-slot-group {
	margin-top: 12px;
}

.ard-pill {
	display: inline-block;
	margin-bottom: 8px;
	padding: 2px 14px;
	background: var(--ard-tint);
	border-radius: var(--ard-radius);
	font-size: 0.9375em;
	font-weight: 600;
}

.ard-slot-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(78px, 1fr));
	gap: 8px;
}

.ard-slot {
	display: inline-flex;
	gap: 4px;
	align-items: center;
	justify-content: center;
	min-height: 46px;
	padding: 6px 4px;
	background: #fff;
	border: 1.5px solid var(--ard-line);
	border-radius: var(--ard-radius);
	color: var(--ard-text);
	font: inherit;
	font-weight: 600;
	font-variant-numeric: tabular-nums;
	cursor: pointer;
}

.ard-slot:hover {
	border-color: var(--ard-text);
}

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

.ard-slot .ard-icon {
	width: 1em;
	height: 1em;
}

/* Selección y botones */
.ard-selection {
	display: flex;
	gap: 10px;
	align-items: center;
	justify-content: center;
	margin-top: 20px;
	padding: 12px 14px;
	background: var(--ard-tint);
	border-radius: var(--ard-radius);
	text-align: center;
}

.ard-button {
	display: block;
	width: 100%;
	min-height: 54px;
	margin-top: 14px;
	padding: 12px 20px;
	background: var(--ard-primary);
	border: 0;
	border-radius: var(--ard-radius);
	color: #fff;
	font: inherit;
	font-size: 1.1em;
	font-weight: 600;
	cursor: pointer;
}

.ard-button:hover:not(:disabled) {
	background: var(--ard-primary-hover);
}

.ard-button:disabled {
	background: var(--ard-surface);
	border: 1.5px solid var(--ard-line);
	color: var(--ard-muted);
	cursor: not-allowed;
}

/* Formulario */
.ard-summary {
	display: flex;
	gap: 12px;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 18px;
	padding: 12px 14px;
	background: var(--ard-tint);
	border-radius: var(--ard-radius);
}

.ard-summary-text {
	display: flex;
	flex-direction: column;
	min-width: 0;
}

.ard-summary-text span {
	color: var(--ard-muted);
	font-size: 0.9375em;
}

.ard-fields {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr));
	gap: 14px 16px;
	margin-top: 12px;
}

.ard-field label {
	display: block;
	margin-bottom: 4px;
	font-weight: 500;
}

.ard-input {
	width: 100%;
	min-height: 46px;
	padding: 9px 12px;
	background: #fff;
	border: 1px solid var(--ard-text);
	border-radius: var(--ard-radius);
	color: var(--ard-text);
	font: inherit;
	/* 16px como mínimo: con menos, el iPhone hace zoom al tocar el campo. */
	font-size: max(16px, 1em);
}

.ard-input[aria-invalid="true"] {
	border-width: 2px;
}

.ard-error {
	display: block;
	margin-top: 4px;
	font-size: 0.875em;
	font-weight: 500;
}

.ard-error:not(:empty)::before {
	content: "⚠ ";
}

.ard-hint {
	display: block;
	margin-top: 4px;
	color: var(--ard-muted);
	font-size: 0.875em;
}

.ard-consent {
	margin-top: 16px;
}

.ard-agenda .ard-check-label {
	display: flex;
	gap: 8px;
	align-items: flex-start;
	margin: 8px 0 0;
	font-size: 0.9375em;
	font-weight: 400;
}

.ard-check-label input {
	flex: 0 0 auto;
	width: 20px;
	height: 20px;
	margin: 1px 0 0;
}

.ard-hp {
	position: absolute;
	left: -9999px;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

/* Mensajes */
.ard-notice:empty {
	display: none;
}

.ard-notice {
	margin-top: 18px;
	padding: 14px 16px;
	background: var(--ard-surface);
	border-left: 4px solid var(--ard-text);
	border-radius: var(--ard-radius);
}

.ard-notice p + p {
	margin-top: 8px;
}

.ard-success {
	padding: 28px 20px;
	background: var(--ard-tint);
	border-radius: var(--ard-radius);
	text-align: center;
}

.ard-success-icon {
	display: inline-flex;
	margin-bottom: 8px;
	padding: 8px;
	background: var(--ard-primary);
	border-radius: 50%;
	color: #fff;
	font-size: 1.4em;
}

.ard-success p {
	margin-top: 6px;
}

.ard-help {
	display: flex;
	flex-wrap: wrap;
	gap: 4px 8px;
	align-items: center;
	justify-content: center;
	margin-top: 18px;
	text-align: center;
}

.ard-link {
	color: var(--ard-primary);
	font-weight: 600;
	text-decoration: underline;
	text-decoration-thickness: 1px;
	text-underline-offset: 3px;
}

.ard-help .ard-link {
	display: inline-flex;
	align-items: center;
	min-height: 44px;
}

/* Foco visible en todo elemento interactivo */
.ard-agenda button:focus-visible,
.ard-agenda a:focus-visible,
.ard-agenda input:focus-visible,
.ard-agenda select:focus-visible {
	outline: 2px solid var(--ard-text);
	outline-offset: 2px;
}

.ard-notice:focus,
.ard-success:focus {
	outline: none;
}

/* Espacio angosto: una columna del sitio o un teléfono pequeño */
@container (max-width: 360px) {
	.ard-steps {
		font-size: 0.8125em;
	}

	.ard-days {
		gap: 6px;
	}

	.ard-day {
		min-height: 76px;
		padding: 10px 2px;
	}

	.ard-day-number {
		font-size: 1.05em;
	}

	.ard-slot-grid {
		grid-template-columns: repeat(auto-fill, minmax(68px, 1fr));
		gap: 6px;
	}
}

/* Espacio amplio */
@container (min-width: 620px) {
	.ard-branch {
		padding: 14px 18px;
	}

	.ard-day {
		min-height: 104px;
		padding: 16px 8px;
	}

	.ard-day-number {
		font-size: 1.45em;
	}

	.ard-slot-grid {
		grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
	}
}

@media (prefers-reduced-motion: reduce) {
	.ard-agenda * {
		animation: none !important;
		scroll-behavior: auto !important;
		transition: none !important;
	}
}

/* Cambio de cita */
.ard-offer-actions {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr));
	gap: 10px;
	margin-top: 12px;
}

.ard-offer-actions .ard-button {
	margin-top: 0;
}

.ard-agenda .ard-button-secondary {
	background: #fff;
	border: 1.5px solid var(--ard-text);
	color: var(--ard-text);
}

.ard-agenda .ard-button-secondary:hover:not(:disabled) {
	background: var(--ard-surface);
}

/* Página de cita reservada */
.ard-confirm-list {
	display: grid;
	grid-template-columns: auto 1fr;
	gap: 6px 14px;
	max-width: 460px;
	margin: 16px auto 0;
	text-align: left;
}

.ard-confirm-list dt {
	color: var(--ard-muted);
}

.ard-confirm-list dd {
	margin: 0;
	font-weight: 600;
}

.ard-agenda .ard-continue {
	display: inline-block;
	width: auto;
	min-width: 200px;
	text-decoration: none;
}

/* Indicador de trabajo */
.ard-agenda .ard-loading {
	display: flex;
	gap: 10px;
	align-items: center;
	justify-content: center;
}

.ard-spinner {
	display: inline-block;
	flex: 0 0 auto;
	width: 1.25em;
	height: 1.25em;
	border: 3px solid color-mix(in srgb, currentColor 25%, transparent);
	border-top-color: currentColor;
	border-radius: 50%;
	animation: ard-spin 0.8s linear infinite;
}

.ard-button .ard-spinner {
	margin-right: 10px;
	vertical-align: -0.2em;
}

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

@media (prefers-reduced-motion: reduce) {
	.ard-agenda .ard-spinner {
		animation: ard-spin 2.4s linear infinite !important;
	}
}
