/* ═══════════════════════════════════════════════════════════════
   ALMAS INDUSTRIES — Design System v2.0 (ALMAS-Industrie-Look)
   2026-05-21 · Override-Layer auf almas-design.css v1
   Lädt NACH almas-design.css damit Token überschreiben.
   ═══════════════════════════════════════════════════════════════ */

/* ─── FONTS ─── */
@import url('https://rsms.me/inter/inter.css');
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600&display=swap');

/* ─── TOKEN OVERRIDES (Industrie-Look) ─── */
:root {
  /* Schriften */
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  /* Radien — kantiger, technischer */
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --radius-xl: 12px;

  /* Brand-Skala — Anthrazit-Header statt Schwarz */
  --almas-anthracite: #1F1F23;
  --almas-anthracite-2: #2A2A2F;
  --almas-anthracite-3: #3A3A40;
  --bg-sidebar: var(--almas-anthracite);
  --bg-sidebar-active: rgba(208, 19, 23, 0.18);

  /* Akzent-Bar Stärke */
  --accent-bar-width: 3px;

  /* Status-Pills */
  --pill-bg-success: #DCFCE7; --pill-fg-success: #166534;
  --pill-bg-warning: #FEF3C7; --pill-fg-warning: #92400E;
  --pill-bg-danger:  #FEE2E2; --pill-fg-danger:  #991B1B;
  --pill-bg-info:    #DBEAFE; --pill-fg-info:    #1E40AF;
  --pill-bg-neutral: #F1F1F2; --pill-fg-neutral: #3F3F46;

  /* Tap-Targets */
  --tap-target: 44px;

  /* Bottom-Bar */
  --bottom-bar-height: 64px;
  --bottom-bar-bg: var(--almas-anthracite);
}

@supports (font-variation-settings: normal) {
  :root { --font-family: 'Inter var', -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif; }
}

/* ─── BODY/HEADINGS ─── */
body {
  font-family: var(--font-family);
  font-feature-settings: 'cv11', 'ss01';
  font-variant-numeric: tabular-nums;
}
.text-h1, .text-h2, .text-h3 { letter-spacing: -0.02em; font-weight: 600; }

/* ─── ZAHLEN-KLASSE ─── */
.num, .stat-value, .almas-table .num,
.dash-stat-card .v, .tech-route-stats b,
.kpi-num, .pool-badge {
  font-family: var(--font-mono);
  font-feature-settings: 'tnum', 'zero';
}

/* ─── SIDEBAR (Industrie-Polish) ─── */
.almas-sidebar {
  background: var(--bg-sidebar);
  border-right: 1px solid var(--almas-anthracite-3);
}
.almas-sidebar a, aside.almas-sidebar a {
  position: relative;
  border-radius: 0;
  border-left: var(--accent-bar-width) solid transparent;
  margin: 1px 0;
  padding: 10px 14px 10px calc(14px - var(--accent-bar-width));
  transition: background 120ms, border-color 120ms;
  letter-spacing: 0.01em;
}
.almas-sidebar a:hover {
  background: rgba(255, 255, 255, 0.05);
  border-left-color: var(--almas-anthracite-3);
}
.almas-sidebar a.active {
  background: var(--bg-sidebar-active);
  border-left-color: var(--almas-red);
  color: #fff;
  font-weight: 600;
}
.almas-sidebar-header {
  border-bottom: 1px solid var(--almas-anthracite-3);
  background: var(--almas-anthracite-2);
}

/* ─── BUTTONS (kantiger) ─── */
.almas-btn {
  border-radius: var(--radius-md);
  font-weight: 500;
  letter-spacing: 0.005em;
  min-height: 36px;
}
.almas-btn-sm { min-height: 32px; }
.almas-btn-primary {
  background: var(--almas-red);
  border-color: var(--almas-red);
}
.almas-btn-primary:hover { background: var(--almas-red-hover); }
.almas-btn-ghost {
  background: var(--bg-secondary);
  border: 1px solid var(--border-primary);
  color: var(--text-primary);
}
.almas-btn-ghost:hover { background: var(--bg-tertiary); }
.almas-btn-secondary {
  background: var(--almas-anthracite);
  border-color: var(--almas-anthracite);
  color: #fff;
}
.almas-btn-secondary:hover { background: var(--almas-anthracite-2); }

/* ─── CARDS ─── */
.almas-card, .dash-stat-card, .tech-route-card {
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-secondary);
  box-shadow: var(--shadow-sm);
}

/* ─── STAT-CARDS (Industrie-Look) ─── */
.dash-stat-card {
  position: relative;
  background: var(--bg-secondary);
  padding: 14px 16px;
  display: flex; flex-direction: column; gap: 4px;
  overflow: hidden;
}
.dash-stat-card::before {
  content: '';
  position: absolute; top: 0; left: 0; bottom: 0;
  width: var(--accent-bar-width);
  background: var(--almas-red);
}
.dash-stat-card .v {
  font-size: 24px; font-weight: 600;
  font-family: var(--font-mono);
  letter-spacing: -0.02em;
  color: var(--text-primary);
}
.dash-stat-card .l {
  font-size: 10px; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--text-tertiary);
  font-weight: 600;
}

/* ─── TABS (Industrie-Look) ─── */
.tab-btn {
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 12px;
  border-bottom: 2px solid transparent;
  padding: 10px 4px;
}
.tab-btn.active { border-bottom-color: var(--almas-red); color: var(--almas-red); }

/* ─── PILLS ─── */
.pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: var(--radius-sm);
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.04em;
  background: var(--pill-bg-neutral); color: var(--pill-fg-neutral);
}
.pill.success { background: var(--pill-bg-success); color: var(--pill-fg-success); }
.pill.warning { background: var(--pill-bg-warning); color: var(--pill-fg-warning); }
.pill.danger  { background: var(--pill-bg-danger);  color: var(--pill-fg-danger); }
.pill.info    { background: var(--pill-bg-info);    color: var(--pill-fg-info); }

/* Pool-Badge als Pill */
.pool-badge {
  background: var(--almas-anthracite);
  color: #fff;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-weight: 500;
  letter-spacing: 0.02em;
  padding: 6px 12px;
}

/* ─── TABELLEN ─── */
.almas-table {
  font-size: 13px;
  border-collapse: separate; border-spacing: 0;
}
.almas-table th {
  background: var(--bg-tertiary);
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-tertiary); font-weight: 600;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-secondary);
}
.almas-table td { padding: 10px 12px; border-bottom: 1px solid var(--border-secondary); }
.almas-table tr:last-child td { border-bottom: 0; }
.almas-table tr:hover td { background: rgba(0,0,0,0.015); }

/* ─── INPUTS ─── */
input[type="text"], input[type="email"], input[type="password"], input[type="search"],
input[type="week"], input[type="date"], input[type="time"], select, textarea {
  border-radius: var(--radius-md);
  border: 1px solid var(--border-primary);
  padding: 10px 12px;
  font-family: inherit; font-size: 14px;
  background: var(--bg-secondary); color: var(--text-primary);
  min-height: 40px;
  transition: border-color 120ms, box-shadow 120ms;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--almas-red);
  box-shadow: 0 0 0 3px var(--almas-red-light);
}

/* ─── MODAL ─── */
.almas-modal {
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
}

/* ─── VERSION-BADGE ─── */
.version-badge {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.04em;
  background: var(--almas-anthracite-2);
  color: #9c9c9c;
  border: 1px solid var(--almas-anthracite-3);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
}
.version-badge:hover { color: #fff; }

/* ═══════════════════════════════════════════════════════════════
   MOBILE-FIRST KOMPONENTEN (Bottom-Bar, Day-Switcher)
   ═══════════════════════════════════════════════════════════════ */

/* v1-Burger ausblenden — wir haben den eigenen im Header */
.almas-menu-toggle, .almas-menu-overlay { display: none !important; }

/* ─── BURGER (Mobile-Toggle) ─── */
.almas-burger {
  display: none;
  width: 40px; height: 40px;
  border: 1px solid var(--border-secondary);
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  font-size: 18px; cursor: pointer;
  align-items: center; justify-content: center;
  margin-right: 12px;
}
.almas-burger:hover { background: var(--bg-tertiary); }
@media (max-width: 768px) {
  .almas-burger { display: inline-flex; }
  .almas-header { gap: 8px; align-items: center; }
}

/* Backdrop wenn Sidebar offen */
body.sidebar-open::after {
  content: '';
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 105;
  animation: backdrop-in 200ms;
}
@keyframes backdrop-in { from { opacity: 0 } to { opacity: 1 } }
body.sidebar-open { overflow: hidden; }

/* ─── BOTTOM-ACTION-BAR (Mobile) ─── */
.almas-bottom-bar {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--bottom-bar-height);
  background: var(--bottom-bar-bg);
  border-top: 1px solid var(--almas-anthracite-3);
  z-index: 100;
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
  gap: 8px;
  align-items: center;
  justify-content: space-around;
  box-shadow: 0 -4px 16px rgba(0,0,0,0.12);
}
.almas-bottom-bar button, .almas-bottom-bar a {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px;
  min-height: var(--tap-target);
  background: transparent;
  color: #d1d1d6;
  border: 0;
  cursor: pointer;
  font-size: 10px; font-weight: 500;
  letter-spacing: 0.02em;
  text-decoration: none;
  border-radius: var(--radius-md);
  padding: 4px;
  transition: background 120ms, color 120ms;
}
.almas-bottom-bar button:hover, .almas-bottom-bar a:hover { background: rgba(255,255,255,0.06); color: #fff; }
.almas-bottom-bar button.active, .almas-bottom-bar a.active {
  background: rgba(208,19,23,0.18);
  color: #fff;
}
.almas-bottom-bar .icon { font-size: 20px; line-height: 1; }
.almas-bottom-bar .primary {
  background: var(--almas-red);
  color: #fff;
  font-weight: 600;
}
.almas-bottom-bar .primary:hover { background: var(--almas-red-hover); }

/* ─── TAG-SWITCHER für Route-Kalender (rcal) ─── */
.rcal-day-switcher {
  display: none;
  gap: 6px;
  margin: 8px 0 6px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 4px;
}
.rcal-day-switcher button {
  flex: 1; min-width: 56px;
  min-height: var(--tap-target);
  background: var(--bg-secondary);
  border: 1px solid var(--border-secondary);
  border-radius: var(--radius-md);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 1px; padding: 4px 6px;
  font-family: var(--font-family);
  cursor: pointer;
  position: relative;
  transition: background 120ms, border-color 120ms;
}
.rcal-day-switcher button .dsw-day {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
}
.rcal-day-switcher button .dsw-date {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}
.rcal-day-switcher button .dsw-cnt {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-tertiary);
}
.rcal-day-switcher button.has-stops { border-color: var(--almas-red-border); }
.rcal-day-switcher button.active {
  background: var(--almas-red);
  border-color: var(--almas-red);
}
.rcal-day-switcher button.active .dsw-day,
.rcal-day-switcher button.active .dsw-date,
.rcal-day-switcher button.active .dsw-cnt { color: #fff; }
.rcal-day-switcher button:disabled { opacity: 0.4; cursor: not-allowed; }

@media (max-width: 768px) {
  .rcal-day-switcher { display: flex; }
  /* Auf Mobile: nur die aktive Tag-Spalte zeigen */
  .rcal-grid {
    grid-template-columns: 50px 1fr !important;
    overflow-x: hidden !important;
  }
  .rcal-grid .rcal-day { display: none; }
  .rcal-grid[data-active-day="0"] .rcal-day[data-day-idx="0"],
  .rcal-grid[data-active-day="1"] .rcal-day[data-day-idx="1"],
  .rcal-grid[data-active-day="2"] .rcal-day[data-day-idx="2"],
  .rcal-grid[data-active-day="3"] .rcal-day[data-day-idx="3"],
  .rcal-grid[data-active-day="4"] .rcal-day[data-day-idx="4"] { display: block; }
}

/* ─── TAG-SWITCHER (Mobile statt Mo-Fr-Grid) ─── */
.almas-day-switcher {
  display: none;
  position: sticky; top: 0;
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border-secondary);
  padding: 8px;
  gap: 4px;
  z-index: 10;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.almas-day-switcher button {
  flex: 1; min-width: 60px;
  min-height: var(--tap-target);
  background: var(--bg-secondary);
  border: 1px solid var(--border-secondary);
  border-radius: var(--radius-md);
  font-family: var(--font-family);
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 2px;
  padding: 4px;
}
.almas-day-switcher button .day-num {
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}
.almas-day-switcher button.active {
  background: var(--almas-red);
  border-color: var(--almas-red);
  color: #fff;
}
.almas-day-switcher button.active .day-num { color: #fff; }
.almas-day-switcher button.has-stops::after {
  content: ''; width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--almas-red);
  position: absolute; bottom: 6px;
}
.almas-day-switcher button.active.has-stops::after { background: #fff; }

/* ═══════════════════════════════════════════════════════════════
   MOBILE-RULES
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  /* Body bekommt unten Platz für Bottom-Bar */
  body { padding-bottom: calc(var(--bottom-bar-height) + env(safe-area-inset-bottom)); }

  /* Bottom-Bar sichtbar */
  .almas-bottom-bar { display: flex; }

  /* Day-Switcher sichtbar */
  .almas-day-switcher { display: flex; }

  /* Größere Tap-Targets */
  .almas-btn { min-height: var(--tap-target); padding: 10px 14px; font-size: 14px; }
  .almas-btn-sm { min-height: 40px; padding: 8px 12px; }

  /* Sidebar als Drawer (von links) */
  .almas-sidebar {
    transform: translateX(-100%);
    transition: transform 250ms cubic-bezier(0.4,0,0.2,1);
    z-index: 110;
    box-shadow: 4px 0 24px rgba(0,0,0,0.2);
  }
  .almas-sidebar.open { transform: translateX(0); }

  /* Page-Title kompakt */
  .almas-page-title { font-size: 18px; }

  /* Stat-Cards stark verkleinert */
  .dash-stat-card { padding: 10px 12px; }
  .dash-stat-card .v { font-size: 18px; }
  .dash-stat-card .l { font-size: 9px; }
}

/* Extra-small Phones */
@media (max-width: 480px) {
  .almas-modal { max-height: 100vh; border-radius: 0; }
  .almas-modal-body { padding: 16px; }
}
