/* ==========================================================================
   SW 25 – UI-Bausteine (im Editorial-Look von SW 25)
   1. Button-Hover      – sanftes Moos-/Tannengrün-Aufblühen ab Mausposition
   2. OTP Input         – 6 Ziffernfelder (3 – 3) mit Auto-Submit (data-otp-auto)
   3. Schritt-Führung   – Live-Stepper im Prüffenster & 1-2-3-Liste in konto.php
   4. Smooth Accordion  – Sanftes Auf- und Zuklappen für <details>
   ========================================================================== */

:root {
  --feder: cubic-bezier(.34, 1.56, .64, 1);
  --feder-ruhig: cubic-bezier(.22, 1.25, .36, 1);
}

/* ---------- 1. Button-Hover (sanftes Aufblühen statt altem style.css-Wisch) ---------- */
.knopf,
.btn {
  --btn-hover: var(--moos);
  position: relative;
  isolation: isolate;
  overflow: hidden;
}

.btn--ghost {
  --btn-hover: var(--tanne);
}

.dunkel .knopf,
.zugang__mitglieder .knopf {
  --btn-hover: var(--salbei);
}

.knopf::before,
.btn::before {
  content: "";
  position: absolute;
  inset: auto;
  left: var(--hx, 50%);
  top: var(--hy, 100%);
  width: max(330%, 420px);
  aspect-ratio: 1;
  border-radius: 50%;
  z-index: -1;
  pointer-events: none;
  background: radial-gradient(circle, var(--btn-hover) 70%, transparent 84%);
  opacity: 0;
  transform: translate(-50%, -50%) scale(0);
  transition:
    transform .58s var(--aus),
    opacity .3s ease;
}

.knopf:hover,
.btn:hover {
  background: var(--tanne);
  border-color: var(--moos);
  color: var(--papier);
  box-shadow: 0 8px 20px -12px rgba(19, 34, 25, .52);
}

.btn--ghost:hover {
  background: transparent;
  border-color: var(--tanne);
  color: var(--papier);
  box-shadow: 0 8px 20px -12px rgba(19, 34, 25, .32);
}

.dunkel .knopf:hover,
.zugang__mitglieder .knopf:hover {
  background: var(--papier);
  border-color: var(--salbei);
  color: var(--tanne);
  box-shadow: none;
}

.knopf:hover::before,
.btn:hover::before {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.knopf:disabled:hover::before,
.btn:disabled:hover::before {
  opacity: 0;
  transform: translate(-50%, -50%) scale(0);
}

.knopf svg,
.btn svg {
  transition: transform .34s var(--aus);
}

.knopf:hover svg,
.btn:hover svg {
  transform: translateX(2px);
}

@media (hover: none) {
  .knopf::before,
  .btn::before {
    display: none;
  }
  .knopf:hover,
  .btn:hover {
    background: var(--tanne);
    border-color: var(--tanne);
    color: var(--papier);
    box-shadow: none;
  }
  .btn--ghost:hover {
    background: transparent;
    border-color: var(--linie-stark);
    color: var(--text);
    box-shadow: none;
  }
  .knopf:hover svg,
  .btn:hover svg {
    transform: none;
  }
}

/* ---------- 2. OTP Input (6 Ziffern-Felder, 3 – 3 gruppiert) ---------- */
.sw-otp {
  display: grid;
  gap: 10px;
}

.sw-otp__zeile {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  max-width: 100%;
}

.sw-otp__trenner {
  width: 10px;
  height: 2px;
  border-radius: 2px;
  background: var(--linie-stark);
  margin-inline: 2px;
  flex: none;
}

.sw-otp__box,
.privat .form-card .field input.sw-otp__box {
  width: 48px;
  min-width: 0;
  height: 58px;
  min-height: 58px;
  padding: 0;
  text-align: center;
  font-family: var(--serif);
  font-size: 1.65rem;
  font-weight: 420;
  font-variant-numeric: tabular-nums lining-nums;
  line-height: 1;
  color: var(--tinte);
  background: var(--otp-bg, var(--papier-hell));
  border: 1px solid var(--otp-rand, var(--linie-stark));
  border-radius: var(--radius);
  caret-color: var(--moos);
  box-shadow: var(--otp-schatten, none);
  transition:
    border-color .2s var(--aus),
    box-shadow .2s var(--aus),
    background-color .2s var(--aus),
    transform .28s var(--feder);
}

.sw-otp__box:hover {
  --otp-rand: var(--grau);
}

.sw-otp__box.ist-gefuellt {
  --otp-rand: var(--moos);
  --otp-bg: #fff;
  animation: sw-otp-pop .28s var(--feder);
}

.sw-otp.ist-fertig .sw-otp__box {
  --otp-rand: rgba(63, 106, 58, .65);
  --otp-bg: #E9EEE2;
}

.sw-otp__box:focus,
.sw-otp.ist-fertig .sw-otp__box:focus {
  outline: none;
  --otp-rand: var(--tanne);
  --otp-bg: #fff;
  --otp-schatten: 0 0 0 3px rgba(63, 106, 58, .28);
  transform: translateY(-2px);
}

.sw-otp.hat-fehler .sw-otp__box {
  --otp-rand: var(--fehler);
  --otp-schatten: 0 0 0 3px rgba(155, 58, 46, .14);
}

@keyframes sw-otp-pop {
  0% { transform: scale(.9); }
  55% { transform: scale(1.07); }
  100% { transform: scale(1); }
}

.sw-otp__umschalter {
  justify-self: start;
  background: none;
  border: 0;
  padding: 4px 0;
  font-family: var(--sans);
  font-size: .875rem;
  font-weight: 500;
  color: var(--moos);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
  transition: color .2s var(--aus);
}

.sw-otp__umschalter:hover {
  color: var(--tanne);
}

.sw-otp__status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: .84rem;
  font-weight: 500;
  color: var(--moos);
  opacity: 0;
  transform: translateY(-3px);
  transition: opacity .25s var(--aus), transform .25s var(--aus);
  min-height: 1.2em;
}

.sw-otp.ist-fertig .sw-otp__status {
  opacity: 1;
  transform: none;
}

/* Ausrichtung in .konto-zeile und .form-grid (z. B. konto.php) */
.konto-zeile:has(.sw-otp) {
  align-items: flex-start;
}

.konto-zeile:has(.sw-otp) > .btn {
  margin-top: 35px;
}

@media (max-width: 820px) {
  .form-grid:has(.sw-otp) {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {
  .konto-zeile:has(.sw-otp) > .btn {
    margin-top: 0;
  }
}

@media (max-width: 440px) {
  .sw-otp__zeile { gap: 5px; }
  .sw-otp__box,
  .privat .form-card .field input.sw-otp__box {
    width: 42px;
    height: 52px;
    min-height: 52px;
    font-size: 1.45rem;
  }
  .sw-otp__trenner { width: 7px; margin-inline: 1px; }
}

/* ---------- 3a. Ruhige 1-2-3-Schrittliste für 2FA-Einrichtung (konto.php) ---------- */
ol.schritte {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  counter-reset: schritt;
  display: grid;
  gap: 0;
}

ol.schritte > li {
  counter-increment: schritt;
  position: relative;
  padding: 0 0 24px 48px;
  margin: 0;
}

ol.schritte > li:last-child {
  padding-bottom: 4px;
}

ol.schritte > li:not(:last-child)::after {
  content: "";
  position: absolute;
  left: 15px;
  top: 36px;
  bottom: 4px;
  width: 2px;
  border-radius: 2px;
  background: var(--linie);
}

ol.schritte > li::before {
  content: counter(schritt);
  position: absolute;
  left: 0;
  top: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  border: 1.5px solid var(--linie-stark);
  background: var(--papier-hell);
  color: var(--tanne);
  font-family: var(--sans);
  font-size: .85rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  transition:
    background-color .28s var(--aus),
    border-color .28s var(--aus),
    color .28s var(--aus),
    transform .32s var(--feder);
}

ol.schritte > li:has(.sw-otp):not(:has(.sw-otp:not(.ist-fertig)))::before {
  content: "✓";
  background: var(--moos);
  border-color: var(--moos);
  color: var(--papier);
  transform: scale(1.06);
}

ol.schritte > li > p:first-child {
  margin-top: 3px;
}

ol.schritte > li > form {
  margin-top: 14px;
}

/* ---------- 3b. Rechnungs-Prüffenster: Live-Stepper (vorstandschaft.php) ---------- */
.pruefung__schritte {
  display: flex;
  align-items: center;
  gap: 0;
  margin: 0 0 0 auto;
  padding: 0;
  list-style: none;
  counter-reset: schritt;
  font-size: .875rem;
  font-weight: 500;
  color: var(--grau);
}

.pruefung__schritte li {
  counter-increment: schritt;
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: color .28s var(--aus);
}

.pruefung__schritte li:not(:first-child) {
  padding-left: 34px;
}

.pruefung__schritte li:not(:first-child)::after {
  content: "";
  position: absolute;
  left: 8px;
  top: 50%;
  width: 18px;
  height: 2px;
  border-radius: 2px;
  background: var(--linie);
  transform: translateY(-50%);
  transition: background-color .35s var(--aus);
}

.pruefung__schritte li.erledigt + li::after {
  background: var(--moos);
}

.pruefung__schritte li::before {
  content: counter(schritt);
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1.5px solid var(--linie-stark);
  background: var(--papier-hell);
  color: var(--grau);
  font-size: .8rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  transition:
    background-color .3s var(--aus),
    border-color .3s var(--aus),
    color .3s var(--aus),
    box-shadow .3s var(--aus),
    transform .32s var(--feder);
}

.pruefung__schritte li.erledigt {
  color: var(--moos);
}

.pruefung__schritte li.erledigt::before {
  content: "✓";
  background: var(--moos);
  border-color: var(--moos);
  color: var(--papier);
  transform: scale(1);
}

.pruefung__schritte li[aria-current="step"] {
  color: var(--tinte);
  font-weight: 600;
}

.pruefung__schritte li[aria-current="step"]::before {
  background: var(--tanne);
  border-color: var(--tanne);
  color: var(--papier);
  box-shadow: 0 0 0 4px rgba(19, 34, 25, .14);
  transform: scale(1.06);
}

@media (max-width: 760px) {
  .pruefung__schritte {
    margin: 0;
    flex-wrap: wrap;
    row-gap: 8px;
  }
}

/* ---------- 4. Smooth Accordion (<details> sanft auf- und zuklappen) ---------- */
details.ist-akkordeon {
  overflow: hidden;
}

details.ist-akkordeon > summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 48px;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  transition: color .2s var(--aus);
}

details.ist-akkordeon > summary::-webkit-details-marker {
  display: none;
}

details.ist-akkordeon > summary::marker {
  content: "";
}

.sw-akk__pfeil {
  flex: none;
  width: 20px;
  height: 20px;
  color: var(--grau);
  transition: transform .36s var(--feder-ruhig), color .2s var(--aus);
}

details.ist-akkordeon > summary:hover .sw-akk__pfeil {
  color: var(--tinte);
}

details.ist-akkordeon[open] > summary .sw-akk__pfeil,
details.ist-akkordeon.ist-offen > summary .sw-akk__pfeil {
  transform: rotate(180deg);
  color: var(--tanne);
}

details.ist-akkordeon.schliesst > summary .sw-akk__pfeil {
  transform: rotate(0deg);
}

.sw-akk__inhalt {
  overflow: hidden;
}

.sw-akk__innen {
  display: flow-root;
}

/* Bestehende <details> (.antwort, .antwort-text, .konto-details) harmonisch einbinden */
details.konto-details.ist-akkordeon {
  border-top: 1px solid var(--haar);
  padding-top: 4px;
}

details.konto-details.ist-akkordeon > summary {
  color: var(--fehler);
  font-weight: 500;
}

details.konto-details.ist-akkordeon > summary .sw-akk__pfeil {
  color: var(--fehler);
}

details.konto-details.ist-akkordeon .sw-akk__innen {
  padding-bottom: 6px;
}

details.antwort.ist-akkordeon,
details.antwort.ist-akkordeon[open] {
  padding-bottom: 0;
}

details.antwort.ist-akkordeon .sw-akk__innen {
  padding-bottom: 18px;
}

details.antwort-text.ist-akkordeon {
  margin-top: 6px;
  border-top: 1px solid var(--haar);
}

details.antwort-text.ist-akkordeon .sw-akk__innen {
  padding-bottom: 14px;
}

/* ---------- Barrierefreiheit: Bewegung reduzieren ---------- */
@media (prefers-reduced-motion: reduce) {
  .knopf::before,
  .btn::before {
    display: none;
  }
  .knopf:hover,
  .btn:hover {
    background: var(--moos);
  }
  .btn--ghost:hover {
    background: var(--tanne);
  }
  .dunkel .knopf:hover,
  .zugang__mitglieder .knopf:hover {
    background: var(--salbei);
  }
  .knopf:hover svg,
  .btn:hover svg {
    transform: none;
  }
  .sw-otp__box:focus,
  .sw-otp__box.ist-gefuellt {
    transform: none;
    animation: none;
  }
  .sw-akk__pfeil,
  ol.schritte > li::before,
  .pruefung__schritte li::before,
  .pruefung__schritte li::after {
    transition: none !important;
  }
}
