/* Club Calendar Frontend Styles */

/* Container */
.clc-calendar-container {
	position: relative;
	font-family: inherit;
	margin-bottom: 2rem;
}

/* Filter Bar */
.clc-filter-bar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px;
	margin-bottom: 12px;
}

.clc-filter-label {
	font-weight: 600;
	font-size: 0.9rem;
	color: #444;
}

.clc-filter-chip {
	display: inline-flex;
	align-items: center;
	padding: 4px 12px;
	border-radius: 20px;
	border: 2px solid var(--clc-cat-color, #3788d8);
	background: transparent;
	color: #333;
	font-size: 0.875rem;
	cursor: pointer;
	transition: background 0.15s, color 0.15s;
	font-family: inherit;
}

.clc-filter-chip.active {
	background: var(--clc-cat-color, #3788d8);
	color: #fff;
}

.clc-filter-chip:hover {
	opacity: 0.85;
}

/* Filter-Liste mit Checkboxen */
.clc-filter-list {
	display: flex;
	flex-wrap: wrap;
	gap: 6px 12px;
	align-items: center;
}

.clc-filter-checkbox {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 3px 10px 3px 8px;
	border-radius: 16px;
	border: 1px solid #d0d4da;
	background: #fff;
	color: #333;
	font-size: 0.875rem;
	cursor: pointer;
	user-select: none;
	transition: border-color 0.15s, background 0.15s, color 0.15s;
	font-family: inherit;
	line-height: 1.4;
}

.clc-filter-checkbox:hover {
	border-color: var(--clc-cat-color, #3788d8);
}

.clc-filter-checkbox.active {
	border-color: var(--clc-cat-color, #3788d8);
	background: var(--clc-cat-color, #3788d8);
	color: #fff;
}

.clc-filter-checkbox .clc-filter-cb {
	margin: 0;
	accent-color: var(--clc-cat-color, #3788d8);
	cursor: pointer;
}

.clc-filter-checkbox .clc-filter-swatch {
	display: inline-block;
	width: 10px;
	height: 10px;
	border-radius: 50%;
	background: var(--clc-cat-color, #3788d8);
	border: 1px solid rgba(0, 0, 0, 0.15);
	flex-shrink: 0;
}

.clc-filter-checkbox.active .clc-filter-swatch {
	background: #fff;
	border-color: rgba(255, 255, 255, 0.7);
}

.clc-filter-checkbox .clc-filter-name {
	white-space: nowrap;
}

/* Filter-Aktionen "Alle" / "Keine" */
.clc-filter-actions {
	display: inline-flex;
	gap: 4px;
	margin-right: 4px;
}

.clc-filter-action {
	padding: 2px 8px;
	border-radius: 4px;
	border: 1px solid #d0d4da;
	background: #f7f8fa;
	color: #444;
	font-size: 0.8rem;
	cursor: pointer;
	font-family: inherit;
	transition: background 0.15s, border-color 0.15s;
}

.clc-filter-action:hover {
	background: #eef0f3;
	border-color: #b0b6bf;
}

/* Toolbar */
.clc-toolbar {
	display: flex;
	justify-content: flex-end;
	margin-bottom: 10px;
}

/* Buttons */
.clc-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 8px 18px;
	border-radius: 4px;
	border: none;
	cursor: pointer;
	font-size: 0.9rem;
	font-family: inherit;
	font-weight: 500;
	transition: opacity 0.15s;
}

.clc-btn:hover {
	opacity: 0.85;
}

.clc-btn-primary {
	background: #3788d8;
	color: #fff;
}

.clc-btn-secondary {
	background: #f0f0f0;
	color: #333;
	border: 1px solid #ccc;
}

.clc-btn-danger {
	background: #dc3545;
	color: #fff;
}

/* FullCalendar mount */
.clc-fc-mount {
	width: 100%;
}

/* Popover */
.clc-popover {
	position: fixed;
	top: 0;
	left: 0;
	z-index: 99999;
	background: #fff;
	border: 1px solid #e0e0e0;
	border-radius: 8px;
	box-shadow: 0 8px 24px rgba(0,0,0,0.18);
	padding: 16px;
	width: max-content;
	max-width: 340px;
	min-width: 220px;
	max-height: calc(100vh - 24px);
	overflow-y: auto;
	box-sizing: border-box;
}

.clc-popover[hidden] {
	display: none;
}

/* Mobile Bottom-Sheet (<600px): volle Breite am unteren Bildschirmrand,
   damit der Inhalt gut lesbar ist und Touch-Targets bequem getroffen
   werden können. Wird per JS-Klasse aktiviert. */
.clc-popover-sheet {
	top: auto !important;
	left: 0 !important;
	right: 0 !important;
	bottom: 0 !important;
	width: 100% !important;
	max-width: 100% !important;
	min-width: 0 !important;
	max-height: 75vh !important;
	border-radius: 14px 14px 0 0;
	padding: 18px 18px calc(18px + env(safe-area-inset-bottom, 0px));
	box-shadow: 0 -8px 28px rgba(0,0,0,0.2);
	animation: clc-sheet-up 0.18s ease-out;
}

@keyframes clc-sheet-up {
	from { transform: translateY(100%); }
	to   { transform: translateY(0); }
}

.clc-popover-header {
	display: flex;
	justify-content: space-between;
	align-items: flex-start;
	gap: 8px;
	margin-bottom: 10px;
}

.clc-popover-title {
	font-size: 1rem;
	font-weight: 600;
	color: #1d2327;
	word-break: break-word;
}

.clc-popover-close {
	background: none;
	border: none;
	cursor: pointer;
	color: #666;
	font-size: 1.2rem;
	line-height: 1;
	padding: 0 4px;
	flex-shrink: 0;
}

.clc-popover-meta {
	font-size: 0.875rem;
	color: #555;
	line-height: 1.5;
}

.clc-popover-meta .clc-meta-row {
	display: flex;
	gap: 6px;
	margin-bottom: 4px;
}

.clc-popover-meta .clc-meta-icon {
	width: 16px;
	flex-shrink: 0;
}

.clc-category-badge {
	display: inline-block;
	padding: 2px 8px;
	border-radius: 10px;
	font-size: 0.75rem;
	font-weight: 500;
	color: #fff;
	background: var(--clc-badge-color, #3788d8);
}

.clc-popover-actions {
	display: flex;
	gap: 8px;
	margin-top: 12px;
	justify-content: flex-end;
}

.clc-popover-actions .clc-btn {
	padding: 5px 12px;
	font-size: 0.8rem;
}

/* Modal */
.clc-modal {
	position: fixed;
	inset: 0;
	z-index: 99999;
}

.clc-modal[hidden] {
	display: none;
}

.clc-modal-backdrop {
	position: absolute;
	inset: 0;
	background: rgba(0,0,0,0.5);
}

.clc-modal-dialog {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	background: #fff;
	border-radius: 8px;
	box-shadow: 0 20px 60px rgba(0,0,0,0.3);
	width: min(500px, 95vw);
	max-height: 90vh;
	overflow-y: auto;
	display: flex;
	flex-direction: column;
}

.clc-modal-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 16px 20px;
	border-bottom: 1px solid #e5e7eb;
}

.clc-modal-title {
	font-size: 1.1rem;
	font-weight: 600;
	margin: 0;
}

.clc-modal-close {
	background: none;
	border: none;
	cursor: pointer;
	color: #666;
	font-size: 1.5rem;
	line-height: 1;
	padding: 0;
}

.clc-modal-body {
	padding: 20px;
	flex: 1;
}

.clc-modal-footer {
	padding: 12px 20px;
	border-top: 1px solid #e5e7eb;
	display: flex;
	justify-content: flex-end;
	gap: 10px;
}

/* Form rows */
.clc-form-row {
	margin-bottom: 14px;
}

.clc-form-row label {
	display: block;
	font-weight: 500;
	margin-bottom: 4px;
	font-size: 0.875rem;
	color: #374151;
}

.clc-form-row label.inline {
	display: flex;
	align-items: center;
	gap: 6px;
	font-weight: 400;
}

.clc-form-row input[type="text"],
.clc-form-row input[type="url"],
.clc-form-row input[type="datetime-local"],
.clc-form-row input[type="date"],
.clc-form-row select,
.clc-form-row textarea {
	width: 100%;
	padding: 7px 10px;
	border: 1px solid #d1d5db;
	border-radius: 4px;
	font-family: inherit;
	font-size: 0.875rem;
	box-sizing: border-box;
}

.clc-form-row textarea {
	resize: vertical;
}

.required {
	color: #dc3545;
}

/* Responsive */
@media (max-width: 480px) {
	.clc-filter-bar {
		gap: 6px;
	}
	.clc-filter-chip {
		font-size: 0.8rem;
		padding: 3px 10px;
	}
}

/* Listenansicht (listMonth/listWeek/listDay): zusätzliche Details unter dem Titel */
.clc-list-details {
	margin-top: 4px;
	font-size: 0.85rem;
	font-weight: normal;
	color: #4b5563;
	line-height: 1.4;
}

.clc-list-details .clc-list-location {
	margin-top: 2px;
}

.clc-list-details .clc-list-desc {
	margin-top: 2px;
	color: #6b7280;
}

.clc-list-details .clc-list-cats {
	margin-top: 4px;
	display: flex;
	flex-wrap: wrap;
	gap: 4px;
}

.clc-list-details .clc-list-cat-badge {
	display: inline-block;
	padding: 1px 8px;
	font-size: 0.75rem;
	color: #fff;
	border-radius: 10px;
	line-height: 1.4;
}

/* FullCalendar Toolbar-Buttons (Ansicht-Umschalter): deutlich sichtbarer
   aktiver Zustand, damit man auf einen Blick sieht, welche Ansicht aktiv
   ist. Überschreibt die blassen FC-Defaults via Variablen + harten Regeln. */
.clc-calendar-container .fc {
	--fc-button-bg-color: #f3f4f6;
	--fc-button-border-color: #d1d5db;
	--fc-button-text-color: #1f2937;
	--fc-button-hover-bg-color: #e5e7eb;
	--fc-button-hover-border-color: #9ca3af;
	--fc-button-active-bg-color: #1d4ed8;
	--fc-button-active-border-color: #1e40af;
}

.clc-calendar-container .fc .fc-button-primary {
	font-weight: 600;
}

.clc-calendar-container .fc .fc-button-primary:not(:disabled).fc-button-active,
.clc-calendar-container .fc .fc-button-primary:not(:disabled):active {
	background-color: #1d4ed8;
	border-color: #1e40af;
	color: #fff;
	box-shadow: 0 0 0 2px rgba(29, 78, 216, 0.25);
}

.clc-calendar-container .fc .fc-button-primary:not(:disabled).fc-button-active:focus,
.clc-calendar-container .fc .fc-button-primary:focus {
	box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.35);
	outline: none;
}

/* ============================================================
 * v0.4.0 — Recurrence section in the edit modal
 * ============================================================ */
.clc-rec-toggle-row {
	margin-top: 0.75em;
	padding-top: 0.75em;
	border-top: 1px solid #e5e7eb;
}

.clc-rec-toggle-label {
	display: flex;
	align-items: center;
	gap: 0.5em;
	font-weight: 600;
	color: #1f2937;
	cursor: pointer;
}

.clc-rec-toggle-label input[type="checkbox"] {
	margin: 0;
}

.clc-rec-section {
	margin-left: 1.25em;
	padding: 0.75em 0 0.25em;
	border-left: 2px solid #d1d5db;
	padding-left: 0.85em;
}

.clc-rec-section .clc-form-row {
	margin-bottom: 0.6em;
}

.clc-rec-section label {
	font-weight: 500;
	color: #374151;
}

.clc-rec-interval-wrap {
	display: flex;
	align-items: center;
	gap: 0.5em;
}

.clc-rec-interval-wrap input[type="number"] {
	width: 5em;
}

.clc-rec-interval-unit {
	color: #4b5563;
}

.clc-rec-byday {
	display: flex;
	flex-wrap: wrap;
	gap: 0.4em;
}

.clc-rec-day {
	display: inline-flex;
	align-items: center;
	gap: 0.25em;
	padding: 0.25em 0.55em;
	border: 1px solid #d1d5db;
	border-radius: 0.4em;
	background: #f9fafb;
	cursor: pointer;
	user-select: none;
	font-size: 0.92em;
}

.clc-rec-day input[type="checkbox"] {
	margin: 0;
}

.clc-rec-day:has(input[type="checkbox"]:checked) {
	background: #dbeafe;
	border-color: #1d4ed8;
	color: #1e3a8a;
	font-weight: 600;
}

.clc-rec-monthly,
.clc-rec-end {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.5em 0.75em;
}

.clc-rec-radio {
	display: inline-flex;
	align-items: center;
	gap: 0.3em;
	cursor: pointer;
}

.clc-rec-end input[type="date"],
.clc-rec-end input[type="number"],
.clc-rec-monthly input[type="number"] {
	width: auto;
	max-width: 9em;
}

.clc-rec-count-unit {
	color: #4b5563;
}

/* ============================================================
 * v0.4.0 — Three-way scope dialog (Edit / Delete recurring)
 * ============================================================ */
.clc-scope-dialog .clc-scope-dialog-inner {
	max-width: 28rem;
}

.clc-scope-prompt {
	margin: 0 0 0.85em;
	color: #1f2937;
}

.clc-scope-options {
	display: flex;
	flex-direction: column;
	gap: 0.55em;
}

.clc-scope-option {
	display: flex;
	align-items: center;
	gap: 0.55em;
	padding: 0.55em 0.7em;
	border: 1px solid #d1d5db;
	border-radius: 0.4em;
	cursor: pointer;
	background: #f9fafb;
	transition: background 0.12s ease, border-color 0.12s ease;
}

.clc-scope-option:hover {
	background: #f3f4f6;
}

.clc-scope-option:has(input[type="radio"]:checked) {
	background: #dbeafe;
	border-color: #1d4ed8;
	color: #1e3a8a;
	font-weight: 600;
}

/* Mobile tweaks */
@media (max-width: 600px) {
	.clc-rec-section {
		margin-left: 0.6em;
		padding-left: 0.55em;
	}

	.clc-rec-byday {
		gap: 0.3em;
	}

	.clc-rec-day {
		padding: 0.25em 0.45em;
		font-size: 0.88em;
	}

	.clc-rec-end,
	.clc-rec-monthly {
		gap: 0.4em 0.55em;
	}

	.clc-scope-dialog .clc-scope-dialog-inner {
		max-width: 100%;
	}
}

/* ---------------------------------------------------------------------
 * Pixelgenaue Ausrichtung der Event-Blöcke an den Stundenlinien
 * (TimeGrid Wochen-/Tagesansicht).
 *
 * Ursachen-Analyse (DevTools-Messung auf einer Live-Theme-Installation):
 * Viele WordPress-Themes setzen ein generisches Padding auf <td>-Zellen
 * (z. B. `td { padding: 13px; }` von Astra, Avada, Divi, GeneratePress
 * oder Bootstrap-basierten Themes). FullCalendar v6 rendert die
 * Tagesspalten in TimeGrid-Ansichten aber als <td class="fc-timegrid-col">,
 * sodass dieses Theme-Padding den .fc-timegrid-col-frame nach unten
 * schiebt — Events landen dadurch systematisch zu tief (im konkreten
 * Fall +13 px ≈ 8 Minuten Versatz). Die Stundenlinien-Slots sitzen in
 * einer eigenen .fc-timegrid-slots-Box und sind nicht betroffen, daher
 * die sichtbare Diskrepanz.
 *
 * Zusätzlich: FullCalendar v6 setzt per Default 1 px Border + 1 px
 * margin-bottom an .fc-timegrid-event, was nochmal 1–2 px Versatz
 * verursacht. Beides hier in einem Block neutralisiert.
 * ------------------------------------------------------------------- */

/* 1. Theme-Padding auf FC-Spaltenzellen entfernen (Hauptursache). */
.fc .fc-timegrid-col,
.fc .fc-timegrid-axis,
.fc .fc-timegrid-slot {
	padding-top: 0 !important;
	padding-bottom: 0 !important;
}

/* 2. Default-Margin und horizontale Borders an Events entfernen. */
.fc .fc-timegrid-event-harness > .fc-timegrid-event:not(.fc-bg-event),
.fc-timegrid-event.fc-v-event:not(.fc-bg-event) {
	margin-top: 0 !important;
	margin-bottom: 0 !important;
	border-top-width: 0 !important;
	border-bottom-width: 0 !important;
	border-radius: 4px !important;
}
