/**
 * Upcoming Calendar Events — front-end styles.
 * v1.1.0 — adds: Pro label badge, Grid/List view toggle, Load More improvements, misc polish.
 * Override with theme CSS using .uce-* classes.
 */

/* ================================================================
   WRAPPER & STATES
   ================================================================ */
.uce-events-wrapper {
	position: relative;
	font-family: inherit;
}

.uce-loading {
	display: flex;
	align-items: center;
	gap: 0.6em;
	color: #6b7280;
	font-size: 0.9em;
	padding: 1.5em 0;
}

.uce-loading::before {
	content: '';
	display: inline-block;
	width: 1em;
	height: 1em;
	border: 2px solid #d1d5db;
	border-top-color: #6366f1;
	border-radius: 50%;
	animation: uce-spin 0.7s linear infinite;
	flex-shrink: 0;
}

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

.uce-error {
	display: flex;
	align-items: center;
	gap: 0.5em;
	color: #dc2626;
	background: #fef2f2;
	border: 1px solid #fecaca;
	border-radius: 8px;
	padding: 0.875em 1em;
	font-size: 0.875em;
}

.uce-no-events {
	color: #9ca3af;
	text-align: center;
	padding: 3em 1em;
	font-style: italic;
	font-size: 0.9em;
	line-height: 1.5;
}

/* ================================================================
   TOOLBAR  (view toggle + event count)
   ================================================================ */
.uce-toolbar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 1.25em;
	min-height: 2em;
}

.uce-event-count {
	font-size: 0.75em;
	font-weight: 600;
	color: #9ca3af;
	letter-spacing: 0.04em;
	text-transform: uppercase;
}

/* View toggle group */
.uce-view-toggle {
	display: flex;
	align-items: center;
	gap: 2px;
	background: #f3f4f6;
	border-radius: 8px;
	padding: 3px;
}

.uce-view-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 30px;
	height: 30px;
	border: none;
	background: transparent;
	border-radius: 6px;
	color: #9ca3af;
	cursor: pointer;
	transition: background 0.15s, color 0.15s;
	padding: 0;
}

.uce-view-btn:hover {
	color: #6366f1;
	background: #fff;
}

.uce-view-btn.is-active {
	background: #fff;
	color: #6366f1;
	box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

/* ================================================================
   DAY GROUP
   ================================================================ */
.uce-event-groups {
	display: flex;
	flex-direction: column;
	gap: 2em;
}

.uce-day-group__header {
	display: flex;
	align-items: center;
	gap: 0.6em;
	margin-bottom: 0.875em;
}

.uce-day-group__dot {
	display: inline-block;
	width: 8px;
	height: 8px;
	background: #6366f1;
	border-radius: 50%;
	flex-shrink: 0;
}

.uce-day-group__label {
	font-size: 0.75em;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.08em;
	color: #6366f1;
}

.uce-day-group__count {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 18px;
	height: 18px;
	padding: 0 5px;
	background: #eef2ff;
	color: #6366f1;
	border-radius: 20px;
	font-size: 0.7em;
	font-weight: 700;
	line-height: 1;
}

/* ================================================================
   CARD GRID — LIST VIEW (default)
   ================================================================ */
.uce-card-grid {
	display: flex;
	flex-direction: column;
	gap: 0.875em;
}

/* ================================================================
   CARD GRID — GRID VIEW
   ================================================================ */
[data-current-view="grid"] .uce-card-grid {
	display: grid;
	grid-template-columns: repeat( auto-fill, minmax( 260px, 1fr ) );
	gap: 1em;
}

[data-current-view="grid"] .uce-card {
	flex-direction: column;
	gap: 0.75em;
}

[data-current-view="grid"] .uce-card__date-badge {
	flex-direction: row;
	width: 100%;
	height: auto;
	padding: 0 0 0.6em;
	background: none;
	border-radius: 0;
	border-bottom: 1px solid #f3f4f6;
	justify-content: flex-start;
	gap: 0.35em;
}

[data-current-view="grid"] .uce-card__month {
	font-size: 0.7em;
	letter-spacing: 0.05em;
}

[data-current-view="grid"] .uce-card__day {
	font-size: 1em;
	margin-top: 0;
}

[data-current-view="grid"] .uce-card__label {
	top: 0.75em;
	right: 0.75em;
}

/* ================================================================
   CARD
   ================================================================ */
.uce-card {
	position: relative;
	display: flex;
	align-items: flex-start;
	gap: 1em;
	background: #fff;
	border: 1px solid #e5e7eb;
	border-radius: 12px;
	padding: 1.125em 1.25em;
	transition: box-shadow 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
	/* Entrance animation */
	animation: uce-fade-up 0.25s ease both;
}

@keyframes uce-fade-up {
	from { opacity: 0; transform: translateY(6px); }
	to   { opacity: 1; transform: translateY(0); }
}

.uce-card:hover {
	border-color: #c7d2fe;
	box-shadow: 0 4px 16px rgba(99, 102, 241, 0.1);
	transform: translateY(-1px);
}

/* ---- Pro / custom label badge ---- */
.uce-card__label {
	position: absolute;
	top: -1px;
	right: 1em;
	display: inline-flex;
	align-items: center;
	padding: 0.2em 0.65em;
	font-size: 0.65em;
	font-weight: 800;
	letter-spacing: 0.07em;
	text-transform: uppercase;
	border-radius: 0 0 6px 6px;
	background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
	color: #fff;
	line-height: 1.6;
	white-space: nowrap;
	box-shadow: 0 2px 6px rgba(99, 102, 241, 0.35);
	pointer-events: none;
	user-select: none;
}

/* Golden "PRO" variant */
.uce-card__label[data-label-text="PRO"],
.uce-card__label[data-label-text="Pro"],
.uce-card__label[data-label-text="pro"] {
	background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
	box-shadow: 0 2px 6px rgba(245, 158, 11, 0.4);
}

/* ---- Date badge ---- */
.uce-card__date-badge {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	width: 3em;
	height: 3em;
	background: #eef2ff;
	border-radius: 10px;
	text-align: center;
	line-height: 1;
}

.uce-card__month {
	font-size: 0.6em;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: #6366f1;
}

.uce-card__day {
	font-size: 1.2em;
	font-weight: 800;
	color: #1e1b4b;
	margin-top: 0.1em;
}

/* ---- Card content ---- */
.uce-card__content {
	flex: 1 1 auto;
	min-width: 0;
}

.uce-card__title {
	margin: 0 0 0.4em;
	font-size: 0.975em;
	font-weight: 600;
	color: #111827;
	line-height: 1.3;
}

.uce-card__title a {
	color: inherit;
	text-decoration: none;
}

.uce-card__title a:hover {
	color: #6366f1;
}

/* ---- Meta row ---- */
.uce-card__meta {
	display: flex;
	flex-wrap: wrap;
	gap: 0.75em;
	margin-bottom: 0.5em;
}

.uce-card__meta-item {
	display: inline-flex;
	align-items: center;
	gap: 0.3em;
	font-size: 0.8em;
	color: #6b7280;
}

.uce-icon {
	width: 12px;
	height: 12px;
	flex-shrink: 0;
	color: #9ca3af;
}

/* ---- Description ---- */
.uce-card__description {
	font-size: 0.85em;
	color: #4b5563;
	line-height: 1.55;
	margin-top: 0.5em;
	border-top: 1px solid #f3f4f6;
	padding-top: 0.5em;
}

.uce-card__description p { margin: 0 0 0.4em; }
.uce-card__description p:last-child { margin: 0; }

/* ---- CTA link ---- */
.uce-card__cta {
	display: inline-flex;
	align-items: center;
	gap: 0.3em;
	font-size: 0.78em;
	font-weight: 600;
	color: #6366f1;
	text-decoration: none;
	margin-top: 0.6em;
	transition: gap 0.15s;
}

.uce-card__cta:hover {
	gap: 0.5em;
	text-decoration: underline;
}

.uce-card__cta .uce-icon {
	width: 13px;
	height: 13px;
	color: currentColor;
}

/* ================================================================
   LOAD MORE
   ================================================================ */
.uce-load-more-wrap {
	text-align: center;
	margin-top: 1.75em;
}

.uce-load-more {
	display: inline-flex;
	align-items: center;
	gap: 0.4em;
	padding: 0.625em 1.75em;
	background: #fff;
	color: #6366f1;
	border: 1.5px solid #6366f1;
	border-radius: 8px;
	font-size: 0.875em;
	font-weight: 600;
	cursor: pointer;
	transition: background 0.15s, color 0.15s, box-shadow 0.15s, opacity 0.15s;
}

.uce-load-more:hover:not(:disabled) {
	background: #6366f1;
	color: #fff;
	box-shadow: 0 4px 12px rgba(99, 102, 241, 0.25);
}

.uce-load-more:disabled {
	opacity: 0.55;
	cursor: default;
}

.uce-load-more .uce-load-more__spinner {
	display: none;
	width: 0.85em;
	height: 0.85em;
	border: 2px solid currentColor;
	border-top-color: transparent;
	border-radius: 50%;
	animation: uce-spin 0.7s linear infinite;
}

.uce-load-more.is-loading .uce-load-more__spinner {
	display: inline-block;
}

/* "All events loaded" message */
.uce-all-loaded {
	text-align: center;
	margin-top: 1.5em;
	font-size: 0.8em;
	color: #9ca3af;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 0.5em;
}

.uce-all-loaded::before,
.uce-all-loaded::after {
	content: '';
	display: inline-block;
	height: 1px;
	width: 2.5em;
	background: #e5e7eb;
}

/* ================================================================
   BLOCK EDITOR PREVIEW
   ================================================================ */
.uce-block-loading {
	display: flex;
	align-items: center;
	gap: 0.5em;
	padding: 1em;
	color: #6b7280;
}

.uce-block-error {
	padding: 1em;
	color: #dc2626;
}

.uce-block-empty {
	padding: 1em;
	color: #9ca3af;
	font-style: italic;
}

/* ================================================================
   RESPONSIVE
   ================================================================ */
@media ( max-width: 600px ) {
	[data-current-view="grid"] .uce-card-grid {
		grid-template-columns: 1fr;
	}
}

@media ( max-width: 480px ) {
	.uce-card {
		flex-direction: column;
		gap: 0.75em;
	}

	.uce-card__date-badge {
		flex-direction: row;
		width: auto;
		height: auto;
		padding: 0.3em 0.6em;
		gap: 0.4em;
	}

	.uce-card__month { font-size: 0.7em; }
	.uce-card__day   { font-size: 0.9em; margin-top: 0; }
}
