/* ============================================================
   VanIQ – Design System & Styleguide v1
   Primärfarben: Dunkelblau #1B2E4B | Signalblau #2563EB
   Schrift: Inter (Google Fonts)
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Montserrat:wght@700;800&display=swap');

/* ── CSS Custom Properties (Design Tokens) ── */
:root {
  --color-primary:       #1B2E4B;
  --color-accent:        #2563EB;
  --color-accent-light:  #3B82F6;
  --color-accent-dark:   #1D4ED8;
  --color-success:       #16A34A;
  --color-warning:       #D97706;
  --color-danger:        #DC2626;
  --color-bg:            #F4F6F9;
  --color-surface:       #FFFFFF;
  --color-border:        #E2E8F0;
  --color-text:          #1E293B;
  --color-text-muted:    #64748B;
  --color-text-light:    #94A3B8;

  --font-sans:    'Inter', system-ui, sans-serif;
  --font-display: 'Montserrat', 'Inter', sans-serif;

  --radius-sm:   6px;
  --radius-md:   10px;
  --radius-lg:   16px;
  --radius-full: 9999px;

  --shadow-sm:  0 1px 3px rgba(0,0,0,.08);
  --shadow-md:  0 4px 16px rgba(27,46,75,.10);
  --shadow-lg:  0 8px 32px rgba(27,46,75,.14);

  --transition: 0.18s ease;
  --sidebar-w:  260px;
}

/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: var(--font-sans);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  min-height: 100vh;
}
a { color: var(--color-accent); text-decoration: none; }
a:hover { color: var(--color-accent-dark); }
img, svg { max-width: 100%; display: block; }

/* ── Typography ── */
h1, h2, h3, h4, h5 {
  font-family: var(--font-display);
  color: var(--color-primary);
  line-height: 1.25;
}
h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.2rem; }
p  { color: var(--color-text); }
.text-muted  { color: var(--color-text-muted); font-size: .9rem; }
.text-small  { font-size: .8rem; }
.text-center { text-align: center; }

/* ── Layout ── */
.app-layout {
  display: flex;
  min-height: 100vh;
}
.sidebar {
  width: var(--sidebar-w);
  background: var(--color-primary);
  color: #fff;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: transform var(--transition);
}
.sidebar-logo {
  padding: 24px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,.1);
}
.sidebar-logo img { height: 36px; }
.sidebar-nav {
  flex: 1;
  padding: 16px 0;
  overflow-y: auto;
}
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 20px;
  color: rgba(255,255,255,.75);
  font-size: .92rem;
  font-weight: 500;
  border-radius: 0;
  transition: background var(--transition), color var(--transition);
}
.sidebar-nav a:hover,
.sidebar-nav a.active {
  background: rgba(255,255,255,.1);
  color: #fff;
}
.sidebar-nav a.active {
  border-left: 3px solid var(--color-accent-light);
}
.sidebar-nav .nav-icon { font-size: 1.1rem; width: 20px; text-align: center; }
.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,.1);
  font-size: .8rem;
  color: rgba(255,255,255,.4);
}
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
.topbar {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  padding: 0 28px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-sm);
}
.topbar-title { font-weight: 600; font-size: 1rem; color: var(--color-primary); }
.topbar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: .88rem;
  color: var(--color-text-muted);
}
.avatar {
  width: 34px; height: 34px;
  background: var(--color-accent);
  border-radius: var(--radius-full);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: .85rem;
}
.page-content {
  padding: 28px;
  flex: 1;
}

/* ── Cards ── */
.card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-border);
  padding: 24px;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.card-title { font-size: 1rem; font-weight: 600; color: var(--color-primary); }
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}
.stat-card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  padding: 20px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-sm);
}
.stat-icon {
  width: 48px; height: 48px;
  border-radius: var(--radius-md);
  background: rgba(37,99,235,.1);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem;
  color: var(--color-accent);
  flex-shrink: 0;
}
.stat-value { font-size: 1.6rem; font-weight: 700; color: var(--color-primary); }
.stat-label { font-size: .82rem; color: var(--color-text-muted); }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
  text-decoration: none;
}
.btn:active { transform: scale(.97); }
.btn-primary {
  background: var(--color-accent);
  color: #fff;
  box-shadow: 0 2px 8px rgba(37,99,235,.25);
}
.btn-primary:hover { background: var(--color-accent-dark); color: #fff; }
.btn-secondary {
  background: var(--color-bg);
  color: var(--color-primary);
  border: 1px solid var(--color-border);
}
.btn-secondary:hover { background: var(--color-border); }
.btn-danger { background: var(--color-danger); color: #fff; }
.btn-sm { padding: 6px 12px; font-size: .82rem; }
.btn-lg { padding: 13px 28px; font-size: 1rem; }
.btn-full { width: 100%; justify-content: center; }

/* ── Forms ── */
.form-group { margin-bottom: 18px; }
.form-label {
  display: block;
  font-size: .85rem;
  font-weight: 600;
  color: var(--color-primary);
  margin-bottom: 6px;
}
.form-control {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: .92rem;
  color: var(--color-text);
  background: var(--color-surface);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}
.form-control:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}
.form-control::placeholder { color: var(--color-text-light); }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 100px; }

/* ── Tables ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
thead th {
  background: var(--color-bg);
  color: var(--color-text-muted);
  font-weight: 600;
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--color-border);
}
tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text);
}
tbody tr:hover { background: rgba(37,99,235,.03); }
tbody tr:last-child td { border-bottom: none; }

/* ── Badges ── */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: .75rem;
  font-weight: 600;
}
.badge-blue    { background: rgba(37,99,235,.1);  color: var(--color-accent); }
.badge-green   { background: rgba(22,163,74,.1);  color: var(--color-success); }
.badge-yellow  { background: rgba(217,119,6,.1);  color: var(--color-warning); }
.badge-red     { background: rgba(220,38,38,.1);  color: var(--color-danger); }
.badge-gray    { background: var(--color-bg);     color: var(--color-text-muted); }

/* ── Chat ── */
.chat-layout {
  display: flex;
  height: calc(100vh - 60px);
  overflow: hidden;
}
.chat-sidebar {
  width: 240px;
  border-right: 1px solid var(--color-border);
  background: var(--color-surface);
  overflow-y: auto;
  flex-shrink: 0;
}
.chat-sidebar-header {
  padding: 16px;
  border-bottom: 1px solid var(--color-border);
  font-weight: 600;
  font-size: .9rem;
  color: var(--color-primary);
}
.chat-session-item {
  padding: 12px 16px;
  border-bottom: 1px solid var(--color-border);
  cursor: pointer;
  font-size: .85rem;
  color: var(--color-text);
  transition: background var(--transition);
}
.chat-session-item:hover,
.chat-session-item.active { background: rgba(37,99,235,.06); }
.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.chat-bubble {
  max-width: 75%;
  padding: 14px 18px;
  border-radius: var(--radius-lg);
  font-size: .92rem;
  line-height: 1.65;
}
.chat-bubble.user {
  background: var(--color-accent);
  color: #fff;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}
.chat-bubble.assistant {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  color: var(--color-text);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
  box-shadow: var(--shadow-sm);
}
.chat-bubble.assistant .bubble-meta {
  font-size: .75rem;
  color: var(--color-text-muted);
  margin-top: 8px;
}
.chat-input-area {
  padding: 16px 24px;
  border-top: 1px solid var(--color-border);
  background: var(--color-surface);
  display: flex;
  gap: 12px;
  align-items: flex-end;
}
.chat-input {
  flex: 1;
  padding: 12px 16px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-lg);
  font-family: var(--font-sans);
  font-size: .92rem;
  resize: none;
  outline: none;
  max-height: 120px;
  transition: border-color var(--transition);
}
.chat-input:focus { border-color: var(--color-accent); }
.chat-send-btn {
  width: 44px; height: 44px;
  background: var(--color-accent);
  border: none;
  border-radius: var(--radius-md);
  color: #fff;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background var(--transition);
  flex-shrink: 0;
}
.chat-send-btn:hover { background: var(--color-accent-dark); }

/* ── Auth Pages ── */
.auth-page {
  min-height: 100vh;
  background: linear-gradient(135deg, var(--color-primary) 0%, #243B6E 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.auth-card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 40px;
  width: 100%;
  max-width: 420px;
}
.auth-logo { margin-bottom: 28px; }
.auth-title { font-size: 1.4rem; margin-bottom: 6px; }
.auth-subtitle { color: var(--color-text-muted); font-size: .9rem; margin-bottom: 28px; }
.auth-divider {
  text-align: center;
  color: var(--color-text-muted);
  font-size: .85rem;
  margin: 16px 0;
  position: relative;
}
.auth-divider::before, .auth-divider::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 42%;
  height: 1px;
  background: var(--color-border);
}
.auth-divider::before { left: 0; }
.auth-divider::after { right: 0; }

/* ── Alerts ── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: .9rem;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.alert-error   { background: rgba(220,38,38,.08);  color: var(--color-danger);  border: 1px solid rgba(220,38,38,.2); }
.alert-success { background: rgba(22,163,74,.08);  color: var(--color-success); border: 1px solid rgba(22,163,74,.2); }
.alert-info    { background: rgba(37,99,235,.08);  color: var(--color-accent);  border: 1px solid rgba(37,99,235,.2); }

/* ── Upload Zone ── */
.upload-zone {
  border: 2px dashed var(--color-border);
  border-radius: var(--radius-lg);
  padding: 40px;
  text-align: center;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
}
.upload-zone:hover,
.upload-zone.drag-over {
  border-color: var(--color-accent);
  background: rgba(37,99,235,.04);
}
.upload-icon { font-size: 2.5rem; margin-bottom: 12px; }
.upload-text { color: var(--color-text-muted); font-size: .9rem; }

/* ── Progress ── */
.progress-bar {
  height: 6px;
  background: var(--color-border);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--color-accent);
  border-radius: var(--radius-full);
  transition: width .4s ease;
}

/* ── Loading Spinner ── */
.spinner {
  width: 20px; height: 20px;
  border: 2.5px solid rgba(37,99,235,.2);
  border-top-color: var(--color-accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Responsive ── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .page-content { padding: 16px; }
  .card-grid { grid-template-columns: 1fr; }
  .chat-sidebar { display: none; }
  .chat-bubble { max-width: 90%; }
}

/* ── Utility ── */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-4 { gap: 16px; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.hidden { display: none !important; }
.w-full { width: 100%; }
