/*
 * Form controls and small UI pieces (v1), based on the CRM
 * https://design.tanzschule-happyfeet.ch/v1/components.css
 *
 * Needs tokens.css. Every class starts with hf- so it never clashes with an
 * app's own .btn, .tag etc. Markup for each piece is in the style guide.
 *
 *   Buttons      .hf-btn  + -secondary | -danger | -success | -ghost, -s, -icon
 *   Website CTA  .hf-cta  + -accent | -outline, -arrow
 *   Tabs         .hf-tabs, .hf-segmented with .hf-tab items (sliding pill, pure CSS)
 *   Fields       .hf-field (floating label: input, textarea, select), .hf-input, .hf-search
 *   Choices      .hf-checkbox, .hf-radio, .hf-toggle
 *   Feedback     .hf-tag, .hf-alert, .hf-spinner
 *   Misc         .hf-separator
 */

/* ─── Shared focus ring ─────────────────────────────────────────────── */

/* Also set on .hf-inverse panels so the ring uses their flipped colors */
:root,
.hf-inverse {
  --hf-focus-ring: 0 0 0 2px var(--blue-6), 0 0 0 4px var(--blue-1);
}

/* ─── Buttons ───────────────────────────────────────────────────────── */

.hf-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-sizing: border-box;
  padding: 6px 10px;
  border: 1px solid var(--blue-3);
  border-radius: var(--border-radius);
  background: var(--blue-3);
  color: var(--blue-6);
  font: inherit;
  font-size: 0.875rem;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
}

.hf-btn:hover:not(:disabled, [aria-disabled="true"]) {
  background: var(--blue-1);
  border-color: var(--blue-1);
  text-decoration: none;
}

.hf-btn:focus-visible {
  outline: none;
  box-shadow: var(--hf-focus-ring);
}

.hf-btn:disabled,
.hf-btn[aria-disabled="true"] {
  opacity: 0.5;
  cursor: default;
}

/* A link can't be disabled natively: block clicks on aria-disabled links */
a.hf-btn[aria-disabled="true"] {
  pointer-events: none;
}

.hf-btn-secondary {
  background: var(--blue-6);
  color: var(--blue-3);
  border-color: var(--blue-4);
}

.hf-btn-secondary:hover:not(:disabled, [aria-disabled="true"]) {
  background: var(--blue-4);
  border-color: var(--blue-4);
  color: var(--blue-2);
}

.hf-btn-danger {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
}

.hf-btn-danger:hover:not(:disabled, [aria-disabled="true"]) {
  background: color-mix(in srgb, var(--red) 80%, #000);
  border-color: color-mix(in srgb, var(--red) 80%, #000);
}

.hf-btn-success {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}

.hf-btn-success:hover:not(:disabled, [aria-disabled="true"]) {
  background: color-mix(in srgb, var(--green) 80%, #000);
  border-color: color-mix(in srgb, var(--green) 80%, #000);
}

/* Text-only button; add .hf-btn-danger for a quiet delete (the CRM's trash button) */
.hf-btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--blue-2);
}

.hf-btn-ghost:hover:not(:disabled, [aria-disabled="true"]) {
  background: rgba(var(--blue-4-rgb), 0.45);
  border-color: transparent;
  color: var(--blue-1);
}

.hf-btn-ghost.hf-btn-danger {
  color: var(--red);
  font-weight: 700;
}

.hf-btn-ghost.hf-btn-danger:hover:not(:disabled, [aria-disabled="true"]) {
  background: rgba(var(--red-rgb), 0.15);
  color: var(--red);
}

.hf-btn-s {
  padding: 3px 6px;
  font-size: 0.8rem;
}

/* Round icon-only button: give it an aria-label */
.hf-btn-icon {
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 50%;
}

.hf-btn-icon.hf-btn-s {
  width: 22px;
  height: 22px;
}

.hf-btn-icon :is(.hf-icon, .material-symbols-outlined) {
  font-size: 18px;
}

.hf-btn-icon.hf-btn-s :is(.hf-icon, .material-symbols-outlined) {
  font-size: 14px;
}

.hf-btn-block {
  display: flex;
  width: 100%;
}

/* ─── Call to action (website) ──────────────────────────────────────── */
/*
 * The big, eye-catching button for the public site: "Probelektion buchen".
 * Not for the CRM; use .hf-btn there.
 *
 *   <a class="hf-cta hf-cta-arrow" href="/kurse">Jetzt anmelden</a>
 *
 * Variants: (default) dark blue · .hf-cta-accent (#D99A45) · .hf-cta-outline
 * .hf-cta-arrow adds an arrow that slides on hover.
 */

.hf-cta {
  --hf-cta-bg: var(--blue-2);
  --hf-cta-bg-hover: var(--blue-1);
  --hf-cta-fg: var(--blue-6);
  --hf-cta-shadow: 0 8px 20px -8px rgba(24, 35, 47, 0.55);

  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55em;
  box-sizing: border-box;
  padding: 0.7em 1.3em;
  border: 0;
  border-radius: var(--border-radius);
  overflow: hidden;
  background: var(--hf-cta-bg);
  color: var(--hf-cta-fg);
  box-shadow: var(--hf-cta-shadow);
  font-family: var(--font-condensed);
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.1;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

/* Soft light sweep across on hover */
.hf-cta::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, 0.18) 50%, transparent 70%);
  transform: translateX(-100%);
  transition: transform 0.6s ease;
  pointer-events: none;
}

.hf-cta:hover:not(:disabled, [aria-disabled="true"]) {
  background-color: var(--hf-cta-bg-hover);
  transform: translateY(-2px);
  box-shadow: 0 14px 28px -10px rgba(24, 35, 47, 0.6);
  text-decoration: none;
}

.hf-cta:hover:not(:disabled, [aria-disabled="true"])::before {
  transform: translateX(100%);
}

.hf-cta:active:not(:disabled, [aria-disabled="true"]) {
  transform: translateY(0);
  box-shadow: 0 4px 10px -6px rgba(24, 35, 47, 0.6);
}

.hf-cta:focus-visible {
  outline: none;
  box-shadow: var(--hf-cta-shadow), var(--hf-focus-ring);
}

.hf-cta:disabled,
.hf-cta[aria-disabled="true"] {
  opacity: 0.5;
  cursor: default;
  box-shadow: none;
}

a.hf-cta[aria-disabled="true"] {
  pointer-events: none;
}

.hf-cta-accent {
  --hf-cta-bg: var(--accent);
  --hf-cta-bg-hover: color-mix(in srgb, var(--accent) 85%, #000);
  --hf-cta-fg: #18232F;
}

.hf-cta-outline {
  --hf-cta-bg: transparent;
  --hf-cta-bg-hover: var(--blue-1);
  --hf-cta-fg: var(--blue-1);
  --hf-cta-shadow: inset 0 0 0 2px var(--blue-1);
  font-weight: 600;
}

.hf-cta-outline:hover:not(:disabled, [aria-disabled="true"]) {
  color: var(--blue-6);
  box-shadow: inset 0 0 0 2px var(--blue-1), 0 14px 28px -10px rgba(24, 35, 47, 0.45);
}

.hf-cta-outline::before {
  display: none;
}

.hf-cta-arrow::after {
  content: "";
  flex-shrink: 0;
  width: 0.9em;
  height: 0.9em;
  background: currentColor;
  -webkit-mask: url('icons/arrow.svg') center / contain no-repeat;
  mask: url('icons/arrow.svg') center / contain no-repeat;
  transition: transform 0.2s ease;
}

.hf-cta-arrow:hover:not(:disabled, [aria-disabled="true"])::after {
  transform: translateX(5px);
}

/* ─── Tabs and segmented control (sliding pill) ─────────────────────── */
/*
 * The pill behind the selected item is pure CSS: the selected item becomes the
 * anchor (anchor-name) and the container's ::after is positioned on it with
 * anchor(). When the selection moves, the pill slides over. No JS measuring.
 *
 * Mark the selected item with any of:
 *   aria-selected="true" (tabs) · aria-pressed="true" (buttons) · .is-active
 *   or a checked radio inside a label: works without any JS at all.
 *
 *   <div class="hf-tabs" role="tablist">
 *     <button class="hf-tab" role="tab" aria-selected="true">Übersicht</button>
 *     <button class="hf-tab" role="tab" aria-selected="false">Rechnungen</button>
 *   </div>
 *
 *   <div class="hf-segmented">
 *     <label class="hf-tab"><input type="radio" name="view" checked>Tag</label>
 *     <label class="hf-tab"><input type="radio" name="view">Woche</label>
 *   </div>
 *
 * Browsers without anchor positioning get the same look without the slide.
 */

.hf-tabs,
.hf-segmented {
  --hf-pill-bg: var(--blue-2);
  --hf-pill-radius: 6px;
  --hf-pill-speed: 0.28s;
  position: relative;
  isolation: isolate;
  display: inline-flex;
  align-items: stretch;
  max-width: 100%;
  anchor-scope: --hf-pill;
}

.hf-tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 0;
  padding: 0.5rem 1rem;
  border: 0;
  border-radius: var(--hf-pill-radius);
  background: transparent;
  color: var(--blue-2);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  line-height: 1.2;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  user-select: none;
  transition: color var(--hf-pill-speed) ease, opacity var(--transition), background var(--transition);
}

.hf-tab:is([aria-selected="true"], [aria-pressed="true"], .is-active, :has(> input:checked)) {
  anchor-name: --hf-pill;
  color: var(--blue-6);
  font-weight: 600;
}

.hf-tab:not([aria-selected="true"], [aria-pressed="true"], .is-active, :has(> input:checked)):hover {
  opacity: 0.75;
}

.hf-tab:focus-visible,
.hf-tab:has(> input:focus-visible) {
  outline: none;
  box-shadow: var(--hf-focus-ring);
}

.hf-tab:is(:disabled, :has(> input:disabled)) {
  opacity: 0.45;
  cursor: default;
}

/* Radio inside a label: hidden but keyboard-focusable (arrow keys switch) */
.hf-tab > input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  opacity: 0;
  pointer-events: none;
}

/* The pill */
:is(.hf-tabs, .hf-segmented)::after {
  content: "";
  position: absolute;
  z-index: -1;
  position-anchor: --hf-pill;
  top: anchor(top);
  bottom: anchor(bottom);
  left: anchor(left);
  right: anchor(right);
  border-radius: var(--hf-pill-radius);
  background: var(--hf-pill-bg);
  pointer-events: none;
  transition:
    left var(--hf-pill-speed) cubic-bezier(0.3, 0.7, 0.3, 1),
    right var(--hf-pill-speed) cubic-bezier(0.3, 0.7, 0.3, 1),
    top var(--hf-pill-speed) cubic-bezier(0.3, 0.7, 0.3, 1),
    bottom var(--hf-pill-speed) cubic-bezier(0.3, 0.7, 0.3, 1);
}

@supports not (anchor-name: --hf-pill) {
  :is(.hf-tabs, .hf-segmented)::after {
    display: none;
  }

  .hf-tab:is([aria-selected="true"], [aria-pressed="true"], .is-active, :has(> input:checked)) {
    background: var(--hf-pill-bg);
  }
}

@media (prefers-reduced-motion: reduce) {
  :is(.hf-tabs, .hf-segmented) {
    --hf-pill-speed: 0s;
  }
}

/* Tabs: many items scroll sideways without a visible scrollbar */
.hf-tabs {
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
}

.hf-tabs::-webkit-scrollbar {
  display: none;
}

/* Segmented: compact control on a dark track */
.hf-segmented {
  --hf-pill-bg: var(--blue-1);
  padding: 3px;
  border-radius: var(--border-radius);
  background: var(--blue-2);
}

.hf-segmented > .hf-tab {
  padding: 0.35rem 0.85rem;
  color: rgba(var(--blue-6-rgb), 0.8);
  font-weight: 500;
}

.hf-segmented > .hf-tab:is([aria-selected="true"], [aria-pressed="true"], .is-active, :has(> input:checked)) {
  color: var(--blue-6);
  font-weight: 500;
}

.hf-segmented > .hf-tab:focus-visible,
.hf-segmented > .hf-tab:has(> input:focus-visible) {
  box-shadow: 0 0 0 2px var(--blue-6);
}

/* ─── Text inputs ───────────────────────────────────────────────────── */
/*
 * .hf-field: floating label inside the box. It rests in the middle and moves
 * up into the top of the field (smaller) on focus or when filled, with no
 * background of its own, so it works on any surface. Text inputs need
 * placeholder=" " so :placeholder-shown can tell empty from filled. Selects
 * and date inputs always show the floated label.
 *
 * --hf-field-bg (default --blue-6) only matters for browser autofill, whose
 * yellow/blue fill is painted over in that color: set it on a parent with a
 * different background.
 */

.hf-input,
.hf-field > :is(input, textarea, select) {
  display: block;
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding: 8px 10px;
  border: 1px solid var(--blue-3);
  border-radius: 6px;
  background: transparent;
  color: var(--blue-2);
  font: inherit;
  font-size: 0.875rem;
  line-height: 1.2;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.hf-field {
  position: relative;
  display: block;
  width: 100%;
}

/* Room at the top of the box for the floated label */
.hf-field > :is(input, textarea, select) {
  padding: 22px 10px 6px;
}

.hf-field > textarea,
textarea.hf-input {
  min-height: 80px;
  resize: vertical;
}

.hf-input:not([readonly], :disabled):hover,
.hf-field > :is(input, textarea, select):not([readonly], :disabled):hover {
  border-color: var(--blue-1);
}

/* 2px focus border without shifting the layout */
.hf-input:not([readonly]):focus,
.hf-field > :is(input, textarea, select):not([readonly]):focus {
  border-color: var(--blue-1);
  box-shadow: inset 0 0 0 1px var(--blue-1);
}

.hf-input:disabled,
.hf-field > :is(input, textarea, select):disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* Resting: vertically centered in the (single-line) box, aligned with the text */
.hf-field > label {
  position: absolute;
  left: 11px;
  top: 23px;
  transform: translateY(-50%);
  max-width: calc(100% - 22px);
  padding: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--blue-3);
  font-size: 0.8rem;
  line-height: 1.2;
  pointer-events: none;
  transition: top var(--transition), font-size var(--transition), color var(--transition);
}

/* Floated: focused, filled, a date/time field or a select. Sits in the top
   padding of the box, above the text, so it needs no background. */
.hf-field > :is(input, textarea):focus + label,
.hf-field > :is(input, textarea):not(:placeholder-shown) + label,
.hf-field > input:is([type="date"], [type="time"], [type="datetime-local"], [type="month"]) + label,
.hf-field > select + label {
  top: 13px;
  font-size: 0.7rem;
}

.hf-field > select + label {
  max-width: calc(100% - 46px);
}

.hf-field > :is(input, textarea, select):not([readonly]):focus + label {
  color: var(--blue-1);
  font-weight: 600;
}

/* Hide the placeholder itself; the label does its job */
.hf-field > :is(input, textarea)::placeholder {
  color: transparent;
}

.hf-input::placeholder {
  color: var(--blue-3);
  opacity: 0.8;
}

/* Browser autofill paints its own background; cover it with the field background */
.hf-input:autofill,
.hf-field > input:autofill {
  box-shadow: inset 0 0 0 1000px var(--hf-field-bg, var(--blue-6));
  -webkit-text-fill-color: var(--blue-2);
  caret-color: var(--blue-2);
}

.hf-input:autofill:not([readonly]):focus,
.hf-field > input:autofill:not([readonly]):focus {
  box-shadow: inset 0 0 0 1px var(--blue-1), inset 0 0 0 1000px var(--hf-field-bg, var(--blue-6));
}

/* Select: custom chevron that follows the theme */
.hf-field > select {
  appearance: none;
  padding-right: 36px;
  cursor: pointer;
}

.hf-field > select option {
  background: var(--blue-6);
  color: var(--blue-1);
}

.hf-field:has(> select)::after {
  content: "";
  position: absolute;
  right: 12px;
  top: 23px;
  width: 12px;
  height: 8px;
  transform: translateY(-50%);
  background: var(--blue-2);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%23000' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%23000' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
  pointer-events: none;
}

/* Help / error text under a field */
.hf-field-hint {
  display: block;
  margin-top: 4px;
  padding-left: 10px;
  font-size: 0.75rem;
  color: var(--blue-3);
}

/* Error state: aria-invalid="true" on the input (or .is-invalid on .hf-field) */
.hf-input[aria-invalid="true"],
.hf-field > [aria-invalid="true"],
.hf-field.is-invalid > :is(input, textarea, select) {
  border-color: var(--red);
}

.hf-input[aria-invalid="true"]:focus,
.hf-field > [aria-invalid="true"]:focus,
.hf-field.is-invalid > :is(input, textarea, select):focus {
  border-color: var(--red);
  box-shadow: inset 0 0 0 1px var(--red);
}

.hf-field > [aria-invalid="true"] + label,
.hf-field.is-invalid > label,
.hf-field:has(> [aria-invalid="true"]) > .hf-field-hint,
.hf-field.is-invalid > .hf-field-hint {
  color: var(--red);
}

/* Search: underline only (CRM table search) */
.hf-search {
  display: inline-block;
  box-sizing: border-box;
  width: auto;
  min-width: 240px;
  padding: 6px 2px;
  border: 0;
  border-bottom: 1px solid var(--blue-2);
  border-radius: 0;
  background: none;
  color: var(--blue-2);
  font: inherit;
  font-size: 0.875rem;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.hf-search:focus {
  border-bottom-color: var(--blue-1);
  box-shadow: 0 1px 0 var(--blue-1);
}

.hf-search::placeholder {
  color: var(--blue-3);
}

/* ─── Checkbox, radio, toggle ───────────────────────────────────────── */
/*
 * All three: a real <input> inside a <label>, visually hidden but focusable,
 * with a drawn box/track right after it.
 *
 *   <label class="hf-checkbox">
 *     <input type="checkbox"><span class="hf-checkbox-box" aria-hidden="true"></span>
 *     Label text
 *   </label>
 */

.hf-checkbox,
.hf-radio,
.hf-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--blue-2);
  font-size: 0.875rem;
  line-height: 1.3;
  cursor: pointer;
  user-select: none;
  align-self: flex-start;
  justify-self: start;
}

.hf-checkbox > input,
.hf-radio > input,
.hf-toggle > input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  padding: 0;
  border: 0;
  opacity: 0;
  pointer-events: none;
}

.hf-checkbox:has(> input:disabled),
.hf-radio:has(> input:disabled),
.hf-toggle:has(> input:disabled) {
  opacity: 0.5;
  cursor: default;
}

/* Round checkbox with a check mark */
.hf-checkbox-box,
.hf-radio-dot {
  position: relative;
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border: 1px solid var(--blue-3);
  border-radius: 50%;
  background: var(--blue-6);
  transition: background var(--transition), box-shadow var(--transition), border-color var(--transition);
}

.hf-checkbox-box::after {
  content: "";
  position: absolute;
  left: 7px;
  top: 3px;
  width: 5px;
  height: 10px;
  border: solid var(--blue-6);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
  opacity: 0;
  transition: opacity var(--transition);
}

.hf-checkbox > input:checked + .hf-checkbox-box {
  background: var(--blue-3);
}

.hf-checkbox > input:checked + .hf-checkbox-box::after {
  opacity: 1;
}

/* Indeterminate (set input.indeterminate = true in JS) */
.hf-checkbox > input:indeterminate + .hf-checkbox-box {
  background: var(--blue-3);
}

.hf-checkbox > input:indeterminate + .hf-checkbox-box::after {
  left: 5px;
  top: 9px;
  width: 10px;
  height: 0;
  border-width: 0 0 2px 0;
  transform: none;
  opacity: 1;
}

/* Radio: filled dot */
.hf-radio-dot::after {
  content: "";
  position: absolute;
  inset: 5px;
  border-radius: 50%;
  background: var(--blue-6);
  transform: scale(0);
  transition: transform var(--transition);
}

.hf-radio > input:checked + .hf-radio-dot {
  background: var(--blue-3);
}

.hf-radio > input:checked + .hf-radio-dot::after {
  transform: scale(1);
}

.hf-checkbox:not(:has(> input:disabled)):hover .hf-checkbox-box,
.hf-radio:not(:has(> input:disabled)):hover .hf-radio-dot {
  border-color: var(--blue-1);
  box-shadow: 0 0 0 3px rgba(var(--blue-2-rgb), 0.15);
}

.hf-checkbox > input:focus-visible + .hf-checkbox-box,
.hf-radio > input:focus-visible + .hf-radio-dot {
  box-shadow: var(--hf-focus-ring);
}

/* Small variant */
/* 13px / 15px: whole pixels, so Expo Sans caps sit exactly on the circle's center
   (0.8rem with line-height 1.3 put them ~1px off) */
.hf-checkbox.hf-s,
.hf-radio.hf-s {
  font-size: 0.8125rem;
  line-height: 15px;
  gap: 6px;
}

.hf-s > .hf-checkbox-box,
.hf-s > .hf-radio-dot {
  width: 16px;
  height: 16px;
}

.hf-s > .hf-checkbox-box::after {
  left: 5px;
  top: 2px;
  width: 4px;
  height: 8px;
}

.hf-s > .hf-radio-dot::after {
  inset: 4px;
}

.hf-s > input:indeterminate + .hf-checkbox-box::after {
  left: 3px;
  top: 6px;
  width: 8px;
}

/* Toggle (slide switch). Put role="switch" on the checkbox. */
.hf-toggle-track {
  position: relative;
  flex-shrink: 0;
  width: 34px;
  height: 20px;
  border-radius: 999px;
  background: var(--blue-4);
  transition: background var(--transition), box-shadow var(--transition);
}

.hf-toggle-track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--blue-6);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  transition: transform var(--transition);
}

.hf-toggle > input:checked + .hf-toggle-track {
  background: var(--blue-2);
}

.hf-toggle > input:checked + .hf-toggle-track::after {
  transform: translateX(14px);
}

.hf-toggle:not(:has(> input:disabled)):hover .hf-toggle-track {
  box-shadow: 0 0 0 3px rgba(var(--blue-2-rgb), 0.15);
}

.hf-toggle > input:focus-visible + .hf-toggle-track {
  box-shadow: var(--hf-focus-ring);
}

/* Group several choices: <div class="hf-choices"> … </div> */
.hf-choices {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}

.hf-choices.hf-row {
  flex-direction: row;
  flex-wrap: wrap;
  gap: 8px 18px;
}

/* ─── Tags ──────────────────────────────────────────────────────────── */

.hf-tag {
  display: inline-block;
  padding: 1px 6px;
  border-radius: var(--border-radius);
  background: var(--blue-3);
  color: var(--blue-6);
  font-size: 0.8rem;
  line-height: 1.4;
  white-space: nowrap;
}

.hf-tag-light {
  background: var(--blue-4);
  color: var(--blue-1);
}

.hf-tag-warning {
  background: var(--accent);
  color: #18232F;
}

.hf-tag-danger {
  background: var(--red);
  color: #fff;
}

.hf-tag-success {
  background: var(--green);
  color: #fff;
}

/* ─── Alerts ────────────────────────────────────────────────────────── */
/*
 *   <div class="hf-alert hf-alert-success" role="status">
 *     <p>Gespeichert.</p>
 *     <button class="hf-alert-close" aria-label="Schliessen">×</button>
 *   </div>
 */

.hf-alert {
  --hf-alert-color: var(--blue-2);
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: start;
  gap: 6px 10px;
  padding: 12px 16px;
  border: 1px solid rgba(var(--blue-4-rgb), 0.8);
  border-left: 4px solid var(--hf-alert-color);
  border-radius: var(--border-radius);
  background: color-mix(in srgb, var(--hf-alert-color) 8%, var(--blue-6));
  color: var(--blue-1);
  font-size: 0.9rem;
  line-height: 1.35;
}

.hf-alert > :only-child {
  grid-column: 1 / -1;
}

.hf-alert-success { --hf-alert-color: var(--green); }
.hf-alert-error   { --hf-alert-color: var(--red); }
.hf-alert-warning { --hf-alert-color: var(--accent); }

.hf-alert-close {
  border: 0;
  background: transparent;
  color: inherit;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  opacity: 0.6;
}

.hf-alert-close:hover {
  opacity: 1;
}

/* Floating variant for toasts */
.hf-alert-toast {
  width: min(320px, calc(100vw - 32px));
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  animation: hf-toast-in 0.16s ease-out;
}

@keyframes hf-toast-in {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ─── Spinner ───────────────────────────────────────────────────────── */

.hf-spinner {
  display: inline-block;
  flex-shrink: 0;
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  vertical-align: middle;
  animation: hf-spin 0.6s linear infinite;
}

.hf-spinner-lg {
  width: 36px;
  height: 36px;
  border-width: 3px;
}

@keyframes hf-spin {
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .hf-spinner { animation-duration: 1.5s; }
  .hf-alert-toast { animation: none; }
}

/* ─── Separator ─────────────────────────────────────────────────────── */

.hf-separator {
  width: 100%;
  height: 0;
  margin: 10px 0;
  border: 0;
  border-top: 1px solid var(--blue-3);
}
