/*
 * add-to-calendar-button - Styles fuer den Shadow Root
 * ----------------------------------------------------
 * Die Library (Resources/Public/JavaScript/calendar-button.js) rendert Button
 * und Auswahlliste in einem Shadow Root. app.min.css kommt dort nicht hinein,
 * Selektoren wie ".atcb-button" greifen von aussen also nie.
 *
 * Der einzige vorgesehene Weg ist buttonStyle="custom" + customCss: die Library
 * haengt genau diese Datei als <link> in den Shadow Root. Sie liefert dann aber
 * KEIN eigenes CSS mehr mit - auch nicht das strukturelle. Deshalb stehen hier
 * Regeln, die nicht nach Design aussehen, aber zwingend sind:
 *
 *   .atcb-list-wrapper { position: absolute }  sonst laeuft die Auswahlliste im
 *                                              Textfluss mit
 *   #atcb-bgoverlay    { position: fixed }     sonst schiebt die Klick-Flaeche
 *                                              zum Schliessen (per JS auf
 *                                              Viewport-Groesse gesetzt) den
 *                                              halben Seiteninhalt nach unten
 *
 * Die Datei liegt als fertiges CSS unter Resources/Public, weil der Gulp-Build
 * ausschliesslich Resources/Private/Baseframe/Styles/app.scss zu app.min.css
 * kompiliert. Werte sind aus den SCSS-Settings gespiegelt:
 *   $color-gray-50 #F1F1F1, $color-gray-75 #E7E7E7, $color-white #FFFFFF,
 *   $color-black #000000, $primary-font-family Poppins,
 *   .p3-medium 13px / ab md (1200px) 14px, 140%, Weight 500.
 * Die @font-face-Regeln aus dem Dokument gelten auch im Shadow Root, Poppins
 * muss hier also nicht erneut deklariert werden.
 */

:host {
	width: max-content;
}

.atcb-initialized {
	font-family: Poppins, sans-serif;
}

.atcb-button-wrapper {
	display: block;
	margin: 0;
	padding: 0;
}

/* Trigger: Pill laut Figma - Hoehe 24, Radius 24, Padding 2px 8px, Gap 8px */
.atcb-button {
	position: relative;
	z-index: 1;
	box-sizing: border-box;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	width: max-content;
	max-width: 100%;
	margin: 0;
	padding: 2px 8px;
	border: 0;
	border-radius: 24px;
	background-color: #f1f1f1;
	color: #000;
	font-family: inherit;
	font-size: 13px;
	font-weight: 500;
	line-height: 140%;
	text-align: left;
	text-decoration: none;
	cursor: pointer;
	appearance: none;
	touch-action: manipulation;
	user-select: none;
	-webkit-user-select: none;
	-webkit-tap-highlight-color: transparent;
}

.atcb-button:hover,
.atcb-button.atcb-active {
	background-color: #e7e7e7;
	color: #000;
}

/* delegatesFocus: der Fokus landet am Host, nicht immer am Button selbst */
.atcb-button:focus-visible,
:host(:focus-visible) .atcb-button {
	outline: 2px solid #000;
	outline-offset: 2px;
}

/* Bei offener Liste ueber das Klick-Overlay heben, damit der zweite Klick
   auf den Button die Liste wieder schliesst */
.atcb-button.atcb-active {
	z-index: 15000000;
}

.atcb-text {
	overflow-wrap: anywhere;
}

/* Unsichtbarer Anker am unteren Buttonrand: daran richtet die Library die
   Liste aus (Breite und Position werden per Inline-Style gesetzt) */
.atcb-dropdown-anchor {
	position: absolute;
	bottom: 0;
	left: 0;
	width: 100%;
	height: 0;
	opacity: 0;
}

/* Auswahlliste als Dropdown */
.atcb-list-wrapper {
	position: absolute;
	z-index: 14000090;
	box-sizing: border-box;
	padding: 4px 0 0;
}

.atcb-list-wrapper.atcb-dropup {
	padding: 0 0 4px;
}

.atcb-list {
	position: relative;
	display: block;
	box-sizing: border-box;
	min-width: 100%;
	width: fit-content;
	overflow: hidden;
	border: 1px solid #f1f1f1;
	border-radius: 12px;
	background-color: #fff;
	box-shadow: 0 4px 16px rgb(0 0 0 / 16%);
	color: #000;
	font-family: inherit;
	font-size: 13px;
	line-height: 140%;
	user-select: none;
	-webkit-user-select: none;
}

.atcb-list-item {
	box-sizing: border-box;
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 8px 12px;
	background-color: transparent;
	color: inherit;
	font-weight: 500;
	text-align: left;
	cursor: pointer;
	touch-action: manipulation;
	-webkit-tap-highlight-color: transparent;
}

.atcb-list-item + .atcb-list-item {
	border-top: 1px solid #f1f1f1;
}

.atcb-list-item:hover,
.atcb-list-item:focus-visible {
	background-color: #f1f1f1;
	color: #000;
	outline: 0;
}

/* Transparente Klick-Flaeche zum Schliessen */
#atcb-bgoverlay {
	position: fixed;
	inset: 0;
	z-index: 14000000;
	box-sizing: border-box;
	display: block;
	border: 0;
	background-color: transparent;
	cursor: default;
}

@media screen and (min-width: 1200px) {
	.atcb-button,
	.atcb-list {
		font-size: 14px;
	}
}
