/*
 * TargetScore Events Calendar — front-end styles.
 * Scoped under .tse-root so the plugin never leaks styles into the host theme.
 * schedule-x ships its own theme CSS (bundled into the JS); these rules only
 * cover our chrome: the view toggle, state messages, category chips, and the
 * detail page layout.
 */

.tse-root {
	--tse-primary: #5B5F8F;
	--tse-text: #1A1C22;
	--tse-muted: #6b7280;
	--tse-border: #e5e7eb;
	--tse-radius: 8px;
	color: var(--tse-text);
	font-size: 16px;
	line-height: 1.5;
}

/* --- View toggle ------------------------------------------------------- */
.tse-toolbar {
	display: flex;
	justify-content: flex-end;
	gap: 8px;
	margin-bottom: 12px;
}

.tse-toggle {
	display: inline-flex;
	border: 1px solid var(--tse-border);
	border-radius: var(--tse-radius);
	overflow: hidden;
}

.tse-toggle__btn {
	appearance: none;
	background: #fff;
	border: 0;
	padding: 8px 16px;
	font: inherit;
	color: var(--tse-text);
	cursor: pointer;
}

.tse-toggle__btn + .tse-toggle__btn {
	border-left: 1px solid var(--tse-border);
}

.tse-toggle__btn[aria-pressed="true"] {
	background: var(--tse-primary);
	color: #fff;
}

/* --- Calendar mount ---------------------------------------------------- */
.tse-calendar {
	min-height: 520px;
}

/*
 * schedule-x renders its own markup (prefixed .sx__) into .tse-calendar. These
 * scoped tweaks make it inherit the theme font, sit in a subtle card, and give
 * event chips a softer, more legible look. Kept minimal so we don't fight the
 * library's layout.
 */
.tse-calendar .sx__calendar {
	font-family: inherit;
	border: 1px solid var(--tse-border);
	border-radius: var(--tse-radius);
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
	overflow: hidden;
}

.tse-calendar .sx__calendar-header {
	padding: 8px 12px;
}

/* Event chips: rounded, medium weight, no clipping of the label. */
.tse-calendar .sx__month-grid-event,
.tse-calendar .sx__time-grid-event,
.tse-calendar .sx__month-agenda-event,
.tse-calendar .sx__event {
	border-radius: 6px;
	font-weight: 600;
	cursor: pointer;
}

.tse-calendar .sx__month-grid-event:hover,
.tse-calendar .sx__month-agenda-event:hover {
	filter: brightness(0.97);
}

/* Emphasize today's cell a touch. */
.tse-calendar .sx__month-grid-day.sx__is-today .sx__month-grid-day__header-day-name,
.tse-calendar .sx__month-grid-day.sx__is-today {
	font-weight: 700;
}

/* --- State messages ---------------------------------------------------- */
.tse-notice {
	padding: 16px;
	border-radius: var(--tse-radius);
	background: #f9fafb;
	border: 1px solid var(--tse-border);
	color: var(--tse-muted);
	text-align: center;
}

.tse-notice--error {
	background: #fef2f2;
	border-color: #fecaca;
	color: #b91c1c;
}

.tse-notice__retry {
	appearance: none;
	margin-left: 8px;
	padding: 6px 14px;
	border: 1px solid currentColor;
	border-radius: var(--tse-radius);
	background: transparent;
	color: inherit;
	font: inherit;
	cursor: pointer;
}

/* Simple spinner for the loading state. */
.tse-loading {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 12px;
	padding: 48px 16px;
	color: var(--tse-muted);
}

.tse-spinner {
	width: 22px;
	height: 22px;
	border: 3px solid var(--tse-border);
	border-top-color: var(--tse-primary);
	border-radius: 50%;
	animation: tse-spin 0.8s linear infinite;
}

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

/* --- Category chip ----------------------------------------------------- */
.tse-chip {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 4px 12px;
	border-radius: 999px;
	font-size: 0.85em;
	font-weight: 600;
	color: #fff;
}

/* --- Detail page ------------------------------------------------------- */
.tse-detail__back {
	display: inline-block;
	margin-bottom: 16px;
	color: var(--tse-primary);
	text-decoration: none;
}

.tse-detail__back:hover {
	text-decoration: underline;
}

.tse-detail__title {
	margin: 8px 0;
	font-size: 1.8em;
	line-height: 1.2;
}

.tse-detail__meta {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 12px;
	margin-bottom: 16px;
	color: var(--tse-muted);
}

.tse-detail__section {
	margin: 20px 0;
}

.tse-detail__section h2 {
	font-size: 1.1em;
	margin-bottom: 8px;
}

/* Overview is sanitized rich-text HTML; let it flow normally and tame media. */
.tse-detail__overview img {
	max-width: 100%;
	height: auto;
}

.tse-detail__overview a {
	color: var(--tse-primary);
}

/* Register button + popup-blocked fallback. */
.tse-register {
	appearance: none;
	display: inline-block;
	margin-top: 8px;
	padding: 12px 24px;
	border: 0;
	border-radius: var(--tse-radius);
	background: var(--tse-primary);
	color: #fff;
	font: inherit;
	font-weight: 600;
	cursor: pointer;
	text-decoration: none;
}

.tse-register:hover {
	opacity: 0.92;
}

.tse-register-fallback {
	margin-top: 12px;
	padding: 12px;
	border: 1px dashed var(--tse-border);
	border-radius: var(--tse-radius);
	background: #f9fafb;
}

.tse-register-fallback[hidden] {
	display: none;
}

/* --- Upcoming Events widget -------------------------------------------- */
.tse-widget-list {
	list-style: none;
	margin: 0;
	padding: 0;
}

.tse-widget-item + .tse-widget-item {
	border-top: 1px solid var(--tse-border);
}

.tse-widget-row {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	padding: 10px 0;
	text-decoration: none;
	color: inherit;
}

.tse-widget-link:hover .tse-widget-title {
	color: var(--tse-primary);
	text-decoration: underline;
}

.tse-widget-dot {
	flex: 0 0 auto;
	width: 10px;
	height: 10px;
	margin-top: 5px;
	border-radius: 50%;
}

.tse-widget-body {
	display: flex;
	flex-direction: column;
	min-width: 0;
}

.tse-widget-title {
	font-weight: 600;
	line-height: 1.3;
}

.tse-widget-date {
	font-size: 0.85em;
	color: var(--tse-muted);
}

/* --- Footer attribution link (intentionally low-key) ------------------ */
.tse-footer {
	margin-top: 8px;
	text-align: right;
	font-size: 0.68em;
	line-height: 1;
	opacity: 0.45;
	transition: opacity 0.15s ease;
}

.tse-footer:hover {
	opacity: 0.85;
}

.tse-footer a {
	color: var(--tse-muted);
	text-decoration: none;
	letter-spacing: 0.02em;
}

.tse-footer a:hover {
	text-decoration: underline;
}
