/* ============================================================
   layout.css — 1:1 from original LiveScatter3D/wwwroot/index.html
   ============================================================ */

/* Fill full viewport — same as original */
html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
}

#app {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100vh;
  min-height: 600px;
  overflow: hidden;
}

/* ── Header ── */
#header {
  display: flex; align-items: center; gap: 12px;
  height: 40px;
  padding: 0 12px 0 calc(170px + 12px);
  background: var(--bg-card);
  border-bottom: 1px solid var(--line);
  flex-shrink: 0; z-index: 10;
}


/* ── Header icon buttons ── */
.hdr-icon-btn {
  display: flex; align-items: center; gap: 6px;
  height: 30px; padding: 0 10px;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 4px;
  font-size: 12px; color: var(--txt-soft);
  cursor: pointer; white-space: nowrap;
  transition: background .12s, border-color .12s, color .12s;
  font-family: 'Segoe UI', sans-serif;
}
.hdr-icon-btn:hover {
  background: var(--bg-main);
  border-color: #b8c8da;
  color: var(--txt-main);
}
body.dark-mode .hdr-icon-btn:hover { border-color: #555; }
.hdr-btn-icon {
  font-family: 'Segoe MDL2 Assets', sans-serif;
  font-size: 14px; line-height: 1;
}
.hdr-btn-label { font-size: 12px; font-weight: 600; }

/* Connect = grün wenn verbunden */
.hdr-connect.connected {
  border-color: var(--ok);
  color: var(--ok);
}
.hdr-connect.connected:hover {
  background: var(--ok-bg);
  border-color: var(--ok);
}

/* Dark mode active state */
.hdr-icon-btn.dm-active {
  background: #23272e;
  border-color: #444c55;
  color: #e8edf3;
}
.hdr-icon-btn.dm-active:hover {
  background: #2c3139;
  border-color: #5a6370;
}
#device-select-wrap { position: relative; }
#device-select-btn {
  display: flex; align-items: center; gap: 8px;
  height: 30px; padding: 0 12px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 4px;
  font-size: 12px; color: var(--txt-main);
  cursor: pointer; white-space: nowrap; min-width: 200px;
  transition: background .12s, border-color .12s;
}
#device-select-btn:hover { background: #f0f4f8; border-color: #b8c8da; }
body.dark-mode #device-select-btn:hover { background: #2a2a2a; border-color: #444; }
.conn-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--txt-muted); flex-shrink: 0; }
.conn-dot.ok  { background: var(--ok); }
.conn-dot.err { background: var(--error); }
#device-select-btn .device-name { flex: 1; text-align: left; }
#device-select-btn .chevron { font-size: 9px; color: var(--txt-muted); font-family: 'Segoe MDL2 Assets', sans-serif; }

#device-dropdown {
  display: none; position: absolute; top: calc(100% + 4px); right: 0;
  min-width: 240px; background: var(--bg-card);
  border: 1px solid var(--line); border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0,0,0,.10); z-index: 100; overflow: hidden;
}
#device-dropdown.open { display: block; }
.device-dropdown-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; font-size: 12px; color: var(--txt-main);
  cursor: pointer; transition: background .1s;
}
.device-dropdown-item:hover { background: #f5f7fa; }
body.dark-mode .device-dropdown-item:hover { background: #2a2a2a; }
.device-dropdown-sep { height: 1px; background: var(--line); margin: 4px 0; }
.device-dropdown-add {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; font-size: 12px; color: var(--brand);
  font-weight: 600; cursor: pointer; transition: background .1s;
}
.device-dropdown-add:hover { background: #f0f0f0; }
body.dark-mode .device-dropdown-add:hover { background: #2a2a2a; }
.device-dropdown-forget {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 12px; font-size: 11px; color: #888;
  cursor: pointer; transition: background .1s;
}
.device-dropdown-forget:hover { background: #fde8e8; color: #d13438; }
body.dark-mode .device-dropdown-forget:hover { background: #2d1414; color: var(--error); }

/* ── Body ── */
#body { display: flex; flex: 1; min-height: 0; overflow: hidden; }

/* ── Sidebar ── */
#sidebar {
  width: 170px; flex-shrink: 0;
  background: var(--bg-card);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column; overflow: hidden;
}
.nav-group { display: flex; flex-direction: column; padding: 4px 0; }
.nav-sep { height: 1px; background: var(--line); margin: 2px 10px; }
.nav-item {
  display: flex; align-items: center; gap: 8px;
  height: 32px; padding: 0 10px 0 12px;
  font-size: 12px; color: var(--txt-soft);
  cursor: pointer; border-left: 3px solid transparent;
  transition: background .1s, color .1s;
  user-select: none; text-decoration: none;
}
.nav-item:hover { background: #f5f7fa; color: var(--txt-main); }
body.dark-mode .nav-item:hover { background: #252525; }
.nav-item.active {
  background: #e0e0e0; color: #1a1a1a;
  border-left-color: #555; font-weight: 600;
}
body.dark-mode .nav-item.active {
  background: #303030; color: #e8e8e8;
  border-left-color: #888;
}
.nav-item .nav-icon {
  font-family: 'Segoe MDL2 Assets', sans-serif;
  font-size: 14px; width: 18px; text-align: center; flex-shrink: 0;
}
.nav-item .nav-label { flex: 1; }
.nav-disabled { opacity: 0.35; cursor: not-allowed !important; pointer-events: none; }
.nav-sub { display: none; flex-direction: column; }
.nav-sub.open { display: flex; }
.nav-sub .nav-item { height: 28px; padding-left: 32px; font-size: 11px; }

/* ── Content ── */
#content {
  flex: 1; min-width: 0; min-height: 0;
  display: flex; flex-direction: column;
  overflow: hidden; background: var(--bg-main);
}

/* ── Page ── */
.page { display: none; flex: 1; flex-direction: column; min-height: 0; overflow: hidden; }
.page.active { display: flex; }

/* Overview page: column layout matching original tab structure */
#page-overview { flex-direction: column; }

/* ── Toolbar ── */
.toolbar {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 12px;
  background: rgba(255,255,255,.88);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
body.dark-mode .toolbar { background: rgba(30,30,30,.92); }
.toolbar-sep { flex: 1; }
.toolbar-title {
  font-size: 12px; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--txt-soft);
}

/* ── Empty state ── */
#empty-state { display: flex; flex: 1; align-items: center; justify-content: center; }
.empty-card {
  display: flex; flex-direction: column; align-items: center; gap: 16px;
  padding: 32px 48px; background: var(--bg-card);
  border: 1px solid var(--line); border-radius: 8px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.06); text-align: center;
}
.empty-card-icon { font-family: 'Segoe MDL2 Assets', sans-serif; font-size: 36px; color: var(--txt-muted); }
.empty-card-title { font-size: 13px; font-weight: 600; color: var(--txt-main); }
.empty-card-sub { font-size: 12px; color: var(--txt-muted); max-width: 280px; line-height: 1.5; }

/* ── Status bar ── */
#statusbar {
  height: 40px; display: flex; align-items: center; gap: 6px; padding: 0 12px;
  background: var(--bg-card); border-top: 1px solid var(--line); flex-shrink: 0;
  position: relative;
}
#statusbar-text { font-size: 11px; color: var(--txt-muted); }
#statusbar-sep  { flex: 1; }
#statusbar-copy {
  font-size: 11px; font-weight: 400; color: var(--txt-muted);
  white-space: nowrap; font-family: 'Segoe UI', 'Segoe UI Variable Text', sans-serif;
  position: absolute; left: 50%; transform: translateX(-50%);
}
#statusbar-tg-link {
  font-size: 11px; font-weight: 400; color: var(--txt-muted);
  font-family: 'Segoe UI', 'Segoe UI Variable Text', sans-serif;
  text-decoration: underline; text-underline-offset: 2px;
}
#statusbar-tg-link:hover { color: var(--txt-main); }

/* Icon buttons in statusbar — kleiner als Header-Variante */
.sb-icon-btn {
  display: flex; align-items: center; justify-content: center;
  width: 28px; height: 28px;
  background: transparent; border: 1px solid var(--line); border-radius: 4px;
  color: var(--txt-soft); cursor: pointer;
  transition: background .12s, border-color .12s, color .12s;
}
.sb-icon-btn:hover { background: var(--bg-main); border-color: #b8c8da; color: var(--txt-main); }
body.dark-mode .sb-icon-btn:hover { border-color: #555; }
.sb-icon-btn .hdr-btn-icon { font-size: 13px; line-height: 1; }
.sb-icon-btn.dm-active { background: #23272e; border-color: #444c55; color: #e8edf3; }
