/* ============================================================
   WFHL – Stylesheet v0.1.0
   Mobile-First, kein Framework
   ============================================================ */

:root {
  --primary:     #1a5f8a;
  --primary-d:   #144d72;
  --primary-l:   #e8f3fa;
  --accent:      #e87b1a;
  --success:     #2e7d32;
  --warning:     #f57c00;
  --danger:      #c62828;
  --bg:          #f4f6f8;
  --surface:     #ffffff;
  --border:      #d0d7de;
  --text:        #1a1a2e;
  --text-muted:  #6b7280;
  --radius:      6px;
  --shadow:      0 1px 4px rgba(0,0,0,.12);
  --shadow-md:   0 4px 16px rgba(0,0,0,.12);
  --font:        'Segoe UI', system-ui, -apple-system, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

/* ---- Typo ---- */
h1 { font-size: 1.6rem; font-weight: 700; margin-bottom: .5rem; }
h2 { font-size: 1.25rem; font-weight: 600; margin-bottom: .4rem; }
h3 { font-size: 1.05rem; font-weight: 600; }
a  { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
small { font-size: .8rem; color: var(--text-muted); }

/* ---- Layout ---- */
.app-shell {
  display: grid;
  grid-template-rows: auto 1fr;
  min-height: 100vh;
}

@media (min-width: 768px) {
  .app-shell {
    grid-template-columns: 220px 1fr;
    grid-template-rows: auto 1fr;
  }
}

/* ---- Topbar ---- */
.topbar {
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .6rem 1rem;
  grid-column: 1 / -1;
  box-shadow: 0 2px 6px rgba(0,0,0,.2);
  position: sticky;
  top: 0;
  z-index: 100;
}
.topbar-brand { font-size: 1.1rem; font-weight: 700; letter-spacing: .04em; flex: 1; }
.topbar-brand span { opacity: .65; font-size: .8rem; font-weight: 400; margin-left: .4rem; }
.topbar-actions { display: flex; gap: .5rem; align-items: center; }
.topbar-user { font-size: .85rem; opacity: .85; }
.btn-icon {
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  padding: .3rem .5rem;
  border-radius: var(--radius);
  font-size: .85rem;
  opacity: .85;
  transition: opacity .15s;
}
.btn-icon:hover { opacity: 1; background: rgba(255,255,255,.15); }

/* ---- Language Switcher ---- */
.lang-switcher {
  background: rgba(255,255,255,.15);
  border: 1px solid rgba(255,255,255,.3);
  border-radius: 4px;
  color: #fff;
  font-size: .82rem;
  padding: .2rem .4rem;
  cursor: pointer;
  outline: none;
}
.lang-switcher:hover { background: rgba(255,255,255,.25); }
.lang-switcher option { background: #1a5f8a; color: #fff; }

/* ---- Sidebar ---- */
.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 1rem 0;
  display: none;
}
@media (min-width: 768px) {
  .sidebar { display: block; }
}
.nav-item {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .55rem 1.25rem;
  color: var(--text);
  font-size: .9rem;
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: background .12s, border-color .12s;
}
.nav-item:hover              { background: var(--primary-l); }
.nav-item.active             { background: var(--primary-l); border-left-color: var(--primary); color: var(--primary); font-weight: 600; }
.nav-item-disabled           { opacity: .45; cursor: not-allowed; pointer-events: none; }
.nav-section                 { padding: .6rem 1.25rem .2rem; font-size: .7rem; text-transform: uppercase; letter-spacing: .07em; color: var(--text-muted); }

/* ---- Main content ---- */
.main-content {
  padding: 1.5rem 1rem;
  overflow: auto;
}
@media (min-width: 768px) {
  .main-content { padding: 2rem; }
}

/* ---- Cards ---- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem;
  margin-bottom: 1rem;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  gap: .5rem;
}
.card-title { font-size: 1rem; font-weight: 600; }

/* ---- Stats grid ---- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  text-align: center;
  box-shadow: var(--shadow);
}
.stat-value { font-size: 2rem; font-weight: 700; color: var(--primary); }
.stat-label { font-size: .8rem; color: var(--text-muted); margin-top: .2rem; }

/* ---- Formulare ---- */
.form-group { margin-bottom: 1rem; }
.form-label {
  display: block;
  font-size: .875rem;
  font-weight: 500;
  margin-bottom: .3rem;
}
.form-label .required { color: var(--danger); margin-left: .2rem; }
.form-control {
  width: 100%;
  padding: .5rem .75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: .95rem;
  font-family: var(--font);
  background: var(--surface);
  color: var(--text);
  transition: border-color .15s, box-shadow .15s;
}
.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26,95,138,.15);
}
.form-control.is-invalid { border-color: var(--danger); }
.form-hint { font-size: .78rem; color: var(--text-muted); margin-top: .25rem; }
.form-error { font-size: .78rem; color: var(--danger); margin-top: .25rem; display: none; }
.form-control.is-invalid + .form-error,
.is-invalid ~ .form-error { display: block; }

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .5rem 1.1rem;
  border: none;
  border-radius: var(--radius);
  font-size: .9rem;
  font-family: var(--font);
  font-weight: 500;
  cursor: pointer;
  transition: background .15s, box-shadow .15s;
  text-decoration: none;
  white-space: nowrap;
}
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary  { background: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--primary-d); }
.btn-secondary { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover:not(:disabled) { background: var(--bg); }
.btn-danger   { background: var(--danger); color: #fff; }
.btn-sm       { padding: .3rem .75rem; font-size: .82rem; }
.btn-block    { width: 100%; justify-content: center; }

/* ---- Tabellen ---- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th { text-align: left; padding: .6rem .75rem; border-bottom: 2px solid var(--border); font-weight: 600; color: var(--text-muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }
td { padding: .6rem .75rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--primary-l); }

/* ---- Badges ---- */
.badge {
  display: inline-block;
  padding: .15rem .5rem;
  border-radius: 9999px;
  font-size: .75rem;
  font-weight: 600;
}
.badge-blue   { background: var(--primary-l); color: var(--primary); }
.badge-green  { background: #e8f5e9; color: var(--success); }
.badge-orange { background: #fff3e0; color: var(--warning); }
.badge-grey   { background: var(--bg); color: var(--text-muted); }

/* ---- Alerts ---- */
.alert {
  padding: .75rem 1rem;
  border-radius: var(--radius);
  font-size: .875rem;
  margin-bottom: 1rem;
  border-left: 4px solid;
}
.alert-danger  { background: #fdecea; border-color: var(--danger); color: #7f1d1d; }
.alert-success { background: #e8f5e9; border-color: var(--success); color: #1b5e20; }
.alert-info    { background: var(--primary-l); border-color: var(--primary); color: var(--primary-d); }
.alert { display: none; }
.alert.show { display: block; }

/* ---- Login-Seite ---- */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--primary-d) 0%, var(--primary) 100%);
  padding: 1rem;
}
.login-box {
  background: var(--surface);
  border-radius: 10px;
  box-shadow: var(--shadow-md);
  padding: 2rem 2rem 1.75rem;
  width: 100%;
  max-width: 380px;
}
.login-logo {
  text-align: center;
  margin-bottom: 1.5rem;
}
.login-logo h1 { font-size: 1.8rem; color: var(--primary); }
.login-logo p  { font-size: .85rem; color: var(--text-muted); }
.login-footer  { text-align: center; margin-top: 1.25rem; font-size: .78rem; color: var(--text-muted); }

/* ---- Loading-Spinner ---- */
.spinner {
  width: 18px; height: 18px;
  border: 2px solid rgba(255,255,255,.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .6s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Toasts ---- */
#toast-container {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: .5rem;
}
.toast {
  background: #333;
  color: #fff;
  padding: .65rem 1rem;
  border-radius: var(--radius);
  font-size: .875rem;
  box-shadow: var(--shadow-md);
  animation: slideIn .2s ease;
}
.toast.toast-success { background: var(--success); }
.toast.toast-error   { background: var(--danger); }
@keyframes slideIn { from { opacity:0; transform:translateY(8px); } to { opacity:1; transform:none; } }

/* ---- Utility ---- */
.d-none     { display: none !important; }
.d-flex     { display: flex !important; }
.gap-1      { gap: .5rem; }
.gap-2      { gap: 1rem; }
.mt-1       { margin-top: .5rem; }
.mt-2       { margin-top: 1rem; }
.mb-1       { margin-bottom: .5rem; }
.mb-2       { margin-bottom: 1rem; }
.text-muted { color: var(--text-muted); }
.text-right { text-align: right; }
.fw-bold    { font-weight: 700; }

/* ============================================================
   WIZARD – Fortschrittsleiste & Schritte
   ============================================================ */
.wizard-progress {
  position: sticky;
  top: 0;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: .75rem 1rem .5rem;
  z-index: 10;
}
.wizard-steps {
  display: flex;
  gap: .3rem;
  flex-wrap: wrap;
  margin-bottom: .5rem;
}
.wz-step {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: var(--border);
  color: var(--text-muted);
  font-size: .75rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background .15s, color .15s;
  user-select: none;
}
.wz-step.active    { background: var(--primary); color: #fff; }
.wz-step.completed { background: var(--success);  color: #fff; cursor: default; }
.progress-bar-wrap {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  background: var(--primary);
  border-radius: 2px;
  transition: width .3s ease;
}

/* Wizard form-row */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
@media (max-width: 540px) {
  .form-row { grid-template-columns: 1fr; }
  .wz-step  { width: 1.6rem; height: 1.6rem; font-size: .65rem; }
}

/* is-invalid highlight */
.form-control.is-invalid {
  border-color: var(--danger);
  box-shadow: 0 0 0 2px rgba(198,40,40,.2);
}

/* ============================================================
   MODAL
   ============================================================ */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.modal {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.modal-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-body {
  padding: 1.25rem;
  overflow-y: auto;
  flex: 1;
}
.modal-footer {
  padding: .75rem 1.25rem;
  border-top: 1px solid var(--border);
  display: flex;
  gap: .75rem;
  justify-content: flex-end;
}

/* ---- Inaktive Zeile ---- */
tr.row-inactive td { opacity: .5; }

/* ---- Badge extras ---- */
.badge-primary { background: var(--primary-l); color: var(--primary); }
.badge-blue    { background: #e3f0ff; color: #1a5f8a; }
.badge-orange  { background: #fff3e0; color: var(--warning); }
