/* ============================================================
   DPR Corporate Design – CallMate
   DPR Deutscher Prüfdienst für Betriebssicherheit GmbH
   ============================================================ */

:root {
  /* Primärfarben */
  --primary:        #0dd18c;
  --primary-dark:   #0aaa72;
  --primary-deep:   #088a5c;
  --primary-soft:   #d0f7eb;
  --primary-glow:   rgba(13, 209, 140, 0.18);

  /* Hintergründe */
  --bg-page:        #f4f5f7;
  --bg-card:        #ffffff;
  --bg-dark:        #0f1923;
  --bg-hatch:       #e8eaed;
  --bg-input:       #f8fafc;

  /* Text */
  --text-1:         #1a2332;
  --text-2:         #5a6a7a;
  --text-3:         #8a9bac;
  --text-on-dark:   #ffffff;
  --text-topbar:    rgba(255, 255, 255, 0.88);

  /* Rahmen */
  --border-card:    #eaecef;
  --border-default: #e2e6ea;

  /* Schatten */
  --shadow-card:    0 4px 20px rgba(0, 0, 0, 0.07);
  --shadow-card-h:  0 8px 32px rgba(13, 209, 140, 0.15);
  --shadow-modal:   0 20px 60px rgba(0, 0, 0, 0.25);
  --shadow-topbar:  0 2px 16px rgba(0, 0, 0, 0.25);

  /* Animation */
  --ease:           cubic-bezier(0.4, 0, 0.2, 1);
  --ease-bounce:    cubic-bezier(0.34, 1.56, 0.64, 1);

  /* Legacy-Aliase (damit app.js-Klassen wie text-lime, bg-bg, bg-panel etc. funktionieren) */
  --bg: var(--bg-page);
  --panel: var(--bg-card);
  --panel-2: var(--bg-page);
  --border: var(--border-card);
  --border-hover: var(--border-default);
  --lime: var(--primary);
  --lime-dark: var(--primary-dark);
  --text: var(--text-1);
  --muted: var(--text-2);
}

* { box-sizing: border-box; }

html, body {
  background: var(--bg-page);
  color: var(--text-1);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-weight: 400;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

/* Scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d4d8de; border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: #b8bec7; }

/* ===========================================================
   Tailwind-Override: app.js verwendet noch Klassen wie
   bg-bg, bg-panel, text-text, text-muted, text-lime, border-border
   etc.  Da der Tailwind-CDN-Build diese mit den ALTEN Hex-Werten
   compiliert, müssen wir sie hart auf DPR-Werte zurückbiegen.
   =========================================================== */
.bg-bg            { background-color: var(--bg-page) !important; }
.bg-panel         { background-color: var(--bg-card) !important; }
.bg-panel2        { background-color: var(--bg-page) !important; }
.bg-lime          { background-color: var(--primary) !important; }
.text-text        { color: var(--text-1) !important; }
.text-muted       { color: var(--text-2) !important; }
.text-lime        { color: var(--primary-deep) !important; }
.text-bg          { color: var(--text-on-dark) !important; }
.border-border    { border-color: var(--border-card) !important; }
.border-borderHover { border-color: var(--border-default) !important; }
.hover\:bg-panel2:hover { background-color: var(--bg-page) !important; }
.hover\:text-text:hover { color: var(--text-1) !important; }
.hover\:border-borderHover:hover { border-color: var(--text-3) !important; }

/* Heading-Aliase aus app.js */
h1.text-lime, .text-lime.text-2xl { color: var(--text-1) !important; }

/* =========================================================
   Karten / Panels
   ========================================================= */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: 18px;
  box-shadow: var(--shadow-card);
  transition: box-shadow 0.22s var(--ease), border-color 0.22s var(--ease), transform 0.22s var(--ease);
}
.card:hover { border-color: var(--border-default); }

.card-2 {
  background: var(--bg-page);
  border: 1px solid var(--border-card);
  border-radius: 12px;
}

.metric-card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: 18px;
  padding: 24px 20px;
  box-shadow: var(--shadow-card);
  transition: box-shadow 0.22s var(--ease), transform 0.22s var(--ease);
}
.metric-card:hover {
  box-shadow: var(--shadow-card-h);
  transform: translateY(-2px);
}

/* =========================================================
   Buttons
   ========================================================= */
.btn-primary {
  background: var(--primary);
  color: #ffffff;
  font-weight: 600;
  border-radius: 8px;
  padding: 9px 20px;
  font-size: 14px;
  box-shadow: 0 2px 8px rgba(13, 209, 140, 0.3);
  transition: all 0.22s var(--ease);
  border: none;
  cursor: pointer;
}
.btn-primary:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(13, 209, 140, 0.4);
}
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  background: transparent;
  border: 1px solid var(--border-card);
  color: var(--text-1);
  border-radius: 8px;
  padding: 9px 20px;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.22s var(--ease);
  cursor: pointer;
}
.btn-secondary:hover {
  background: #f1f5f9;
  border-color: var(--border-default);
}

.btn-purple {
  background: var(--bg-dark);
  color: var(--text-on-dark);
  font-weight: 600;
  border-radius: 8px;
  padding: 9px 20px;
  font-size: 14px;
  border: none;
  cursor: pointer;
  transition: all 0.22s var(--ease);
}
.btn-purple:hover { background: #1a2638; transform: translateY(-1px); }

/* =========================================================
   Inputs & Selects
   ========================================================= */
.input, .textarea, .select {
  width: 100%;
  background: var(--bg-input);
  border: 1.5px solid var(--border-card);
  color: var(--text-1);
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: all 0.22s var(--ease);
}
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.input:focus, .textarea:focus, .select:focus {
  border-color: var(--primary);
  background: var(--bg-card);
  box-shadow: 0 0 0 3px rgba(13, 209, 140, 0.12);
}
.textarea { resize: vertical; min-height: 100px; }

/* =========================================================
   Tab-Pills
   ========================================================= */
.tab-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  border-radius: 999px;
  font-size: 14px;
  color: var(--text-2);
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.22s var(--ease);
}
.tab-pill:hover { color: var(--text-1); background: #f1f5f9; }
.tab-pill.active {
  background: var(--primary);
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(13, 209, 140, 0.3);
}

/* =========================================================
   TOPBAR – Sticky Navy mit DPR-Grünen Strich darunter
   ========================================================= */
.dpr-topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  height: 60px;
  background: var(--bg-dark);
  border-bottom: 2px solid var(--primary);
  box-shadow: var(--shadow-topbar);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 20px;
  color: var(--text-topbar);
}
.dpr-topbar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
}
.dpr-topbar-logo {
  width: 34px; height: 34px;
  border-radius: 8px;
  background: var(--primary);
  display: flex; align-items: center; justify-content: center;
  color: #ffffff;
  font-weight: 700;
  font-size: 15px;
  box-shadow: 0 2px 8px var(--primary-glow);
}
.dpr-topbar-title {
  color: var(--text-on-dark);
  font-weight: 700;
  font-size: 15px;
  line-height: 1.1;
}
.dpr-topbar-sub {
  color: rgba(255,255,255,0.6);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.3px;
  margin-top: 2px;
}
.dpr-topbar-meta {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 18px;
  font-size: 13px;
  color: var(--text-topbar);
}
.dpr-topbar-meta .status-dot {
  display: inline-block;
  width: 8px; height: 8px;
  background: var(--primary);
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(13, 209, 140, 0.25);
  animation: pulseDot 2s infinite;
}
.dpr-topbar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 10px 4px 4px;
  background: rgba(255,255,255,0.06);
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.22s var(--ease);
}
.dpr-topbar-user:hover { background: rgba(255,255,255,0.12); }
.dpr-topbar-user .avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 11px;
}

/* =========================================================
   SIDEBAR (links, helles Layout)
   ========================================================= */
.dpr-sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--bg-card);
  border-right: 1px solid var(--border-card);
  min-height: calc(100vh - 60px);
  display: flex;
  flex-direction: column;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 8px;
  color: var(--text-2);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.22s var(--ease);
  text-decoration: none;
}
.sidebar-item:hover {
  color: var(--text-1);
  background: var(--bg-page);
}
.sidebar-item.active {
  color: var(--primary-deep);
  background: var(--primary-soft);
  font-weight: 600;
}
.sidebar-item.active i { color: var(--primary-deep); }

.sidebar-sub {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 14px 7px 38px;
  border-radius: 6px;
  color: var(--text-3);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.22s var(--ease);
  text-decoration: none;
}
.sidebar-sub:hover { color: var(--text-1); background: var(--bg-page); }
.sidebar-sub.active {
  color: var(--primary-deep);
  font-weight: 600;
  background: var(--primary-soft);
}

/* =========================================================
   Tags / Badges
   ========================================================= */
.tag {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  background: var(--primary-soft);
  color: var(--primary-deep);
}

.tag-mitarbeiter {
  background: #eef2ff;
  color: #4f46e5;
}
.tag-warn { background: #fef9ec; color: #b45309; }
.tag-info { background: #fffbeb; color: #d97706; }
.tag-danger { background: #fef2f2; color: #dc2626; }
.tag-news { background: #ecfdf5; color: #059669; }
.tag-termin { background: #eef2ff; color: #4f46e5; }

.dot-online {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 0 3px rgba(13, 209, 140, 0.25);
  animation: pulseDot 2s infinite;
}

/* =========================================================
   Icon-Badges
   ========================================================= */
.icon-badge {
  width: 48px; height: 48px;
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  background: var(--primary);
  color: #ffffff;
  font-weight: 700;
  box-shadow: 0 2px 8px var(--primary-glow);
}

.icon-badge-soft {
  width: 40px; height: 40px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  background: var(--primary-soft);
  color: var(--primary-deep);
  flex-shrink: 0;
}
.flex-col { flex-direction: column; }

.icon-badge-purple { background: #eef2ff; color: #4f46e5; }
.icon-badge-blue   { background: #e0f2fe; color: #0369a1; }
.icon-badge-orange { background: #fef3c7; color: #b45309; }
.icon-badge-red    { background: #fee2e2; color: #dc2626; }

/* =========================================================
   Modals
   ========================================================= */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(10, 18, 30, 0.6);
  backdrop-filter: blur(4px);
  z-index: 50;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  animation: fadeIn 0.22s var(--ease);
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: 24px;
  width: 100%;
  max-width: 720px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-modal);
  animation: slideUp 0.32s var(--ease-bounce);
}

.modal-side {
  background: var(--bg-card);
  border-left: 1px solid var(--border-card);
  height: 100vh;
  width: 420px;
  margin-left: auto;
  overflow-y: auto;
  box-shadow: var(--shadow-modal);
  animation: slideIn 0.25s var(--ease);
}

@keyframes slideIn { from { transform: translateX(100%); } to { transform: translateX(0); } }
@keyframes slideUp { from { transform: translateY(40px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes fadeIn  { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes pulseDot {
  0%, 100% { transform: scale(1); opacity: 1; }
  50%      { transform: scale(0.85); opacity: 0.6; }
}
@keyframes spin { to { transform: rotate(360deg); } }

/* =========================================================
   Flow Editor
   ========================================================= */
.flow-canvas {
  position: relative;
  background:
    radial-gradient(circle at 1px 1px, rgba(13, 209, 140, 0.18) 1px, transparent 0);
  background-size: 24px 24px;
  background-color: var(--bg-page);
  border-radius: 18px;
  min-height: 520px;
  overflow: hidden;
  border: 1px solid var(--border-card);
}

.flow-node {
  position: absolute;
  width: 220px;
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: 12px;
  padding: 12px 14px;
  cursor: pointer;
  box-shadow: var(--shadow-card);
  transition: all 0.22s var(--ease);
  z-index: 2;
}
.flow-node:hover { border-color: var(--primary); box-shadow: var(--shadow-card-h); }
.flow-node.selected {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow), var(--shadow-card-h);
}

.flow-node-header {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.flow-node.goal     .flow-node-header { color: var(--primary-deep); }
.flow-node.transfer .flow-node-header { color: #b45309; }
.flow-node.tool     .flow-node-header { color: #0369a1; }
.flow-node.end      .flow-node-header { color: #dc2626; }

.flow-node-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-1);
  margin-bottom: 4px;
}
.flow-node-desc {
  font-size: 11px;
  color: var(--text-2);
  line-height: 1.4;
}

.flow-edge-label {
  position: absolute;
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 10px;
  color: var(--text-1);
  z-index: 3;
  white-space: nowrap;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

/* =========================================================
   Voice-Cards
   ========================================================= */
.voice-card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: 12px;
  padding: 12px 14px;
  display: flex; align-items: center; gap: 10px;
  cursor: pointer;
  box-shadow: var(--shadow-card);
  transition: all 0.22s var(--ease);
}
.voice-card:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-card-h);
}
.voice-card.selected {
  border-color: var(--primary);
  background: var(--primary-soft);
  box-shadow: 0 0 0 2px var(--primary-glow);
}

.voice-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
  color: #ffffff;
  font-weight: 600;
}

/* =========================================================
   Toggle / Segmented
   ========================================================= */
.toggle {
  position: relative;
  width: 40px; height: 22px;
  background: #d4d8de;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.22s var(--ease);
}
.toggle.on { background: var(--primary); }
.toggle::after {
  content: '';
  position: absolute;
  top: 3px; left: 3px;
  width: 16px; height: 16px;
  background: #ffffff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
  transition: transform 0.22s var(--ease);
}
.toggle.on::after { transform: translateX(18px); }

.segmented {
  display: flex;
  background: var(--bg-input);
  border: 1px solid var(--border-card);
  border-radius: 8px;
  padding: 4px;
  gap: 2px;
}
.segmented > button {
  flex: 1;
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 13px;
  color: var(--text-2);
  background: transparent;
  border: none;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.22s var(--ease);
}
.segmented > button.active {
  background: var(--primary);
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 2px 6px rgba(13, 209, 140, 0.3);
}
.segmented > button:hover:not(.active) { color: var(--text-1); }

/* =========================================================
   Chat Bubbles
   ========================================================= */
.chat-bubble-bot {
  background: var(--bg-page);
  border: 1px solid var(--border-card);
  border-radius: 14px;
  padding: 10px 14px;
  font-size: 13px;
  color: var(--text-1);
  max-width: 80%;
}
.chat-bubble-user {
  background: var(--primary);
  color: #ffffff;
  border-radius: 14px;
  padding: 10px 14px;
  font-size: 13px;
  max-width: 80%;
  margin-left: auto;
  font-weight: 500;
}

/* =========================================================
   Brand-Logo Text (ersetzt das alte Lime/Purple-Gradient)
   ========================================================= */
.gradient-logo {
  color: var(--text-on-dark);
  font-weight: 700;
  letter-spacing: -0.3px;
}

/* =========================================================
   Tabellen
   ========================================================= */
table.callmate-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-card);
}
table.callmate-table thead th {
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--text-3);
  padding: 14px 18px;
  background: var(--bg-page);
  border-bottom: 1px solid var(--border-card);
}
table.callmate-table tbody td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-card);
  font-size: 14px;
  color: var(--text-1);
}
table.callmate-table tbody tr:last-child td { border-bottom: none; }
table.callmate-table tbody tr {
  transition: background 0.22s var(--ease);
}
table.callmate-table tbody tr:hover { background: var(--bg-page); cursor: pointer; }

/* =========================================================
   Empty / Spinner
   ========================================================= */
.empty-state {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 60px 20px;
  color: var(--text-2);
  text-align: center;
}
.empty-state i { font-size: 36px; margin-bottom: 12px; color: var(--text-3); }
.empty-state .font-medium { color: var(--text-1); }

.spinner {
  border: 3px solid var(--primary-soft);
  border-top-color: var(--primary);
  border-radius: 50%;
  width: 28px; height: 28px;
  animation: spin 0.8s linear infinite;
}

/* =========================================================
   Eyebrow / Hero Text
   ========================================================= */
.eyebrow {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.8px;
  color: var(--primary-deep);
}

.dpr-hero-title {
  font-size: clamp(22px, 3.5vw, 32px);
  font-weight: 700;
  color: var(--text-1);
  line-height: 1.2;
  letter-spacing: -0.5px;
}

/* =========================================================
   Animations utility classes
   ========================================================= */
.fade-in-up { animation: fadeInUp 0.5s var(--ease) both; }

/* =========================================================
   Responsive
   ========================================================= */
@media (max-width: 768px) {
  .dpr-topbar { height: 56px; padding: 0 16px; }
  .dpr-topbar-sub { display: none; }
  .dpr-sidebar { display: none; }
  .modal-side { width: 100%; }
}

@media (hover: none) {
  .card:hover, .metric-card:hover, .voice-card:hover, .flow-node:hover {
    transform: none;
  }
  .card:active, .metric-card:active, .voice-card:active {
    transform: scale(0.97);
  }
}
