/* design-system.css — Variablen, Reset und atomare Komponenten.
   Profi-Logistik-Look: hell, klar, blau-dominant, gelber Akzent für CTAs. */

:root {
  /* Primär */
  /* PSG Brand-Blau (#0968a0) — Quelle: psg-logistik.eu */
  --primary: #0968A0;
  --primary-dark: #075177;
  --primary-light: #D6EBF7;

  /* Sekundär (Sidebar / dunkle Flächen) */
  --secondary: #0F172A;
  --secondary-light: #334155;

  /* Akzent (CTAs) */
  --accent: #F59E0B;
  --accent-dark: #D97706;

  /* Status */
  --success: #10B981;
  --warning: #F59E0B;
  --danger:  #EF4444;
  --info:    #3B82F6;

  /* Neutrals */
  --bg: #F8FAFC;
  --bg-card: #FFFFFF;
  --text: #1E293B;
  --text-muted: #64748B;
  --border: #E2E8F0;

  /* Typography */
  --font-sans: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, monospace;

  /* Spacing */
  --space-xs: 0.5rem;
  --space-sm: 1rem;
  --space-md: 1.5rem;
  --space-lg: 2rem;
  --space-xl: 3rem;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow:    0 4px 6px -1px rgba(15, 23, 42, 0.08), 0 2px 4px -2px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.1), 0 4px 6px -4px rgba(15, 23, 42, 0.08);

  /* Radius */
  --radius:    8px;
  --radius-lg: 12px;
}

/* === Reset === */
* { box-sizing: border-box; margin: 0; padding: 0; }

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

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

img, svg { display: block; max-width: 100%; }

button { font-family: inherit; }

/* === Typography === */
h1 { font-size: 1.5rem; font-weight: 700; line-height: 1.25; letter-spacing: -0.01em; }
h2 { font-size: 1.25rem; font-weight: 700; line-height: 1.3; letter-spacing: -0.005em; }
h3 { font-size: 1rem; font-weight: 600; }

.text-muted { color: var(--text-muted); }
.text-sm    { font-size: 0.875rem; }
.text-xs    { font-size: 0.75rem; }
.font-mono  { font-family: var(--font-mono); }

/* === Buttons === */
.btn {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: var(--radius);
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 160ms ease, transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  white-space: nowrap;
  text-decoration: none;
}
.btn:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}
.btn-primary:active { transform: translateY(0); box-shadow: var(--shadow-sm); }

.btn-accent {
  background: var(--accent);
  color: #fff;
}
.btn-accent:hover {
  background: var(--accent-dark);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.btn-secondary {
  background: #fff;
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover {
  border-color: #cbd5e1;
  background: #F8FAFC;
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}
.btn-danger:hover { filter: brightness(0.95); }

.btn-block { width: 100%; }
.btn-lg { padding: 0.9375rem 1.75rem; font-size: 1rem; }
.btn-sm { padding: 0.5rem 0.875rem; font-size: 0.8125rem; }

.btn .icon { width: 18px; height: 18px; flex: none; }

/* === Cards === */
.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: var(--space-md);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}
.card-lg { padding: var(--space-lg); }
.card-pad-sm { padding: var(--space-sm); }

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-sm);
}
.card-title { font-size: 1rem; font-weight: 600; }

/* === Inputs === */
.input, .select, .textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.9375rem;
  font-family: inherit;
  color: var(--text);
  background: #fff;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}
.input::placeholder { color: #94A3B8; }

.field { margin-bottom: var(--space-sm); }
.field label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.375rem;
}

/* === Badges === */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.25rem 0.625rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.badge-primary { background: var(--primary-light); color: var(--primary-dark); }
.badge-success { background: #D1FAE5; color: #065F46; }
.badge-warning { background: #FEF3C7; color: #92400E; }
.badge-danger  { background: #FEE2E2; color: #991B1B; }
.badge-muted   { background: #F1F5F9; color: #475569; }

/* === Tables === */
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
}
.table th, .table td {
  padding: 0.875rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.table th {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  background: #F8FAFC;
}
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: #F8FAFC; }

/* === Alerts === */
.alert {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  border: 1px solid;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.alert-error   { background: #FEF2F2; border-color: #FECACA; color: #991B1B; }
.alert-success { background: #F0FDF4; border-color: #BBF7D0; color: #166534; }
.alert-info    { background: #E8F4FA; border-color: #B3DBED; color: #075177; }

/* === Utility === */
.flex     { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-xs { gap: var(--space-xs); }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }

.grid { display: grid; gap: var(--space-md); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }

/* === Spinner === */
.spinner {
  width: 1rem; height: 1rem;
  border: 2px solid rgba(255,255,255,0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 600ms linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* === Icon-Buttons (klein) für Stammdaten-Listen === */
.icon-btn-sm {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 32px; height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  margin-left: 0.25rem;
  transition: color 160ms ease, border-color 160ms ease;
}
.icon-btn-sm:hover { color: var(--text); border-color: #cbd5e1; }
.icon-btn-sm.danger:hover { color: var(--danger); border-color: var(--danger); }
.icon-btn-sm svg { width: 16px; height: 16px; }
.icon-btn-sm:disabled { opacity: 0.4; cursor: not-allowed; }

/* === Checkbox-Rows === */
.checkbox-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0;
}
.checkbox-row input[type="checkbox"] { width: 18px; height: 18px; cursor: pointer; }

/* === Tabellen-Wrap === */
.table-wrap { overflow-x: auto; }

/* === Focus-Ring (Accessibility) === */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: 4px;
}
