/* admin.css — seitenspezifische Styles der Admin-/Benutzerverwaltung.
   Theme-Variablen, obere Leiste, Settings-Panel, Basis-Buttons, Modal-
   Grundgeruest, .field und .msg kommen aus page-shell.css. */

main { max-width: 1100px; margin: 32px auto; padding: 0 16px; }
.card { background: var(--surface); border-radius: 10px; padding: 24px; margin-bottom: 20px; border: 1.5px solid var(--border); }
h2 { font-size: 1rem; font-weight: 700; margin-bottom: 16px; color: var(--text-heading); }
table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
td, th { padding: 9px 10px; border-bottom: 1px solid var(--border); text-align: left; color: var(--text); }
th { color: var(--text-muted); font-weight: 600; background: var(--surface2); }
/* Lange E-Mails ohne Trennzeichen duerfen brechen, sonst sprengen sie die Tabelle.
   Nur auf Text-Elemente anwenden, NICHT auf Buttons (sonst brechen Button-Labels mitten im Wort). */
.users-table .user-secondary { overflow-wrap: anywhere; }

/* Tabellen-Aktionsspalte: alle Knoepfe rechtsbuendig; wrappen erst, wenn nicht genug Platz da ist. */
.user-actions { display: flex; align-items: center; justify-content: flex-end; gap: 6px; flex-wrap: wrap; }
/* Aktions-Buttons in Tabelle / Mobile-Karten kompakt halten — page-shell .btn ist groesser. */
.user-actions .btn, .user-card-actions .btn { padding: 6px 14px; height: 30px; font-size: 0.83rem; }

/* Werkzeugschluessel-Button vor dem Nutzernamen */
.btn-wrench {
  background: none; border: none; cursor: pointer;
  padding: 2px 5px; font-size: 0.95rem; line-height: 1;
  vertical-align: middle; border-radius: 5px;
  opacity: 0.7; transition: background 0.15s, opacity 0.15s, transform 0.15s;
  margin-left: 6px; color: var(--text-muted);
}
.btn-wrench:hover { background: var(--surface2); opacity: 1; transform: scale(1.1); color: var(--accent); }
.btn-wrench:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; opacity: 1; }

/* Mobile: Karten statt Tabelle */
.user-card-list { display: none; }
.user-card { background: var(--surface2); border-radius: 8px; padding: 14px; margin-bottom: 10px; border: 1px solid var(--border); }
.user-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.user-card-top > div:first-child { min-width: 0; flex: 1; }
.user-card-name { font-weight: 700; font-size: 0.95rem; overflow-wrap: anywhere; }
.user-card-email { font-size: 0.8rem; color: var(--text-muted); margin-top: 2px; overflow-wrap: anywhere; }
.user-card-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; font-size: 0.8rem; color: var(--text-muted); }
.user-card-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.user-card-actions .btn { flex: 1; min-width: 90px; text-align: center; }
@media (max-width: 820px) {
  .users-table { display: none; }
  .user-card-list { display: block; }
  main { margin: 16px auto; }
  .card { padding: 16px; }
}

/* Button-Varianten (Basis .btn/.btn-primary/.btn-outline/.btn-danger aus page-shell.css) */
.btn-activate { background: var(--surface); color: #059669; border: 1.5px solid #059669; }
.btn-status   { width: 118px; justify-content: center; }

/* Badges */
.badge { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: 0.75rem; font-weight: 600; }
.badge-admin    { background: var(--accent-light); color: var(--accent); }
.badge-customer { background: #f0fdf4; color: #059669; }
.role-badge { display: inline-flex; flex-direction: column; align-items: center; gap: 1px; padding: 3px 10px; border-radius: 10px; font-size: 0.75rem; font-weight: 600; line-height: 1.2; }
.role-badge-emoji { font-size: 1rem; line-height: 1; letter-spacing: 0; white-space: nowrap; }
.role-badge.badge-customer { background: transparent; padding: 0; }
.badge-disabled { background: #fef2f2; color: #ef4444; }
.badge-self     { background: #dcfce7; color: #15803d; border: 1px solid #86efac; }
.user-secondary { font-size: 0.82rem; color: var(--text-secondary); }

/* Danger-Modal (Loeschen) */
.modal-danger { border: 2px solid #ef4444; background: #fff5f5; text-align: center; }
[data-theme="dark"] .modal-danger { background: #2d1010; border-color: #ef4444; }
.danger-icon { font-size: 2.8rem; line-height: 1; margin-bottom: 10px; }
.modal-danger h3 { font-size: 1.15rem; color: #ef4444; font-weight: 700; }
.danger-text { color: #b91c1c !important; font-size: 0.9rem !important; line-height: 1.5; margin-bottom: 0; }
[data-theme="dark"] .danger-text { color: #fca5a5 !important; }
.delete-slider-wrap { margin: 20px 0 4px; }
.delete-slider-track { position: relative; height: 52px; background: #fee2e2; border: 2px solid #ef4444; border-radius: 99px; overflow: hidden; cursor: ew-resize; user-select: none; }
[data-theme="dark"] .delete-slider-track { background: #3d1515; }
.delete-slider-track.done { background: #dcfce7; border-color: #22c55e; }
.delete-slider-label { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 0.8rem; font-weight: 600; color: #ef4444; pointer-events: none; letter-spacing: 0.02em; }
.delete-slider-track.done .delete-slider-label { color: #16a34a; }
.delete-slider-handle { position: absolute; top: 2px; left: 2px; width: 44px; height: 44px; background: #ef4444; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 1.2rem; line-height: 1; cursor: grab; transition: background 0.2s; box-shadow: 0 2px 6px rgba(239,68,68,0.4); }
.delete-slider-handle.dragging { cursor: grabbing; }
.delete-slider-track.done .delete-slider-handle { background: #22c55e; }
.delete-countdown { font-size: 4rem; font-weight: 800; color: #ef4444; line-height: 1; margin: 8px 0 6px; animation: countdown-pulse 1s ease-in-out infinite; }
@keyframes countdown-pulse { 0%,100%{transform:scale(1);opacity:1} 50%{transform:scale(1.12);opacity:0.85} }

/* Zugriffslevel-Toggle (Lesen <-> Bearbeiten) */
.access-toggle-wrap { display: inline-flex; align-items: center; gap: 8px; user-select: none; }
.access-toggle-label { font-size: 0.85rem; color: var(--text-muted); transition: color .15s, font-weight .15s; }
.access-toggle-wrap.is-view  .access-toggle-label-left  { color: var(--accent); font-weight: 700; }
.access-toggle-wrap.is-edit  .access-toggle-label-right { color: var(--accent); font-weight: 700; }
.access-toggle { position: relative; display: inline-block; width: 40px; height: 22px; cursor: pointer; }
.access-toggle input { opacity: 0; width: 0; height: 0; position: absolute; }
.access-toggle-track { position: absolute; inset: 0; background: var(--border); border-radius: 22px; transition: background .2s; }
.access-toggle-track::before { content: ""; position: absolute; height: 18px; width: 18px; left: 2px; top: 2px; background: #fff; border-radius: 50%; transition: transform .2s; box-shadow: 0 1px 3px rgba(0,0,0,0.25); }
.access-toggle input:checked + .access-toggle-track { background: var(--accent); }
.access-toggle input:checked + .access-toggle-track::before { transform: translateX(18px); }
.access-toggle:hover .access-toggle-track { filter: brightness(0.92); }
.access-toggle input:focus-visible + .access-toggle-track { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Passwort-Anzeige mit Kopier-Button */
.pw-display { display: flex; align-items: center; gap: 8px; background: var(--surface2); border: 1.5px solid var(--border); border-radius: 7px; padding: 10px 14px; margin-bottom: 12px; }
.pw-display-text { flex: 1; font-family: monospace; font-size: 1rem; letter-spacing: 0.05em; color: var(--text); word-break: break-all; }
.pw-copy-btn { flex-shrink: 0; background: transparent; border: 1.5px solid var(--border); color: var(--text-muted); width: 34px; height: 34px; border-radius: 6px; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; padding: 0; transition: color .15s, border-color .15s, background .15s, opacity .15s; }
.pw-copy-btn:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-light); }
.pw-copy-btn:focus-visible { outline: none; color: var(--accent); border-color: var(--accent); background: var(--accent-light); }
.pw-copy-btn.is-copied { color: #059669; border-color: #059669; background: #ecfdf5; }
[data-theme="dark"] .pw-copy-btn.is-copied { background: #0d2a20; }
.pw-copy-btn svg { width: 16px; height: 16px; display: block; }

/* Formularfelder ausserhalb von .field (z. B. Filterzeile im Sicherheits-Protokoll).
   Modal-Felder in .field werden von page-shell.css gestylt (hoehere Spezifitaet). */
label { display: block; font-size: 0.8rem; font-weight: 600; color: var(--text-muted); margin-bottom: 4px; }
input, select { width: 100%; padding: 8px 11px; border: 1.5px solid var(--border); border-radius: 7px; font-size: 0.93rem; background: var(--surface2); color: var(--text); }
input:focus, select:focus { outline: none; border-color: var(--accent); }
input[readonly] { opacity: 0.7; cursor: not-allowed; background: var(--surface); }

/* Modal-Button-Leiste linksbuendig (page-shell setzt flex-end; einzelne Modals
   ueberschreiben per Inline-Style auf flex-end). */
.modal-btns { display: flex; gap: 10px; margin-top: 16px; }

/* Hover fuer "Abbrechen"-Buttons */
.btn-cancel-hover:hover { border-color: #ef4444 !important; color: #ef4444 !important; background: #fee2e2 !important; }
