/* Estilos base del widget de reserva — deliberadamente neutros para no chocar
   con el tema final; el equipo de diseño puede sobreescribirlos con más
   especificidad o directamente en el theme. Usa las variables de color de la
   guía HTML si están disponibles, con fallback a valores propios. */

.sgk-booking-widget,
.sgk-booking-page {
	--sgk-bg: var(--bg-soft, #ECE4DA);
	--sgk-accent: var(--accent, #B9A590);
	--sgk-text: var(--text-dark, #36302A);
	--sgk-border: #e3ddd5;
	--sgk-error: #b3261e;
	--sgk-success-bg: #eef7ee;
	--sgk-success-border: #b7d9b7;
	--sgk-dot-low: #e53935;
	--sgk-dot-mid: #fb8c00;
	--sgk-dot-high: #43a047;
	font-family: inherit;
	color: var(--sgk-text);
}

.sgk-booking-widget {
	max-width: 480px;
}

/* Los anchos al 100% cuentan con el relleno dentro: no depender de que el
   tema ponga border-box (en la web real llegaba content-box y las filas de
   servicio se salían por la derecha). */
.sgk-booking-widget,
.sgk-booking-widget *,
.sgk-booking-widget *::before,
.sgk-booking-widget *::after,
.sgk-booking-page,
.sgk-booking-page *,
.sgk-booking-page *::before,
.sgk-booking-page *::after {
	box-sizing: border-box;
}

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

/* Reset defensivo: muchos temas (p. ej. GeneratePress) aplican estilos
   globales a <button> asumiendo fondo de color + texto blanco. Como aquí
   pintamos botones con fondo claro, hay que fijar el color de texto de forma
   explícita o el texto queda invisible (blanco sobre blanco). */
.sgk-booking-widget button {
	font-family: inherit;
	appearance: none;
	-webkit-appearance: none;
	line-height: normal;
}

.sgk-booking-widget :focus-visible {
	outline: 2px solid var(--sgk-text);
	outline-offset: 2px;
}

/* --- Duración y precio ---------------------------------------------------- */

.sgk-service-info {
	display: flex;
	flex-wrap: wrap;
	gap: 6px 16px;
	margin: 0 0 12px;
	font-size: 0.9rem;
}
.sgk-service-duration::before {
	content: "◷ ";
}

/* --- Pasos ---------------------------------------------------------------- */

.sgk-steps {
	display: flex;
	gap: 6px;
	margin: 0 0 14px;
	padding: 0;
	list-style: none;
	counter-reset: sgk-step;
	font-size: 0.78rem;
}
.sgk-steps-item {
	flex: 1;
	padding-top: 6px;
	border-top: 3px solid var(--sgk-border);
	opacity: 0.6;
	counter-increment: sgk-step;
}
.sgk-steps-item::before {
	content: counter(sgk-step) ". ";
}
.sgk-steps-item.is-done {
	border-top-color: var(--sgk-accent);
}
.sgk-steps-item.is-current {
	border-top-color: var(--sgk-text);
	font-weight: 600;
	opacity: 1;
}

.sgk-step {
	margin: 0 0 14px;
}

.sgk-step-title {
	margin: 10px 0 6px;
	padding: 0;
	font-size: 0.85rem;
}

fieldset.sgk-step {
	min-width: 0;
	padding: 0;
	border: 0;
}

/* --- Profesionales -------------------------------------------------------- */

.sgk-pros {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
	gap: 8px;
}

.sgk-pro {
	position: relative;
	display: flex;
	align-items: center;
	gap: 10px;
	min-height: 56px;
	padding: 8px 10px;
	background: #fff;
	border: 1px solid var(--sgk-border);
	border-radius: 8px;
	cursor: pointer;
}
.sgk-pro:hover {
	background: var(--sgk-bg);
}
.sgk-pro.is-selected {
	border-color: var(--sgk-accent);
	box-shadow: 0 0 0 1px var(--sgk-accent);
}
.sgk-pro-input {
	position: absolute;
	opacity: 0;
	pointer-events: none;
}
.sgk-pro:focus-within {
	outline: 2px solid var(--sgk-text);
	outline-offset: 2px;
}

.sgk-pro-avatar {
	display: inline-flex;
	flex: 0 0 40px;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	overflow: hidden;
	border-radius: 50%;
	background: var(--sgk-bg);
	font-size: 0.85rem;
	font-weight: 600;
}
.sgk-pro-avatar img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.sgk-pro-text {
	display: flex;
	flex-direction: column;
	min-width: 0;
}
.sgk-pro-name {
	font-size: 0.88rem;
}
.sgk-pro-hint {
	font-size: 0.72rem;
	opacity: 0.75;
}

/* --- Calendario ----------------------------------------------------------- */

.sgk-calendar {
	padding: 12px;
	background: #fff;
	border: 1px solid var(--sgk-border);
	border-radius: 8px;
}

.sgk-cal-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 8px;
}

.sgk-cal-title {
	font-size: 0.95rem;
}

.sgk-booking-widget .sgk-cal-nav {
	width: 40px;
	height: 40px;
	padding: 0;
	border: none;
	border-radius: 50%;
	background: transparent;
	color: var(--sgk-text);
	font-size: 1.3rem;
	cursor: pointer;
}
.sgk-booking-widget .sgk-cal-nav:hover:not(:disabled) {
	background: var(--sgk-bg);
}
.sgk-booking-widget .sgk-cal-nav:disabled {
	opacity: 0.3;
	cursor: default;
}

.sgk-cal-grid {
	display: grid;
	grid-template-columns: repeat(7, 1fr);
	gap: 2px;
	text-align: center;
}

.sgk-cal-weekday {
	padding: 4px 0;
	font-size: 0.75rem;
	opacity: 0.7;
}

.sgk-booking-widget .sgk-cal-day {
	position: relative;
	justify-self: center;
	width: 100%;
	max-width: 44px;
	height: 44px;
	padding: 0;
	border: none;
	border-radius: 50%;
	background: transparent;
	color: var(--sgk-text);
	font-size: 0.85rem;
	cursor: pointer;
}
.sgk-booking-widget .sgk-cal-day:hover:not(.is-disabled) {
	background: var(--sgk-bg);
}
.sgk-booking-widget .sgk-cal-day.is-today .sgk-cal-num {
	font-weight: 700;
}
.sgk-booking-widget .sgk-cal-day.is-selected,
.sgk-booking-widget .sgk-cal-day.is-selected:hover {
	background: var(--sgk-accent);
	color: #fff;
}
.sgk-booking-widget .sgk-cal-day.is-disabled {
	opacity: 0.35;
	cursor: default;
}

.sgk-cal-day .sgk-cal-dot {
	position: absolute;
	left: 50%;
	bottom: 4px;
	transform: translateX(-50%);
}

.sgk-cal-dot {
	display: inline-block;
	width: 6px;
	height: 6px;
	border-radius: 50%;
}
.sgk-cal-dot.is-low { background: var(--sgk-dot-low); }
.sgk-cal-dot.is-mid { background: var(--sgk-dot-mid); }
.sgk-cal-dot.is-high { background: var(--sgk-dot-high); }

/* Mientras llega la disponibilidad del mes. */
.sgk-calendar.is-loading .sgk-cal-grid {
	opacity: 0.6;
}

.sgk-cal-legend {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 6px 14px;
	margin-top: 10px;
	font-size: 0.72rem;
	opacity: 0.8;
}
.sgk-cal-legend-item {
	display: inline-flex;
	align-items: center;
	gap: 5px;
}

.sgk-month-notice:not(:empty) {
	margin-top: 10px;
	padding: 10px 12px;
	background: var(--sgk-bg);
	border-radius: 8px;
	font-size: 0.85rem;
}
.sgk-month-notice p {
	margin: 0 0 6px;
}
.sgk-booking-widget .sgk-month-next {
	padding: 8px 14px;
	border: 1px solid var(--sgk-accent);
	border-radius: 20px;
	background: #fff;
	color: var(--sgk-text);
	font-size: 0.85rem;
	cursor: pointer;
}

.sgk-notice:not(:empty) {
	margin: 10px 0 0;
	padding: 10px 12px;
	background: #fdf3e7;
	border-left: 3px solid var(--sgk-dot-mid);
	font-size: 0.85rem;
}

/* --- Horas ---------------------------------------------------------------- */

.sgk-slot-group {
	margin: 12px 0 0;
}
.sgk-slot-group-title {
	margin: 0 0 6px;
	font-size: 0.78rem;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	opacity: 0.75;
}
.sgk-slot-list {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.sgk-booking-widget .sgk-slot {
	min-height: 40px;
	padding: 8px 14px;
	border: 1px solid var(--sgk-accent);
	background: #fff;
	color: var(--sgk-text);
	border-radius: 20px;
	font-size: 0.85rem;
	cursor: pointer;
}
.sgk-booking-widget .sgk-slot:hover {
	background: var(--sgk-bg);
	color: var(--sgk-text);
}
.sgk-booking-widget .sgk-slot.is-selected {
	background: var(--sgk-accent);
	color: #fff;
	border-color: var(--sgk-accent);
}

/* --- Estado, errores y alternativas --------------------------------------- */

.sgk-status {
	min-height: 1.2em;
	margin-top: 8px;
	font-size: 0.82rem;
}
.sgk-status p {
	margin: 0 0 6px;
}
.sgk-error-text {
	color: var(--sgk-error);
}
.sgk-contact-links {
	display: flex;
	flex-wrap: wrap;
	gap: 6px 14px;
	margin: 6px 0 0;
	padding: 0;
	list-style: none;
}
.sgk-contact-links a,
.sgk-booking-widget .sgk-link-button {
	padding: 0;
	border: 0;
	background: none;
	color: inherit;
	font-size: 0.85rem;
	text-decoration: underline;
	cursor: pointer;
}

/* --- Formulario ----------------------------------------------------------- */

.sgk-selected-slot {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 6px 12px;
	margin-bottom: 6px;
	padding: 10px 12px;
	background: var(--sgk-bg);
	border-radius: 8px;
	font-size: 0.88rem;
}
.sgk-booking-widget .sgk-change {
	padding: 6px 12px;
	border: 1px solid var(--sgk-text);
	border-radius: 20px;
	background: transparent;
	color: var(--sgk-text);
	font-size: 0.8rem;
	cursor: pointer;
}

.sgk-field {
	margin-top: 10px;
}
.sgk-field > label {
	display: block;
	margin-bottom: 4px;
	font-size: 0.85rem;
}

.sgk-booking-widget input[type="text"],
.sgk-booking-widget input[type="tel"],
.sgk-booking-widget input[type="email"],
.sgk-booking-widget textarea {
	width: 100%;
	min-height: 44px;
	padding: 8px 10px;
	border: 1px solid #ccc;
	border-radius: 4px;
	font-size: 1rem; /* 16px: evita el zoom automático de iOS al enfocar. */
	background: #fff;
	box-sizing: border-box;
}
.sgk-field.has-error input,
.sgk-field.has-error textarea {
	border-color: var(--sgk-error);
}

.sgk-field-error {
	display: block;
	color: var(--sgk-error);
	font-size: 0.78rem;
}
.sgk-field-error:empty {
	display: none;
}

.sgk-booking-widget .sgk-checkbox {
	display: flex;
	align-items: flex-start;
	gap: 8px;
	font-size: 0.85rem;
}
.sgk-booking-widget .sgk-checkbox input {
	flex: 0 0 auto;
	width: 18px;
	height: 18px;
	margin-top: 0.1em;
}
.sgk-booking-widget .sgk-checkbox a {
	color: inherit;
	text-decoration: underline;
}
.sgk-not-me {
	margin: 4px 0 0 26px;
}

.sgk-privacy-info {
	margin: 10px 0 0;
	font-size: 0.75rem;
	line-height: 1.4;
	opacity: 0.8;
}

.sgk-booking-widget .sgk-honeypot {
	position: absolute;
	left: -9999px;
	width: 1px;
	height: 1px;
	opacity: 0;
}

.sgk-turnstile {
	margin-top: 12px;
}

.sgk-booking-widget .sgk-submit {
	width: 100%;
	min-height: 48px;
	margin-top: 14px;
	padding: 10px 20px;
	border: none;
	border-radius: 4px;
	background: var(--sgk-accent);
	color: #fff;
	font-size: 0.95rem;
	cursor: pointer;
}
.sgk-booking-widget .sgk-submit:disabled {
	opacity: 0.6;
	cursor: default;
}

/* --- Confirmación --------------------------------------------------------- */

.sgk-confirmation {
	padding: 16px;
	background: var(--sgk-success-bg);
	border: 1px solid var(--sgk-success-border);
	border-radius: 8px;
	font-size: 0.9rem;
}
.sgk-confirmation:focus {
	outline: none;
}
.sgk-confirmation-title {
	margin: 0 0 4px;
	font-size: 1.05rem;
	font-weight: 600;
}
.sgk-confirmation-title::before {
	content: "✓ ";
}
.sgk-confirmation-text {
	margin: 0 0 10px;
}
.sgk-confirmation-summary {
	display: grid;
	grid-template-columns: max-content 1fr;
	gap: 4px 12px;
	margin: 0 0 12px;
}
.sgk-confirmation-summary dt {
	opacity: 0.75;
}
.sgk-confirmation-summary dd {
	margin: 0;
}
.sgk-add-calendar-title {
	margin: 0 0 6px;
	font-weight: 600;
}
.sgk-add-calendar-links {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-bottom: 12px;
}
.sgk-add-calendar-links a {
	padding: 8px 14px;
	border: 1px solid var(--sgk-text);
	border-radius: 20px;
	color: var(--sgk-text);
	font-size: 0.85rem;
	text-decoration: none;
}
.sgk-cancel-info {
	margin: 0 0 4px;
	font-size: 0.85rem;
}
.sgk-new-booking {
	margin-top: 12px;
}

/* --- Página de reservas [sgk_reserva] ------------------------------------- */

.sgk-booking-page {
	display: grid;
	gap: 32px;
	align-items: start;
}
.sgk-booking-page.has-team {
	grid-template-columns: minmax(0, 1fr) 280px;
}
/* El buscador y "Cambiar servicio" ocultan con [hidden]: que ningún estilo
   del tema lo anule. */
.sgk-booking-page [hidden] {
	display: none !important;
}

.sgk-booking-page button {
	font-family: inherit;
	appearance: none;
	-webkit-appearance: none;
	line-height: normal;
}
.sgk-booking-page :focus-visible {
	outline: 2px solid var(--sgk-text);
	outline-offset: 2px;
}

.sgk-bp-search {
	position: relative;
	margin-bottom: 16px;
}
.sgk-bp-search::before {
	content: "";
	position: absolute;
	top: 50%;
	left: 14px;
	width: 14px;
	height: 14px;
	margin-top: -9px;
	border: 2px solid currentColor;
	border-radius: 50%;
	opacity: 0.5;
	pointer-events: none;
}
.sgk-bp-search::after {
	content: "";
	position: absolute;
	top: 50%;
	left: 27px;
	width: 2px;
	height: 7px;
	margin-top: 2px;
	background: currentColor;
	transform: rotate(-45deg);
	opacity: 0.5;
	pointer-events: none;
}
.sgk-booking-page .sgk-bp-search-input {
	width: 100%;
	min-height: 48px;
	padding: 10px 14px 10px 42px;
	border: 1px solid var(--sgk-border);
	border-radius: 8px;
	background: #fff;
	color: var(--sgk-text);
	font: inherit;
}

.sgk-bp-empty {
	margin: 0 0 16px;
	font-size: 0.9rem;
}

.sgk-bp-group {
	margin: 0 0 12px;
	overflow: hidden;
	background: #fff;
	border: 1px solid var(--sgk-border);
	border-radius: 8px;
}
.sgk-bp-group-title {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 14px 16px;
	background: var(--sgk-bg);
	font-weight: 600;
	cursor: pointer;
	list-style: none;
}
.sgk-bp-group-title::-webkit-details-marker {
	display: none;
}
.sgk-bp-group-title::after {
	content: "";
	flex: 0 0 auto;
	width: 8px;
	height: 8px;
	margin-top: -4px;
	border-right: 2px solid currentColor;
	border-bottom: 2px solid currentColor;
	transform: rotate(45deg);
}
.sgk-bp-group[open] > .sgk-bp-group-title::after {
	margin-top: 4px;
	transform: rotate(-135deg);
}

.sgk-bp-list {
	margin: 0;
	padding: 0;
	list-style: none;
}
.sgk-bp-row + .sgk-bp-row {
	border-top: 1px solid var(--sgk-border);
}
.sgk-booking-page .sgk-bp-item {
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto;
	gap: 2px 16px;
	width: 100%;
	padding: 14px 16px;
	border: 0;
	border-radius: 0;
	background: transparent;
	color: var(--sgk-text);
	font-size: 0.95rem;
	text-align: left;
	cursor: pointer;
}
.sgk-booking-page .sgk-bp-item:hover {
	background: var(--sgk-bg);
}
.sgk-bp-item-name {
	font-weight: 600;
}
.sgk-bp-item-duration {
	font-size: 0.85rem;
	white-space: nowrap;
}
.sgk-bp-item-duration::before,
.sgk-bp-selected-duration::before {
	content: "◷ ";
}
.sgk-bp-item-detail {
	grid-column: 1 / -1;
	font-size: 0.82rem;
	opacity: 0.75;
}

.sgk-bp-selected {
	margin-bottom: 16px;
}
.sgk-booking-page .sgk-bp-back {
	padding: 0;
	border: 0;
	background: none;
	color: inherit;
	font-size: 0.85rem;
	text-decoration: underline;
	cursor: pointer;
}
.sgk-bp-selected-name {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 4px 12px;
	margin: 8px 0 0;
	font-size: 1.2rem;
	font-weight: 600;
}
.sgk-bp-selected-name:focus {
	outline: none;
}
.sgk-bp-selected-duration {
	font-size: 0.85rem;
	font-weight: 400;
}
.sgk-booking-page .sgk-booking-widget {
	max-width: 640px;
}

.sgk-bp-team {
	padding: 20px;
	background: #fff;
	border: 1px solid var(--sgk-border);
	border-radius: 8px;
}
.sgk-bp-team-title {
	margin: 0 0 14px;
	font-size: 1.1rem;
}
.sgk-bp-team-list {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
	gap: 16px 8px;
	margin: 0;
	padding: 0;
	list-style: none;
}
.sgk-bp-member {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 8px;
	text-align: center;
	font-size: 0.85rem;
}
.sgk-bp-member .sgk-pro-avatar {
	flex-basis: 64px;
	width: 64px;
	height: 64px;
	font-size: 1rem;
}

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

/* --- Pantallas pequeñas --------------------------------------------------- */

@media (max-width: 480px) {
	.sgk-pros {
		grid-template-columns: 1fr;
	}
	.sgk-calendar {
		padding: 8px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.sgk-booking-widget * {
		transition: none !important;
		scroll-behavior: auto !important;
	}
}

/* Dentro de un Overlay Panel de GenerateBlocks: el contenido del panel tiene
   max-height:100% pero no overflow, así que el widget (alto en móvil) se
   salía de la pantalla sin poder desplazarse. Solo afecta a paneles que
   contienen el widget. */
.gb-overlay__content:has(.sgk-booking-app) {
	max-height: calc(100% - 32px);
	overflow-y: auto;
	overscroll-behavior: contain;
}
