/* ══════════════════════════════════════════════
   LEGIO — Components
   Buttons, Cards, Badges, Inputs, Toasts
   ══════════════════════════════════════════════ */

/* ── Buttons (1.C — Soft mit Tiefe) ── */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  background: var(--accent);
  color: var(--text-inverse);
  padding: 9px 18px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  border: none;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(26,25,22,0.08);
  transition: background 0.15s, box-shadow 0.15s;
}
.btn-primary:hover {
  background: var(--accent-hover);
  box-shadow: 0 2px 4px rgba(26,25,22,0.12);
}
.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  background: var(--bg-subtle);
  color: var(--text-primary);
  border: 0;
  padding: 9px 18px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-secondary:hover {
  background: var(--bg-muted);
}

.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 9px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-ghost:hover {
  background: var(--bg-subtle);
  color: var(--text-primary);
}

.btn-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  background: #DC2626;
  color: var(--text-inverse);
  border: 0;
  padding: 9px 18px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(220,38,38,0.16);
  transition: background 0.15s, box-shadow 0.15s;
}
.btn-danger:hover {
  background: #B91C1C;
  box-shadow: 0 2px 4px rgba(220,38,38,0.20);
}

/* Full width variant */
.btn-full {
  width: 100%;
}

/* ── Inputs ── */
.input {
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 9px 14px;
  font-family: var(--font-ui);
  font-size: 14px;
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}
.input::placeholder {
  color: var(--text-muted);
}

/* ── Form Groups ── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.form-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
}

/* ── Floating-Label-Inputs (12.B) ──
   Verwendung:
     <div class="input-float">
       <input class="input" type="text" placeholder=" " id="firma">
       <label for="firma">Firma</label>
     </div>
   Wichtig: placeholder=" " (mit Leerzeichen) — sonst funktioniert :placeholder-shown nicht.
*/
.input-float {
  position: relative;
  padding-top: 8px;
}

.input-float .input {
  padding: 14px 14px 8px;
  font-size: 14px;
}

.input-float label {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 400;
  color: var(--text-muted);
  pointer-events: none;
  transition: all 0.18s ease;
  background: var(--bg-surface);
  padding: 0 4px;
}

.input-float .input:focus + label,
.input-float .input:not(:placeholder-shown) + label {
  top: 8px;
  transform: translateY(0);
  font-size: 11px;
  color: var(--text-primary);
  font-weight: 500;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

/* ── Cards (8.B — Borderless + Deep Shadow) ── */
.card {
  background: var(--bg-surface);
  border: 0;
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: var(--space-6);
}

/* ── Badges (29.H Notion-Style — Dot + Text auf grau) ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.04);
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}
.badge::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-muted);
  flex-shrink: 0;
}

/* ── Toast (16.B — Bottom-Right Card) ── */
.toast-container {
  position: fixed;
  bottom: var(--space-6);
  right: var(--space-6);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--space-2);
  pointer-events: none;
}

.toast {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  background: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border);
  padding: 12px 18px;
  border-radius: var(--radius-md);
  font-size: 13.5px;
  font-weight: 500;
  pointer-events: auto;
  box-shadow: var(--shadow-card);
  animation: toastInRight 0.28s cubic-bezier(0.32, 0.72, 0, 1), toastOutRight 0.22s ease 2.6s forwards;
  max-width: 380px;
}

.toast-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.toast--success .toast-icon { color: #15803D; }
.toast--warning .toast-icon { color: #D97706; }
.toast--error .toast-icon   { color: #DC2626; }

@keyframes toastInRight {
  from { opacity: 0; transform: translateX(40px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes toastOutRight {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(8px); }
}

/* ── Dropdown-Menü (17.B — Rich-Items mit Beschreibung) ──
   Verwendung:
     <div class="dropdown" data-dropdown>
       <button class="dropdown-trigger">Verwalten <svg>chevron</svg></button>
       <div class="dropdown-menu">
         <a class="dropdown-item">
           <div class="dropdown-item-title"><svg>icon</svg> Vertrag pausieren</div>
           <div class="dropdown-item-desc">Ruhezeit für 1–6 Monate</div>
         </a>
       </div>
     </div>
   JS: open/close-Toggle + Outside-Click. */
.dropdown { position: relative; display: inline-block; }
.dropdown-trigger {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border);
  padding: 8px 14px;
  border-radius: var(--radius-md);
  font: 500 13px/1 var(--font-ui);
  cursor: pointer;
}
.dropdown-trigger:hover { background: var(--bg-subtle); }
.dropdown-trigger svg.chevron {
  width: 12px; height: 12px;
  transition: transform 0.18s;
}
.dropdown.open .dropdown-trigger svg.chevron { transform: rotate(180deg); }

.dropdown-menu {
  position: absolute; top: calc(100% + 6px); left: 0;
  min-width: 240px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: 0 8px 24px rgba(26,25,22,0.10);
  padding: 6px;
  opacity: 0; transform: translateY(-4px) scale(0.98);
  transition: opacity 0.16s ease, transform 0.16s cubic-bezier(0.32, 0.72, 0, 1);
  pointer-events: none;
  z-index: 50;
}
.dropdown.open .dropdown-menu {
  opacity: 1; transform: translateY(0) scale(1);
  pointer-events: auto;
}

.dropdown-item {
  display: block; padding: 10px 12px; border-radius: 8px;
  cursor: pointer; transition: background 0.15s;
  background: transparent; border: 0; width: 100%; text-align: left;
  text-decoration: none; color: var(--text-primary);
}
.dropdown-item:hover { background: var(--bg-subtle); }
.dropdown-item-title {
  font: 500 13px/1.2 var(--font-ui);
  color: var(--text-primary);
  display: flex; align-items: center; gap: 8px;
}
.dropdown-item-title svg {
  width: 14px; height: 14px;
  stroke: currentColor; fill: none;
  stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round;
  color: var(--text-secondary);
}
.dropdown-item-desc {
  font: 400 11.5px/1.4 var(--font-ui);
  color: var(--text-muted);
  margin-top: 2px;
  padding-left: 22px;
}
.dropdown-divider {
  height: 1px; background: var(--border); margin: 4px 0;
}

/* ── Form-Errors (23.B — Roter BG + Icon innen) ──
   Verwendung:
     <div class="form-error-wrap">
       <input class="input input-error" ...>
       <span class="form-error-icon"><svg>!</svg></span>
     </div>
     <div class="form-error-msg">E-Mail ist nicht vollständig</div>
*/
.form-error-wrap { position: relative; }
.input.input-error {
  border-color: #DC2626;
  background: #FEF2F2;
  padding-right: 38px;
}
.form-error-icon {
  position: absolute;
  right: 12px; top: 50%;
  transform: translateY(-50%);
  color: #DC2626;
  pointer-events: none;
}
.form-error-icon svg {
  width: 16px; height: 16px;
  stroke: currentColor; fill: none;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.form-error-msg {
  font: 500 12px/1.4 var(--font-ui);
  color: #DC2626;
  margin-top: 4px;
}

/* ── Skeleton-Loading (22.C — Wave) ── */
@keyframes sk-wave {
  0%   { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

.skeleton {
  background: linear-gradient(110deg, #E8E6E1 8%, #F8F7F4 18%, #E8E6E1 33%);
  background-size: 200% 100%;
  animation: sk-wave 1.8s linear infinite;
  border-radius: var(--radius-sm);
  height: 12px;
  display: block;
}

.skeleton-text { height: 12px; margin-bottom: 6px; }
.skeleton-text:last-child { margin-bottom: 0; }
.skeleton-title { height: 18px; width: 60%; margin-bottom: 12px; }
.skeleton-line  { height: 12px; width: 100%; }
.skeleton-short { width: 40%; }
.skeleton-card {
  background: var(--bg-surface);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 18px 20px;
}

/* ── Empty-States (13.B — Hand-Skizze + Text) ── */
.empty {
  padding: 48px 24px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
}

.empty-illu {
  width: 100px;
  height: 80px;
  margin-bottom: var(--space-1);
  /* SVGs werden inline mit stroke="var(--text-primary)" gefüllt */
}

.empty-icon-box {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-lg);
  background: var(--bg-subtle);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 4px;
}

.empty-icon-box svg {
  width: 26px;
  height: 26px;
  stroke-width: 1.5;
}

.empty-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 500;
  color: var(--text-primary);
  letter-spacing: -0.3px;
  line-height: 1.3;
}

.empty-text {
  font-family: var(--font-ui);
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  max-width: 340px;
}

.empty-cta {
  margin-top: var(--space-2);
}

/* ── Stub-Page für noch nicht implementierte Module ── */
.stub-page {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-12) var(--space-8);
  text-align: center;
}

.stub-page-icon {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-full);
  background: var(--accent-light);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-5);
}

.stub-page-icon svg {
  width: 28px;
  height: 28px;
}

.stub-page h1 {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-2);
}

.stub-page p {
  font-size: 15px;
  color: var(--text-secondary);
  max-width: 480px;
  line-height: 1.6;
  margin-bottom: var(--space-6);
}

.stub-page-tag {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  background: var(--bg-subtle);
  color: var(--text-secondary);
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 500;
}

/* ── Page-Tabs (Pill-Bar, gleiche Optik wie Leads-Bucket-Tabs) ────────
   Generisches Pattern für seiten-interne Sub-Navigation. Verwendung:
   <div class="page-tabs" role="tablist">
     <a class="page-tab" role="tab" aria-selected="true" href="...">
       <svg .../>
       <span class="page-tab-label">Übersicht</span>
       <span class="page-tab-count">12</span>  (optional)
     </a>
     ...
   </div>
   Sowohl <a>- als auch <button>-Kinder funktionieren. */
.page-tabs {
  display: flex;
  gap: 4px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 4px;
  margin: 0 auto 24px;
  width: fit-content;
}
.page-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border: 0;
  background: transparent;
  border-radius: 9px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.page-tab:hover {
  color: var(--text-primary);
}
.page-tab[aria-selected="true"] {
  background: var(--bg-surface);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}
.page-tab svg {
  flex-shrink: 0;
  color: currentColor;
}
.page-tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 20px;
  padding: 0 7px;
  background: var(--bg-muted);
  color: var(--text-secondary);
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.01em;
}
.page-tab[aria-selected="true"] .page-tab-count {
  background: var(--accent);
  color: #fff;
}
