/* =====================================================================
   View switcher + nav group (used by Month, Week, and Day views)
   ===================================================================== */

.cec-calendar-header {
	flex-wrap: wrap;
	gap: 0.5em;
}

.cec-view-switcher {
	display: flex;
	border: 1px solid #c3c4c7;
	border-radius: 4px;
	overflow: hidden;
}

.cec-view-tab {
	display: inline-block;
	padding: 0.3em 0.8em;
	font-size: 0.8em;
	text-decoration: none;
	color: #50575e;
	border-right: 1px solid #c3c4c7;
	background: #fff;
	white-space: nowrap;
}

.cec-view-tab:last-child {
	border-right: none;
}

.cec-view-tab:hover,
.cec-view-tab.is-active {
	background: #2271b1;
	color: #fff;
	text-decoration: none;
}

.cec-nav-group {
	display: flex;
	gap: 0.25em;
	align-items: center;
}

.cec-nav-btn {
	display: inline-block;
	padding: 0.3em 0.75em;
	font-size: 0.85em;
	text-decoration: none;
	color: #50575e;
	background: #fff;
	border: 1px solid #c3c4c7;
	border-radius: 4px;
	white-space: nowrap;
}

.cec-nav-btn:hover {
	background: #f6f7f7;
	color: #2271b1;
	text-decoration: none;
}

.cec-view-title {
	margin: 0;
	font-size: 1.2em;
}

.cec-view-title.is-today {
	color: #2271b1;
}

/* Day-number links in the month view (was a plain div). */
a.cec-day-number {
	display: block;
	font-size: 0.85em;
	margin-bottom: 0.15em;
	text-decoration: none;
	color: inherit;
	width: 1.7em;
	height: 1.7em;
	line-height: 1.7em;
	text-align: center;
	border-radius: 50%;
}

a.cec-day-number:hover {
	background: #f0f0f1;
	color: #2271b1;
}

.cec-day-today a.cec-day-number {
	background: #2271b1;
	color: #fff;
}

.cec-day-today a.cec-day-number:hover {
	background: #135e96;
}

/* =====================================================================
   Shared time-view outer wrapper
   ===================================================================== */

.cec-time-view-wrap {
	border: 1px solid #ddd;
	border-radius: 4px;
	overflow: hidden;
	margin-top: 0.5em;
}

/* =====================================================================
   Column-header row  (day abbreviation + date number)
   ===================================================================== */

.cec-col-header-row {
	display: flex;
	background: #f6f7f7;
	border-bottom: 2px solid #ddd;
}

.cec-time-gutter-spacer {
	flex: 0 0 52px;
	width: 52px;
}

.cec-col-head {
	flex: 1;
	min-width: 0;
	text-align: center;
	padding: 0.35em 0;
	border-left: 1px solid #e5e7eb;
}

.cec-col-head.is-today {
	background: color-mix(in srgb, #2271b1 8%, #fff);
}

.cec-col-head-link {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.1em;
	text-decoration: none;
	color: inherit;
}

.cec-col-head-link:hover {
	color: #2271b1;
	text-decoration: none;
}

.cec-col-dow {
	font-size: 0.7em;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: #757575;
}

.cec-col-num {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 1.8em;
	height: 1.8em;
	font-size: 1em;
	font-weight: 600;
	border-radius: 50%;
}

.cec-col-num.is-today {
	background: #2271b1;
	color: #fff;
}

/* =====================================================================
   All-day banner row
   ===================================================================== */

.cec-allday-row {
	display: flex;
	border-bottom: 1px solid #ddd;
	background: #fafafa;
}

.cec-allday-label {
	flex: 0 0 52px;
	width: 52px;
	padding: 0.3em 0.4em 0.3em 0;
	text-align: right;
	font-size: 0.7em;
	color: #999;
	border-right: 1px solid #ddd;
	align-self: flex-start;
	padding-top: 0.5em;
}

.cec-allday-col {
	flex: 1;
	min-width: 0;
	border-left: 1px solid #e5e7eb;
	padding: 0.2em 0.25em;
	min-height: 1.8em;
}

.cec-event-allday {
	display: block;
	font-size: 0.78em;
	margin-bottom: 0.15em;
	padding: 0.1em 0.4em;
	border-left: 3px solid var(--cec-event-color, #2271b1);
	background: color-mix(in srgb, var(--cec-event-color, #2271b1) 12%, #fff);
	color: inherit;
	text-decoration: none;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	border-radius: 2px;
}

.cec-event-allday:hover {
	text-decoration: underline;
}

/* =====================================================================
   Scrollable time grid
   ===================================================================== */

.cec-time-scroll {
	overflow-y: auto;
	max-height: 600px;
}

.cec-time-grid {
	display: flex;
	/* height set via inline style = TimeGrid::total_height() px */
	position: relative;
}

/* ---- Gutter (hour labels) ---- */

.cec-time-gutter {
	flex: 0 0 52px;
	width: 52px;
	position: relative;
	border-right: 1px solid #ddd;
	background: #fff;
}

.cec-hour-label {
	position: absolute;
	right: 0.4em;
	font-size: 0.68em;
	color: #aaa;
	transform: translateY( -0.55em ); /* center label on the hour line */
	white-space: nowrap;
	user-select: none;
	pointer-events: none;
}

/* ---- Day columns ---- */

.cec-time-col {
	flex: 1;
	min-width: 0;
	position: relative;
	border-left: 1px solid #e5e7eb;
	/* Repeating 64px background creates the hour-separator lines without extra DOM. */
	background-image: repeating-linear-gradient(
		to bottom,
		transparent calc( 64px - 1px ),
		#e8e8e8 calc( 64px - 1px ),
		#e8e8e8 64px
	);
	background-size: 100% 64px;
}

.cec-time-col.is-today {
	background-color: color-mix(in srgb, #2271b1 4%, #fff);
}

/* ---- Positioned timed event blocks ---- */

.cec-timed-event {
	position: absolute;
	box-sizing: border-box;
	padding: 0.15em 0.35em;
	font-size: 0.75em;
	line-height: 1.3;
	border-left: 3px solid var(--cec-event-color, #2271b1);
	background: color-mix(in srgb, var(--cec-event-color, #2271b1) 14%, #fff);
	color: inherit;
	text-decoration: none;
	overflow: hidden;
	border-radius: 2px;
	outline: 1px solid #fff; /* visual gap between side-by-side events */
	z-index: 1;
}

.cec-timed-event:hover {
	z-index: 2;
	text-decoration: underline;
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.cec-timed-event .cec-event-time {
	font-weight: 700;
	display: block;
}

.cec-timed-event .cec-event-title {
	display: block;
}

.cec-timed-event .cec-event-where {
	display: block;
	font-size: 0.88em;
	opacity: 0.75;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

/* =====================================================================
   Day-view single-column layout
   ===================================================================== */

.cec-single-col .cec-allday-col {
	flex: 1;
}

.cec-single-col .cec-time-col {
	flex: 1;
}

/* =====================================================================
   Responsive
   ===================================================================== */

@media (max-width: 640px) {
	.cec-col-dow {
		display: none;
	}

	.cec-col-num {
		font-size: 0.85em;
	}

	.cec-time-gutter-spacer,
	.cec-time-gutter,
	.cec-allday-label {
		flex: 0 0 34px;
		width: 34px;
	}

	.cec-hour-label {
		font-size: 0.58em;
	}

	.cec-timed-event .cec-event-time {
		display: inline;
	}

	.cec-timed-event .cec-event-title {
		display: none; /* very tight columns; time label stays */
	}
}

@media (max-width: 480px) {
	.cec-view-switcher {
		order: 3;
		width: 100%;
	}
}
