/*
 * Piercing Booking - veřejný widget
 * Světlý, čistý styl (inspirace noona.cz) - hodně bílého prostoru, jemné stíny,
 * decentní teplý gold akcent jako odkaz na materiál šperků. Zelená/červená/šedá
 * u slotů jsou funkční barvy stavu, ne brand barvy.
 */

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;600;700&family=IBM+Plex+Sans:wght@400;500;600&display=swap');

.pb-widget {
	--pb-bg: #ffffff;
	--pb-bg-subtle: #f7f6f3;
	--pb-border: #e2ded5;
	--pb-border-input: #cec8ba;
	--pb-text: #1c1a16;
	--pb-text-muted: #6f6a61;
	--pb-accent: #a9762f;
	--pb-accent-soft: rgba(169, 118, 47, 0.09);
	--pb-primary: #1c1a16;
	--pb-primary-text: #ffffff;
	--pb-free: #1c7a4a;
	--pb-free-bg: #eaf7f0;
	--pb-booked: #b23b2e;
	--pb-booked-bg: #fdeeec;
	--pb-closed: #8a8478;
	--pb-closed-bg: #f2f0eb;
	--pb-font-display: 'Space Grotesk', 'Segoe UI', sans-serif;
	--pb-font-body: 'IBM Plex Sans', 'Segoe UI', sans-serif;

	max-width: 100%;
	width: 100%;
	margin: 1.5rem 0;
	background: var(--pb-bg);
	color: var(--pb-text);
	border-radius: 20px;
	padding: clamp(20px, 4vw, 36px);
	font-family: var(--pb-font-body);
	border: 1px solid var(--pb-border);
	box-shadow: 0 12px 32px -16px rgba(28, 26, 22, 0.12);
	box-sizing: border-box;
	container-type: inline-size;
	container-name: pb;
}

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

.pb-widget button {
	font-family: var(--pb-font-body);
}

.pb-widget :focus-visible {
	outline: 2px solid var(--pb-accent);
	outline-offset: 2px;
}

/* Zaručuje, že nativní atribut hidden vždy skutečně skryje prvek, i když má
   jinde v CSS nastavené vlastní display (např. display:flex u placeholderu) -
   author styly jinak UA výchozí [hidden]{display:none} přebijí. */
.pb-widget [hidden] {
	display: none !important;
}

/* ---------------- Hlavička (instrukce nad kalendářem) ---------------- */

.pb-widget-header {
	margin-bottom: 22px;
}

.pb-widget-title {
	font-family: var(--pb-font-display);
	font-size: 1.25rem;
	font-weight: 600;
	margin: 0 0 4px;
	color: var(--pb-text);
}

.pb-widget-subtitle {
	font-size: 0.88rem;
	color: var(--pb-text-muted);
	margin: 0;
}

/* ---------------- Layout (kalendář vlevo / sloty+formulář vpravo na širších obrazovkách) ---------------- */

.pb-layout {
	display: block;
}

.pb-col-calendar,
.pb-col-panel {
	width: 100%;
}

.pb-col-panel {
	margin-top: 24px;
	padding-top: 22px;
	border-top: 1px solid var(--pb-border);
}

.pb-placeholder {
	text-align: center;
	color: var(--pb-text-muted);
	font-size: 0.85rem;
	padding: 22px 12px;
}

/* Kalendář má rozumný strop šířky, ať buňky dnů nejsou na širokém sloupci obří. */
.pb-col-calendar {
	max-width: 420px;
}

/* Obsah panelu (sloty, formulář) necháváme čitelně široký, i když je sloupec širší. */
.pb-slots,
.pb-form-wrap,
.pb-success {
	max-width: 480px;
}

@container pb (min-width: 680px) {
	.pb-layout {
		display: grid;
		grid-template-columns: minmax(260px, 380px) 1fr;
		gap: 40px;
		align-items: start;
	}
	.pb-col-panel {
		margin-top: 0;
		padding-top: 0;
		border-top: none;
		border-left: 1px solid var(--pb-border);
		padding-left: 40px;
	}
	.pb-placeholder {
		text-align: left;
		padding: 4px 12px;
	}
}

/* Fallback pro prohlížeče bez podpory container queries - vychází z šířky okna. */
@supports not (container-type: inline-size) {
	@media (min-width: 720px) {
		.pb-layout {
			display: grid;
			grid-template-columns: minmax(260px, 380px) 1fr;
			gap: 40px;
			align-items: start;
		}
		.pb-col-panel {
			margin-top: 0;
			padding-top: 0;
			border-top: none;
			border-left: 1px solid var(--pb-border);
			padding-left: 40px;
		}
	}
}

/* ---------------- Kalendář ---------------- */

.pb-calendar-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 18px;
}

.pb-calendar-title {
	font-family: var(--pb-font-display);
	font-weight: 600;
	font-size: 1.1rem;
	letter-spacing: 0.01em;
	text-transform: capitalize;
	color: var(--pb-text);
}

.pb-nav-btn {
	background: var(--pb-bg);
	border: 1px solid var(--pb-border-input);
	color: var(--pb-text);
	width: 32px;
	height: 32px;
	border-radius: 50%;
	cursor: pointer;
	font-size: 1rem;
	line-height: 1;
	transition: background 0.15s ease, border-color 0.15s ease;
}

.pb-nav-btn:hover:not(:disabled) {
	background: var(--pb-accent-soft);
	border-color: var(--pb-accent);
}

.pb-nav-btn:disabled {
	opacity: 0.3;
	cursor: not-allowed;
}

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

.pb-weekdays {
	margin-bottom: 6px;
}

.pb-weekday {
	text-align: center;
	font-size: 0.7rem;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	color: var(--pb-text-muted);
	padding-bottom: 4px;
}

.pb-day {
	position: relative;
	aspect-ratio: 1 / 1;
	display: flex;
	align-items: center;
	justify-content: center;
	background: var(--pb-bg-subtle);
	border: 1px solid transparent;
	border-radius: 10px;
	color: var(--pb-text);
	font-size: 0.85rem;
	cursor: pointer;
	transition: background 0.15s ease, border-color 0.15s ease;
}

.pb-day:hover:not(.pb-day-disabled):not(.pb-day-empty) {
	border-color: var(--pb-accent);
	background: var(--pb-bg);
}

.pb-day-empty {
	background: transparent;
	cursor: default;
}

.pb-day-disabled {
	color: var(--pb-border-input);
	background: transparent;
	cursor: not-allowed;
}

.pb-day-today {
	box-shadow: inset 0 0 0 1.5px var(--pb-text);
}

.pb-day-selected {
	background: var(--pb-accent);
	border-color: var(--pb-accent);
	color: #fff;
	font-weight: 600;
}

.pb-day-available::after {
	content: '';
	position: absolute;
	bottom: 6px;
	width: 4px;
	height: 4px;
	border-radius: 50%;
	background: var(--pb-accent);
}

.pb-day-selected.pb-day-available::after {
	background: #fff;
}

/* ---------------- Legenda ---------------- */

.pb-legend {
	display: flex;
	flex-wrap: wrap;
	gap: 16px;
	margin-top: 16px;
	padding-top: 14px;
	border-top: 1px solid var(--pb-border);
	font-size: 0.78rem;
	color: var(--pb-text-muted);
}

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

.pb-dot {
	display: inline-block;
	width: 9px;
	height: 9px;
	border-radius: 50%;
}

.pb-dot-free { background: var(--pb-free); }
.pb-dot-booked { background: var(--pb-booked); }
.pb-dot-closed { background: var(--pb-closed); }

/* ---------------- Sloty ---------------- */

.pb-slots-title {
	font-family: var(--pb-font-display);
	font-size: 1.02rem;
	font-weight: 600;
	margin: 0 0 14px;
	color: var(--pb-text);
}

.pb-slots-grid {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.pb-slot {
	border: 1px solid var(--pb-border-input);
	background: var(--pb-bg);
	color: var(--pb-text);
	padding: 8px 13px;
	border-radius: 8px;
	font-size: 0.85rem;
	cursor: pointer;
	transition: transform 0.1s ease, border-color 0.15s ease, background 0.15s ease;
}

.pb-slot-free {
	border-color: var(--pb-free);
	background: var(--pb-free-bg);
	color: var(--pb-free);
}

.pb-slot-free:hover {
	transform: translateY(-1px);
	border-color: var(--pb-accent);
	background: var(--pb-accent-soft);
	color: var(--pb-text);
}

.pb-slot-selected {
	background: var(--pb-accent) !important;
	border-color: var(--pb-accent) !important;
	color: #fff !important;
	font-weight: 600;
}

.pb-slot-booked {
	border-color: var(--pb-booked-bg);
	background: var(--pb-booked-bg);
	color: var(--pb-text-muted);
	cursor: not-allowed;
	text-decoration: line-through;
}

.pb-slot-past,
.pb-slot-closed {
	border-color: var(--pb-closed-bg);
	background: var(--pb-closed-bg);
	color: var(--pb-text-muted);
	cursor: not-allowed;
}

.pb-slots-empty {
	color: var(--pb-text-muted);
	font-size: 0.9rem;
}

/* ---------------- Formulář ---------------- */

.pb-back {
	background: none;
	border: none;
	color: var(--pb-text-muted);
	font-size: 0.82rem;
	cursor: pointer;
	padding: 0 0 14px;
}

.pb-back:hover {
	color: var(--pb-accent);
}

.pb-field {
	margin-bottom: 14px;
}

.pb-field label {
	display: block;
	font-size: 0.78rem;
	color: var(--pb-text-muted);
	margin-bottom: 5px;
}

.pb-field input,
.pb-field select {
	width: 100%;
	background: var(--pb-bg);
	border: 1px solid var(--pb-border-input);
	color: var(--pb-text);
	padding: 10px 12px;
	border-radius: 8px;
	font-size: 0.92rem;
	font-family: var(--pb-font-body);
}

.pb-field input:focus,
.pb-field select:focus {
	border-color: var(--pb-accent);
}

.pb-service-description {
	margin: 8px 0 0;
	padding: 9px 12px;
	background: var(--pb-accent-soft);
	border-left: 2px solid var(--pb-accent);
	border-radius: 6px;
	font-size: 0.82rem;
	line-height: 1.5;
	color: var(--pb-text-muted);
	white-space: pre-line;
}

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

.pb-fit-warning {
	background: var(--pb-booked-bg);
	border: 1px solid var(--pb-booked);
	color: var(--pb-booked);
	padding: 10px 12px;
	border-radius: 8px;
	font-size: 0.84rem;
	margin: 4px 0 16px;
}

.pb-staff-info {
	background: var(--pb-free-bg);
	border: 1px solid var(--pb-free);
	color: var(--pb-free);
	padding: 10px 12px;
	border-radius: 8px;
	font-size: 0.84rem;
	font-weight: 600;
	margin: 4px 0 16px;
}

.pb-submit {
	width: 100%;
	background: var(--pb-primary);
	color: var(--pb-primary-text);
	border: none;
	padding: 13px;
	border-radius: 10px;
	font-size: 0.95rem;
	font-weight: 600;
	cursor: pointer;
	transition: filter 0.15s ease;
}

.pb-submit:hover {
	filter: brightness(1.3);
}

.pb-submit:disabled {
	opacity: 0.4;
	cursor: not-allowed;
}

.pb-form-message {
	margin-top: 12px;
	font-size: 0.85rem;
	min-height: 1em;
}

.pb-form-message.pb-message-error {
	color: var(--pb-booked);
}

.pb-form-message.pb-message-success {
	color: var(--pb-free);
}

/* ---------------- Úspěšná rezervace ---------------- */

.pb-success {
	text-align: center;
	padding: 30px 10px;
}

.pb-success-icon {
	width: 52px;
	height: 52px;
	line-height: 52px;
	border-radius: 50%;
	background: var(--pb-free-bg);
	color: var(--pb-free);
	font-size: 1.4rem;
	margin: 0 auto 16px;
}

.pb-success p {
	font-size: 0.95rem;
	line-height: 1.5;
	color: var(--pb-text);
}

/* ---------------- Stránka pro zrušení rezervace ---------------- */

.pb-cancel-widget {
	max-width: 440px;
	margin: 1.5rem auto;
}

.pb-cancel-card h2 {
	font-family: var(--pb-font-display);
	font-size: 1.1rem;
	margin-top: 0;
	color: var(--pb-text);
}

.pb-cancel-details {
	background: var(--pb-bg-subtle);
	border: 1px solid var(--pb-border);
	border-radius: 10px;
	padding: 14px 16px;
	margin: 14px 0;
	font-size: 0.9rem;
	line-height: 1.7;
	color: var(--pb-text);
}

.pb-cancel-btn {
	width: 100%;
	background: var(--pb-booked);
	color: #fff;
	border: none;
	padding: 12px;
	border-radius: 10px;
	font-size: 0.92rem;
	font-weight: 600;
	cursor: pointer;
}

.pb-cancel-btn:hover {
	filter: brightness(1.1);
}

.pb-cancel-btn:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

.pb-cancel-note {
	font-size: 0.82rem;
	color: var(--pb-text-muted);
	margin-top: 10px;
}

/* ---------------- Responzivita ---------------- */

@media (max-width: 480px) {
	.pb-widget {
		margin: 0 auto;
		border-radius: 0;
		border-left: none;
		border-right: none;
		padding: 20px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.pb-widget * {
		transition: none !important;
	}
}
