/* Wiederverwendbare Bausteine — Karten, Buttons, Formulare, Badges, Stepper. */

/* Sicherheitsnetz: jedes Icon hat eine Standardgröße; Kontexte übersteuern gezielt. */
.icon { width: 18px; height: 18px; flex-shrink: 0; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 22px;
}
.card--hover { transition: border-color var(--t-fast), transform var(--t-fast); }
.card--hover:hover { border-color: var(--line-strong); }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 18px; border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: var(--surface-2); color: var(--ink);
  cursor: pointer; font-weight: 600; text-decoration: none;
  transition: background var(--t-fast), border-color var(--t-fast);
}
.btn:hover { background: var(--surface-3); }
.btn--primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn--primary:hover { background: #e8e8ea; }
.btn--danger { color: var(--danger); border-color: var(--danger); background: transparent; }
.btn--ghost { background: transparent; border-color: transparent; color: var(--ink-muted); }
.btn--ghost:hover { color: var(--ink); background: var(--surface-2); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn .icon { width: 16px; height: 16px; }

.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; font-weight: 650; margin-bottom: 6px; }
/* Pflichtfeld-Stern (Konvention: jedes Pflichtfeld trägt <span class="req">*</span>) */
.req { color: var(--danger); font-weight: 700; }
.hint-inline { color: var(--ink-faint); font-weight: 500; font-size: 12px; }
.field .hint { font-size: 12.5px; color: var(--ink-muted); margin-top: 5px; }
.input, textarea.input, select.input {
  width: 100%; padding: 10px 14px;
  background: var(--surface-2); border: 1px solid var(--line-strong);
  border-radius: 10px; color: var(--ink);
  transition: border-color var(--t-fast);
}
.input:focus { border-color: var(--ink-muted); outline: none; }
.input::placeholder { color: var(--ink-faint); }

.badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11.5px; font-weight: 700; letter-spacing: .04em;
  padding: 3px 10px; border-radius: 99px;
  border: 1px solid var(--line-strong); color: var(--ink-muted);
  text-transform: uppercase;
}
.badge--ok { color: var(--ok); border-color: var(--ok); background: var(--ok-bg); }
.badge--warn { color: var(--warn); border-color: var(--warn); background: var(--warn-bg); }
.badge--danger { color: var(--danger); border-color: var(--danger); background: var(--danger-bg); }

/* Stepper (Setup-Wizard, TicketPilot-Muster) */
.stepper { display: flex; align-items: flex-start; margin: 0 0 28px; }
.stepper .step { display: flex; flex-direction: column; align-items: center; gap: 8px; min-width: 64px; }
.stepper .dot {
  width: 44px; height: 44px; border-radius: 50%;
  border: 1px solid var(--line-strong); background: var(--surface);
  display: grid; place-items: center; transition: border-color var(--t);
}
.stepper .dot .icon { width: 18px; height: 18px; stroke: var(--ink-muted); }
.stepper .step.is-active .dot { border-color: var(--ink); }
.stepper .step.is-active .dot .icon { stroke: var(--ink); }
.stepper .step.is-done .dot { background: var(--surface-3); }
.stepper .label { font-size: 12.5px; color: var(--ink-muted); }
.stepper .step.is-active .label { color: var(--ink); font-weight: 650; }
.stepper .bar { flex: 1; height: 1px; background: var(--line-strong); margin-top: 22px; }

/* Auswahlkarten (Radio-Karten) */
.choice { position: relative; display: flex; gap: 14px; align-items: flex-start;
  padding: 18px 20px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); cursor: pointer; transition: border-color var(--t-fast); }
.choice:hover { border-color: var(--line-strong); }
.choice.is-selected { border-color: var(--ink); }
.choice .icon-box { width: 40px; height: 40px; border-radius: 10px; background: var(--surface-3);
  display: grid; place-items: center; flex-shrink: 0; }
.choice .icon-box .icon { width: 18px; height: 18px; }
.choice .check { position: absolute; top: 16px; right: 16px; width: 22px; height: 22px;
  border-radius: 50%; border: 1px solid var(--line-strong); display: grid; place-items: center; }
.choice.is-selected .check { background: var(--ink); border-color: var(--ink); }
.choice.is-selected .check .icon { width: 12px; height: 12px; stroke: var(--accent-ink); }

/* Toast + Modal */
.toast { position: fixed; bottom: 24px; left: 50%; translate: -50% 0; z-index: 90;
  background: var(--surface-3); border: 1px solid var(--line-strong);
  padding: 10px 18px; border-radius: 10px; box-shadow: var(--shadow); font-size: 14px; }
/* Backdrop scrollt, Karte zentriert per margin — hohe Modale bleiben auch auf
   kleinen Displays vollständig erreichbar (grid+place-items würde oben abschneiden). */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 80;
  display: flex; overflow: auto; padding: 20px; }
.modal { margin: auto; width: min(520px, 100%); min-width: 0;
  max-height: calc(100dvh - 40px); overflow: auto;
  background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: var(--radius-l); padding: 24px; box-shadow: var(--shadow); }

/* Upload-Zone (Link · Drag&Drop · Paste · Dateidialog) */
.dropzone { border: 1.5px dashed var(--line-strong); border-radius: var(--radius);
  padding: 26px; text-align: center; color: var(--ink-muted); cursor: pointer;
  transition: border-color var(--t-fast), background var(--t-fast); }
.dropzone.is-over, .dropzone:hover { border-color: var(--info); color: var(--ink); background: var(--surface-2); }
.dropzone .icon { width: 20px; height: 20px; margin: 0 auto 8px; }

/* Kopierbare Wert-Zeile */
.copy-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 14px; background: var(--surface-2); border: 1px solid var(--line-strong);
  border-radius: 10px; margin: 10px 0; }
.copy-row__label { font-size: 12.5px; color: var(--ink-muted); }
.copy-row code { font-size: 14px; }
.copy-row .btn { margin-left: auto; padding: 5px 12px; font-size: 13px; }

/* Premium-Sperre */
.premium-gate { text-align: center; padding: 60px 24px; }
.premium-gate .crown { width: 64px; height: 64px; margin: 0 auto 20px; border-radius: 16px;
  background: var(--warn-bg); display: grid; place-items: center; }
.premium-gate .crown .icon { width: 28px; height: 28px; stroke: var(--warn); }

/* ---------- Versions-Hinweis (version-watch.js) ---------- */
.ver-bar {
  position: fixed; z-index: 88; bottom: 16px; left: 50%; translate: -50% 0;
  width: min(560px, calc(100vw - 32px));
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 12px 14px; background: var(--surface-2);
  border: 1px solid var(--line-strong); border-radius: var(--radius);
  box-shadow: var(--shadow); animation: ver-up .3s ease both;
}
.ver-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); flex-shrink: 0; }
.ver-txt { flex: 1 1 180px; min-width: 0; display: flex; flex-direction: column; font-size: 14px; }
.ver-txt strong { overflow-wrap: anywhere; }
.ver-txt .muted { font-size: 12.5px; line-height: 1.4; overflow-wrap: anywhere; }
.ver-bar .btn { padding: 7px 14px; font-size: 13.5px; }
.ver-bar .ver-x { padding: 7px; }
@keyframes ver-up { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@media (max-width: 480px) {
  .ver-bar { gap: 8px; }
  .ver-txt { flex-basis: 100%; }
  .ver-bar .btn:not(.ver-x) { flex: 1; justify-content: center; }
}
@media (prefers-reduced-motion: reduce) { .ver-bar { animation: none; } }

/* ---------- Bug-Report ---------- */
.bug-fab { position: fixed; bottom: 22px; right: 22px; z-index: 60; width: 46px; height: 46px;
  border-radius: 50%; border: 1px solid var(--line-strong); background: var(--surface-2);
  color: var(--ink-muted); display: grid; place-items: center; cursor: pointer;
  box-shadow: var(--shadow); transition: color var(--t-fast), border-color var(--t-fast); }
.bug-fab:hover { color: var(--ink); border-color: var(--ink-muted); }

.bug-form { position: fixed; bottom: 80px; right: 22px; z-index: 61;
  width: min(420px, calc(100vw - 32px)); max-height: min(78dvh, 720px);
  display: flex; flex-direction: column; padding: 0; box-shadow: var(--shadow); }
@media (max-width: 560px) {
  .bug-form { right: 16px; left: 16px; width: auto; bottom: 76px; max-height: 80dvh; }
}
.bug-head { display: flex; align-items: center; gap: 10px; padding: 16px 18px;
  border-bottom: 1px solid var(--line); }
.bug-head h3 { margin: 0; flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; font-size: 16px; }
.bug-x { padding: 5px; }
.bug-body { padding: 16px 18px; overflow-y: auto; flex: 1; min-height: 0; }
.bug-body .field:last-of-type { margin-bottom: 10px; }
.bug-body textarea.input { resize: vertical; min-height: 74px; }
.bug-foot { display: flex; gap: 8px; justify-content: flex-end; padding: 12px 18px;
  border-top: 1px solid var(--line); flex-wrap: wrap; }

.bug-meta { display: flex; flex-direction: column; gap: 3px; font-size: 12px;
  color: var(--ink-faint); background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 12px; overflow-wrap: anywhere; }
.bug-meta .k { color: var(--ink-muted); font-weight: 650; display: inline-flex; align-items: center; gap: 6px; }

.bug-shots { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.bug-shot { position: relative; width: 72px; height: 72px; border-radius: 8px;
  overflow: hidden; border: 1px solid var(--line-strong); flex-shrink: 0; }
.bug-shot img { width: 100%; height: 100%; object-fit: cover; }
.bug-shot .btn { position: absolute; top: 2px; right: 2px; padding: 2px;
  background: rgba(0,0,0,.65); border-radius: 6px; }
.bug-shot .icon { width: 12px; height: 12px; }

/* ---------- Halte-Button (3 Sekunden halten) ---------- */
.hold-btn { position: relative; overflow: hidden; user-select: none; touch-action: none;
  background-image: linear-gradient(var(--danger), var(--danger));
  background-repeat: no-repeat; background-size: 0% 100%; background-position: left center; }
/* Höhere Spezifität als `.btn .icon` — Mülleimer soll klar erkennbar sein */
.btn.hold-btn { padding: 7px 12px; min-height: 38px; }
/* Fest definierte Größe — unabhängig von Kaskade und Kontext */
.icon--del, .btn .icon--del, .btn.hold-btn .icon--del {
  width: 19px; height: 19px; stroke-width: 2; }
/* Greift unabhaengig davon, ob wireHold die Klasse schon gesetzt hat */
[data-hold] .icon, .hold-btn .icon { width: 19px; height: 19px; stroke-width: 2; }
/* WICHTIG: `overflow: hidden` (für die Füllanimation) setzt die automatische
   Mindestbreite eines Flex-Elements auf 0 — daneben stehende `.input`-Felder
   (width: 100%) quetschen den Button sonst zusammen und schneiden das Icon ab. */
[data-hold], .hold-btn { flex-shrink: 0; min-height: 38px; min-width: fit-content; }
.hold-btn.is-holding { background-size: 100% 100%; transition: background-size 1.5s linear;
  color: #fff; border-color: var(--danger); animation: hold-wobble .32s ease-in-out infinite; }
.hold-btn.is-holding .icon { color: #fff; }
.hold-btn.shake { background-size: 100% 100%; color: #fff; animation: hold-shake .4s ease; }
.hold-btn.shake .icon { color: #fff; }
@keyframes hold-wobble {
  0%, 100% { rotate: -2.5deg; translate: -1px 0; }
  50% { rotate: 2.5deg; translate: 1px 0; }
}
@keyframes hold-shake {
  10%, 90% { translate: -1px 0; } 20%, 80% { translate: 2px 0; }
  30%, 50%, 70% { translate: -4px 0; } 40%, 60% { translate: 4px 0; }
}
@media (prefers-reduced-motion: reduce) { .hold-btn.is-holding { animation: none; } }

/* ---------- Rückgängig-Fenster ---------- */
.undo-toast { position: fixed; bottom: 22px; right: 22px; z-index: 95;
  display: flex; align-items: center; gap: 12px; max-width: min(380px, calc(100vw - 32px));
  padding: 12px 14px; border-radius: 12px; box-shadow: var(--shadow);
  background: var(--surface-3); border: 1px solid var(--line-strong);
  animation: undo-in .22s ease; }
@keyframes undo-in { from { opacity: 0; translate: 0 12px; } to { opacity: 1; translate: 0 0; } }
.undo-text { flex: 1; min-width: 0; font-size: 14px; overflow-wrap: anywhere; }
.undo-btn { padding: 5px 10px; font-size: 13px; flex-shrink: 0; color: var(--ink); }
.undo-ring { width: 18px; height: 18px; border-radius: 50%; flex-shrink: 0;
  background: conic-gradient(var(--danger) var(--p, 0turn), var(--line-strong) 0);
  animation: undo-ring 5s linear forwards; }
@keyframes undo-ring { from { --p: 1turn; } to { --p: 0turn; } }
@property --p { syntax: '<angle>'; inherits: false; initial-value: 0turn; }
@media (max-width: 480px) { .undo-toast { left: 16px; right: 16px; max-width: none; bottom: 78px; } }
@media (prefers-reduced-motion: reduce) { .undo-ring, .undo-toast, .hold-btn.shake { animation: none; } }
