/* =========================================================================
   Hearth – gemeinsames Stylesheet
   Ästhetik: dunkles "Control Room", Lime-Akzent, technische Typografie
   ========================================================================= */

@import url('https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,400..800&family=DM+Sans:ital,opsz,wght@0,9..40,400..700;1,9..40,400&family=JetBrains+Mono:wght@400;500;700&display=swap');

:root {
  --bg: #0c0e0d;
  --bg-soft: #131613;
  --panel: #181c1a;
  --panel-2: #1f2421;
  --border: #2a302c;
  --border-bright: #3a423d;
  --text: #e9efe9;
  --text-dim: #9aa79c;
  --text-faint: #6a766d;
  --accent: #c4f042;
  --accent-dim: #8fae3a;
  --accent-glow: rgba(196, 240, 66, 0.14);
  --danger: #ff6b5e;
  --danger-bg: rgba(255, 107, 94, 0.12);
  --ok: #58d68d;
  --warn: #f5c451;
  --radius: 14px;
  --radius-sm: 9px;
  --font-display: 'Bricolage Grotesque', sans-serif;
  --font-body: 'DM Sans', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --shadow: 0 18px 50px -18px rgba(0, 0, 0, 0.7);
}

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

html,
body {
  height: 100%;
}

html {
  /* Reserve scrollbar space permanently so the layout never shifts
     when switching between short tabs (no scrollbar) and long ones (store). */
  scrollbar-gutter: stable;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg);
  background-image: radial-gradient(
      circle at 12% 8%,
      rgba(196, 240, 66, 0.05),
      transparent 38%
    ),
    radial-gradient(circle at 88% 92%, rgba(88, 214, 141, 0.04), transparent 42%);
  background-attachment: fixed;
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100%;
}

/* feine Raster-Textur im Hintergrund */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(rgba(255, 255, 255, 0.015) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.015) 1px, transparent 1px);
  background-size: 44px 44px;
  z-index: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

select option {
  background: var(--panel-2);
  color: var(--text);
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border-bright);
  border-radius: 10px;
}

/* ---------- Layout-Wrapper ---------- */
.wrap {
  position: relative;
  z-index: 1;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ---------- Topbar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(14px);
  background: rgba(12, 14, 13, 0.82);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  display: flex;
  align-items: center;
  gap: 18px;
  height: 64px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 20px;
  letter-spacing: -0.02em;
}
.brand .flame {
  width: 28px;
  height: 28px;
  border-radius: 9px;
  box-shadow: 0 0 22px var(--accent-glow);
  display: block;
  flex-shrink: 0;
}
/* ── SVG icon system ── */
.icon {
  display: inline-block;
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  vertical-align: middle;
  flex-shrink: 0;
}
.icon-sm  { width: 13px; height: 13px; }
.icon-md  { width: 18px; height: 18px; }
.icon-lg  { width: 20px; height: 20px; }
.icon-xl  { width: 24px; height: 24px; }

.brand small {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-left: 2px;
}
.spacer {
  flex: 1;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 15px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-bright);
  background: var(--panel-2);
  color: var(--text);
  font-weight: 600;
  font-size: 13.5px;
  cursor: pointer;
  transition: all 0.16s ease;
  white-space: nowrap;
}
.btn:hover {
  border-color: var(--accent-dim);
  transform: translateY(-1px);
}
.btn:active {
  transform: translateY(0);
}
.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #0c0e0d;
}
.btn.primary:hover {
  box-shadow: 0 0 24px var(--accent-glow);
}
.btn.danger {
  color: var(--danger);
  border-color: rgba(255, 107, 94, 0.4);
}
.btn.danger:hover {
  background: var(--danger-bg);
  border-color: var(--danger);
}
.btn.ghost {
  background: transparent;
  border-color: transparent;
}
.btn.ghost:hover {
  background: var(--panel-2);
  border-color: var(--border);
}
.btn.sm {
  padding: 6px 11px;
  font-size: 12.5px;
}
.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

/* ---------- Pills / Badges ---------- */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  padding: 3px 9px;
  border-radius: 30px;
  border: 1px solid var(--border);
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.pill .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-faint);
}
.pill.running {
  color: var(--ok);
  border-color: rgba(88, 214, 141, 0.35);
}
.pill.running .dot {
  background: var(--ok);
  box-shadow: 0 0 8px var(--ok);
}
.pill.stopped {
  color: var(--text-faint);
}

/* ---------- Cards / Panels ---------- */
.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* ---------- Inputs ---------- */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}
.field label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-dim);
}
.input,
select.input,
textarea.input {
  width: 100%;
  padding: 10px 13px;
  background: var(--bg-soft);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius-sm);
  color: var(--text);
  transition: border-color 0.15s ease;
  font-size: 14px;
}
.input:focus,
textarea.input:focus,
select.input:focus {
  outline: none;
  border-color: var(--accent-dim);
}
.input::placeholder {
  color: var(--text-faint);
}
textarea.input {
  resize: vertical;
  min-height: 70px;
  font-family: var(--font-mono);
  font-size: 13px;
}

/* ---------- Toast ---------- */
#toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.toast {
  background: var(--panel-2);
  border: 1px solid var(--border-bright);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 13px 16px;
  min-width: 240px;
  max-width: 360px;
  box-shadow: var(--shadow);
  animation: toastIn 0.25s ease;
  font-size: 13.5px;
}
.toast.error {
  border-left-color: var(--danger);
}
.toast.ok {
  border-left-color: var(--ok);
}
@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
}

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 60px 20px;
  overflow-y: auto;
}
.modal-backdrop.open {
  display: flex;
}
.modal {
  width: 100%;
  max-width: 620px;
  background: var(--panel);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  animation: modalIn 0.22s ease;
}
@keyframes modalIn {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.99);
  }
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
}
.modal-head h3 {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
}
.modal-body {
  padding: 22px;
}
.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 22px;
  border-top: 1px solid var(--border);
}

.muted {
  color: var(--text-dim);
}
.mono {
  font-family: var(--font-mono);
}
.empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-faint);
}
.empty .big {
  font-size: 42px;
  margin-bottom: 12px;
  opacity: 0.5;
}

/* =========================================================================
   Dateimanager – CasaOS-inspiriertes Layout
   ========================================================================= */

/* Toolbar nav buttons */
.fm-nav-btns {
  display: flex;
  gap: 2px;
  margin-left: 8px;
}

/* Two-column layout */
.fm-layout {
  display: flex;
  gap: 0;
  height: calc(100vh - 190px);
  min-height: 360px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--panel);
}

/* Sidebar */
.fm-sidebar {
  width: 190px;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 12px 0;
  background: var(--bg-soft);
}

.fm-sidebar-section {
  margin-bottom: 8px;
}

.fm-sidebar-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
  padding: 0 14px 6px;
}

.fm-vol-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-dim);
  transition: background 0.12s, color 0.12s;
  border-left: 2px solid transparent;
}
.fm-vol-item:hover {
  background: var(--panel-2);
  color: var(--text);
}
.fm-vol-item.active {
  background: var(--accent-glow);
  color: var(--accent);
  border-left-color: var(--accent);
}

.fm-vol-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.7;
}
.fm-vol-item.active .fm-vol-icon {
  opacity: 1;
}

.fm-vol-info {
  flex: 1;
  min-width: 0;
}

.fm-vol-name {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 13px;
}

.fm-vol-usage {
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--text-faint);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fm-vol-bar {
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  margin-top: 4px;
}

.fm-vol-bar-fill {
  height: 100%;
  background: var(--accent-dim);
  border-radius: 2px;
  transition: width 0.4s ease;
}
.fm-vol-item.active .fm-vol-bar-fill {
  background: var(--accent);
}

/* Main area */
.fm-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Breadcrumbs */
.crumbs {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 2px;
  padding: 9px 14px;
  font-size: 13px;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border);
  background: var(--bg-soft);
  flex-shrink: 0;
}
.crumbs a {
  color: var(--text-dim);
  padding: 3px 7px;
  border-radius: 5px;
  transition: background 0.12s, color 0.12s;
  font-weight: 500;
}
.crumbs a:hover {
  background: var(--panel-2);
  color: var(--text);
}
.crumb-sep {
  color: var(--text-faint);
  padding: 0 1px;
}

/* Dropzone */
.dropzone {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  margin: 8px 8px 4px;
  border: 1.5px dashed var(--border-bright);
  border-radius: var(--radius-sm);
  color: var(--text-faint);
  cursor: pointer;
  font-size: 12.5px;
  transition: all 0.15s;
  flex-shrink: 0;
}
.dropzone:hover,
.dropzone.drag {
  border-color: var(--accent-dim);
  background: var(--accent-glow);
  color: var(--accent);
}

/* File list */
.fm-list {
  flex: 1;
  overflow-y: auto;
  padding: 4px 0 8px;
}

/* File row */
.fm-file-row {
  display: grid;
  grid-template-columns: 38px 1fr auto auto;
  align-items: center;
  gap: 10px;
  padding: 6px 14px 6px 10px;
  cursor: pointer;
  border-radius: var(--radius-sm);
  margin: 1px 6px;
  transition: background 0.1s;
}
.fm-file-row:hover {
  background: var(--panel-2);
}

/* File icon box */
.fm-file-icon {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 9px;
  background: var(--panel-2);
  color: var(--text-faint);
  flex-shrink: 0;
  transition: background 0.1s;
}
.fm-file-row:hover .fm-file-icon { background: var(--border); }

.fm-file-icon.dir  { color: var(--accent);  background: var(--accent-glow); }
.fm-file-icon.img  { color: #a78bfa; background: rgba(167, 139, 250, 0.13); }
.fm-file-icon.vid  { color: #f87171; background: rgba(248, 113, 113, 0.13); }
.fm-file-icon.aud  { color: #34d399; background: rgba(52,  211, 153, 0.13); }
.fm-file-icon.arc  { color: var(--warn); background: rgba(245, 196, 81, 0.13); }
.fm-file-icon.code { color: #60a5fa; background: rgba(96,  165, 250, 0.13); }
.fm-file-icon.doc  { color: #f9a8d4; background: rgba(249, 168, 212, 0.13); }

.fm-file-name {
  font-size: 13.5px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fm-file-meta {
  font-size: 11.5px;
  color: var(--text-faint);
  font-family: var(--font-mono);
  white-space: nowrap;
  text-align: right;
}

.fm-file-actions {
  display: flex;
  gap: 3px;
  opacity: 0;
  transition: opacity 0.15s;
}
.fm-file-row:hover .fm-file-actions {
  opacity: 1;
}

/* iconbtn reuse */
.iconbtn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 5px;
  color: var(--text-dim);
  font-size: 14px;
  transition: background 0.12s, color 0.12s;
}
.iconbtn:hover {
  background: var(--border);
  color: var(--text);
}
.iconbtn.danger:hover {
  background: var(--danger-bg);
  color: var(--danger);
}

/* ── Hearth Mini-Spinner (laufendes Licht am Dreieck) ─────────────────────── */
.hearth-spin {
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
  overflow: visible;
}
.hs-bg  { fill: var(--accent); opacity: 0.08; }
.hs-run {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2.2;
  stroke-linejoin: round;
  stroke-dasharray: 26 53;
  animation: hs-orbit 1.1s linear infinite;
}
@keyframes hs-orbit {
  from { stroke-dashoffset: 79; }
  to   { stroke-dashoffset: 0;  }
}
/* Container für Spinner + Text */
.hearth-loading {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-faint);
  font-size: 13px;
  padding: 6px 0;
}
