/*
 * Parafia – Rezerwacje obrazu / Frontend
 *
 * Style są neutralne i bazują na zmiennych CSS, żeby motyw Astra/Elementor mógł
 * je nadpisać przez --pobr-* w Custom CSS. Nie używamy ID, tylko klas.
 */

:root {
	--pobr-color-primary: #5a4082;
	--pobr-color-primary-dark: #443063;
	--pobr-color-text: #1f2937;
	--pobr-color-muted: #6b7280;
	--pobr-color-border: #e5e7eb;
	--pobr-color-bg: #ffffff;
	--pobr-color-bg-soft: #f9fafb;
	--pobr-color-success: #15803d;
	--pobr-color-success-bg: #dcfce7;
	--pobr-color-error: #b91c1c;
	--pobr-color-error-bg: #fee2e2;
	--pobr-color-busy: #dc2626;
	--pobr-color-busy-bg: rgba(220, 38, 38, 0.45);
	--pobr-color-selected-bg: rgba(90, 64, 130, 0.20);
	--pobr-radius: 8px;
	--pobr-gap: 16px;
}

/* ---------- Wrappery ---------- */

.pobr-form-wrap,
.pobr-calendar-only,
.pobr-list-wrap {
	color: var(--pobr-color-text);
	font-size: 1rem;
	line-height: 1.5;
	max-width: 100%;
}

.pobr-form-title {
	margin: 0 0 var(--pobr-gap);
	font-size: 1.5rem;
	font-weight: 600;
}

.pobr-instruction {
	margin: 0 0 var(--pobr-gap);
	padding: 12px 16px;
	background: var(--pobr-color-bg-soft);
	border-left: 3px solid var(--pobr-color-primary);
	border-radius: 4px;
	color: var(--pobr-color-muted);
	font-size: 0.92rem;
}

/* ---------- Banner okresu peregrynacji ---------- */

.pobr-period-banner {
	margin: 0 0 var(--pobr-gap);
	padding: 10px 16px;
	background: rgba(90, 64, 130, 0.08);
	border-radius: var(--pobr-radius);
	color: var(--pobr-color-primary-dark);
	font-size: 0.95rem;
}

.pobr-period-banner strong {
	color: var(--pobr-color-primary);
}

.pobr-period-closed {
	margin: var(--pobr-gap) 0;
	padding: 24px 28px;
	background: var(--pobr-color-bg-soft);
	border: 2px dashed var(--pobr-color-border);
	border-radius: var(--pobr-radius);
	color: var(--pobr-color-muted);
	font-size: 1.05rem;
	text-align: center;
}

/* ---------- Layout 2-kolumnowy (desktop) ---------- */

.pobr-layout {
	display: grid;
	grid-template-columns: 1fr; /* mobile-first */
	gap: 24px;
	align-items: start;
}

@media (min-width: 900px) {
	.pobr-layout {
		grid-template-columns: minmax(420px, 1.3fr) minmax(320px, 1fr);
	}
}

.pobr-layout-calendar,
.pobr-layout-form {
	min-width: 0; /* zapobiega overflow w gridzie */
}

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

.pobr-legend {
	display: flex;
	gap: 18px;
	margin-bottom: 12px;
	flex-wrap: wrap;
	font-size: 0.88rem;
	color: var(--pobr-color-muted);
}

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

.pobr-legend-swatch {
	display: inline-block;
	width: 14px;
	height: 14px;
	border-radius: 3px;
	border: 1px solid var(--pobr-color-border);
}

.pobr-swatch-free { background: var(--pobr-color-bg); }
.pobr-swatch-busy { background: var(--pobr-color-busy-bg); border-color: var(--pobr-color-busy); }
.pobr-swatch-busy-partial {
	background: var(--pobr-color-bg);
	position: relative;
	overflow: hidden;
}
.pobr-swatch-busy-partial::after {
	content: '';
	position: absolute;
	inset: 0;
	background: var(--pobr-color-busy-bg);
	clip-path: polygon(100% 0, 100% 100%, 0 100%);
}
.pobr-swatch-selected { background: var(--pobr-color-selected-bg); border-color: var(--pobr-color-primary); }

/* ---------- Kalendarz (FullCalendar override) ---------- */

.pobr-calendar {
	background: var(--pobr-color-bg);
	padding: 12px;
	border: 1px solid var(--pobr-color-border);
	border-radius: var(--pobr-radius);
	min-height: 300px;
}

/* ---------- Zajęte dni — nakładki (trójkąty / pełne) ---------- */

/*
 * Nakładka jest realnym <div class="pobr-busy-overlay">, wstawianym przez JS
 * do .fc-daygrid-day-frame. Solidniejsze niż pseudoelement na <td>.
 */
.pobr-calendar .fc-daygrid-day-frame {
	position: relative;
}

.pobr-busy-overlay {
	position: absolute;
	inset: 0;
	pointer-events: none;
	background: rgba(220, 38, 38, 0.45);
	z-index: 1;
}

.pobr-busy-overlay-start {
	clip-path: polygon(100% 0, 100% 100%, 0 100%);
}

.pobr-busy-overlay-end {
	clip-path: polygon(0 0, 100% 0, 0 100%);
}

/* full / single — pełne tło, bez clip-path */

/* Numer dnia i eventy nad nakładką */
.pobr-calendar .fc-daygrid-day-top,
.pobr-calendar .fc-daygrid-day-events {
	position: relative;
	z-index: 2;
}

/* Numer dnia — pogrubiony, ciemny, z białym text-shadow dla czytelności na czerwonym tle */
.pobr-calendar .fc-daygrid-day-number {
	color: #1f2937 !important;
	font-weight: 700 !important;
	text-shadow: 0 0 3px rgba(255, 255, 255, 0.85), 0 0 1px rgba(255, 255, 255, 0.95);
}

/* Eventy z imieniem rezerwującego — wyglądają jak metka (białe tło, ciemny tekst) */
.pobr-calendar .fc-event.pobr-event-name,
.pobr-calendar a.fc-event.pobr-event-name {
	background-color: rgba(255, 255, 255, 0.92) !important;
	border: 1px solid rgba(0, 0, 0, 0.08) !important;
	color: #1f2937 !important;
	font-weight: 600 !important;
	font-size: 0.78rem !important;
	padding: 1px 6px !important;
	border-radius: 4px !important;
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
	cursor: default;
}
.pobr-calendar .fc-event.pobr-event-name .fc-event-title,
.pobr-calendar a.fc-event.pobr-event-name .fc-event-title {
	color: #1f2937 !important;
	font-weight: 600 !important;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
.pobr-calendar .fc-event.pobr-event-name:hover {
	background-color: #fff !important;
}

/* Klasy dat zaznaczonych przez usera — tło i ramka na td (działa, bo background-color) */
.pobr-calendar .fc-day.pobr-day-selected-from,
.pobr-calendar .fc-day.pobr-day-selected-to {
	background-color: var(--pobr-color-selected-bg) !important;
	box-shadow: inset 0 0 0 3px var(--pobr-color-primary);
}
.pobr-calendar .fc-day.pobr-day-selected-range {
	background-color: rgba(90, 64, 130, 0.10) !important;
}

/* Gdy user wybiera dzień który jest zajęty — przyciemnij nakładkę żeby wybór był widoczny */
.pobr-calendar .fc-day.pobr-day-selected-from .pobr-busy-overlay,
.pobr-calendar .fc-day.pobr-day-selected-to .pobr-busy-overlay,
.pobr-calendar .fc-day.pobr-day-selected-range .pobr-busy-overlay {
	opacity: 0.45;
}

.pobr-calendar .fc-day.pobr-day-no-slots {
	background-color: rgba(0, 0, 0, 0.04) !important;
	cursor: not-allowed !important;
}
.pobr-calendar .fc-day.pobr-day-no-slots .fc-daygrid-day-number {
	color: #9ca3af !important;
}

/* FullCalendar styling */
.pobr-calendar .fc-toolbar-title {
	font-size: 1.05rem;
	font-weight: 600;
}
.pobr-calendar .fc-button {
	background: var(--pobr-color-primary) !important;
	border-color: var(--pobr-color-primary) !important;
	font-size: 0.85rem !important;
	padding: 6px 12px !important;
	box-shadow: none !important;
}
.pobr-calendar .fc-button:hover,
.pobr-calendar .fc-button:focus {
	background: var(--pobr-color-primary-dark) !important;
	border-color: var(--pobr-color-primary-dark) !important;
}
.pobr-calendar .fc-button-primary:disabled {
	opacity: 0.5;
}

.pobr-calendar .fc-day-today {
	background-color: rgba(90, 64, 130, 0.04) !important;
}

/* Header kalendarza na wąskich ekranach */
@media (max-width: 480px) {
	.pobr-calendar .fc-toolbar.fc-header-toolbar {
		flex-direction: column;
		gap: 8px;
		align-items: stretch;
	}
	.pobr-calendar .fc-toolbar-chunk {
		display: flex;
		justify-content: center;
	}
}

/* ---------- Formularz ---------- */

.pobr-form {
	margin: 0;
}

.pobr-grid {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: var(--pobr-gap);
	margin-bottom: var(--pobr-gap);
}

.pobr-field--full {
	grid-column: 1 / -1;
}

.pobr-field {
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.pobr-field label {
	font-weight: 500;
	font-size: 0.92rem;
	color: var(--pobr-color-text);
}

.pobr-field input[type="text"],
.pobr-field input[type="email"],
.pobr-field input[type="tel"],
.pobr-field input[type="date"],
.pobr-field select,
.pobr-field textarea {
	width: 100%;
	padding: 10px 12px;
	border: 1px solid var(--pobr-color-border);
	border-radius: var(--pobr-radius);
	background: var(--pobr-color-bg);
	color: var(--pobr-color-text);
	font-size: 1rem;
	line-height: 1.4;
	font-family: inherit;
	box-sizing: border-box;
	transition: border-color 0.15s, box-shadow 0.15s;
}

.pobr-field input:focus,
.pobr-field select:focus,
.pobr-field textarea:focus {
	outline: none;
	border-color: var(--pobr-color-primary);
	box-shadow: 0 0 0 3px rgba(90, 64, 130, 0.15);
}

.pobr-field input.pobr-invalid,
.pobr-field select.pobr-invalid,
.pobr-field textarea.pobr-invalid {
	border-color: var(--pobr-color-error);
}

.pobr-field textarea {
	resize: vertical;
	min-height: 80px;
}

.pobr-readonly {
	padding: 10px 12px;
	border: 1px dashed var(--pobr-color-border);
	border-radius: var(--pobr-radius);
	background: var(--pobr-color-bg-soft);
	color: var(--pobr-color-muted);
	min-height: 1.4em;
}

.pobr-readonly:not(:empty) {
	color: var(--pobr-color-text);
	font-weight: 500;
}

.pobr-hint {
	font-size: 0.82rem;
	color: var(--pobr-color-muted);
	min-height: 1em;
}

.pobr-hint.pobr-hint-warning {
	color: var(--pobr-color-error);
}

/* ---------- Honeypot ---------- */

.pobr-honeypot {
	position: absolute !important;
	left: -10000px !important;
	top: auto !important;
	width: 1px !important;
	height: 1px !important;
	overflow: hidden !important;
}

/* ---------- Przyciski + komunikaty ---------- */

.pobr-actions {
	margin-top: var(--pobr-gap);
}

.pobr-submit {
	background: var(--pobr-color-primary);
	color: #fff;
	border: none;
	padding: 12px 24px;
	border-radius: var(--pobr-radius);
	font-size: 1rem;
	font-weight: 600;
	cursor: pointer;
	transition: background 0.15s;
	font-family: inherit;
	width: 100%;
}

@media (min-width: 900px) {
	.pobr-submit { width: auto; }
}

.pobr-submit:hover:not(:disabled) {
	background: var(--pobr-color-primary-dark);
}

.pobr-submit:disabled {
	opacity: 0.6;
	cursor: not-allowed;
}

.pobr-message {
	margin: 0 0 var(--pobr-gap);
	padding: 14px 16px;
	border-radius: var(--pobr-radius);
	font-weight: 500;
}

.pobr-message.pobr-message-success {
	background: var(--pobr-color-success-bg);
	color: var(--pobr-color-success);
	border: 1px solid var(--pobr-color-success);
}

.pobr-message.pobr-message-error {
	background: var(--pobr-color-error-bg);
	color: var(--pobr-color-error);
	border: 1px solid var(--pobr-color-error);
}

.pobr-errors {
	margin: 0 0 var(--pobr-gap);
	padding: 12px 16px;
	border-radius: var(--pobr-radius);
	background: var(--pobr-color-error-bg);
	border: 1px solid var(--pobr-color-error);
	color: var(--pobr-color-error);
	font-size: 0.92rem;
}

.pobr-errors ul {
	margin: 4px 0 0;
	padding-left: 20px;
}

/* ---------- Lista publiczna ---------- */

.pobr-list {
	list-style: none;
	margin: 0;
	padding: 0;
	border: 1px solid var(--pobr-color-border);
	border-radius: var(--pobr-radius);
	background: var(--pobr-color-bg);
}

.pobr-list-item {
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
	align-items: baseline;
	gap: 8px;
	padding: 12px 16px;
	border-bottom: 1px solid var(--pobr-color-border);
}

.pobr-list-item:last-child {
	border-bottom: none;
}

.pobr-list-dates {
	font-weight: 600;
	color: var(--pobr-color-text);
}

.pobr-list-time {
	font-weight: 400;
	color: var(--pobr-color-muted);
	font-size: 0.92em;
}

.pobr-list-person {
	color: var(--pobr-color-muted);
}

.pobr-list-empty {
	color: var(--pobr-color-muted);
	font-style: italic;
	margin: 0;
}

.pobr-arrow {
	color: var(--pobr-color-muted);
}

/* ---------- Mobile ---------- */

@media (max-width: 640px) {
	.pobr-grid {
		grid-template-columns: 1fr;
	}

	.pobr-list-item {
		flex-direction: column;
		align-items: flex-start;
		gap: 4px;
	}
}
