/* =========================================================================
   Lifehub — Application styles
   Builds on colors_and_type.css (NEXTMEDIA Voice tokens)
   ========================================================================= */

* { box-sizing: border-box; }
html, body, #root { height: 100%; }
body {
  background: var(--color-bg);
  color: var(--text-hi);
  overflow: hidden;
  font-feature-settings: "ss01", "cv11";
}

/* Background ambient orbs */
body::before, body::after {
  content: ""; position: fixed; pointer-events: none; z-index: 0;
  width: 600px; height: 600px; border-radius: 50%;
  filter: blur(120px); opacity: 0.15;
}
body::before { background: var(--color-primary); top: -200px; left: -200px; }
body::after { background: #5a06b0; bottom: -200px; right: -200px; }

/* =========================================================================
   App shell
   ========================================================================= */
.app {
  position: relative; z-index: 1;
  display: grid;
  grid-template-columns: 248px 1fr;
  grid-template-rows: 56px 1fr;
  height: 100vh;
}

/* ---------- Sidebar ---------- */
.sidebar {
  grid-row: 1 / span 2; grid-column: 1;
  background: rgba(10, 7, 14, 0.5);
  backdrop-filter: blur(8px);
  border-right: 1px solid var(--color-border);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 12px;
  padding: 18px 16px 18px;
}
.brand-tile {
  width: 32px; height: 32px;
  background: var(--color-primary);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  box-shadow: 0 8px 24px rgba(127,13,242,0.25);
}
.brand-tile .material-symbols-outlined { font-size: 20px; }
.brand-name {
  font-size: 17px; font-weight: 800;
  letter-spacing: -0.01em; color: var(--text-hi);
}
.brand-name span { color: var(--color-primary); }

.sidebar-search {
  margin: 0 12px 12px;
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  cursor: text;
  transition: all 150ms;
}
.sidebar-search:hover { border-color: rgba(127,13,242,0.3); }
.sidebar-search input {
  background: transparent; border: 0; outline: none; flex: 1; min-width: 0;
  color: var(--text-hi); font-size: 13px; font-family: inherit;
}
.sidebar-search input::placeholder { color: var(--text-faint); }
.sidebar-search .material-symbols-outlined { font-size: 16px; color: var(--text-muted); }
.sidebar-search kbd {
  font-size: 10px; font-family: ui-monospace, Menlo, monospace;
  padding: 1px 5px; background: rgba(255,255,255,0.05);
  border: 1px solid var(--color-border); border-radius: 4px;
  color: var(--text-muted);
}

.sidebar-scroll {
  flex: 1; overflow-y: auto;
  padding: 0 12px 12px;
  display: flex; flex-direction: column; gap: 2px;
}
.nav-section-label {
  font-size: 10px; font-weight: 700;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--text-muted);
  padding: 14px 12px 6px;
}
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 12px; border-radius: 10px;
  font-size: 13px; color: var(--text-lo);
  cursor: pointer; transition: all 150ms;
  border: 1px solid transparent;
  font-family: inherit;
  background: transparent;
  width: 100%;
  text-align: left;
}
.nav-item .material-symbols-outlined { font-size: 19px; }
.nav-item:hover { background: rgba(255,255,255,0.04); color: #fff; }
.nav-item.active {
  background: rgba(127,13,242,0.1);
  color: var(--color-primary);
  border-color: rgba(127,13,242,0.2);
  box-shadow: 0 0 0 1px rgba(127,13,242,0.05) inset;
}
.nav-item.active .material-symbols-outlined { color: var(--color-primary); }
.nav-count {
  margin-left: auto;
  font-size: 11px; font-weight: 600;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.nav-item.active .nav-count { color: var(--color-primary); }

.sidebar-foot {
  margin: 0 12px 12px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 12px;
  display: flex; align-items: center; gap: 10px;
}
.sidebar-foot .avatar {
  width: 32px; height: 32px; border-radius: 999px;
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-light));
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 12px;
}
.sidebar-foot .meta { flex: 1; min-width: 0; }
.sidebar-foot .meta .name { font-size: 13px; font-weight: 600; color: var(--text-hi); }
.sidebar-foot .meta .sub { font-size: 11px; color: var(--text-muted); }
.sidebar-foot .iconbtn { background: transparent; border: 0; color: var(--text-lo); cursor: pointer; padding: 4px; border-radius: 6px; display: flex; }
.sidebar-foot .iconbtn:hover { color: #fff; background: rgba(255,255,255,0.04); }

/* ---------- Header ---------- */
.header {
  grid-row: 1; grid-column: 2;
  background: rgba(10, 7, 14, 0.4);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--color-border);
  display: flex; align-items: center;
  padding: 0 24px; gap: 16px;
}
.page-title {
  font-size: 15px; font-weight: 600;
  color: var(--text-hi);
  display: flex; align-items: center; gap: 10px;
}
.page-title .material-symbols-outlined {
  font-size: 20px; color: var(--color-primary);
}
.page-sub {
  font-size: 12px; color: var(--text-muted);
  padding-left: 12px; border-left: 1px solid var(--color-border);
}
.header-spacer { flex: 1; }
.header-actions { display: flex; align-items: center; gap: 8px; }

/* ---------- Main ---------- */
.main {
  grid-row: 2; grid-column: 2;
  overflow: hidden;
  display: flex; flex-direction: column;
  min-height: 0;
}

/* =========================================================================
   Atoms
   ========================================================================= */
.lh-badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10px; font-weight: 600;
  padding: 2px 7px; border-radius: 999px;
  letter-spacing: 0.02em;
  text-transform: capitalize;
  white-space: nowrap;
}
.lh-badge .material-symbols-outlined { font-size: 12px; }

.lh-iconbtn {
  width: 30px; height: 30px;
  border-radius: 8px;
  background: transparent; border: 1px solid transparent;
  color: var(--text-lo);
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all 120ms;
  font-family: inherit;
}
.lh-iconbtn:hover { color: #fff; background: rgba(255,255,255,0.05); }
.lh-iconbtn.is-active {
  color: var(--color-primary); background: rgba(127,13,242,0.1);
  border-color: rgba(127,13,242,0.2);
}
.lh-iconbtn[data-tone="danger"]:hover { color: var(--color-error); background: rgba(248,113,113,0.08); }
.lh-iconbtn .material-symbols-outlined { font-size: 17px; }

.lh-btn {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: inherit;
  font-size: 13px; font-weight: 500;
  padding: 8px 14px; border-radius: 10px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  color: var(--text-md); cursor: pointer;
  transition: all 150ms;
}
.lh-btn:hover { border-color: rgba(127,13,242,0.3); color: var(--text-hi); }
.lh-btn .material-symbols-outlined { font-size: 16px; }
.lh-btn.primary {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
  box-shadow: 0 6px 20px rgba(127,13,242,0.3);
}
.lh-btn.primary:hover { background: var(--color-primary-light); border-color: var(--color-primary-light); color: #fff; transform: translateY(-1px); }
.lh-btn.danger {
  color: #fca5a5;
}
.lh-btn.danger:hover { color: #f87171; border-color: rgba(248,113,113,0.4); background: rgba(248,113,113,0.06); }
.lh-btn.ghost { background: transparent; border-color: transparent; }

.lh-chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: inherit;
  font-size: 11px; font-weight: 600;
  padding: 5px 9px; border-radius: 7px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--color-border);
  color: var(--text-lo); cursor: pointer;
  transition: all 120ms;
  text-transform: uppercase; letter-spacing: 0.06em;
}
.lh-chip:hover { color: #fff; border-color: rgba(127,13,242,0.4); background: rgba(127,13,242,0.06); }
.lh-chip .material-symbols-outlined { font-size: 13px; }
.lh-chip.is-active {
  color: var(--color-primary);
  border-color: rgba(127,13,242,0.4);
  background: rgba(127,13,242,0.1);
}
.lh-chip.is-compact { padding: 5px 7px; }

/* Send-to popover */
.lh-sendto { position: relative; display: inline-block; }
.lh-sendto-menu {
  position: absolute; top: calc(100% + 6px); right: 0;
  min-width: 200px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 12px; padding: 6px;
  box-shadow: 0 12px 32px rgba(0,0,0,0.5), 0 0 0 1px rgba(127,13,242,0.1);
  z-index: 100;
  display: flex; flex-direction: column; gap: 2px;
}
.lh-sendto-head {
  font-size: 10px; font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--text-muted);
  padding: 8px 10px 6px;
}
.lh-sendto-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 8px;
  background: transparent; border: 0; cursor: pointer;
  font-family: inherit;
  font-size: 13px; color: var(--text-md);
  text-align: left;
  width: 100%;
}
.lh-sendto-item:hover { background: rgba(127,13,242,0.08); color: #fff; }
.lh-sendto-item .material-symbols-outlined { font-size: 16px; color: var(--text-muted); }
.lh-sendto-item:hover .material-symbols-outlined { color: var(--color-primary); }
.lh-sendto-item .trail { margin-left: auto; font-size: 14px; opacity: 0.5; }

/* Inputs */
.lh-input {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 13px; font-family: inherit;
  color: var(--text-hi);
  outline: none;
  transition: all 120ms;
  width: 100%;
}
.lh-input:focus { border-color: var(--color-primary); box-shadow: 0 0 0 3px rgba(127,13,242,0.15); }
.lh-input::placeholder { color: var(--text-faint); }

textarea.lh-input { resize: vertical; min-height: 80px; line-height: 1.55; }

/* Empty state */
.lh-empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 60px 24px; text-align: center;
  color: var(--text-muted);
  flex: 1;
}
.lh-empty .material-symbols-outlined {
  font-size: 48px; color: var(--color-border); margin-bottom: 16px;
}
.lh-empty .title { font-size: 15px; color: var(--text-md); margin-bottom: 4px; }
.lh-empty .sub { font-size: 12px; }

/* Scrollbar */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--color-border); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: rgba(127,13,242,0.3); }
::-webkit-scrollbar-track { background: transparent; }

/* =========================================================================
   Two-pane tool layout (list + detail)
   ========================================================================= */
.tool {
  display: flex; flex-direction: column;
  flex: 1; min-height: 0; min-width: 0;
}
.tool-twopane {
  display: grid;
  grid-template-columns: 320px 1fr;
  flex: 1; min-height: 0;
}
.tool-list {
  border-right: 1px solid var(--color-border);
  overflow: hidden;
  display: flex; flex-direction: column;
  background: rgba(10, 7, 14, 0.2);
}
.tool-list-head {
  padding: 14px 16px;
  border-bottom: 1px solid var(--color-border);
  display: flex; align-items: center; gap: 8px;
}
.tool-list-head h2 {
  font-size: 13px; font-weight: 600;
  color: var(--text-hi); margin: 0;
  letter-spacing: -0.005em;
  flex: 1;
}
.tool-list-head .count {
  font-size: 11px; color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.tool-list-search {
  padding: 8px 12px;
  border-bottom: 1px solid var(--color-border);
  display: flex; align-items: center; gap: 8px;
}
.tool-list-search input {
  background: transparent; border: 0; outline: none; flex: 1;
  color: var(--text-hi); font-size: 12px; font-family: inherit;
  min-width: 0;
}
.tool-list-search input::placeholder { color: var(--text-faint); }
.tool-list-search .material-symbols-outlined { font-size: 15px; color: var(--text-muted); }
.tool-list-scroll {
  flex: 1; overflow-y: auto; padding: 6px;
}
.tool-detail {
  overflow: hidden;
  display: flex; flex-direction: column;
  min-width: 0;
  position: relative;
}
.tool-detail-head {
  padding: 14px 24px;
  border-bottom: 1px solid var(--color-border);
  display: flex; align-items: center; gap: 12px;
  flex-shrink: 0;
}
.tool-detail-body {
  flex: 1; overflow-y: auto;
  padding: 24px;
  min-height: 0;
}
.tool-detail-body.no-pad { padding: 0; }
