/* BioStudio AI — Web Harvester: Edge-style browser chrome + data panel. */

.wh-browser {
  display: flex;
  flex-direction: column;
  height: 100%;
  color: var(--ink);
  font-size: 13px;
  background: var(--wh-page, #f3f3f3);
  --wh-line: rgba(120, 130, 150, 0.22);
  --wh-surface: rgba(127, 137, 160, 0.08);
  --wh-surface-2: rgba(127, 137, 160, 0.14);
  --wh-chrome: rgba(243, 244, 248, 0.92);
  --wh-page: #ffffff;
}
.dark .wh-browser { --wh-chrome: rgba(38, 40, 48, 0.92); --wh-page: #1d1f25; }

/* ---- Tab strip -------------------------------------------------------- */
.wh-tabstrip {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  padding: 6px 8px 0;
  background: var(--wh-chrome);
  overflow-x: auto;
  scrollbar-width: none;
}
.wh-tabstrip::-webkit-scrollbar { display: none; }
.wh-tab {
  display: flex; align-items: center; gap: 8px;
  min-width: 150px; max-width: 230px;
  padding: 8px 10px; border-radius: 9px 9px 0 0;
  cursor: pointer; color: var(--ink-soft);
  position: relative; flex: 0 0 auto;
}
.wh-tab:hover { background: var(--wh-surface); }
.wh-tab.active { background: var(--wh-page); color: var(--ink); box-shadow: 0 -1px 4px rgba(0,0,0,0.05); }
.wh-tabfav { width: 16px; height: 16px; flex: 0 0 auto; object-fit: contain; font-size: 14px; line-height: 1; }
.wh-tabtitle { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 12px; }
.wh-tabclose { width: 18px; height: 18px; border-radius: 5px; display: grid; place-items: center; font-size: 11px; color: var(--ink-soft); flex: 0 0 auto; }
.wh-tabclose:hover { background: var(--wh-surface-2); }
.wh-newtab { width: 30px; height: 30px; border-radius: 7px; font-size: 18px; color: var(--ink-soft); margin: 0 4px 4px; flex: 0 0 auto; }
.wh-newtab:hover { background: var(--wh-surface); }

/* ---- Toolbar ---------------------------------------------------------- */
.wh-toolbar {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px; background: var(--wh-page);
  border-bottom: 1px solid var(--wh-line);
}
.wh-navbtns { display: flex; gap: 2px; }
.wh-navbtn {
  width: 34px; height: 34px; border-radius: 50%; font-size: 18px; line-height: 1;
  color: var(--ink); display: grid; place-items: center;
}
.wh-navbtn:hover { background: var(--wh-surface); }
.wh-navbtn:disabled { opacity: 0.32; cursor: default; }
.wh-omniwrap {
  flex: 1; display: flex; align-items: center; gap: 8px;
  background: var(--wh-surface); border: 1px solid transparent;
  border-radius: 999px; padding: 0 14px; height: 34px;
}
.wh-omniwrap:focus-within { background: var(--wh-page); border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.wh-omni-ico { font-size: 13px; opacity: 0.7; }
.wh-omni { flex: 1; border: none; background: transparent; outline: none; color: var(--ink); font-size: 13px; }
.wh-toolactions { display: flex; align-items: center; gap: 4px; }
.wh-tool { height: 34px; padding: 0 12px; border-radius: 7px; color: var(--ink); display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.wh-tool:hover { background: var(--wh-surface); }
.wh-data-btn { position: relative; }
.wh-badge {
  background: var(--accent); color: #fff; font-size: 10px; font-weight: 700;
  border-radius: 999px; padding: 1px 6px; min-width: 16px; text-align: center;
}

/* ---- Stage (viewport + panel) ---------------------------------------- */
.wh-stage { flex: 1; display: flex; min-height: 0; }
.wh-viewport { flex: 1; min-width: 0; overflow: auto; background: var(--wh-page); position: relative; }

/* ---- Live interactive page view -------------------------------------- */
.wh-live { height: 100%; background: #0b0b0d; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.wh-livesurface { position: relative; line-height: 0; max-width: 100%; max-height: 100%; box-shadow: 0 8px 40px rgba(0,0,0,0.4); }
.wh-liveframe { display: block; max-width: 100%; max-height: 100%; background: #fff; user-select: none; -webkit-user-drag: none; }
.wh-liveoverlay { position: absolute; inset: 0; outline: none; cursor: default; }
.wh-loadoverlay { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; background: rgba(11,11,13,0.85); color: #fff; z-index: 3; }
.wh-collect-btn { background: var(--accent); color: #fff; }
.wh-collect-btn:hover { filter: brightness(1.08); background: var(--accent); }
.wh-liveoverlay.wh-picking { cursor: crosshair; box-shadow: inset 0 0 0 3px var(--accent); }

/* ---- Teach / search-list panel --------------------------------------- */
.wh-queries { width: 100%; resize: vertical; border: 1px solid var(--wh-line); border-radius: var(--radius); background: var(--wh-surface); color: var(--ink); padding: 8px; font-family: inherit; font-size: 12px; line-height: 1.5; }
.wh-queries:focus { outline: none; border-color: var(--accent); }
.wh-recipe-box { background: var(--wh-surface); border: 1px solid var(--wh-line); border-radius: var(--radius); padding: 8px 10px; display: flex; flex-direction: column; gap: 4px; }
.wh-recipe-box code { font-size: 11px; word-break: break-all; color: var(--accent); }
.wh-recipe-box select { color: var(--ink); }
.wh-recipe-box .wh-btn.tiny { align-self: flex-start; margin-top: 2px; }
.wh-agent-status { font-size: 12px; padding: 8px 10px; border-radius: var(--radius); background: var(--wh-surface); border: 1px solid var(--wh-line); }
.wh-agent-status.live { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; animation: wh-pulse 1.4s ease-in-out infinite; }
@keyframes wh-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.65; } }
.wh-datapanel { width: 0; flex: 0 0 0; overflow: hidden; border-left: 1px solid var(--wh-line); background: var(--wh-page); display: flex; flex-direction: column; transition: width 0.16s ease, flex-basis 0.16s ease; }
.wh-browser.wh-panel-open .wh-datapanel { width: 460px; flex: 0 0 460px; }

/* ---- New tab page ----------------------------------------------------- */
.wh-newtabpage, .wh-servicedown, .wh-pageerror { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; height: 100%; padding: 30px; text-align: center; }
.wh-bigicon { font-size: 56px; }
.wh-bigtitle { font-size: 22px; font-weight: 700; }
.wh-bigsub { color: var(--ink-soft); max-width: 520px; line-height: 1.5; }
.wh-bigsearchwrap { display: flex; align-items: center; gap: 8px; width: min(620px, 90%); background: var(--wh-surface); border: 1px solid var(--wh-line); border-radius: 999px; padding: 6px 8px 6px 16px; margin-top: 6px; }
.wh-bigsearchwrap:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.wh-bigsearch { flex: 1; border: none; background: transparent; outline: none; color: var(--ink); font-size: 15px; padding: 8px 0; }
.wh-shortcuts { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; margin-top: 22px; }
.wh-shortcut { display: flex; flex-direction: column; align-items: center; gap: 8px; width: 92px; padding: 14px 8px; border-radius: 12px; color: var(--ink); }
.wh-shortcut:hover { background: var(--wh-surface); }
.wh-scfav, .wh-sr-host .wh-scfav { width: 28px; height: 28px; object-fit: contain; }

/* ---- Categorized bookmarks (new-tab page) ----------------------------- */
.wh-bookmarks { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 18px 26px; width: 100%; max-width: 980px; margin: 26px auto 0; text-align: left; }
.wh-bmcat { display: flex; flex-direction: column; gap: 8px; }
.wh-bmhead { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 13px; color: var(--ink); padding-bottom: 4px; border-bottom: 1px solid var(--wh-line); }
.wh-bmicon { font-size: 16px; }
.wh-bmlist { display: flex; flex-direction: column; gap: 2px; }
.wh-bmitem { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 8px; color: var(--ink); font-size: 13px; text-align: left; }
.wh-bmitem:hover { background: var(--wh-surface); }
.wh-bmitem .wh-scfav { width: 18px; height: 18px; flex: 0 0 18px; }

/* ---- Search-list demo presets ---------------------------------------- */
.wh-demo-btns { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }

/* ---- In-app native-<select> dropdown --------------------------------- */
.wh-selectmenu { position: absolute; z-index: 40; max-height: 280px; overflow-y: auto; background: var(--wh-page, #fff); color: var(--ink, #1a1a1a); border: 1px solid var(--wh-line, #ccc); border-radius: 6px; box-shadow: 0 8px 28px rgba(0,0,0,0.28); padding: 4px; font-size: 13px; }
.wh-selopt { padding: 6px 10px; border-radius: 4px; cursor: pointer; white-space: nowrap; }
.wh-selopt:hover { background: var(--accent, #2563eb); color: #fff; }
.wh-selopt.sel { font-weight: 600; }
.wh-selopt.disabled { opacity: 0.45; pointer-events: none; }

/* ---- Teach "what to collect" methods ---------------------------------- */
.wh-method-tabs { display: flex; gap: 6px; margin-bottom: 8px; }
.wh-method-tab { flex: 1; padding: 6px 8px; border: 1px solid var(--wh-line); border-radius: 6px; font-size: 12px; color: var(--ink); background: var(--wh-surface); }
.wh-method-tab.active { border-color: var(--accent); color: var(--accent); font-weight: 600; }
.wh-phrase-in { width: 100%; border: 1px solid var(--wh-line); border-radius: 6px; background: var(--wh-surface); color: var(--ink); padding: 7px 8px; font-size: 12px; margin-top: 4px; }
.wh-phrase-in:focus { outline: none; border-color: var(--accent); }

/* ---- Drag-to-select region box --------------------------------------- */
.wh-regionbox { position: absolute; z-index: 35; border: 2px dashed var(--accent, #2563eb); background: rgba(37, 99, 235, 0.14); pointer-events: none; border-radius: 3px; }

/* ---- Loading / page view --------------------------------------------- */
.wh-pageloading { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; height: 100%; color: var(--ink-soft); }
.wh-spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--wh-line); border-top-color: var(--accent); animation: wh-spin 0.8s linear infinite; }
.wh-spinner.big { width: 38px; height: 38px; border-width: 3px; }
@keyframes wh-spin { to { transform: rotate(360deg); } }

.wh-pageview { display: flex; flex-direction: column; min-height: 100%; }
.wh-pagebar { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 10px; padding: 8px 14px; background: var(--wh-chrome); border-bottom: 1px solid var(--wh-line); backdrop-filter: blur(6px); }
.wh-pagebar-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 60%; }
.wh-grow { flex: 1; }
.wh-tag { font-size: 11px; padding: 2px 8px; border-radius: 999px; background: var(--wh-surface-2); color: var(--ink-soft); }
.wh-shotwrap { padding: 14px; display: flex; justify-content: center; }
.wh-pageshot { max-width: 100%; width: 1000px; border-radius: 8px; border: 1px solid var(--wh-line); box-shadow: 0 6px 24px rgba(0,0,0,0.08); }

/* ---- Search results page --------------------------------------------- */
.wh-searchpage { max-width: 760px; margin: 0 auto; padding: 22px 20px; }
.wh-searchhead { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--ink-soft); margin-bottom: 16px; }
.wh-searchresults { display: flex; flex-direction: column; gap: 20px; }
.wh-sr { display: flex; flex-direction: column; gap: 3px; }
.wh-sr-host { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--ink-soft); }
.wh-sr-host .wh-scfav { width: 16px; height: 16px; }
.wh-sr-title { font-size: 17px; color: var(--accent); text-decoration: none; }
.wh-sr-title:hover { text-decoration: underline; }
.wh-sr-snippet { color: var(--ink-soft); font-size: 13px; line-height: 1.45; }

/* ---- Data panel internals -------------------------------------------- */
.wh-panel-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 10px; border-bottom: 1px solid var(--wh-line); }
.wh-ptabs { display: flex; gap: 4px; }
.wh-ptab { padding: 6px 12px; border-radius: 999px; font-weight: 600; color: var(--ink-soft); }
.wh-ptab.active { background: var(--accent); color: #fff; }
.wh-panel-body { flex: 1; min-height: 0; overflow: auto; display: flex; flex-direction: column; }
.wh-panel-section { padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; }
.wh-section-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink-soft); }

.wh-dataset-card { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 10px; border-radius: var(--radius); background: var(--wh-surface); border: 1px solid var(--wh-line); }
.wh-dataset-card.active { border-color: var(--accent); }
.wh-ds-name { font-weight: 600; }
.wh-ds-sub { font-size: 11px; color: var(--ink-soft); }
.wh-ds-actions { display: flex; gap: 6px; flex: 0 0 auto; }

.wh-coll { padding: 8px 10px; border-radius: var(--radius); cursor: pointer; position: relative; border: 1px solid transparent; }
.wh-coll:hover { background: var(--wh-surface); }
.wh-coll.active { background: var(--accent-soft); border-color: var(--accent); }
.wh-coll-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wh-coll-sub { font-size: 11px; color: var(--ink-soft); margin-top: 2px; }
.wh-coll-actions { position: absolute; top: 6px; right: 6px; display: none; gap: 2px; }
.wh-coll:hover .wh-coll-actions { display: flex; }
.wh-icon-btn { width: 22px; height: 22px; border-radius: 6px; background: var(--wh-surface-2); color: var(--ink-soft); display: grid; place-items: center; font-size: 12px; }
.wh-icon-btn:hover { background: var(--accent); color: #fff; }

/* ---- Buttons ---------------------------------------------------------- */
.wh-btn { padding: 8px 14px; border-radius: var(--radius); font-weight: 600; background: var(--wh-surface-2); color: var(--ink); border: 1px solid var(--wh-line); white-space: nowrap; }
.wh-btn:hover { background: var(--wh-surface); }
.wh-btn.primary { background: var(--accent); color: #fff; border-color: transparent; }
.wh-btn.primary:hover { filter: brightness(1.08); }
.wh-btn.sm { padding: 5px 10px; font-size: 12px; }
.wh-btn.tiny { padding: 4px 10px; font-size: 12px; }
.wh-btn.active { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

/* ---- Table ------------------------------------------------------------ */
.wh-table-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 12px; border-top: 1px solid var(--wh-line); border-bottom: 1px solid var(--wh-line); }
.wh-tt-right { display: flex; gap: 6px; flex-wrap: wrap; }
.wh-search { padding: 6px 11px; border-radius: var(--radius); border: 1px solid var(--wh-line); background: var(--wh-surface); color: var(--ink); width: 160px; outline: none; }
.wh-search:focus { border-color: var(--accent); }
.wh-panel-table { flex: 1; min-height: 200px; display: flex; flex-direction: column; }
.wh-table-wrap { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.wh-table-meta { display: flex; align-items: center; gap: 16px; padding: 6px 12px; color: var(--ink-soft); font-size: 12px; }
.wh-table-scroll { flex: 1; overflow: auto; }
.wh-table { border-collapse: collapse; width: 100%; font-size: 12px; }
.wh-table th, .wh-table td { border: 1px solid var(--wh-line); padding: 6px 9px; text-align: left; vertical-align: top; max-width: 320px; }
.wh-table thead th { position: sticky; top: 0; background: var(--wh-surface-2); cursor: pointer; user-select: none; z-index: 1; }
.wh-table tbody tr:nth-child(even) { background: var(--wh-surface); }
.wh-filter-row th { position: sticky; top: 30px; background: var(--wh-surface-2); z-index: 1; }
.wh-filter-input { width: 100%; padding: 3px 6px; border-radius: 5px; border: 1px solid var(--wh-line); background: rgba(255,255,255,0.04); color: var(--ink); }
.wh-cell-link { color: var(--accent); text-decoration: none; }
.wh-cell-link:hover { text-decoration: underline; }

/* ---- QC + feature ideas ---------------------------------------------- */
.wh-qc-panel, .wh-feature-panel { padding: 10px 12px; border-bottom: 1px solid var(--wh-line); background: var(--wh-surface); display: flex; flex-direction: column; gap: 8px; }
.wh-qc-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.wh-qc-head strong { text-transform: capitalize; }
.wh-qc-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.wh-qc-stat { border: 1px solid var(--wh-line); border-radius: 7px; padding: 6px 8px; background: var(--wh-page); display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.wh-qc-stat span { font-size: 10px; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wh-qc-stat b { font-size: 13px; }
.wh-qc-line { font-size: 12px; color: var(--ink-soft); line-height: 1.35; }
.wh-feature-search { width: 100%; padding: 6px 9px; border: 1px solid var(--wh-line); border-radius: 7px; background: var(--wh-page); color: var(--ink); outline: none; }
.wh-feature-search:focus { border-color: var(--accent); }
.wh-feature-list { display: flex; flex-direction: column; gap: 4px; max-height: 260px; overflow: auto; }
.wh-feature-item { display: grid; grid-template-columns: 120px 1fr; gap: 8px; align-items: start; padding: 6px 8px; border-radius: 7px; background: var(--wh-page); border: 1px solid var(--wh-line); }
.wh-feature-item span { color: var(--ink-soft); font-size: 11px; }
.wh-feature-item b { font-size: 12px; font-weight: 600; line-height: 1.3; }

/* ---- Misc / menus ----------------------------------------------------- */
.wh-empty { padding: 18px; text-align: center; color: var(--ink-soft); }
.wh-code { background: rgba(0,0,0,0.4); color: #f3f3f5; padding: 12px 14px; border-radius: 8px; font-family: ui-monospace, monospace; font-size: 12px; white-space: pre; text-align: left; }
.wh-menu { position: fixed; z-index: 9999; width: 270px; max-height: 380px; overflow-y: auto; background: var(--taskbar-bg); backdrop-filter: blur(18px); border: 1px solid var(--wh-line, rgba(120,130,150,0.3)); border-radius: var(--radius); box-shadow: 0 12px 40px rgba(0,0,0,0.3); padding: 10px; color: var(--ink); display: flex; flex-direction: column; gap: 6px; }
.wh-menu-row { display: flex; align-items: center; gap: 8px; }
.wh-rename { flex: 1; padding: 4px 6px; border-radius: 5px; border: 1px solid rgba(120,130,150,0.3); background: rgba(127,137,160,0.1); color: var(--ink); }
.wh-menu-check { display: flex; align-items: center; gap: 8px; }
.wh-menu-num { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.wh-num { width: 64px; padding: 4px 6px; border-radius: 6px; border: 1px solid var(--wh-line); background: var(--wh-surface); color: var(--ink); }
