/* ═══════════════════════════════════════════════════════
   Wartungsvertrag Generator – Design System 2026
   ═══════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,300..900;1,14..32,300..900&display=swap');

/* ── Design Tokens ─────────────────────────────────────── */
:root {
  --brand:        #C8241A;
  --brand-dark:   #a51d14;
  --brand-dim:    rgba(200,36,26,0.09);

  --bg:           #e8ecf4;        /* klar blau-grau – sofort sichtbar */
  --surface:      #ffffff;
  --nav-bg:       #0b1120;        /* fast schwarz-blau */
  --text:         #0d1117;
  --text-2:       #44546f;
  --muted:        #8993a4;
  --border:       #dde1eb;

  /* Shadows – deutlicher */
  --sh-xs: 0 1px 3px rgba(9,30,66,0.08);
  --sh:    0 2px 8px rgba(9,30,66,0.08), 0 0 1px rgba(9,30,66,0.1);
  --sh-md: 0 4px 16px rgba(9,30,66,0.12), 0 0 1px rgba(9,30,66,0.1);
  --sh-lg: 0 8px 32px rgba(9,30,66,0.16), 0 0 1px rgba(9,30,66,0.1);

  --r-xs: 6px;
  --r-sm: 8px;
  --r:    12px;
  --r-lg: 16px;

  --t:    140ms cubic-bezier(0.16, 1, 0.3, 1);

  /* Legacy */
  --red: var(--brand); --red-dark: var(--brand-dark); --red-light: var(--brand-dim);
  --dark: var(--nav-bg); --dark2: #1a2540; --white: #fff;
  --shadow-sm: var(--sh); --shadow: var(--sh); --shadow-md: var(--sh-md);
  --radius: var(--r); --radius-sm: var(--r-sm); --radius-xs: var(--r-xs);
}

/* ── Base ──────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  font-family: 'Inter', -apple-system, 'Segoe UI', system-ui, sans-serif;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  line-height: 1.55;
  font-size: 15px;
}

/* ── Sidebar Layout ────────────────────────────────────────── */
:root { --sidebar-w: 240px; }

body {
  padding-left: var(--sidebar-w);
  min-height: 100vh;
}

/* ── Sidebar ───────────────────────────────────────────────── */
.sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: #0b0f1a;
  display: flex;
  flex-direction: column;
  z-index: 500;
  border-right: 1px solid rgba(255,255,255,0.05);
  overflow-y: auto;
  overflow-x: hidden;
}

/* Brand */
.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 20px 16px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  flex-shrink: 0;
}
.sidebar-logo {
  width: 34px; height: 34px; flex-shrink: 0;
  background: var(--brand);
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 900; font-size: 0.68rem; letter-spacing: 1.5px;
  color: white;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.12) inset,
              0 4px 14px rgba(200,36,26,0.55);
}
.sidebar-brand-name {
  font-size: 0.82rem; font-weight: 700;
  color: #f0f4ff; letter-spacing: -0.02em;
  white-space: nowrap;
}
.sidebar-brand-sub {
  font-size: 0.6rem; color: rgba(255,255,255,0.25);
  white-space: nowrap;
}

/* Nav */
.sidebar-nav {
  flex: 1;
  padding: 10px 8px;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.sidebar-section-label {
  font-size: 0.6rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 1px;
  color: rgba(255,255,255,0.2);
  padding: 14px 8px 4px;
  margin-top: 2px;
}

.sidebar-item {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 10px;
  border-radius: 7px;
  color: rgba(255,255,255,0.45);
  text-decoration: none !important;
  font-size: 0.83rem; font-weight: 500;
  transition: background var(--t), color var(--t);
  position: relative;
  white-space: nowrap;
}
.sidebar-item i {
  font-size: 0.95rem;
  width: 18px; text-align: center;
  flex-shrink: 0;
}
.sidebar-item:hover {
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.85);
}
.sidebar-item.active {
  background: rgba(200,36,26,0.12);
  color: #ff6b6b;
  font-weight: 600;
}
.sidebar-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 4px; bottom: 4px;
  width: 3px;
  background: var(--brand);
  border-radius: 0 3px 3px 0;
}

/* Footer */
.sidebar-footer {
  padding: 12px 8px;
  border-top: 1px solid rgba(255,255,255,0.05);
  display: flex; align-items: center; gap: 8px;
  flex-shrink: 0;
}
.sidebar-user {
  display: flex; align-items: center; gap: 9px; flex: 1; min-width: 0;
}
.sidebar-avatar {
  width: 30px; height: 30px; border-radius: 8px;
  background: var(--brand);
  color: white; font-weight: 700; font-size: 0.8rem;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.sidebar-user-name {
  font-size: 0.8rem; font-weight: 600;
  color: rgba(255,255,255,0.8);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar-user-role {
  font-size: 0.65rem; color: rgba(255,255,255,0.3);
}
.sidebar-logout {
  color: rgba(255,255,255,0.25);
  font-size: 1rem;
  padding: 6px;
  border-radius: 6px;
  text-decoration: none !important;
  transition: color var(--t), background var(--t);
  flex-shrink: 0;
}
.sidebar-logout:hover { color: #ff6b6b; background: rgba(200,36,26,0.1); }

/* ── Mobile Header ─────────────────────────────────────────── */
.mobile-header {
  display: none;
  position: fixed; top: 0; left: 0; right: 0;
  height: 52px; z-index: 450;
  background: #0b0f1a;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  align-items: center;
  padding: 0 12px; gap: 10px;
}
.sidebar-toggle-btn {
  background: none; border: none;
  color: rgba(255,255,255,0.6); font-size: 1.3rem;
  padding: 6px; cursor: pointer;
  display: flex; align-items: center;
}
.mobile-header-logo {
  width: 28px; height: 28px;
  background: var(--brand); border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 900; font-size: 0.6rem; color: white; letter-spacing: 1px;
}
.mobile-header-title {
  font-size: 0.88rem; font-weight: 700;
  color: #f0f4ff; flex: 1;
}
.mobile-header-action {
  color: rgba(255,255,255,0.4); font-size: 1.1rem;
  text-decoration: none !important;
  padding: 6px;
}

/* Overlay */
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 490;
  backdrop-filter: blur(2px);
}
.sidebar-overlay.show { display: block; }

/* ── Mobile Bottom Nav ─────────────────────────────────────── */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: 68px;
  background: #0d1117;
  border-top: 1px solid rgba(255,255,255,0.1);
  z-index: 600;
  padding: 0 2px;
  align-items: center;
  justify-content: space-around;
  padding-bottom: env(safe-area-inset-bottom);
}
.mobile-bottom-nav a {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  color: rgba(255,255,255,0.4);
  text-decoration: none !important;
  font-size: 0.65rem; font-weight: 600;
  padding: 6px 8px;
  border-radius: 10px;
  transition: color var(--t);
  flex: 1;
  letter-spacing: 0.01em;
}
.mobile-bottom-nav a i { font-size: 1.35rem; line-height: 1; }
.mobile-bottom-nav a span { line-height: 1; }
.mobile-bottom-nav a.active { color: var(--brand); }
.mobile-bottom-nav a.active i { filter: drop-shadow(0 0 4px rgba(200,36,26,0.5)); }
.mobile-center-btn {
  width: 50px !important; height: 50px;
  background: var(--brand) !important;
  border-radius: 50% !important;
  color: white !important;
  display: flex !important; align-items: center !important; justify-content: center !important;
  box-shadow: 0 4px 20px rgba(200,36,26,0.6);
  flex: 0 0 50px !important;
  padding: 0 !important;
  margin-bottom: 10px;
}
.mobile-center-btn i { font-size: 1.4rem !important; }

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 900px) {
  body { padding-left: 0; }
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.25s cubic-bezier(0.16,1,0.3,1);
  }
  .sidebar.open { transform: translateX(0); }
  .mobile-header { display: flex; }
  .mobile-bottom-nav { display: flex; }
  body { padding-top: 52px; padding-bottom: 62px; }
}

/* Red bar – hidden in sidebar layout */
.red-bar { display: none; }

/* ── Page ──────────────────────────────────────────────── */
.page-header { margin-bottom: 24px; }
.page-header h1 {
  font-size: 1.4rem; font-weight: 700;
  margin: 0 0 2px; letter-spacing: -0.03em;
}
.page-header .sub { font-size: 0.84rem; color: var(--muted); }

/* ── Cards ─────────────────────────────────────────────── */
.card {
  border: 1px solid var(--border) !important;
  border-radius: var(--r) !important;
  box-shadow: var(--sh) !important;
  background: var(--surface) !important;
  overflow: hidden;
}
.card-header {
  background: #fafbfc !important;
  border-bottom: 1px solid var(--border) !important;
  border-radius: var(--r) var(--r) 0 0 !important;
  padding: 14px 20px !important;
  font-weight: 600; font-size: 0.88rem;
  color: var(--text);
  display: flex !important; align-items: center !important; gap: 10px;
  letter-spacing: -0.01em;
}
.card-icon {
  width: 28px; height: 28px;
  background: var(--brand-dim);
  border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  color: var(--brand); font-size: 0.84rem; flex-shrink: 0;
}
.card-body  { padding: 20px !important; }
.card-footer {
  background: #fafbfc !important;
  border-top: 1px solid var(--border) !important;
  padding: 12px 20px !important;
}

/* ── KPI Stat Cards – volle Gradient-Backgrounds ────────── */
.stat-card {
  border-radius: var(--r) !important;
  padding: 22px 24px;
  display: flex; align-items: center; gap: 16px;
  transition: transform var(--t), box-shadow var(--t);
  border: none !important;
  position: relative;
  overflow: hidden;
}
.stat-card::after {   /* Glanzschimmer oben rechts */
  content: '';
  position: absolute; top: -30px; right: -30px;
  width: 100px; height: 100px;
  background: rgba(255,255,255,0.12);
  border-radius: 50%;
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--sh-lg) !important; }

/* Farbvarianten */
.stat-card.sc-blue   { background: linear-gradient(135deg, #1d4ed8, #3b82f6); color: white; box-shadow: 0 4px 20px rgba(59,130,246,0.35) !important; }
.stat-card.sc-red    { background: linear-gradient(135deg, #a51d14, #C8241A); color: white; box-shadow: 0 4px 20px rgba(200,36,26,0.35) !important; }
.stat-card.sc-green  { background: linear-gradient(135deg, #15803d, #22c55e); color: white; box-shadow: 0 4px 20px rgba(34,197,94,0.35) !important; }
.stat-card.sc-orange { background: linear-gradient(135deg, #c2410c, #f97316); color: white; box-shadow: 0 4px 20px rgba(249,115,22,0.35) !important; }

.stat-icon {
  width: 50px; height: 50px;
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem; flex-shrink: 0;
  background: rgba(255,255,255,0.2);
  color: white;
}

/* Legacy stat-icon color variants (for other pages) */
.stat-icon.red    { background: rgba(255,255,255,0.2); color: white; }
.stat-icon.blue   { background: rgba(255,255,255,0.2); color: white; }
.stat-icon.green  { background: rgba(255,255,255,0.2); color: white; }
.stat-icon.orange { background: rgba(255,255,255,0.2); color: white; }

.stat-val   { font-size: 2.2rem; font-weight: 800; line-height: 1; margin-bottom: 3px; letter-spacing: -0.06em; color: white; }
.stat-label { font-size: 0.75rem; color: rgba(255,255,255,0.75); font-weight: 500; letter-spacing: 0.02em; }

/* ── Quick Action Cards ────────────────────────────────── */
.action-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 16px 18px;
  display: flex; align-items: center; gap: 14px;
  text-decoration: none !important;
  color: var(--text) !important;
  transition: all var(--t);
  box-shadow: var(--sh-xs);
}
.action-card:hover {
  box-shadow: var(--sh-md);
  transform: translateY(-2px);
  border-color: var(--brand);
}
.action-card:hover .ac-icon { background: var(--brand); color: white; }
.action-card:hover .ac-label { color: var(--brand); }

.action-card .ac-icon {
  width: 42px; height: 42px;
  border-radius: 11px;
  background: #f0f3fa;
  color: var(--text-2);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; flex-shrink: 0;
  transition: background var(--t), color var(--t);
}
.action-card .ac-label { font-size: 0.875rem; font-weight: 600; letter-spacing: -0.01em; transition: color var(--t); }
.action-card .ac-sub   { font-size: 0.73rem; color: var(--muted); margin-top: 1px; }

/* ── Section title ─────────────────────────────────────── */
.section-title {
  font-size: 0.69rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 1.2px;
  color: var(--muted); margin-bottom: 12px;
  display: flex; align-items: center; gap: 10px;
}
.section-title::after { content: ''; flex: 1; height: 1px; background: var(--border); }

.section-header {
  font-size: 0.72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 1px;
  color: var(--muted); margin-bottom: 10px;
}

/* ── Buttons ───────────────────────────────────────────── */
.btn {
  border-radius: var(--r-xs) !important;
  font-size: 0.855rem !important;
  font-weight: 500 !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
  transition: all var(--t) !important;
  letter-spacing: -0.01em !important;
}

.btn-red {
  background: var(--brand) !important;
  color: white !important;
  border: none !important;
  padding: 9px 18px !important;
  font-weight: 600 !important;
  box-shadow: 0 2px 8px rgba(200,36,26,0.3) !important;
}
.btn-red:hover {
  background: var(--brand-dark) !important;
  color: white !important;
  box-shadow: 0 4px 16px rgba(200,36,26,0.4) !important;
  transform: translateY(-1px);
}
.btn-red:active { transform: scale(0.97) !important; }

.btn-outline-red { background: transparent !important; color: var(--brand) !important; border: 1.5px solid var(--brand) !important; }
.btn-outline-red:hover { background: var(--brand-dim) !important; }
.btn-danger  { background: var(--brand) !important; border-color: var(--brand) !important; }
.btn-outline-danger { color: var(--brand) !important; border-color: var(--brand) !important; }
.btn-outline-danger:hover { background: rgba(200,36,26,0.06) !important; }
.btn-outline-secondary {
  border-color: var(--border) !important;
  color: var(--text-2) !important;
  background: var(--surface) !important;
}
.btn-outline-secondary:hover {
  background: #f0f3fa !important;
  border-color: #c4cad8 !important;
  color: var(--text) !important;
}

/* ── Forms ─────────────────────────────────────────────── */
.form-label { font-size: 0.82rem; font-weight: 500; color: var(--text-2); margin-bottom: 5px; }
.form-control, .form-select {
  border-radius: var(--r-xs) !important;
  border: 1.5px solid var(--border) !important;
  font-size: 0.875rem !important;
  padding: 8px 12px !important;
  color: var(--text) !important;
  background: white !important;
  transition: border-color var(--t), box-shadow var(--t) !important;
}
.form-control:focus, .form-select:focus {
  border-color: var(--brand) !important;
  box-shadow: 0 0 0 3px rgba(200,36,26,0.1) !important;
  outline: none !important;
}
.form-control::placeholder { color: var(--muted) !important; }
.input-group-text {
  border: 1.5px solid var(--border) !important;
  border-radius: var(--r-xs) !important;
  background: #f5f7fb !important;
  color: var(--muted) !important;
  font-size: 0.85rem !important;
}
.form-check-input:checked { background-color: var(--brand) !important; border-color: var(--brand) !important; }

/* ── Section steps ─────────────────────────────────────── */
.section-step {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 18px; padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.step-num {
  width: 24px; height: 24px; background: var(--brand); color: white;
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 0.7rem; font-weight: 700; flex-shrink: 0;
}
.step-label { font-weight: 600; font-size: 0.875rem; }

/* ── Pills ─────────────────────────────────────────────── */
.pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px; border-radius: 20px;
  font-size: 0.7rem; font-weight: 600; line-height: 1.4;
}
.pill-green  { background: #dcfce7; color: #15803d; }
.pill-blue   { background: #dbeafe; color: #1d4ed8; }
.pill-orange { background: #fff4ed; color: #c2410c; }
.pill-red    { background: #fee2e2; color: #b91c1c; }
.pill-gray   { background: #f1f3f6; color: #44546f; }

/* ── Tables ────────────────────────────────────────────── */
.table { font-size: 0.875rem; margin-bottom: 0 !important; }
.table thead th {
  font-size: 0.68rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.8px;
  color: var(--muted); border-bottom: 1px solid var(--border) !important;
  padding: 12px 16px !important;
  background: #fafbfc; white-space: nowrap;
}
.table tbody td {
  padding: 13px 16px !important; vertical-align: middle;
  border-color: var(--border) !important; color: var(--text);
}
.table tbody tr { transition: background var(--t); }
.table tbody tr:hover { background: #f6f8fc !important; }
.table tbody tr:last-child td { border-bottom: none !important; }

/* ── Alerts ────────────────────────────────────────────── */
.alert { border-radius: var(--r-sm) !important; border: none !important; font-size: 0.875rem !important; }
.alert-success { background: #f0fdf4 !important; color: #15803d !important; border-left: 3px solid #22c55e !important; }
.alert-danger  { background: #fff5f5 !important; color: #b91c1c !important; border-left: 3px solid var(--brand) !important; }
.alert-info    { background: #eff6ff !important; color: #1d4ed8 !important; border-left: 3px solid #3b82f6 !important; }
.alert-warning { background: #fffbeb !important; color: #b45309 !important; border-left: 3px solid #f59e0b !important; }

/* ── Empty states ──────────────────────────────────────── */
.empty-state { text-align: center; padding: 48px 24px; }
.empty-icon {
  width: 60px; height: 60px; background: #f0f3fa;
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  margin: 0 auto 16px; font-size: 1.5rem; color: var(--muted);
}
.empty-state h5 { font-size: 0.95rem; font-weight: 600; color: var(--text-2); margin-bottom: 5px; }
.empty-state p  { font-size: 0.84rem; color: var(--muted); margin-bottom: 18px; }

/* ── List group ────────────────────────────────────────── */
.list-group-item {
  border-color: var(--border) !important;
  padding: 13px 20px !important;
  transition: background var(--t);
}
.list-group-item:hover { background: #f6f8fc !important; }

/* ── Avatar ────────────────────────────────────────────── */
.avatar {
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.76rem; flex-shrink: 0;
}
.avatar-red  { background: #fee2e2; color: var(--brand); }
.avatar-blue { background: #dbeafe; color: #1d4ed8; }

/* ── Type selector ─────────────────────────────────────── */
.type-selector { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.type-option {
  border: 2px solid var(--border); border-radius: var(--r-sm);
  padding: 16px; cursor: pointer; transition: all var(--t);
  background: white; text-align: left;
}
.type-option:hover { border-color: #fca5a5; background: #fff8f8; }
.type-option.selected { border-color: var(--brand); background: rgba(200,36,26,0.03); }
.type-option .type-icon { font-size: 1.5rem; margin-bottom: 8px; display: block; }
.type-option .type-name { font-weight: 700; font-size: 0.88rem; margin-bottom: 3px; }
.type-option .type-desc { font-size: 0.77rem; color: var(--muted); }
.type-option.selected .type-desc { color: #b91c1c; }

/* ── Utility ───────────────────────────────────────────── */
.hint { font-size: 0.77rem; color: var(--muted); margin-top: 3px; }

/* ── Scrollbar ─────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #c4cad8; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #a0a8bb; }

/* ── Card Entrance Animations ─────────────────────────── */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
.card { animation: fadeInUp 0.3s ease-out both; }
.card:nth-child(2) { animation-delay: 0.05s; }
.card:nth-child(3) { animation-delay: 0.1s; }
.card:nth-child(4) { animation-delay: 0.15s; }

/* ── Card Hover Transitions ───────────────────────────── */
.card { transition: box-shadow 0.2s ease, transform 0.2s ease; }
.card:hover { box-shadow: 0 4px 20px rgba(0,0,0,0.08); }

/* ── Notification Badge ───────────────────────────────── */
.nav-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  background: #ef4444;
  color: white;
  font-size: 0.6rem;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  line-height: 1;
  animation: pulse-badge 2s ease-in-out infinite;
}
.nav-badge:empty { display: none; }
@keyframes pulse-badge {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

/* ── Dashboard Greeting ───────────────────────────────── */
.greeting-section {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 4px;
}

/* ── Stat Card Animations ─────────────────────────────── */
.stat-card { animation: fadeInUp 0.3s ease-out both; }
.row .col-6:nth-child(2) .stat-card { animation-delay: 0.05s; }
.row .col-6:nth-child(3) .stat-card { animation-delay: 0.1s; }
.row .col-6:nth-child(4) .stat-card { animation-delay: 0.15s; }
