/* ═══════════════════════════════════════════════════════════════════════
   3D-DRUCK WIKI – Globales Stylesheet
   Wird auf allen Seiten als <link rel="stylesheet" href="styles.css"> eingebunden.
   Enthält: CSS-Variablen, Topbar, Mobile-Nav, generische Buttons,
            Theme-Toggle, Modal-Basics, Toasts, Form-Elemente.
   Seitenspezifisches CSS (Tabellen, Charts, Hub-Layout etc.) bleibt
   im jeweiligen HTML.
   ═══════════════════════════════════════════════════════════════════════ */

:root {
  --accent:#f97316; --accent-soft:rgba(249,115,22,.15); --accent-hover:#ea6c0a;
  --bg:#0f1117; --bg-secondary:#161b27; --surface:#1c2233; --surface-2:#232b3e;
  --border:rgba(255,255,255,.08); --border-soft:rgba(255,255,255,.04);
  --text:#f0f2f7; --text-muted:#8892a4; --text-faint:#4d5668;
  --success:#22c55e; --success-soft:rgba(34,197,94,.15);
  --warning:#f59e0b; --warning-soft:rgba(245,158,11,.15);
  --danger:#ef4444;  --danger-soft:rgba(239,68,68,.15);
  --info:#3b82f6;    --info-soft:rgba(59,130,246,.15);
  --neutral:#8892a4; --neutral-soft:rgba(136,146,164,.15);
  --primary:#f97316; --primary-soft:rgba(249,115,22,.15);
  --radius-sm:6px; --radius:12px; --radius-lg:18px; --radius-xl:24px;
  --shadow:0 4px 24px rgba(0,0,0,.5);
  --font:'Manrope',system-ui,sans-serif;
  --transition:.2s cubic-bezier(.4,0,.2,1);
}

[data-theme="light"] {
  --bg:#f4f6fb; --bg-secondary:#eef0f7; --surface:#ffffff; --surface-2:#f0f2f9;
  --border:rgba(0,0,0,.08); --border-soft:rgba(0,0,0,.04);
  --text:#0f1117; --text-muted:#5a657a; --text-faint:#9ba5b5;
  --shadow:0 4px 16px rgba(0,0,0,.08);
  --muted:#5a657a; --faint:#9ba5b5;
}

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 15px;
  line-height: 1.6;
  transition: background var(--transition), color var(--transition);
}

a { color: var(--accent); text-decoration: none; }

button, input, textarea, select { font-family: var(--font); }

/* ═══════════════════════════════════════════════════════════════════════
   TOPBAR
   ═══════════════════════════════════════════════════════════════════════ */
.topbar {
  position: sticky; top: 0; z-index: 200;
  background: #161b27;
  border-bottom: 1px solid rgba(255,255,255,.08);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
[data-theme="light"] .topbar {
  background: #ffffff;
  border-bottom-color: rgba(0,0,0,.09);
}

.topbar-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 20px;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 10px;
  overflow-x: auto;
  scrollbar-width: none;
  position: relative;
}
.topbar-inner::-webkit-scrollbar { display: none; }

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: 'Montserrat', 'Manrope', system-ui, sans-serif;
  font-weight: 400;
  font-size: 16px;
  color: #f0f2f7;
  letter-spacing: 1px;
  white-space: nowrap;
  flex-shrink: 0;
  text-decoration: none;
  text-transform: uppercase;
}
[data-theme="light"] .topbar-brand { color: #0f1117; }

.brand-icon {
  width: 27px; height: 27px;
  background: #f97316;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
  line-height: 1;
}

.topbar-sep {
  width: 1px; height: 20px;
  background: rgba(255,255,255,.08);
  margin: 0 2px;
  flex-shrink: 0;
}
[data-theme="light"] .topbar-sep { background: rgba(0,0,0,.1); }

.nav-links {
  display: flex;
  align-items: center;
  gap: 2px;
  list-style: none;
  flex-wrap: nowrap;
  margin: 0;
  padding: 0;
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}
.nav-links a {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 5px 9px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  color: #8892a4;
  transition: background .18s, color .18s;
  white-space: nowrap;
  text-decoration: none;
}
[data-theme="light"] .nav-links a { color: #5a657a; }
.nav-links a:hover {
  background: rgba(255,255,255,.07);
  color: #f0f2f7;
}
[data-theme="light"] .nav-links a:hover {
  background: rgba(0,0,0,.05);
  color: #0f1117;
}
.nav-links a.nav-active {
  background: rgba(249,115,22,.15);
  color: #f97316;
}

.topbar-right {
  margin-left: auto;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ═══════════════════════════════════════════════════════════════════════
   THEME TOGGLE
   ═══════════════════════════════════════════════════════════════════════ */
.theme-btn {
  width: 34px; height: 34px;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  color: #f0f2f7;
  transition: background .18s;
  line-height: 1;
}
[data-theme="light"] .theme-btn {
  border-color: rgba(0,0,0,.1);
  color: #0f1117;
}
.theme-btn:hover { background: rgba(255,255,255,.07); }
[data-theme="light"] .theme-btn:hover { background: rgba(0,0,0,.05); }

.icon-sun { display: none; }
[data-theme="dark"] .icon-moon { display: none; }
[data-theme="dark"] .icon-sun { display: block; }

/* ═══════════════════════════════════════════════════════════════════════
   HAMBURGER + MOBILE NAV
   ═══════════════════════════════════════════════════════════════════════ */
.hamburger {
  display: none;
  width: 34px; height: 34px;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  flex-shrink: 0;
}
[data-theme="light"] .hamburger { border-color: rgba(0,0,0,.1); }

.hamburger span {
  display: block;
  width: 14px; height: 2px;
  background: #f0f2f7;
  border-radius: 2px;
  transition: all .2s;
}
[data-theme="light"] .hamburger span { background: #0f1117; }

.mobile-nav {
  display: none;
  position: fixed;
  inset: 56px 0 0 0;
  z-index: 190;
  background: rgba(0,0,0,.7);
  backdrop-filter: blur(4px);
}
.mobile-nav.open { display: block; }

.mobile-nav-inner {
  background: #161b27;
  border-bottom: 1px solid rgba(255,255,255,.08);
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
[data-theme="light"] .mobile-nav-inner {
  background: #fff;
  border-bottom-color: rgba(0,0,0,.09);
}

.mobile-nav-inner a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  color: #8892a4;
  text-decoration: none;
  transition: background .15s, color .15s;
}
[data-theme="light"] .mobile-nav-inner a { color: #5a657a; }
.mobile-nav-inner a:hover,
.mobile-nav-inner a.nav-active {
  background: rgba(249,115,22,.15);
  color: #f97316;
}

@media (max-width: 700px) {
  .nav-links { display: none !important; }
  .hamburger { display: flex; }
}

/* ═══════════════════════════════════════════════════════════════════════
   GENERISCHE BUTTONS
   ═══════════════════════════════════════════════════════════════════════ */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius);
  border: none;
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background var(--transition);
  white-space: nowrap;
}
.btn-primary:hover { background: var(--accent-hover); }

.btn-ghost {
  padding: 9px 18px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: transparent;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
}
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }

.btn-save {
  padding: 9px 22px;
  border-radius: var(--radius);
  border: none;
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background var(--transition);
}
.btn-save:hover { background: var(--accent-hover); }
.btn-save:disabled { opacity: .5; cursor: default; }

/* ═══════════════════════════════════════════════════════════════════════
   MODAL BASICS
   ═══════════════════════════════════════════════════════════════════════ */
.modal-bg {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.7);
  backdrop-filter: blur(4px);
  z-index: 500;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-bg.open { display: flex; }

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow);
}

.modal-head {
  padding: 22px 26px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 1;
}

.modal-title {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -.3px;
}

.modal-close {
  width: 30px; height: 30px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: transparent;
  cursor: pointer;
  font-size: 15px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-close:hover { background: var(--surface-2); color: var(--text); }

.modal-body { padding: 22px 26px; }

.modal-foot {
  padding: 14px 26px 22px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  border-top: 1px solid var(--border);
  align-items: center;
}

/* ═══════════════════════════════════════════════════════════════════════
   FORM ELEMENTE (in Modals)
   ═══════════════════════════════════════════════════════════════════════ */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.form-full { grid-column: 1 / -1; }

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.field label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}
.field input,
.field select,
.field textarea {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-size: 13px;
  color: var(--text);
  outline: none;
  transition: border-color var(--transition);
  font-family: var(--font);
}
.field input:focus,
.field select:focus,
.field textarea:focus { border-color: var(--accent); }

.field select option { background: var(--bg-secondary); }
.field textarea { resize: vertical; min-height: 64px; }

@media (max-width: 600px) {
  .form-grid { grid-template-columns: 1fr; }
}

/* ═══════════════════════════════════════════════════════════════════════
   TOAST
   ═══════════════════════════════════════════════════════════════════════ */
.toast {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 600;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 18px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--shadow);
  transform: translateY(20px);
  opacity: 0;
  transition: all .3s cubic-bezier(.4,0,.2,1);
  pointer-events: none;
}
.toast.show { transform: translateY(0); opacity: 1; }
.toast.success { border-left: 3px solid var(--success); }
.toast.warning { border-left: 3px solid var(--warning); }

/* ═══════════════════════════════════════════════════════════════════════
   LOGIN OVERLAY (genutzt von Filament-DB, Projekt-DB, Statistik)
   ═══════════════════════════════════════════════════════════════════════ */
.login-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 400;
  background: var(--bg);
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.login-overlay.show { display: flex; }

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 36px 28px;
  width: 100%;
  max-width: 380px;
  text-align: center;
  box-shadow: 0 24px 80px rgba(0,0,0,.4);
}

.login-logo {
  width: 56px; height: 56px;
  background: var(--accent);
  color: #fff;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  margin: 0 auto 18px;
}

.login-card h2 {
  font-size: 21px;
  font-weight: 800;
  letter-spacing: -.4px;
  margin: 0 0 6px;
}

.login-card .sub {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0 0 22px;
}

.login-input {
  width: 100%;
  box-sizing: border-box;
  padding: 12px 14px;
  margin-bottom: 10px;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 16px;
  font-family: var(--font);
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  transition: border-color .2s;
}
.login-input:focus { border-color: var(--accent); }

.login-btn {
  width: 100%;
  box-sizing: border-box;
  padding: 12px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  font-family: var(--font);
  -webkit-appearance: none;
  appearance: none;
  transition: background .2s;
}
.login-btn:hover { background: var(--accent-hover); }

.login-error {
  font-size: 12px;
  color: var(--danger);
  margin: 0 0 8px;
  min-height: 16px;
}

/* User-Anzeige in Topbar */
.topbar-user {
  display: none;
  align-items: center;
  gap: 8px;
}
.topbar-user-email {
  font-size: 11px;
  color: var(--text-faint);
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}
.btn-logout {
  padding: 5px 10px;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,.08);
  background: transparent;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  font-family: var(--font);
}
[data-theme="light"] .btn-logout { border-color: rgba(0,0,0,.1); }
.btn-logout:hover { background: var(--surface-2); color: var(--text); }
