/* Class calendar (public/shared/class-calendar.js): last, this and next week of the student's
   class. Rise palette; status colours are the house ones (open green, view blue, closed amber). */

.cc-root {
	container-type: inline-size;
	font-family: 'DM Sans', system-ui, sans-serif;
	/* On /z these follow the student's colour theme (src/utils/zPageTheme.ts); elsewhere the
	   --z-* tokens are unset and the Rise fallbacks stand. */
	--cc-ground: var(--z-surface, #160c24);
	--cc-surface: var(--z-surface-2, #21123a);
	--cc-border: var(--z-line, #3a2257);
	--cc-dim: var(--z-muted, #b7a5d6);
	--cc-text: var(--z-text, #f3ecff);
	--cc-gold: var(--z-rise, #ffd700);
	--cc-orange: var(--z-rise-2, #ff8a00);
	--cc-open: var(--status-open, #4ade80);
	--cc-view: var(--status-view, #60a5fa);
	--cc-closed: var(--status-closed, #fbbf24);
}

.cc-card {
	background: var(--cc-ground);
	border: 1px solid var(--cc-border);
	border-radius: 14px;
	padding: 12px;
	color: var(--cc-text);
}

.cc-head {
	display: flex;
	align-items: center;
	gap: 8px;
	margin-bottom: 10px;
}
.cc-head svg {
	width: 16px;
	height: 16px;
	color: var(--cc-gold);
	flex: none;
}
.cc-title {
	font-family: 'Space Grotesk', 'DM Sans', sans-serif;
	font-weight: 700;
	font-size: 15px;
	background: linear-gradient(90deg, var(--cc-gold), var(--cc-orange));
	-webkit-background-clip: text;
	background-clip: text;
	color: transparent;
}
.cc-class {
	margin-left: auto;
	font-size: 12px;
	color: var(--cc-dim);
}

.cc-note {
	margin-top: 10px;
	font-size: 11px;
	font-style: italic;
	color: var(--cc-dim);
}

.cc-week + .cc-week {
	margin-top: 10px;
}
.cc-week__label {
	display: flex;
	align-items: baseline;
	gap: 6px;
	font-size: 11px;
	font-weight: 600;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: var(--cc-dim);
	margin-bottom: 5px;
}
.cc-week--now .cc-week__label {
	color: var(--cc-gold);
}
.cc-week__range {
	font-weight: 400;
	text-transform: none;
	letter-spacing: 0;
	opacity: 0.8;
}

.cc-grid {
	display: grid;
	grid-template-columns: repeat(5, minmax(0, 1fr));
	gap: 5px;
}

.cc-day {
	display: flex;
	flex-direction: column;
	gap: 3px;
	min-height: 74px;
	padding: 6px;
	background: var(--cc-surface);
	border: 1px solid var(--cc-border);
	border-radius: 8px;
	cursor: help;
	outline: none;
	transition:
		border-color 0.15s ease,
		background 0.15s ease;
}
.cc-day:hover,
.cc-day:focus-visible {
	border-color: var(--cc-dim);
}
.cc-week--past .cc-day {
	opacity: 0.72;
}
.cc-day--off {
	background: transparent;
	border-style: dashed;
}
.cc-day--today {
	border-color: var(--cc-gold);
	border-style: solid;
	box-shadow: 0 0 0 1px var(--cc-gold) inset;
}

.cc-day__date {
	font-size: 11px;
	font-weight: 600;
	color: var(--cc-dim);
}
.cc-day--today .cc-day__date {
	color: var(--cc-gold);
}
.cc-day__dow {
	font-weight: 400;
}
.cc-day__topic {
	font-size: 12px;
	line-height: 1.25;
	display: -webkit-box;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
	overflow: hidden;
	overflow-wrap: anywhere;
}
.cc-day__none {
	font-size: 11px;
	color: var(--cc-dim);
	opacity: 0.7;
}
.cc-day__chips {
	margin-top: auto;
	display: flex;
	flex-wrap: wrap;
	gap: 3px;
}
.cc-chip {
	font-size: 10px;
	padding: 1px 6px;
	border-radius: 999px;
	background: color-mix(in srgb, var(--z-muted, #b7a5d6) 16%, transparent);
	color: var(--cc-dim);
	white-space: nowrap;
}
.cc-chip--quiz {
	background: linear-gradient(90deg, var(--cc-gold), var(--cc-orange));
	color: var(--z-bg, #0b0612);
	font-weight: 700;
}

/* A booked Flex appointment (flexScheduler.ts): sky, so it never reads as the quiz chip. */
.cc-chip--flex {
	background: transparent;
	border: 1px solid #7cc4ff;
	color: #7cc4ff;
	font-weight: 700;
}

.cc-chip--flex-pending {
	border-style: dashed;
	opacity: 0.85;
}

.cc-tip__pending {
	display: block;
	font-weight: 500;
	font-style: italic;
}

.cc-tip__flex {
	margin: 4px 0 6px;
	font-size: 12px;
	font-weight: 700;
	color: #7cc4ff;
}

/* The stream sidebar is narrow: fewer words a cell. */
@container (max-width: 380px) {
	.cc-card {
		padding: 10px;
	}
	.cc-grid {
		gap: 4px;
	}
	.cc-day {
		min-height: 64px;
		padding: 5px 4px;
	}
	.cc-day__topic {
		font-size: 10.5px;
	}
	.cc-chip {
		font-size: 9px;
		padding: 1px 4px;
	}
}

/* Tooltip, appended to body. */
.cc-tip {
	display: none;
	position: fixed;
	z-index: 100000;
	width: min(320px, calc(100vw - 16px));
	max-height: min(420px, calc(100vh - 16px));
	overflow-y: auto;
	padding: 12px 14px;
	background: var(--z-surface-2, #21123a);
	border: 1px solid var(--z-line, #3a2257);
	border-radius: 12px;
	box-shadow: 0 14px 40px rgba(0, 0, 0, 0.5);
	color: var(--z-text, #f3ecff);
	font-family: 'DM Sans', system-ui, sans-serif;
	font-size: 13px;
	line-height: 1.4;
}
.cc-tip__when {
	font-size: 11px;
	color: var(--z-muted, #b7a5d6);
	margin-bottom: 2px;
}
.cc-tip__topic {
	font-family: 'Space Grotesk', 'DM Sans', sans-serif;
	font-weight: 700;
	font-size: 15px;
}
.cc-tip__span {
	font-size: 12px;
	color: var(--z-muted, #b7a5d6);
	margin-top: 2px;
}
.cc-tip__quiz {
	display: inline-block;
	margin-top: 6px;
	font-size: 11px;
	font-weight: 700;
	padding: 2px 8px;
	border-radius: 999px;
	background: linear-gradient(90deg, #ffd700, #ff8a00);
	color: var(--z-bg, #0b0612);
}
.cc-tip__label {
	margin: 10px 0 4px;
	font-size: 11px;
	font-weight: 600;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: var(--z-muted, #b7a5d6);
}
.cc-tip__sets {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 6px;
}
.cc-set {
	display: flex;
	flex-direction: column;
	gap: 3px;
}
.cc-set__title {
	font-weight: 600;
}
.cc-set__meta {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 5px;
	font-size: 11px;
	color: var(--z-muted, #b7a5d6);
}
.cc-status {
	padding: 1px 7px;
	border-radius: 999px;
	font-weight: 600;
}
.cc-status--open {
	color: var(--status-open, #4ade80);
	background: rgba(var(--status-open-rgb, 74, 222, 128), 0.14);
}
.cc-status--view {
	color: var(--status-view, #60a5fa);
	background: rgba(var(--status-view-rgb, 96, 165, 250), 0.14);
}
.cc-status--closed {
	color: var(--status-closed, #fbbf24);
	background: rgba(var(--status-closed-rgb, 251, 191, 36), 0.14);
}
.cc-status--home {
	color: var(--z-muted, #b7a5d6);
	background: color-mix(in srgb, var(--z-muted, #b7a5d6) 14%, transparent);
}
.cc-tip__empty {
	margin-top: 8px;
	font-size: 12px;
	color: var(--z-muted, #b7a5d6);
}

/* Where a page puts it. */
/* Its own row under /z's two-column card grid, never one cell of it. */
#class-calendar-z {
	grid-column: 1 / -1;
	margin-top: 16px;
}
.ss-class-calendar {
	margin-bottom: 12px;
}
