/* ═══════════════════════════════════════════════════════════════════════════
   Kelmaplast Zukunftsentwicklung – Dark Mode CSS
   Port 5080 | zukunft.cerus-projekt.de
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Light Mode (Standard) ────────────────────────────────────────────── */
:root {
  --bg:           #f1f5f9;
  --bg-card:      #ffffff;
  --bg-sidebar:   #f8fafc;
  --bg-input:     #ffffff;
  --border:       #e2e8f0;
  --border-hover: #FF2200;
  --primary:      #FF2200;
  --primary-dim:  #CC1800;
  --accent:       #6366f1;
  --accent-dim:   #4338ca;
  --text:         #0f172a;
  --text-muted:   #475569;
  --text-dim:     #94a3b8;
  --green:        #16a34a;
  --yellow:       #ca8a04;
  --red:          #dc2626;
  --blue:         #2563eb;
  --purple:       #9333ea;
  --teal:         #0d9488;
  --sidebar-w:    240px;
}

/* ── Dark Mode ────────────────────────────────────────────────────────── */
[data-theme=dark] {
  --bg:           #000000;
  --bg-card:      #0a0a0a;
  --bg-sidebar:   #080808;
  --bg-input:     #111111;
  --border:       #1a1a1a;
  --border-hover: #FF2200;
  --primary:      #FF2200;
  --primary-dim:  #CC1800;
  --accent:       #6366f1;
  --accent-dim:   #4338ca;
  --text:         #e2e8f0;
  --text-muted:   #64748b;
  --text-dim:     #475569;
  --green:        #22c55e;
  --yellow:       #eab308;
  --red:          #ef4444;
  --blue:         #3b82f6;
  --purple:       #a855f7;
  --teal:         #14b8a6;
  --sidebar-w:    240px;
}

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

body {
  background: var(--bg);
  color: var(--text);
  transition: background 0.2s, color 0.2s;
  font-family: 'Segoe UI', Arial, sans-serif;
  font-size: 14px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

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

/* ── TOPBAR ─────────────────────────────────────────────────────────────── */
.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 52px;
  background: var(--bg-sidebar);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 14px;
  z-index: 200;
}

.topbar-logo {
  height: 28px;
  opacity: 0.9;
}

.topbar-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.topbar-title span {
  color: var(--primary);
}

.topbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 0.75rem;
  color: var(--text-dim);
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 6px;
}

.role-badge {
  background: #1a1a1a;
  border: 1px solid #2a2a2a;
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 0.68rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.topbar-btn {
  background: transparent;
  border: 1px solid #1e293b;
  color: var(--text-muted);
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 0.73rem;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.topbar-btn:hover { border-color: var(--primary); color: var(--text); }

/* ── SIDEBAR ─────────────────────────────────────────────────────────────── */
.sidebar {
  position: fixed;
  top: 52px;
  left: 0;
  width: var(--sidebar-w);
  bottom: 0;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 16px 0;
  z-index: 100;
}

.nav-section {
  padding: 0 12px;
  margin-bottom: 6px;
}

.nav-label {
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--text-dim);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 8px 8px 4px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 0.8rem;
  color: var(--text-muted);
  transition: background 0.12s, color 0.12s;
  cursor: pointer;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
}

.nav-link:hover, .nav-link.active {
  background: #111;
  color: var(--text);
  text-decoration: none;
}

.nav-link.active {
  color: var(--primary);
  border-left: 3px solid var(--primary);
  padding-left: 7px;
}

.nav-icon { font-size: 1rem; min-width: 18px; text-align: center; }

.nav-divider {
  height: 1px;
  background: var(--border);
  margin: 10px 12px;
}

.nav-external::after {
  content: " ↗";
  font-size: 0.65rem;
  color: var(--text-dim);
}

/* ── MAIN CONTENT ────────────────────────────────────────────────────────── */
.main {
  margin-top: 52px;
  margin-left: var(--sidebar-w);
  padding: 28px 32px;
  flex: 1;
}

/* ── SEITEN-HEADER ───────────────────────────────────────────────────────── */
.page-header {
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 16px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.page-header-left h1 {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.01em;
}

.page-header-left .subtitle {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 3px;
}

.page-header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
}

/* ── BUTTONS ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  border: none;
  letter-spacing: 0.02em;
}

.btn-primary {
  background: var(--primary);
  color: #000;
}
.btn-primary:hover { background: var(--primary-dim); color: #000; text-decoration: none; }

.btn-secondary {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
}
.btn-secondary:hover { border-color: var(--primary); color: var(--text); text-decoration: none; }

.btn-ghost {
  background: transparent;
  color: var(--text-dim);
  font-weight: 400;
}
.btn-ghost:hover { color: var(--text); text-decoration: none; }

.btn-danger {
  background: #450a0a;
  border: 1px solid #7f1d1d;
  color: #fca5a5;
}
.btn-danger:hover { background: #7f1d1d; color: #fff; text-decoration: none; }

.btn-sm { padding: 4px 10px; font-size: 0.72rem; }

/* ── CARDS ───────────────────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
  transition: border-color 0.15s;
}

.card:hover { border-color: var(--border-hover); }
.card-clickable:hover { border-color: var(--border-hover); cursor: pointer; }

.card-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
}

.card-body {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.6;
}

/* ── GRID LAYOUTS ────────────────────────────────────────────────────────── */
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }

@media (max-width: 1200px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 900px)  { .grid-3, .grid-4 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 640px)  { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }

/* ── KPI KACHELN ─────────────────────────────────────────────────────────── */
.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 18px 20px;
  position: relative;
  overflow: hidden;
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
}

.kpi-red::before   { background: var(--red); }
.kpi-green::before { background: var(--green); }
.kpi-blue::before  { background: var(--blue); }
.kpi-yellow::before{ background: var(--yellow); }
.kpi-purple::before{ background: var(--purple); }
.kpi-teal::before  { background: var(--teal); }
.kpi-accent::before{ background: var(--accent); }

.kpi-label {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 8px;
}

.kpi-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
}

.kpi-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ── STATUS BADGES ───────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge-idee         { background: #1a1a2e; color: #a5b4fc; border: 1px solid #3730a3; }
.badge-konzept      { background: #1a1400; color: #fde68a; border: 1px solid #854d0e; }
.badge-planung      { background: #0c1a4a; color: #93c5fd; border: 1px solid #1d4ed8; }
.badge-umsetzung    { background: #052e16; color: #86efac; border: 1px solid #166534; }
.badge-abgeschlossen{ background: #0f172a; color: #64748b; border: 1px solid #1e293b; }
.badge-pausiert     { background: #1a0f00; color: #fb923c; border: 1px solid #9a3412; }

.badge-hoch         { background: #450a0a; color: #fca5a5; border: 1px solid #7f1d1d; }
.badge-mittel       { background: #1a1400; color: #fde68a; border: 1px solid #854d0e; }
.badge-niedrig      { background: #0a1f0f; color: #86efac; border: 1px solid #166534; }

.badge-beobachten   { background: #0f172a; color: #94a3b8; border: 1px solid #334155; }
.badge-testen       { background: #1a1400; color: #fde68a; border: 1px solid #854d0e; }
.badge-einsetzen    { background: #052e16; color: #86efac; border: 1px solid #166534; }
.badge-verwerfen    { background: #450a0a; color: #fca5a5; border: 1px solid #7f1d1d; }

/* ── FORTSCHRITTSBALKEN ──────────────────────────────────────────────────── */
.progress-bar {
  height: 4px;
  background: #1a1a1a;
  border-radius: 2px;
  overflow: hidden;
  margin: 6px 0;
}

.progress-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 2px;
  transition: width 0.3s;
}

.progress-fill.green  { background: var(--green); }
.progress-fill.yellow { background: var(--yellow); }
.progress-fill.blue   { background: var(--blue); }

/* ── TABELLEN ────────────────────────────────────────────────────────────── */
.table-wrapper { overflow-x: auto; }

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
}

.data-table th {
  background: var(--bg-sidebar);
  color: var(--text-muted);
  padding: 10px 14px;
  text-align: left;
  font-weight: 600;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
}

.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid #0a0a0a;
  color: var(--text-muted);
  vertical-align: middle;
}

.data-table tr:hover td { background: var(--bg-sidebar); }

.data-table td.title { color: var(--text); font-weight: 500; }

/* ── FORMS ───────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 18px; }

.form-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.form-ctrl {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid #1e293b;
  color: var(--text);
  padding: 9px 12px;
  border-radius: 6px;
  font-size: 0.82rem;
  font-family: inherit;
  transition: border-color 0.15s;
}

.form-ctrl:focus {
  outline: none;
  border-color: var(--accent);
}

textarea.form-ctrl { min-height: 80px; resize: vertical; }

.form-ctrl option { background: #111; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

/* ── FLASH MELDUNGEN ─────────────────────────────────────────────────────── */
.flash-container {
  position: fixed;
  top: 60px;
  right: 16px;
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 360px;
}

.flash {
  padding: 12px 16px;
  border-radius: 6px;
  font-size: 0.78rem;
  border: 1px solid;
  animation: flash-in 0.2s ease;
}

@keyframes flash-in { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }

.flash-success { background: #052e16; border-color: #166534; color: #86efac; }
.flash-error   { background: #450a0a; border-color: #7f1d1d; color: #fca5a5; }
.flash-info    { background: #0c1a4a; border-color: #1d4ed8; color: #93c5fd; }
.flash-warning { background: #1c1200; border-color: #854d0e; color: #fde68a; }

/* ── DETAIL PANEL ────────────────────────────────────────────────────────── */
.detail-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 24px; align-items: start; }
@media (max-width: 900px) { .detail-grid { grid-template-columns: 1fr; } }

.detail-meta {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
}

.meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid #0a0a0a;
  font-size: 0.78rem;
}

.meta-row:last-child { border-bottom: none; }
.meta-key { color: var(--text-dim); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; }
.meta-val { color: var(--text); text-align: right; }

/* ── RADAR-CHART SEKTION ─────────────────────────────────────────────────── */
.radar-group {
  margin-bottom: 28px;
}

.radar-group-title {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.radar-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  margin-bottom: 6px;
  transition: border-color 0.15s;
}

.radar-item:hover { border-color: #2a2a2a; }

.radar-name { flex: 1; font-size: 0.8rem; color: var(--text); font-weight: 500; }
.radar-desc { font-size: 0.72rem; color: var(--text-muted); flex: 2; }

/* ── LOGIN ───────────────────────────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
}

.login-box {
  width: 380px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 40px 36px;
}

.login-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 32px;
}

.login-logo img { height: 32px; }
.login-logo-text { font-size: 0.82rem; color: var(--text-muted); line-height: 1.3; }
.login-logo-name { font-weight: 700; color: var(--text); font-size: 0.9rem; }

.login-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
}

.login-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 28px;
}

/* ── EMPTY STATE ─────────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-dim);
}

.empty-icon { font-size: 2.5rem; margin-bottom: 12px; }
.empty-title { font-size: 0.9rem; font-weight: 600; color: var(--text-muted); margin-bottom: 6px; }
.empty-desc { font-size: 0.78rem; line-height: 1.6; max-width: 360px; margin: 0 auto 20px; }

/* ── UTILITY ─────────────────────────────────────────────────────────────── */
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mt-32 { margin-top: 32px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.text-muted { color: var(--text-muted); }
.text-dim   { color: var(--text-dim); }
.text-red   { color: var(--red); }
.text-green { color: var(--green); }
.text-yellow{ color: var(--yellow); }
.text-blue  { color: var(--blue); }
.text-right { text-align: right; }
.text-center{ text-align: center; }
.fw-700     { font-weight: 700; }
.font-sm    { font-size: 0.75rem; }

.flex        { display: flex; }
.flex-center { display: flex; align-items: center; }
.gap-8       { gap: 8px; }
.gap-12      { gap: 12px; }
.gap-16      { gap: 16px; }
.flex-1      { flex: 1; }
.ml-auto     { margin-left: auto; }

.divider { height: 1px; background: var(--border); margin: 20px 0; }

/* ── RESPONSIVE ──────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .main { margin-left: 0; padding: 20px 16px; }
  .page-header { flex-direction: column; }
  .detail-grid { grid-template-columns: 1fr; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
}

/* ── Mobile Nav (Hamburger) ──────────────────────────────────────────────── */
.hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  flex-direction: column;
  gap: 5px;
  min-width: 44px;
  min-height: 44px;
  justify-content: center;
  align-items: center;
}
.hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text, #0f172a);
  border-radius: 2px;
  transition: all 0.25s;
}
.hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Touch targets */
.topbar-nav a, .topbar-nav button { min-height: 44px; display: inline-flex; align-items: center; }
#zk-theme-btn { min-width: 44px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; }

@media (max-width: 768px) {
  .hamburger { display: flex; }
  .topbar-nav, nav.topbar-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0; right: 0;
    background: var(--bg-card, #fff);
    border-top: 2px solid var(--primary, #FF2200);
    flex-direction: column;
    padding: 8px 0;
    z-index: 100;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  }
  .topbar-nav.open, nav.topbar-nav.open { display: flex; }
  .topbar-nav a {
    padding: 12px 20px;
    border-bottom: 1px solid var(--border, #e2e8f0);
    min-height: 48px;
  }
  .topbar { position: relative; flex-wrap: nowrap; }
  .topbar-actions { gap: 8px; }
}
