/* =====================================================================
   PWFL Events Calendar
   Custom calendar component for pwf.lu — replaces [tribe_events]
   ===================================================================== */

/* ===================== CONTAINER ===================== */
.pwfl-cal {
	--pwfl-cal-red: var(--pwfl-red, #EF3340);
	--pwfl-cal-blue: var(--pwfl-blue, #00A1DE);
	--pwfl-cal-dark: var(--pwfl-dark, #1a1a2e);
	--pwfl-cal-text: var(--pwfl-text, #2d2d3d);
	--pwfl-cal-light-grey: var(--pwfl-light-grey, #f7f8fa);
	--pwfl-cal-mid-grey: var(--pwfl-mid-grey, #e8eaed);
	--pwfl-cal-white: var(--pwfl-white, #ffffff);
	--pwfl-cal-radius: 8px;
	--pwfl-cal-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);

	font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
	color: var(--pwfl-cal-text);
	line-height: 1.5;
	max-width: 1200px;
	margin: 0 auto;
}

/* ===================== TOOLBAR ===================== */
.pwfl-cal-toolbar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 12px;
	margin-bottom: 24px;
}

.pwfl-cal-toolbar-left {
	display: flex;
	align-items: center;
	gap: 8px;
}

.pwfl-cal-toolbar-right {
	display: flex;
	align-items: center;
	gap: 8px;
}

.pwfl-cal-title {
	font-family: 'Oswald', sans-serif;
	font-size: 22px;
	font-weight: 600;
	letter-spacing: 0.5px;
	color: var(--pwfl-cal-dark);
	margin: 0;
	min-width: 200px;
	text-align: center;
}

.pwfl-cal-btn {
	font-family: 'Oswald', sans-serif;
	font-size: 12px;
	font-weight: 500;
	text-transform: uppercase;
	letter-spacing: 0.8px;
	border: 1px solid var(--pwfl-cal-mid-grey);
	background: var(--pwfl-cal-white);
	color: var(--pwfl-cal-text);
	padding: 8px 14px;
	border-radius: 4px;
	cursor: pointer;
	transition: background-color 0.15s, border-color 0.15s, color 0.15s;
	white-space: nowrap;
	line-height: 1;
}

.pwfl-cal-btn:hover {
	background: var(--pwfl-cal-light-grey);
	border-color: var(--pwfl-cal-blue);
	color: var(--pwfl-cal-blue);
}

.pwfl-cal-btn:focus-visible {
	outline: 2px solid var(--pwfl-cal-blue);
	outline-offset: 2px;
	border-radius: 4px;
}

.pwfl-cal-btn--active {
	background: var(--pwfl-cal-blue);
	color: var(--pwfl-cal-white);
	border-color: var(--pwfl-cal-blue);
}

.pwfl-cal-btn--active:hover {
	background: var(--pwfl-cal-blue);
	color: var(--pwfl-cal-white);
	border-color: var(--pwfl-cal-blue);
	opacity: 0.9;
}

.pwfl-cal-btn--today {
	background: var(--pwfl-cal-red);
	color: var(--pwfl-cal-white);
	border-color: var(--pwfl-cal-red);
}

.pwfl-cal-btn--today:hover {
	opacity: 0.9;
	background: var(--pwfl-cal-red);
	color: var(--pwfl-cal-white);
	border-color: var(--pwfl-cal-red);
}

.pwfl-cal-btn--nav {
	padding: 8px 10px;
	font-size: 16px;
	line-height: 1;
	min-width: 36px;
	text-align: center;
}

/* ===================== MONTH VIEW LAYOUT ===================== */
.pwfl-cal-month-layout {
	display: grid;
	grid-template-columns: 1fr 340px;
	gap: 24px;
	align-items: start;
}

/* ===================== MONTH GRID ===================== */
.pwfl-cal-grid-wrap {
	background: var(--pwfl-cal-white);
	border-radius: var(--pwfl-cal-radius);
	box-shadow: var(--pwfl-cal-shadow);
	border: 1px solid var(--pwfl-cal-mid-grey);
	overflow: hidden;
}

.pwfl-cal-weekdays {
	display: grid;
	grid-template-columns: repeat(7, 1fr);
	background: var(--pwfl-cal-dark);
}

.pwfl-cal-weekday {
	font-family: 'Oswald', sans-serif;
	font-size: 11px;
	font-weight: 500;
	text-transform: uppercase;
	letter-spacing: 1.2px;
	color: rgba(255, 255, 255, 0.85);
	text-align: center;
	padding: 10px 4px;
}

.pwfl-cal-days {
	display: grid;
	grid-template-columns: repeat(7, 1fr);
}

.pwfl-cal-day {
	position: relative;
	min-height: 56px;
	padding: 6px;
	border-right: 1px solid var(--pwfl-cal-mid-grey);
	border-bottom: 1px solid var(--pwfl-cal-mid-grey);
	cursor: default;
	transition: background-color 0.15s;
}

.pwfl-cal-day:nth-child(7n) {
	border-right: none;
}

.pwfl-cal-day--empty {
	background: var(--pwfl-cal-light-grey);
	cursor: default;
}

.pwfl-cal-day--has-events {
	cursor: pointer;
}

.pwfl-cal-day--has-events:hover {
	background: rgba(0, 161, 222, 0.06);
}

.pwfl-cal-day--has-events:focus-visible {
	outline: 2px solid var(--pwfl-cal-blue);
	outline-offset: -2px;
	border-radius: 2px;
}

.pwfl-cal-day--selected {
	background: rgba(0, 161, 222, 0.1);
	box-shadow: inset 0 0 0 2px var(--pwfl-cal-blue);
}

.pwfl-cal-day--today .pwfl-cal-day-num {
	background: var(--pwfl-cal-blue);
	color: var(--pwfl-cal-white);
	border-radius: 50%;
	width: 28px;
	height: 28px;
	display: flex;
	align-items: center;
	justify-content: center;
	font-weight: 600;
}

.pwfl-cal-day--outside .pwfl-cal-day-num {
	color: #c0c4cc;
}

.pwfl-cal-day-num {
	font-size: 13px;
	font-weight: 500;
	color: var(--pwfl-cal-text);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 28px;
	height: 28px;
}

.pwfl-cal-day-dot {
	position: absolute;
	bottom: 6px;
	left: 50%;
	transform: translateX(-50%);
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: var(--pwfl-cal-red);
}

/* ===================== SIDEBAR ===================== */
.pwfl-cal-sidebar {
	background: var(--pwfl-cal-white);
	border-radius: var(--pwfl-cal-radius);
	box-shadow: var(--pwfl-cal-shadow);
	border: 1px solid var(--pwfl-cal-mid-grey);
	overflow: hidden;
	max-height: 520px;
	display: flex;
	flex-direction: column;
}

.pwfl-cal-sidebar-header {
	font-family: 'Oswald', sans-serif;
	font-size: 13px;
	font-weight: 500;
	text-transform: uppercase;
	letter-spacing: 1px;
	color: var(--pwfl-cal-white);
	background: var(--pwfl-cal-dark);
	padding: 12px 16px;
	flex-shrink: 0;
}

.pwfl-cal-sidebar-list {
	flex: 1;
	overflow-y: auto;
	padding: 8px;
	overscroll-behavior: contain;
}

.pwfl-cal-sidebar-empty {
	padding: 32px 16px;
	text-align: center;
	color: #999;
	font-size: 13px;
}

.pwfl-cal-event-card {
	display: block;
	padding: 12px;
	border-radius: 6px;
	border-left: 3px solid var(--pwfl-cal-red);
	background: var(--pwfl-cal-light-grey);
	margin-bottom: 8px;
	text-decoration: none !important;
	color: var(--pwfl-cal-text) !important;
	transition: background-color 0.15s, transform 0.15s;
}

.pwfl-cal-event-card:last-child {
	margin-bottom: 0;
}

.pwfl-cal-event-card:hover {
	background: var(--pwfl-cal-mid-grey);
	transform: translateX(2px);
}

.pwfl-cal-event-card:focus-visible {
	outline: 2px solid var(--pwfl-cal-blue);
	outline-offset: 2px;
	border-radius: 6px;
}

.pwfl-cal-event-title {
	font-family: 'Oswald', sans-serif;
	font-size: 14px;
	font-weight: 500;
	letter-spacing: 0.3px;
	color: var(--pwfl-cal-dark);
	margin-bottom: 4px;
	line-height: 1.3;
}

.pwfl-cal-event-date {
	font-size: 12px;
	color: #6b7280;
	display: flex;
	align-items: center;
	gap: 4px;
}

.pwfl-cal-event-date::before {
	content: '';
	display: inline-block;
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: var(--pwfl-cal-red);
	flex-shrink: 0;
}

/* ===================== YEAR VIEW ===================== */
.pwfl-cal-year-grid {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 16px;
}

.pwfl-cal-mini-month {
	background: var(--pwfl-cal-white);
	border-radius: var(--pwfl-cal-radius);
	box-shadow: var(--pwfl-cal-shadow);
	border: 1px solid var(--pwfl-cal-mid-grey);
	overflow: hidden;
	cursor: pointer;
	transition: box-shadow 0.15s, transform 0.15s;
}

.pwfl-cal-mini-month:hover {
	box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
	transform: translateY(-2px);
}

.pwfl-cal-mini-month:focus-visible {
	outline: 2px solid var(--pwfl-cal-blue);
	outline-offset: 2px;
	border-radius: var(--pwfl-cal-radius);
}

.pwfl-cal-mini-month-title {
	font-family: 'Oswald', sans-serif;
	font-size: 12px;
	font-weight: 500;
	text-transform: uppercase;
	letter-spacing: 1px;
	color: var(--pwfl-cal-white);
	background: var(--pwfl-cal-dark);
	padding: 8px 10px;
	text-align: center;
}

.pwfl-cal-mini-month--current .pwfl-cal-mini-month-title {
	background: var(--pwfl-cal-blue);
}

.pwfl-cal-mini-weekdays {
	display: grid;
	grid-template-columns: repeat(7, 1fr);
	padding: 4px 6px 0;
}

.pwfl-cal-mini-weekday {
	font-size: 8px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.5px;
	color: #999;
	text-align: center;
	padding: 2px 0;
}

.pwfl-cal-mini-days {
	display: grid;
	grid-template-columns: repeat(7, 1fr);
	padding: 2px 6px 6px;
	gap: 1px;
}

.pwfl-cal-mini-day {
	font-size: 10px;
	text-align: center;
	padding: 2px 0;
	color: var(--pwfl-cal-text);
	position: relative;
	line-height: 1.6;
}

.pwfl-cal-mini-day--empty {
	visibility: hidden;
}

.pwfl-cal-mini-day--today {
	font-weight: 700;
	color: var(--pwfl-cal-blue);
}

.pwfl-cal-mini-day--has-events::after {
	content: '';
	display: block;
	width: 4px;
	height: 4px;
	border-radius: 50%;
	background: var(--pwfl-cal-red);
	margin: -2px auto 0;
}

/* ===================== LOADING ===================== */
.pwfl-cal-loading {
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 48px 24px;
	color: #999;
	font-size: 14px;
	gap: 8px;
}

.pwfl-cal-spinner {
	width: 18px;
	height: 18px;
	border: 2px solid var(--pwfl-cal-mid-grey);
	border-top-color: var(--pwfl-cal-blue);
	border-radius: 50%;
	animation: pwfl-cal-spin 0.6s linear infinite;
}

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

/* ===================== ERROR ===================== */
.pwfl-cal-error {
	text-align: center;
	padding: 32px 16px;
	color: var(--pwfl-cal-red);
	font-size: 13px;
}

/* ===================== RESPONSIVE ===================== */
@media (max-width: 960px) {
	.pwfl-cal-year-grid {
		grid-template-columns: repeat(3, 1fr);
	}
}

@media (max-width: 768px) {
	.pwfl-cal-month-layout {
		grid-template-columns: 1fr;
	}

	.pwfl-cal-sidebar {
		max-height: 400px;
	}

	.pwfl-cal-toolbar {
		flex-direction: column;
		align-items: stretch;
	}

	.pwfl-cal-toolbar-left,
	.pwfl-cal-toolbar-right {
		justify-content: center;
	}

	.pwfl-cal-title {
		font-size: 18px;
		min-width: auto;
	}

	.pwfl-cal-year-grid {
		grid-template-columns: repeat(2, 1fr);
	}

	.pwfl-cal-day {
		min-height: 44px;
		padding: 4px;
	}

	.pwfl-cal-day-num {
		font-size: 12px;
		width: 24px;
		height: 24px;
	}

	.pwfl-cal-day--today .pwfl-cal-day-num {
		width: 24px;
		height: 24px;
	}

	.pwfl-cal-day-dot {
		width: 5px;
		height: 5px;
		bottom: 4px;
	}
}

@media (max-width: 480px) {
	.pwfl-cal-year-grid {
		grid-template-columns: repeat(2, 1fr);
		gap: 10px;
	}

	.pwfl-cal-btn {
		font-size: 11px;
		padding: 6px 10px;
	}

	.pwfl-cal-day {
		min-height: 38px;
		padding: 3px;
	}

	.pwfl-cal-weekday {
		font-size: 9px;
		padding: 8px 2px;
		letter-spacing: 0.5px;
	}
}

/* ===================== LIST VIEW ===================== */
.pwfl-cal-list {
	max-width: 800px;
	margin: 0 auto;
}
.pwfl-cal-list-empty {
	text-align: center;
	color: var(--pwfl-text-light, #6b7280);
	padding: 40px 20px;
	font-size: 14px;
}
.pwfl-cal-list-month-header {
	font-family: 'Oswald', sans-serif;
	font-size: 13px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 1.5px;
	color: var(--pwfl-blue, #00A1DE);
	padding: 16px 0 8px;
	margin-top: 8px;
	border-bottom: 2px solid var(--pwfl-mid-grey, #e8eaed);
}
.pwfl-cal-list-month-header:first-child {
	margin-top: 0;
}
.pwfl-cal-list-item {
	display: flex;
	align-items: flex-start;
	gap: 16px;
	padding: 12px 8px;
	text-decoration: none !important;
	color: var(--pwfl-text, #2d2d3d) !important;
	border-bottom: 1px solid var(--pwfl-light-grey, #f7f8fa);
	transition: background-color 0.15s;
}
.pwfl-cal-list-item:hover {
	background: var(--pwfl-light-grey, #f7f8fa);
}
.pwfl-cal-list-item:focus-visible {
	outline: 2px solid var(--pwfl-blue, #00A1DE);
	outline-offset: -2px;
	border-radius: 4px;
}
.pwfl-cal-list-item-date {
	display: flex;
	flex-direction: column;
	align-items: center;
	min-width: 48px;
	flex-shrink: 0;
}
.pwfl-cal-list-item-day {
	font-family: 'Oswald', sans-serif;
	font-size: 24px;
	font-weight: 600;
	color: var(--pwfl-red, #EF3340);
	line-height: 1;
}
.pwfl-cal-list-item-weekday {
	font-family: 'Oswald', sans-serif;
	font-size: 10px;
	font-weight: 500;
	text-transform: uppercase;
	letter-spacing: 1px;
	color: var(--pwfl-text-light, #6b7280);
	margin-top: 2px;
}
.pwfl-cal-list-item-info {
	flex: 1;
	min-width: 0;
}
.pwfl-cal-list-item-title {
	font-family: 'Oswald', sans-serif;
	font-size: 15px;
	font-weight: 500;
	letter-spacing: 0.3px;
	line-height: 1.3;
}
.pwfl-cal-list-item-range {
	font-size: 12px;
	color: var(--pwfl-text-light, #6b7280);
	margin-top: 3px;
}

@media (max-width: 480px) {
	.pwfl-cal-list-item {
		gap: 12px;
		padding: 10px 4px;
	}
	.pwfl-cal-list-item-day {
		font-size: 20px;
	}
	.pwfl-cal-list-item-title {
		font-size: 14px;
	}
}

/* ===================== REDUCED MOTION ===================== */
@media (prefers-reduced-motion: reduce) {
	.pwfl-cal-event-card,
	.pwfl-cal-mini-month,
	.pwfl-cal-day,
	.pwfl-cal-btn,
	.pwfl-cal-spinner {
		transition: none !important;
		animation: none !important;
	}
}
