/* RefurbFlow – Basis-CSS
   Konsistent mit OrderFlow / B&R Corporate Identity:
   Schwarz-Theme, Lime-Akzent (#c8f060), Mint sekundär (#4af0b8),
   Display Syne, Body DM Sans
*/

:root {
  --bg:           #0a0a0a;
  --bg-elev:     #141414;
  --bg-elev-2:   #1c1c1c;
  --border:      #2a2a2a;
  --text:        #f4f4f4;
  --text-muted:  #9a9a9a;
  --accent:      #c8f060;   /* Lime */
  --accent-ink:  #0a0a0a;
  --mint:        #4af0b8;
  --danger:      #ff6b6b;
  --warn:        #ffd166;
  --info:        #4af0b8;

  --radius:      6px;
  --radius-lg:   12px;
  --shadow:      0 8px 32px rgba(0,0,0,0.45);

  --font-display: 'Syne', system-ui, sans-serif;
  --font-body:    'DM Sans', system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0 0 0.5em;
}

/* ---------------- Auth-Layout ---------------- */

body.auth {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 20% 10%, rgba(200,240,96,0.06), transparent 50%),
    radial-gradient(circle at 80% 90%, rgba(74,240,184,0.05), transparent 50%),
    var(--bg);
}

.auth-shell {
  width: 100%;
  max-width: 420px;
  padding: 24px;
}

.auth-card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 36px 32px;
}

.auth-brand {
  text-align: center;
  margin-bottom: 28px;
}
.auth-brand h1 {
  font-size: 32px;
  margin: 0;
}
.auth-brand .accent { color: var(--accent); }
.auth-sub {
  color: var(--text-muted);
  margin: 6px 0 0;
  font-size: 14px;
}

.auth-form { display: flex; flex-direction: column; gap: 16px; }

.auth-hint {
  color: var(--text-muted);
  font-size: 14px;
  margin: 0 0 4px;
}

.auth-alt {
  text-align: center;
  margin: 12px 0 0;
  font-size: 14px;
}

/* ---------------- Page-Layout ---------------- */

.page {
  max-width: 960px;
  margin: 0 auto;
  padding: 32px 24px;
}

.card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
}

/* ---------------- Fields & Buttons ---------------- */

.field { display: flex; flex-direction: column; gap: 6px; }
.field span {
  font-size: 13px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.field input {
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  padding: 12px 14px;
  border-radius: var(--radius);
  transition: border-color 120ms ease, box-shadow 120ms ease;
}
.field input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(200,240,96,0.18);
}
.code-input {
  font-family: 'DM Sans', monospace;
  font-size: 22px;
  letter-spacing: 0.3em;
  text-align: center;
}

.btn {
  display: inline-block;
  padding: 12px 20px;
  border: 1px solid var(--border);
  background: var(--bg-elev-2);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 500;
  border-radius: var(--radius);
  cursor: pointer;
  text-decoration: none;
  transition: background 120ms ease, border-color 120ms ease;
}
.btn:hover { border-color: var(--accent); text-decoration: none; }

.btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
  font-weight: 700;
}
.btn-primary:hover { background: #d8ff70; border-color: #d8ff70; }

/* ---------------- Alerts ---------------- */

.alert {
  padding: 12px 14px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  font-size: 14px;
  border: 1px solid var(--border);
}
.alert-error   { background: rgba(255,107,107,0.10); border-color: rgba(255,107,107,0.35); color: #ffc4c4; }
.alert-success { background: rgba(74,240,184,0.10);  border-color: rgba(74,240,184,0.35);  color: #b8ffe2; }
.alert-info    { background: rgba(200,240,96,0.08);  border-color: rgba(200,240,96,0.30);  color: #e8ffb0; }

/* ---------------- 2FA-Setup-spezifisch ---------------- */

.setup-steps {
  list-style: none;
  padding: 0;
  counter-reset: step;
  display: flex;
  flex-direction: column;
  gap: 22px;
}
.setup-steps li {
  counter-increment: step;
  padding-left: 44px;
  position: relative;
}
.setup-steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
}

.qr-block {
  margin: 12px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 16px;
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.qr-block img { background: white; padding: 8px; border-radius: 4px; }
.secret-text {
  font-family: monospace;
  font-size: 13px;
  color: var(--text-muted);
  word-break: break-all;
  user-select: all;
}

.backup-codes {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin: 16px 0 24px;
  padding: 16px;
  background: var(--bg-elev-2);
  border: 1px dashed var(--accent);
  border-radius: var(--radius);
}
.backup-codes code {
  font-size: 16px;
  font-family: monospace;
  color: var(--accent);
  text-align: center;
  padding: 6px;
  user-select: all;
}

/* ============================================================
   Phase 2: Navigation, Page-Layout, Tabellen, Forms, Badges
   ============================================================ */

/* ---------------- Navigation ---------------- */

.app-nav {
  background: var(--bg-elev);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 32px;
  height: 60px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.app-nav .brand {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.01em;
}
.app-nav .brand .accent { color: var(--accent); }
.app-nav .brand:hover { text-decoration: none; }

.nav-links {
  display: flex;
  gap: 4px;
  list-style: none;
  margin: 0;
  padding: 0;
  flex: 1;
}
.nav-links > li { position: relative; }
.nav-links a {
  display: block;
  padding: 8px 14px;
  color: var(--text-muted);
  text-decoration: none;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  transition: color 120ms ease, background 120ms ease;
}
.nav-links a:hover { color: var(--text); background: var(--bg-elev-2); text-decoration: none; }
.nav-links a.active { color: var(--accent); background: rgba(200,240,96,0.10); }

.has-submenu .submenu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  list-style: none;
  margin: 4px 0 0;
  padding: 6px;
  min-width: 200px;
  box-shadow: var(--shadow);
}
.has-submenu:hover .submenu,
.has-submenu:focus-within .submenu { display: block; }
.has-submenu .submenu a { white-space: nowrap; }

.user-menu {
  display: flex;
  align-items: center;
  gap: 12px;
}
.user-info {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1.2;
}
.user-info strong { font-size: 14px; }
.user-info small { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.user-link {
  font-size: 18px;
  padding: 4px 8px;
  text-decoration: none;
}
.logout-form { margin: 0; }

/* ---------------- Page-Header ---------------- */

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.page-header h1 { font-size: 28px; margin-bottom: 4px; }
.page-sub { color: var(--text-muted); font-size: 14px; margin: 0; }
.page-actions { display: flex; gap: 8px; }
.page-narrow { max-width: 720px; }

.toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 16px;
}

.flash-wrap {
  max-width: 960px;
  margin: 16px auto 0;
  padding: 0 24px;
}

/* ---------------- Cards mit Stack ---------------- */

.card { margin-bottom: 24px; }
.card h2 { font-size: 18px; margin-bottom: 12px; }
.card h3 { font-size: 15px; margin-bottom: 8px; }

/* ---------------- Tabellen ---------------- */

.table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.table th, .table td {
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.table th {
  background: var(--bg-elev-2);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: var(--bg-elev-2); }
.table .actions-col { width: 1%; white-space: nowrap; text-align: right; }
.table .row-inactive td { opacity: 0.5; }
.table-compact th, .table-compact td { padding: 8px 10px; font-size: 14px; }

/* ---------------- Forms ---------------- */

.form-vertical { display: flex; flex-direction: column; gap: 16px; }
.form-inline   { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.row-form {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.row-form:last-child { border-bottom: none; }

.field textarea, .field select {
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  padding: 10px 12px;
  border-radius: var(--radius);
}
.field textarea:focus, .field select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(200,240,96,0.18);
}
.field input:disabled { opacity: 0.5; cursor: not-allowed; }

.checkbox {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 14px;
}
.checkbox input { width: 18px; height: 18px; accent-color: var(--accent); }

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  margin-top: 8px;
}

.inline-form { display: inline-block; margin: 0; }
.muted { color: var(--text-muted); }

/* ---------------- Buttons ---------------- */

.btn-sm { padding: 6px 10px; font-size: 13px; }
.btn-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text-muted);
}
.btn-ghost:hover {
  border-color: var(--accent);
  color: var(--text);
}
.btn-danger {
  background: var(--danger);
  color: white;
  border-color: var(--danger);
}
.btn-danger:hover { background: #ff8585; border-color: #ff8585; }

/* ---------------- Badges ---------------- */

.badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--bg-elev-2);
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.badge-ok     { background: rgba(74,240,184,0.12);  color: #b8ffe2; border-color: rgba(74,240,184,0.35); }
.badge-warn   { background: rgba(255,209,102,0.12); color: #ffe7b0; border-color: rgba(255,209,102,0.35); }
.badge-accent { background: rgba(200,240,96,0.15);  color: var(--accent); border-color: rgba(200,240,96,0.40); }
.badge-mint   { background: rgba(74,240,184,0.12);  color: var(--mint); border-color: rgba(74,240,184,0.35); }
.badge-muted  { background: var(--bg-elev-2); color: var(--text-muted); }

/* ---------------- Stats-Grid (Dashboard) ---------------- */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}
.stat-card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
}
.stat-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.stat-value {
  font-family: var(--font-display);
  font-size: 36px;
  font-weight: 700;
  color: var(--accent);
}

/* ---------------- Empty-State ---------------- */

.empty-state {
  text-align: center;
  padding: 40px 20px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
  color: var(--text-muted);
}

/* ---------------- Responsive Anpassungen ---------------- */

@media (max-width: 720px) {
  .app-nav { flex-wrap: wrap; height: auto; padding: 8px 16px; gap: 16px; }
  .nav-links { order: 3; width: 100%; flex-wrap: wrap; }
  .user-info { display: none; }
  .page-header { flex-direction: column; align-items: stretch; }
  .table .actions-col { white-space: normal; }
}
