/* Colours and spacing are variables so a theme can override them in one line. */
/* Der Kalender stand ueber die ganze Breite und wurde dadurch zu einem
   Feld aus grossen Flaechen. Ein Terminwaehler liest sich besser schmal
   und mittig; das Formular darunter bleibt breit, dort wird getippt. */
.easyresv-calendar {
	max-width: 26rem;
	margin-inline: auto;
}

.easyresv-calendar,
.easyresv-form {
	--easyresv-accent: #1d4ed8;
	/* Die vier Zustaende lagen alle bei rund 95 Prozent Helligkeit und
	   waren dadurch kaum zu trennen. Jetzt sattere Toene, und statt Gelb
	   ein Orange: Gelb und Gruen sind bei Rot-Gruen-Sehschwaeche schwer
	   auseinanderzuhalten, Orange nicht. Dunkle Schrift bleibt auf allen
	   vier lesbar. */
	--easyresv-free: #a5d6a7;
	--easyresv-partly: #ffb74d;
	--easyresv-full: #e57373;
	--easyresv-past: #d8d8d8;
	--easyresv-radius: 6px;
	--easyresv-gap: 4px;
}

.easyresv-month {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin: 0 0 var(--easyresv-gap);
	font-weight: 600;
}

.easyresv-month__name {
	flex: 1;
	text-align: center;
}

.easyresv-days {
	display: grid;
	grid-template-columns: repeat(7, 1fr);
	gap: var(--easyresv-gap);
	list-style: none;
	margin: 0 0 var(--easyresv-gap);
	padding: 0;
}

.easyresv-weekdays {
	display: grid;
	grid-template-columns: repeat(7, 1fr);
	gap: var(--easyresv-gap);
	list-style: none;
	margin: 0 0 var(--easyresv-gap);
	padding: 0;
	font-size: 0.85em;
	text-align: center;
	opacity: 0.7;
}

.easyresv-day {
	border-radius: var(--easyresv-radius);
	padding: 4px 2px;
	text-align: center;
	font-size: 0.95em;
	line-height: 1.7;
}

/* The border repeats what the colour says, for anyone who cannot tell the
   colours apart. */
.easyresv-day--free {
	background: var(--easyresv-free);
	border: 2px solid #2e7d32;
}

.easyresv-day--partly {
	background: var(--easyresv-partly);
	border: 2px dashed #e65100;
}

.easyresv-day--full {
	background: var(--easyresv-full);
	border: 2px solid #b71c1c;
}

.easyresv-day--empty {
	background: none;
	border: 0;
}

/* A day that has gone is not another free day; it carries no border so it
   reads as out of reach rather than as a fourth colour to book against. */
.easyresv-day--past {
	background: var(--easyresv-past);
	border: 0;
}

/* Read out loud, shown in a text browser, invisible on screen. */
.easyresv-day__state {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

.easyresv-hp { position: absolute; left: -9999px; }

.easyresv-key {
	display: inline-block;
	width: 14px;
	height: 14px;
	border-radius: 3px;
	margin: 0 4px 0 12px;
	vertical-align: middle;
}

.easyresv-key--free { background: var(--easyresv-free); }
.easyresv-key--partly { background: var(--easyresv-partly); }
.easyresv-key--full { background: var(--easyresv-full); }

.easyresv-notice {
	border-radius: var(--easyresv-radius);
	padding: 12px 16px;
	margin: 0 0 var(--easyresv-gap);
	border-left: 4px solid currentColor;
}

.easyresv-notice--success { background: var(--easyresv-free); }
.easyresv-notice--error { background: var(--easyresv-full); }

/* The page a confirmation or cancellation link leads to. Its outcome is
   named by a class, not by wording, so a theme can style it without
   depending on a translation. */
.easyresv-result {
	border-radius: var(--easyresv-radius);
	padding: 12px 16px;
	margin: 0 0 var(--easyresv-gap);
	border-left: 4px solid currentColor;
}

.easyresv-result--confirmed { background: var(--easyresv-free); }
.easyresv-result--cancelled { background: var(--easyresv-partly); }

/* --- Zeitraumwahl -----------------------------------------------------
   Diese Regeln greifen erst, wenn das Skript den Kalender uebernommen
   hat. Ohne JavaScript bleibt alles wie zuvor: eine Anzeige, die nicht
   vorgibt, anklickbar zu sein. */

.easyresv-calendar--interactive .easyresv-day[role="button"] {
	cursor: pointer;
}

.easyresv-calendar--interactive .easyresv-day[role="button"]:hover {
	filter: brightness(0.94);
}

.easyresv-calendar--interactive .easyresv-day[role="button"]:focus-visible {
	outline: 3px solid var(--easyresv-accent);
	outline-offset: 2px;
}

/* Der gewaehlte Zeitraum wird kraeftig eingefaerbt, nicht nur umrandet:
   eine Umrandung allein ginge neben den Rahmen der Zustaende unter. */
.easyresv-day--chosen {
	background: var(--easyresv-accent);
	border-color: var(--easyresv-accent);
	color: #fff;
	font-weight: 600;
}

/* Die beiden Enden des Zeitraums, damit sichtbar ist, was Beginn und
   was Ende ist. */
.easyresv-day--edge {
	box-shadow: inset 0 0 0 2px #fff;
}

/* Was an einem Tag schon vergeben ist. Der Kasten entsteht erst durch
   das Skript; ohne Skript stehen dieselben Zeiten im Tooltip des Tages
   und im vorgelesenen Text. */
.easyresv-busy {
	min-height: 1.5em;
	margin: var(--easyresv-gap) 0 0;
	font-size: 0.9em;
	text-align: center;
}

.easyresv-busy:not(:empty) {
	padding: 6px 8px;
	border-radius: var(--easyresv-radius);
	background: var(--easyresv-past);
}

/* Die Auswahl der Ressource. Sie steht ueber dem Kalender und bleibt
   stehen, damit ein Besucher wechseln kann, ohne zurueckzugehen. */
.easyresv-picker {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
	gap: 8px;
	/* Deutlicher Abstand nach unten: die Auswahl gehoert nicht an den
	   Kalender geklebt, sie ist der Schritt davor. */
	margin: 0 auto 24px;
	max-width: 26rem;
}

/* Die Beschriftung nimmt die ganze Zeile, damit Auswahlfeld und
   Schaltflaeche gemeinsam darunter stehen statt in einer Reihe mit ihr. */
.easyresv-picker label {
	flex: 0 0 100%;
	text-align: center;
}

/* Das Feld nur so breit wie noetig: der laengste Name bestimmt die
   Breite, nicht die Spalte. */
.easyresv-picker select {
	flex: 0 1 auto;
	max-width: 14rem;
}

/* --- Das Formular in Spalten -------------------------------------------
   Untereinander wurde das Formular auf einem breiten Bildschirm zu einer
   langen Leiter. Zwei Spalten und nicht drei: eine Mailadresse und ein
   Feld fuer Datum mit Uhrzeit brauchen Platz, in einem Drittel einer
   Inhaltsspalte werden sie unleserlich. Auf schmalen Geraeten bleibt
   alles untereinander. */

.easyresv-form {
	display: grid;
	grid-template-columns: 1fr;
	gap: 0 20px;
}

.easyresv-form .easyresv-field {
	margin: 0 0 12px;
}

.easyresv-form label {
	display: block;
}

.easyresv-form input:not([type="checkbox"]),
.easyresv-form textarea,
.easyresv-form select {
	width: 100%;
	box-sizing: border-box;
}

@media screen and (min-width: 48rem) {
	.easyresv-form {
		grid-template-columns: 1fr 1fr;
	}

	/* Notiz, Zustimmung und Absenden ueber beide Spalten: ein Textfeld
	   in halber Breite ist nicht zu gebrauchen, und eine Schaltflaeche
	   neben einem Eingabefeld sieht aus wie dessen Zubehoer. */
	.easyresv-form .easyresv-field--wide {
		grid-column: 1 / -1;
	}
}
