/*
 * DTU Course Booking – form + calendar.
 * Follows dtudiscgolf.dk: square corners, DTU corp red buttons, navy accents,
 * Neo Sans headings, light grey cards with a coloured top border.
 * Uses the GeneratePress global colours when they exist, with fallbacks so it
 * looks the same on any theme. Override any --dtucb-* variable in custom CSS.
 */

.dtucb {
	--dtucb-red: var(--dtu-corp-red, #990000);
	--dtucb-red-hover: #bf2b37;
	--dtucb-navy: var(--dtu-navy, #030f4f);
	--dtucb-grey: var(--dtu-grey, #dadada);
	--dtucb-light: var(--dtu-light-grey, #f6f6f6);
	--dtucb-text: var(--black, #000000);
	--dtucb-muted: #5a5a5a;
	--dtucb-white: var(--white, #ffffff);
	--dtucb-error: var(--dtu-red, #e83f48);
	--dtucb-heading-font: var(--gp-font--neo-sans-std, "Neo Sans Std"), Arial, sans-serif;

	box-sizing: border-box;
	width: 100%;
	max-width: 100%;
	color: var(--dtucb-text);
	line-height: 1.5;
}

.dtucb *,
.dtucb *::before,
.dtucb *::after {
	box-sizing: border-box;
}

.dtucb [hidden] {
	display: none !important;
}

/* ---------- Form ---------- */

.dtucb-form-wrap {
	display: flex;
	flex-direction: column;
	height: 100%;
	container-type: inline-size;
}

.dtucb-form {
	flex: 1 1 auto;
	width: 100%;
	margin: 0;
	padding: clamp(20px, 5cqi, 40px);
	background: var(--dtucb-light);
	border-top: 3px solid var(--dtucb-red);
}

.dtucb-form__title {
	margin: 0 0 8px;
	font-family: var(--dtucb-heading-font);
	font-weight: bold;
	font-size: 1.5em;
	line-height: 1.2;
	color: var(--dtucb-text);
}

.dtucb-form__intro {
	margin: 0 0 24px;
	color: var(--dtucb-muted);
}

.dtucb-grid {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: 18px 20px;
}

@container (min-width: 540px) {
	.dtucb-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
	.dtucb-col-full {
		grid-column: 1 / -1;
	}
}

.dtucb-field {
	display: flex;
	flex-direction: column;
	min-width: 0;
}

.dtucb-field label,
.dtucb-contact legend {
	margin: 0 0 6px;
	font-weight: bold;
	font-size: 0.95em;
}

.dtucb-req {
	color: var(--dtucb-red);
}

.dtucb-form input[type="text"],
.dtucb-form input[type="email"],
.dtucb-form input[type="tel"],
.dtucb-form input[type="number"],
.dtucb-form input[type="date"],
.dtucb-form select,
.dtucb-form textarea {
	display: block;
	width: 100%;
	min-height: 46px;
	margin: 0;
	padding: 10px 12px;
	font: inherit;
	color: var(--dtucb-text);
	background: var(--dtucb-white);
	border: 1px solid var(--dtucb-grey);
	border-radius: 0;
	box-shadow: none;
	transition: border-color 0.15s ease-in, box-shadow 0.15s ease-in;
}

.dtucb-form textarea {
	min-height: 110px;
	resize: vertical;
}

.dtucb-form input:focus,
.dtucb-form select:focus,
.dtucb-form textarea:focus {
	outline: none;
	border-color: var(--dtucb-navy);
	box-shadow: 0 0 0 2px var(--dtucb-navy);
}

.dtucb-form .is-invalid {
	border-color: var(--dtucb-error);
	box-shadow: 0 0 0 1px var(--dtucb-error);
}

/* Course picker: one tile per course, side by side when there is room. */
.dtucb-choice {
	margin: 0;
	padding: 0;
	border: 0;
}

.dtucb-choice legend {
	margin: 0 0 6px;
	padding: 0;
	font-weight: bold;
	font-size: 0.95em;
}

.dtucb-choice__opts {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
	gap: 10px;
}

.dtucb-choice__opt {
	position: relative;
	display: flex;
	align-items: center;
	gap: 10px;
	min-height: 52px;
	margin: 0;
	padding: 10px 14px;
	font-weight: 600;
	background: var(--dtucb-white);
	border: 1px solid var(--dtucb-grey);
	border-left: 6px solid var(--course-color, var(--dtucb-navy));
	cursor: pointer;
	transition: border-color 0.15s ease-in, box-shadow 0.15s ease-in;
}

.dtucb-choice__opt input {
	flex: none;
	width: 18px;
	height: 18px;
	margin: 0;
	accent-color: var(--course-color, var(--dtucb-navy));
}

.dtucb-choice__opt:hover {
	border-color: var(--course-color, var(--dtucb-navy));
}

.dtucb-choice__opt:has(input:checked) {
	border-color: var(--course-color, var(--dtucb-navy));
	box-shadow: inset 0 0 0 1px var(--course-color, var(--dtucb-navy));
	background: color-mix(in srgb, var(--course-color, #030f4f) 8%, #ffffff);
}

.dtucb-choice__opt:has(input:focus-visible) {
	outline: 2px solid var(--dtucb-navy);
	outline-offset: 2px;
}

.dtucb-form .dtucb-choice.is-invalid {
	border: 0;
	box-shadow: none;
}

.dtucb-choice.is-invalid .dtucb-choice__opt {
	border-top-color: var(--dtucb-error);
	border-right-color: var(--dtucb-error);
	border-bottom-color: var(--dtucb-error);
}

.dtucb-error {
	min-height: 0;
	margin-top: 4px;
	font-size: 0.85em;
	color: var(--dtucb-error);
}

.dtucb-error:empty {
	display: none;
}

.dtucb-notice {
	padding: 14px 16px;
	background: var(--dtucb-white);
	border-left: 4px solid var(--dtu-bright-green, #1fd082);
	font-size: 0.95em;
}

.dtucb-contact {
	margin: 4px 0 0;
	padding: 20px;
	min-width: 0;
	background: var(--dtucb-white);
	border: 0;
	border-top: 3px solid var(--dtucb-navy);
}

.dtucb-contact legend {
	float: left;
	width: 100%;
	margin-bottom: 4px;
	padding: 0;
	font-family: var(--dtucb-heading-font);
	font-size: 1.15em;
}

.dtucb-contact__intro {
	clear: both;
	margin: 0 0 16px;
	color: var(--dtucb-muted);
	font-size: 0.95em;
}

.dtucb-contact .dtucb-grid {
	clear: both;
}

/* Honeypot: off-screen, not display:none (some bots skip hidden fields). */
.dtucb-hp {
	position: absolute !important;
	left: -10000px !important;
	top: auto !important;
	width: 1px !important;
	height: 1px !important;
	overflow: hidden !important;
}

.dtucb-privacy {
	margin: 20px 0 0;
	font-size: 0.85em;
	color: var(--dtucb-muted);
}

.dtucb-button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	margin-top: 20px;
	padding: 14px 24px;
	font: inherit;
	font-weight: 600;
	line-height: 1.2;
	text-align: center;
	color: var(--dtucb-white);
	background: var(--dtucb-red);
	border: 2px solid var(--dtucb-red);
	border-radius: 0;
	cursor: pointer;
	transition: all 0.2s ease-in;
}

.dtucb-button:hover,
.dtucb-button:focus-visible {
	color: var(--dtucb-white);
	background: var(--dtucb-red-hover);
	border-color: var(--dtucb-red-hover);
}

.dtucb-button:focus-visible {
	outline: 2px solid var(--dtucb-navy);
	outline-offset: 2px;
}

.dtucb-button[disabled] {
	opacity: 0.6;
	cursor: wait;
}

.dtucb-button--ghost {
	color: var(--dtucb-red);
	background: transparent;
}

.dtucb-button--ghost:hover,
.dtucb-button--ghost:focus-visible {
	color: var(--dtucb-white);
	background: var(--dtucb-red);
	border-color: var(--dtucb-red);
}

@container (min-width: 540px) {
	.dtucb-button {
		width: auto;
	}
}

.dtucb-status:not(:empty) {
	margin-top: 16px;
	padding: 14px 16px;
	background: var(--dtucb-white);
	border-left: 4px solid var(--dtucb-navy);
}

.dtucb-status.is-error {
	border-left-color: var(--dtucb-error);
}

.dtucb-success {
	padding: 4px 0;
}

.dtucb-success h3 {
	margin: 0 0 8px;
	font-family: var(--dtucb-heading-font);
	font-weight: bold;
	font-size: 1.5em;
}

.dtucb-success p {
	margin: 0 0 8px;
}

.dtucb-admin-note {
	margin: 0 0 12px;
	padding: 10px 14px;
	background: #fff8e5;
	border-left: 4px solid var(--dtu-yellow, #f6d04d);
	font-size: 0.9em;
}

/* ---------- Calendar ---------- */

/*
 * Full width, but the height comes from the content: the month grid has fixed
 * row heights so it never stretches to match a neighbouring column (e.g. the
 * form growing when the contact fields open). The list view is as long as it needs.
 */
.dtucb-cal {
	--dtucb-day-h: 120px;
	--dtucb-day-h-small: 64px;

	position: relative;
	display: flex;
	flex-direction: column;
	align-self: flex-start;
	min-height: var(--dtucb-cal-min-h, 0);
	container-type: inline-size;
	background: var(--dtucb-white);
}

.dtucb-cal__heading {
	margin: 0 0 12px;
	font-family: var(--dtucb-heading-font);
	font-weight: bold;
}

.dtucb-cal__app {
	display: flex;
	flex: 1 1 auto;
	flex-direction: column;
	min-height: 0;
}

.dtucb-cal__loading {
	margin: 0;
	padding: 40px 16px;
	text-align: center;
	color: var(--dtucb-muted);
}

.dtucb-toolbar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 10px;
	padding-bottom: 12px;
}

.dtucb-toolbar__title {
	flex: 1 1 auto;
	margin: 0;
	font-family: var(--dtucb-heading-font);
	font-weight: bold;
	font-size: 1.4em;
	line-height: 1.2;
	text-transform: capitalize;
	color: var(--dtucb-text);
}

.dtucb-toolbar__group {
	display: inline-flex;
}

.dtucb-tbtn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 40px;
	min-height: 40px;
	margin: 0;
	padding: 6px 12px;
	font: inherit;
	font-weight: 600;
	font-size: 0.9em;
	line-height: 1;
	color: var(--dtucb-navy);
	background: var(--dtucb-white);
	border: 2px solid var(--dtucb-navy);
	border-radius: 0;
	cursor: pointer;
	transition: all 0.2s ease-in;
}

.dtucb-tbtn + .dtucb-tbtn {
	margin-left: -2px;
}

.dtucb-tbtn:hover,
.dtucb-tbtn:focus-visible,
.dtucb-tbtn[aria-pressed="true"] {
	color: var(--dtucb-white);
	background: var(--dtucb-navy);
}

.dtucb-tbtn:focus-visible {
	position: relative;
	outline: 2px solid var(--dtucb-red);
	outline-offset: 2px;
}

.dtucb-tbtn svg {
	width: 16px;
	height: 16px;
	fill: currentColor;
}

/* Month grid */

.dtucb-month {
	display: grid;
	grid-template-columns: repeat(7, minmax(0, 1fr));
	grid-template-rows: auto;
	grid-auto-rows: var(--dtucb-day-h);
	border-top: 1px solid var(--dtucb-grey);
	border-left: 1px solid var(--dtucb-grey);
	transition: opacity 0.15s ease-in;
}

.dtucb-month.is-loading {
	opacity: 0.55;
}

.dtucb-month__dow {
	padding: 8px 6px;
	font-family: var(--dtucb-heading-font);
	font-weight: bold;
	font-size: 0.85em;
	text-align: center;
	text-transform: capitalize;
	color: var(--dtucb-white);
	background: var(--dtucb-navy);
	border-right: 1px solid var(--dtucb-navy);
}

.dtucb-day {
	display: flex;
	flex-direction: column;
	gap: 3px;
	min-width: 0;
	min-height: 0;
	overflow: hidden;
	padding: 4px;
	background: var(--dtucb-white);
	border-right: 1px solid var(--dtucb-grey);
	border-bottom: 1px solid var(--dtucb-grey);
}

.dtucb-day.is-other {
	background: var(--dtucb-light);
}

.dtucb-day.is-other .dtucb-day__num {
	color: #9a9a9a;
}

.dtucb-day.is-past .dtucb-ev {
	opacity: 0.6;
}

.dtucb-day__num {
	align-self: flex-end;
	min-width: 26px;
	padding: 2px 6px;
	font-size: 0.85em;
	font-weight: 600;
	text-align: center;
}

.dtucb-day.is-today {
	box-shadow: inset 0 0 0 2px var(--dtucb-red);
}

.dtucb-day.is-today .dtucb-day__num {
	color: var(--dtucb-white);
	background: var(--dtucb-red);
}

.dtucb-ev {
	display: block;
	width: 100%;
	margin: 0;
	padding: 3px 6px;
	font: inherit;
	font-size: 0.78em;
	line-height: 1.3;
	text-align: left;
	color: var(--dtucb-text);
	background: var(--dtucb-light);
	background: color-mix(in srgb, var(--ev-color, #dadada) 25%, #ffffff);
	border: 0;
	border-left: 4px solid var(--ev-color, #dadada);
	border-radius: 0;
	cursor: pointer;
	overflow: hidden;
}

.dtucb-ev:hover,
.dtucb-ev:focus-visible {
	background: color-mix(in srgb, var(--ev-color, #dadada) 45%, #ffffff);
	outline: none;
}

.dtucb-ev:focus-visible {
	box-shadow: 0 0 0 2px var(--dtucb-navy);
}

.dtucb-ev__time {
	display: block;
	font-weight: bold;
	white-space: nowrap;
}

/* Course tag: small square label in the course colour. */
.dtucb-tag {
	display: inline-block;
	max-width: 100%;
	margin-right: 4px;
	vertical-align: 1px;
	padding: 1px 5px;
	overflow: hidden;
	font-size: 0.85em;
	font-weight: bold;
	line-height: 1.35;
	letter-spacing: 0.02em;
	white-space: nowrap;
	text-overflow: ellipsis;
	color: #ffffff;
	background: var(--course-color, #5a5a5a);
}

.dtucb-detail .dtucb-tag {
	margin: 2px 6px 6px 0;
	font-size: 0.8em;
	vertical-align: middle;
}

.dtucb-legend {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	padding-bottom: 12px;
}

.dtucb-legend__chip {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	margin: 0;
	padding: 6px 12px 6px 10px;
	font: inherit;
	font-size: 0.85em;
	font-weight: 600;
	line-height: 1.2;
	color: var(--dtucb-text);
	background: var(--dtucb-white);
	border: 2px solid var(--course-color, var(--dtucb-navy));
	border-radius: 0;
}

button.dtucb-legend__chip {
	cursor: pointer;
	transition: all 0.2s ease-in;
}

button.dtucb-legend__chip[aria-pressed="false"] {
	color: var(--dtucb-muted);
	border-color: var(--dtucb-grey);
	text-decoration: line-through;
}

button.dtucb-legend__chip:focus-visible {
	outline: 2px solid var(--dtucb-navy);
	outline-offset: 2px;
}

.dtucb-legend__dot {
	width: 12px;
	height: 12px;
	background: var(--course-color, var(--dtucb-navy));
}

button.dtucb-legend__chip[aria-pressed="false"] .dtucb-legend__dot {
	background: var(--dtucb-grey);
}

.dtucb-ev__title {
	display: block;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.dtucb-ev.is-new {
	animation: dtucb-flash 1.6s ease-out 2;
}

@keyframes dtucb-flash {
	0%, 100% { box-shadow: none; }
	30% { box-shadow: 0 0 0 3px var(--dtucb-red); }
}

.dtucb-more {
	margin: 0;
	padding: 2px 6px;
	font: inherit;
	font-size: 0.78em;
	font-weight: 600;
	text-align: left;
	color: var(--dtucb-red);
	background: none;
	border: 0;
	cursor: pointer;
}

.dtucb-more:hover {
	text-decoration: underline;
}

/* List view */

.dtucb-list {
	flex: 1 1 auto;
	margin: 0;
	padding: 0;
	list-style: none;
	border-top: 3px solid var(--dtucb-navy);
}

.dtucb-list__day {
	display: grid;
	grid-template-columns: 64px minmax(0, 1fr);
	gap: 12px;
	padding: 14px 0;
	border-bottom: 1px solid var(--dtucb-grey);
}

.dtucb-list__date {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	align-self: start;
	padding: 8px 4px;
	color: var(--dtucb-white);
	background: var(--dtucb-navy);
	text-align: center;
	line-height: 1.1;
}

.dtucb-list__day.is-today .dtucb-list__date {
	background: var(--dtucb-red);
}

.dtucb-list__day.is-past {
	opacity: 0.6;
}

.dtucb-list__dnum {
	font-family: var(--dtucb-heading-font);
	font-weight: bold;
	font-size: 1.5em;
}

.dtucb-list__dname {
	font-size: 0.75em;
	text-transform: uppercase;
	letter-spacing: 0.04em;
}

.dtucb-list__events {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.dtucb-list .dtucb-ev {
	font-size: 0.95em;
	padding: 8px 10px;
}

.dtucb-list .dtucb-ev__title {
	white-space: normal;
	font-weight: bold;
}

.dtucb-ev__meta {
	display: block;
	color: var(--dtucb-muted);
	font-size: 0.92em;
}

.dtucb-empty {
	margin: 0;
	padding: 40px 16px;
	text-align: center;
	color: var(--dtucb-muted);
	background: var(--dtucb-light);
}

/* Detail panel */

.dtucb-panel {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
	background: rgba(3, 15, 79, 0.35);
}

.dtucb-panel__box {
	position: relative;
	width: 100%;
	max-width: 480px;
	max-height: 100%;
	overflow: auto;
	padding: 24px;
	background: var(--dtucb-white);
	border-top: 3px solid var(--dtucb-red);
	box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}

.dtucb-panel__title {
	margin: 0 40px 16px 0;
	font-family: var(--dtucb-heading-font);
	font-weight: bold;
	font-size: 1.25em;
	text-transform: capitalize;
}

.dtucb-panel__close {
	position: absolute;
	top: 12px;
	right: 12px;
}

.dtucb-detail {
	margin: 0 0 12px;
	padding: 12px 14px;
	background: var(--dtucb-light);
	border-left: 4px solid var(--ev-color, #dadada);
}

.dtucb-detail.is-focus {
	box-shadow: 0 0 0 2px var(--dtucb-navy);
}

.dtucb-detail h4 {
	margin: 0 0 4px;
	font-family: var(--dtucb-heading-font);
	font-size: 1.05em;
}

.dtucb-detail p {
	margin: 0 0 4px;
	font-size: 0.92em;
}

.dtucb-badge {
	display: inline-block;
	margin: 2px 0 6px;
	padding: 2px 8px;
	font-size: 0.75em;
	font-weight: bold;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: var(--dtucb-white);
	background: var(--dtucb-navy);
}

.dtucb-badge.is-confirmed {
	color: var(--dtucb-text);
	background: var(--dtu-bright-green, #1fd082);
}

.dtucb-cal__stale {
	margin: 8px 0 0;
	font-size: 0.85em;
	color: var(--dtucb-muted);
}

/* Small containers: tighter month cells, only the colour strip + time. */
@container (max-width: 640px) {
	.dtucb-month {
		grid-auto-rows: var(--dtucb-day-h-small);
	}
	.dtucb-day {
		padding: 2px;
	}
	.dtucb-month .dtucb-ev {
		padding: 2px 3px;
		font-size: 0.68em;
	}
	/* Only room for the time and a course colour square, not the names. */
	.dtucb-month .dtucb-ev {
		display: flex;
		align-items: center;
		gap: 3px;
	}
	.dtucb-month .dtucb-ev__title {
		order: -1;
		flex: none;
		font-size: 0;
		line-height: 0;
	}
	.dtucb-month .dtucb-tag {
		width: 8px;
		height: 8px;
		margin: 0;
		padding: 0;
		vertical-align: 0;
	}
	.dtucb-toolbar__title {
		flex-basis: 100%;
		order: -1;
	}
}

@media (prefers-reduced-motion: reduce) {
	.dtucb *,
	.dtucb *::before,
	.dtucb *::after {
		animation: none !important;
		transition: none !important;
	}
}
