/**
 * Datumswahl im Team-Bereich (assets/js/datumswahl.js) – ruhiges Kalenderblatt statt Browser-Kalender.
 * Clash Display für den Monat, Satoshi für alles andere, Orange nur für den gewählten Tag und „heute“.
 * Nimmt die Farben der Team-Seiten (team-dashboard.css), hat aber eigene Rückfallwerte für die übrigen Seiten.
 */

.gd {
	--gd-karte: var(--card, #fff);
	--gd-text: var(--text, #121212);
	--gd-leise: var(--muted, #595959);
	--gd-blass: var(--faint, #858580);
	--gd-linie: var(--line, #e0e0dc);
	--gd-flaeche: var(--fog, #ececea);
	--gd-orange: #f05a22;
	--gd-tinte: var(--ink, #121212);

	position: fixed;
	inset: auto;
	margin: 0;
	z-index: 2147483000;
	width: 316px;
	max-width: calc(100vw - 16px);
	max-height: calc(100vh - 16px);
	overflow: auto;
	padding: 18px 18px 14px;
	border: 1px solid var(--gd-linie);
	border-radius: 14px;
	background: var(--gd-karte);
	color: var(--gd-text);
	box-shadow: 0 1px 2px rgb(0 0 0 / 6%), 0 18px 48px -12px rgb(0 0 0 / 28%);
	font-family: "Satoshi", system-ui, sans-serif;
	font-size: 14px;
	line-height: 1.3;
	text-align: left;
	animation: gd-auf 0.16s cubic-bezier(0.2, 0.8, 0.2, 1);
	transform-origin: top left;
}

.gd[data-seite="oben"] {
	transform-origin: bottom left;
}

.gd.is-zu {
	animation: gd-zu 0.12s ease forwards;
}

@keyframes gd-auf {

	from {
		opacity: 0;
		transform: translateY(-4px) scale(0.98);
	}
}

@keyframes gd-zu {

	to {
		opacity: 0;
		transform: translateY(-4px) scale(0.98);
	}
}

.gd button {
	font: inherit;
	color: inherit;
	margin: 0;
	cursor: pointer;
	-webkit-tap-highlight-color: transparent;
}

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

/* --- Monat --- */

.gd__kopf {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 14px;
}

.gd__titel {
	margin: 0;
	font-size: 20px;
	letter-spacing: -0.01em;
}

.gd__monat {
	font-family: "Clash Display", "Satoshi", system-ui, sans-serif;
	font-weight: 600;
}

.gd__jahr {
	color: var(--gd-blass);
	font-weight: 500;
}

.gd__pfeile {
	display: flex;
	gap: 4px;
}

.gd__pfeil {
	display: grid;
	place-items: center;
	width: 34px;
	height: 34px;
	padding: 0;
	border: 1px solid var(--gd-linie);
	border-radius: 50%;
	background: transparent;
	transition: background-color 0.15s, border-color 0.15s;
}

.gd__pfeil svg {
	width: 18px;
	height: 18px;
}

.gd__pfeil--vor svg {
	transform: scaleX(-1);
}

.gd__pfeil:hover {
	background: var(--gd-flaeche);
	border-color: var(--gd-flaeche);
}

.gd__raster {
	display: grid;
	grid-template-columns: repeat(7, 1fr);
	row-gap: 2px;
}

.gd__raster[data-richtung="vor"] .gd__tag {
	animation: gd-vor 0.2s ease;
}

.gd__raster[data-richtung="zurueck"] .gd__tag {
	animation: gd-zurueck 0.2s ease;
}

@keyframes gd-vor {

	from {
		opacity: 0;
		transform: translateX(8px);
	}
}

@keyframes gd-zurueck {

	from {
		opacity: 0;
		transform: translateX(-8px);
	}
}

.gd__wt {
	padding-bottom: 8px;
	color: var(--gd-blass);
	font-size: 12px;
	font-weight: 500;
	text-align: center;
}

.gd__tag {
	position: relative;
	justify-self: center;
	width: 38px;
	height: 38px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: transparent;
	font-variant-numeric: tabular-nums;
	font-weight: 500;
	transition: background-color 0.15s, color 0.15s;
}

.gd__tag.is-we {
	color: var(--gd-leise);
}

.gd__tag.is-fremd {
	color: var(--gd-blass);
	opacity: 0.55;
}

.gd__tag.is-leer {
	visibility: hidden;
}

.gd__tag:hover:not(:disabled, .is-gewaehlt) {
	background: var(--gd-flaeche);
}

/* Heute: kleiner oranger Punkt unter der Zahl – ruhig, aber sofort zu finden. */
.gd__tag.is-heute::after {
	content: "";
	position: absolute;
	left: 50%;
	bottom: 5px;
	width: 4px;
	height: 4px;
	margin-left: -2px;
	border-radius: 50%;
	background: var(--gd-orange);
}

.gd__tag.is-heute {
	font-weight: 700;
	color: var(--gd-text);
}

.gd__tag.is-gewaehlt {
	background: var(--gd-orange);
	color: #fff;
	font-weight: 700;
	opacity: 1;
}

.gd__tag.is-gewaehlt::after {
	background: #fff;
}

.gd__tag:disabled {
	color: var(--gd-blass);
	opacity: 0.35;
	cursor: not-allowed;
	text-decoration: line-through;
	text-decoration-thickness: 1px;
}

/* --- Uhrzeit --- */

.gd__zeit {
	display: grid;
	gap: 10px;
}

.gd--datetime-local .gd__zeit {
	margin-top: 14px;
	padding-top: 14px;
	border-top: 1px solid var(--gd-linie);
}

.gd__zeit-kopf {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
}

.gd__zeit-label {
	color: var(--gd-leise);
	font-size: 13px;
	font-weight: 500;
}

.gd__zeit-wert {
	font-family: "Clash Display", "Satoshi", system-ui, sans-serif;
	font-size: 18px;
	font-weight: 600;
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
}

.gd__chips {
	display: grid;
	gap: 4px;
}

.gd__chips--h {
	grid-template-columns: repeat(6, 1fr);
}

.gd__chips--m {
	grid-template-columns: repeat(auto-fill, minmax(44px, 1fr));
}

.gd__chip {
	height: 32px;
	padding: 0;
	border: 0;
	border-radius: 8px;
	background: var(--gd-flaeche);
	font-size: 13px;
	font-weight: 500;
	font-variant-numeric: tabular-nums;
	transition: background-color 0.15s, color 0.15s;
}

.gd__chip.is-nacht:not(.is-gewaehlt) {
	color: var(--gd-blass);
	background: transparent;
}

.gd__chip:hover:not(.is-gewaehlt) {
	background: var(--gd-linie);
}

.gd__chip.is-gewaehlt {
	background: var(--gd-tinte);
	color: #fff;
	font-weight: 700;
}

/* Datum + Uhrzeit: auf breiten Bildschirmen nebeneinander, damit das Blatt nicht zu hoch wird. */
@media (min-width: 640px) {

	.gd--datetime-local {
		display: grid;
		grid-template-columns: 300px 196px;
		column-gap: 20px;
		width: auto;
	}

	.gd--datetime-local .gd__zeit {
		align-content: start;
		margin-top: 0;
		padding: 2px 0 0 20px;
		border-top: 0;
		border-left: 1px solid var(--gd-linie);
	}

	.gd--datetime-local .gd__zeit-kopf {
		min-height: 34px;
		align-items: center;
		margin-bottom: 4px;
	}

	.gd--datetime-local .gd__chips--h,
	.gd--datetime-local .gd__chips--m {
		grid-template-columns: repeat(4, 1fr);
	}

	.gd--datetime-local .gd__chips--m {
		margin-top: 6px;
	}

	.gd--datetime-local .gd__chip {
		height: 30px;
	}

	.gd--datetime-local .gd__fuss {
		grid-column: 1 / -1;
	}
}

/* --- Fuß --- */

.gd__fuss {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin-top: 14px;
	padding-top: 12px;
	border-top: 1px solid var(--gd-linie);
}

.gd__fuss-links {
	display: flex;
	gap: 16px;
}

.gd__link {
	padding: 4px 0;
	border: 0;
	background: none;
	font-weight: 600;
	text-decoration: underline;
	text-decoration-color: var(--gd-orange);
	text-decoration-thickness: 2px;
	text-underline-offset: 4px;
}

.gd__link--leise {
	color: var(--gd-leise) !important;
	text-decoration-color: var(--gd-linie);
}

.gd__link:hover {
	color: var(--gd-orange) !important;
}

.gd__ok {
	min-height: 38px;
	padding: 0 18px;
	border: 0;
	border-radius: 999px;
	background: var(--gd-orange);
	color: #fff !important;
	font-weight: 700;
	transition: background-color 0.15s, opacity 0.15s;
}

.gd__ok:hover:not(:disabled) {
	background: #d94c18;
}

.gd__ok:disabled {
	opacity: 0.4;
	cursor: not-allowed;
}

/* --- Dunkel (Team-Seiten im Dunkelmodus setzen ihre Farben selbst; hier nur, was nicht über Variablen kommt) --- */

:root[data-theme="dark"] .gd__chip.is-gewaehlt {
	background: #f5f5f5;
	color: #121212;
}

@media (prefers-color-scheme: dark) {

	:root:not([data-theme="light"]) .gd__chip.is-gewaehlt {
		background: #f5f5f5;
		color: #121212;
	}
}

/* --- Das Feld selbst: Browser-Symbol durch ein ruhiges Kalender-/Uhr-Zeichen ersetzen --- */

input.gd-feld::-webkit-calendar-picker-indicator {
	width: 18px;
	height: 18px;
	padding: 0;
	margin-left: 6px;
	cursor: pointer;
	opacity: 0.7;
	background: center / 18px no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23858580' stroke-width='1.8' stroke-linecap='round'%3E%3Crect x='3.5' y='5' width='17' height='15.5' rx='2.5'/%3E%3Cpath d='M3.5 10h17M8 3v4M16 3v4'/%3E%3Ccircle cx='16' cy='15' r='1.4' fill='%23f05a22' stroke='none'/%3E%3C/svg%3E");
	transition: opacity 0.15s;
}

input.gd-feld[type="time"]::-webkit-calendar-picker-indicator {
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23858580' stroke-width='1.8' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='8.5'/%3E%3Cpath d='M12 7.5V12l3 2'/%3E%3Ccircle cx='12' cy='12' r='1.4' fill='%23f05a22' stroke='none'/%3E%3C/svg%3E");
}

input.gd-feld:hover::-webkit-calendar-picker-indicator,
input.gd-feld[aria-expanded="true"]::-webkit-calendar-picker-indicator {
	opacity: 1;
}

input.gd-feld:not(:disabled) {
	cursor: pointer;
}

@media (max-width: 380px) {

	.gd {
		padding: 14px 12px 12px;
	}

	.gd__tag {
		width: 34px;
		height: 34px;
	}
}

@media (prefers-reduced-motion: reduce) {

	.gd,
	.gd.is-zu,
	.gd__raster .gd__tag {
		animation: none !important;
	}
}
