/* EPICS shell styles — login, tabs, browse, history. Layered ON TOP of the
   desktop css/app.css (which owns :root vars, .btn, #topbar, .panel, etc.),
   so this file only adds EPICS-specific components and uses desktop vars
   (with fallbacks) to stay in theme. */

/* ---- login ---- */
.login-screen {
  position: fixed; inset: 0; z-index: 2000; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(1200px 600px at 50% -10%, #1e2431, var(--bg, #14171d));
}
.login-screen.hidden { display: none; }
.login-card { width: 340px; background: var(--bg2, #1a1e26); border: 1px solid var(--line, #333a47);
  border-radius: 12px; padding: 28px 26px; box-shadow: 0 20px 60px rgba(0,0,0,.5); }
.login-brand { font-size: 22px; font-weight: 700; }
.brand-mark { color: var(--accent-hi, #4b8bec); }
.login-tag { color: var(--txt-faint, #6b7484); font-size: 12px; margin: 2px 0 20px; }
.login-field { display: block; margin-bottom: 14px; }
.login-field span { display: block; font-size: 12px; color: var(--txt-dim, #9aa3b2); margin-bottom: 4px; }
.login-field input { width: 100%; font: inherit; color: var(--txt, #e7eaf0); background: var(--bg, #14171d);
  border: 1px solid var(--line2, #3d4553); border-radius: 6px; padding: 9px 10px; }
.login-field input:focus { outline: none; border-color: var(--accent, #2f6fd0); }
.login-error { color: var(--danger, #d0503f); font-size: 12px; min-height: 16px; margin-top: 10px; }
.login-note { color: var(--txt-faint, #6b7484); font-size: 11px; margin-top: 14px; text-align: center; }

/* ---- topbar tabs / identity ---- */
.etabs { display: flex; gap: 4px; margin-left: 8px; }
.etab { font: inherit; background: transparent; border: none; color: var(--txt-dim, #9aa3b2);
  padding: 7px 14px; border-radius: 7px; cursor: pointer; }
.etab:hover { background: var(--bg3, #20252f); color: var(--txt, #e7eaf0); }
.etab.active { background: var(--bg4, #2a303c); color: var(--txt, #e7eaf0); }
.who { color: var(--txt-dim, #9aa3b2); font-size: 12px; }
/* app version chip in the title slot — bumps each deploy (like the desktop) */
.app-ver { font-size: 11px; font-weight: 600; color: var(--txt-dim, #9aa3b2);
  background: var(--bg4, #2a303c); border-radius: 5px; padding: 1px 6px; vertical-align: middle; margin-left: 4px; }

/* ---- browse ---- */
#browse-view { position: absolute; inset: 52px 0 0 0; overflow: auto; }
.tab-view { padding: 18px 22px; }   /* full window width — no centered max-width */
.browse-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.browse-title { font-size: 22px; font-weight: 650; color: var(--txt, #e7eaf0); }
.spacer { flex: 1; }
.browse-controls { display: flex; align-items: center; gap: 8px; }
/* group selector as chip buttons (blue fill when selected, to match the theme).
   The radio input is kept for state + the existing change handler, but hidden. */
.chip-btn { display: inline-flex; align-items: center; cursor: pointer; user-select: none;
  font-size: 13px; color: var(--txt-dim, #9aa3b2);
  background: var(--bg3, #20252f); border: 1px solid var(--line2, #3d4553);
  border-radius: 999px; padding: 6px 14px;
  transition: background .12s, color .12s, border-color .12s; }
.chip-btn input { position: absolute; opacity: 0; width: 0; height: 0; pointer-events: none; }
.chip-btn:hover { color: var(--txt, #e7eaf0); border-color: var(--accent, #2f6fd0); }
.chip-btn:has(input:checked) { background: var(--accent, #2f6fd0); border-color: var(--accent, #2f6fd0); color: #fff; }
/* group boxes flow row by row (wrap); the user's box is first / top-left */
.builds-list { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 18px; }

/* --- My vs Community: strong, obvious separation --- */
.bsection { border-radius: 12px; padding: 14px 16px 18px; box-sizing: border-box; }
/* EVERY box hugs its cards (no empty box area) and the boxes flow row by row;
   cards inside wrap to more rows only once the box would exceed the window. */
.mine-section, .bsection.by-author, .community-all, .trash-section {
  flex: 0 0 auto; width: -moz-fit-content; width: fit-content; max-width: 100%; }
.bsection-head { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 650; margin-bottom: 12px; }
.bsection-count { font-size: 11px; font-weight: 600; color: var(--txt-dim, #9aa3b2);
  background: var(--bg4, #2a303c); border-radius: 10px; padding: 1px 8px; }
.bsection-empty { font-size: 13px; padding: 4px 2px; }
.mine-section { background: rgba(47,111,208,.08); border: 1px solid rgba(47,111,208,.34); }
.mine-section .bsection-head { color: var(--accent-hi, #4b8bec); }
.mine-section .bsection-head::before { content: '\1F464'; }   /* bust */
.shared-section { background: var(--bg, #14171d); border: 1px solid var(--line, #333a47); }
.shared-section .bsection-head { color: var(--txt-dim, #9aa3b2); }
.shared-section .bsection-head::before { content: '\1F310'; }  /* globe */

/* --- build cards: thumbnail-dominant, fixed width so boxes hug them.
   The thumb slot's aspect-ratio MUST match THUMB_AR in js/app.js (4:3) so a
   captured thumbnail fills the slot with nothing cropped and no bars; card
   height is auto = thumb + footer, so every card is a uniform height. --- */
.bgrid { display: flex; flex-wrap: wrap; gap: 12px; }
.bcard { box-sizing: border-box; width: 240px;
  display: flex; flex-direction: column;
  background: var(--bg2, #1a1e26); border: 1px solid var(--line, #333a47); border-radius: 10px;
  overflow: hidden; transition: border-color .12s; }
.bcard:hover { border-color: var(--line2, #3d4553); }
.bcard.mine { border-color: rgba(47,111,208,.55); }
.bcard-thumb { flex: none; aspect-ratio: 4 / 3; background: var(--bg, #14171d);
  display: flex; align-items: center; justify-content: center; }
.bcard-img { width: 100%; height: 100%; object-fit: contain; display: block; }
.bcard-noimg { color: var(--txt-faint, #6b7484); font-size: 12px; }
.bcard-foot { flex: none; padding: 9px 11px 10px; border-top: 1px solid var(--line, #333a47); }
.bcard-name { font-size: 14px; font-weight: 600; color: var(--txt, #e7eaf0);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bcard-meta { font-size: 12px; color: var(--txt-dim, #9aa3b2); margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bcard-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.bcard-actions .btn { flex: 0 0 auto; }

/* ---- thumbnail framing overlay (Builder viewport) ----
   Fills #bld-viewport; the guide rect darkens everything outside it via a
   huge box-shadow clipped by this container's overflow:hidden. pointer-events
   pass through so the user can still orbit/zoom the build; only the toolbar
   catches clicks. The WebGL capture reads the canvas, not this DOM, so the
   guide never appears in the saved thumbnail. */
.thumb-frame-ui { position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: 30; }
.thumb-frame-ui.hidden { display: none; }
.thumb-frame-rect { position: absolute; box-sizing: border-box; border-radius: 3px;
  border: 2px solid rgba(255,255,255,.92);
  box-shadow: 0 0 0 100vmax rgba(0,0,0,.55); }
.thumb-frame-bar { position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%);
  display: flex; align-items: center; gap: 10px; pointer-events: auto; max-width: 92%;
  background: var(--bg2, #1a1e26); border: 1px solid var(--line, #333a47);
  border-radius: 10px; padding: 8px 12px; box-shadow: 0 10px 34px rgba(0,0,0,.5); }
.thumb-frame-hint { color: var(--txt-dim, #9aa3b2); font-size: 12px; }

.chip { font-size: 10px; text-transform: uppercase; letter-spacing: .04em; background: var(--bg4, #2a303c);
  color: var(--txt-dim, #9aa3b2); border-radius: 4px; padding: 1px 6px; vertical-align: middle; }
.chip.latest { background: var(--ok, #3ac661); color: #06240f; }
.chip.trashed { background: rgba(208,80,63,.22); color: var(--danger, #e0705f); }
.muted { color: var(--txt-dim, #9aa3b2); }

/* ---- Trash box + trashed cards (admin only) ---- */
/* sizing (fit-content) comes from the shared box rule above */
.trash-section { background: rgba(208,80,63,.06); border: 1px solid rgba(208,80,63,.30); }
.trash-section .bsection-head { color: var(--danger, #e0705f); }
.trash-section .bsection-head::before { content: '\1F5D1'; }   /* wastebasket */
.bcard.trashed { border-color: rgba(208,80,63,.45); opacity: .82; }
.bcard.trashed .bcard-thumb { filter: grayscale(.4); }

/* ---- card right-click context menu ---- */
.card-menu { position: fixed; z-index: 80; min-width: 140px; padding: 5px;
  background: var(--bg2, #1a1e26); border: 1px solid var(--line2, #3d4553);
  border-radius: 8px; box-shadow: 0 12px 34px rgba(0,0,0,.55); }
.card-menu-item { display: block; width: 100%; text-align: left; font: inherit; font-size: 13px;
  color: var(--txt, #e7eaf0); background: transparent; border: none; border-radius: 5px;
  padding: 7px 10px; cursor: pointer; }
.card-menu-item:hover { background: var(--bg4, #2a303c); }
.card-menu-item.danger { color: var(--danger, #e0705f); }
.card-menu-item.danger:hover { background: rgba(208,80,63,.16); }

/* ---- yes/no confirmation dialog ---- */
.confirm-overlay { z-index: 70; }
.confirm-card { width: 380px; max-width: 92vw; padding: 20px 22px;
  background: var(--bg2, #1a1e26); border: 1px solid var(--line2, #3d4553);
  border-radius: 12px; box-shadow: 0 20px 60px rgba(0,0,0,.6); }
.confirm-title { font-size: 16px; font-weight: 650; color: var(--txt, #e7eaf0); margin-bottom: 8px; }
.confirm-msg { font-size: 13px; line-height: 1.5; color: var(--txt-dim, #9aa3b2); }
.confirm-msg b { color: var(--txt, #e7eaf0); }
.confirm-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }

/* ---- admin: users panel ---- */
.admin-card { width: 720px; }
.admin-add { background: var(--bg, #14171d); border: 1px solid var(--line, #333a47);
  border-radius: 8px; padding: 12px 14px; margin-bottom: 14px; }
.admin-add-title { font-size: 13px; font-weight: 650; margin-bottom: 8px; color: var(--txt, #e7eaf0); }
.admin-add-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 8px; }
.admin-add-row input[type=text], .admin-add-row input:not([type]) {
  flex: 1 1 140px; min-width: 120px; font: inherit; font-size: 13px;
  color: var(--txt, #e7eaf0); background: var(--bg2, #1a1e26);
  border: 1px solid var(--line2, #3d4553); border-radius: 6px; padding: 6px 8px; }
.admin-add-row label, .admin-user-flags label {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12.5px; color: var(--txt-dim, #9aa3b2); cursor: pointer; white-space: nowrap; }
.admin-list { display: flex; flex-direction: column; gap: 6px; }
.admin-user { display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--bg, #14171d); border: 1px solid var(--line, #333a47);
  border-radius: 7px; padding: 9px 12px; flex-wrap: wrap; }
.admin-user.inactive { opacity: .6; border-style: dashed; }
.admin-user-name { font-size: 13.5px; color: var(--txt, #e7eaf0); }
.admin-user-flags { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

/* trash/restore/copy audit lines in the history */
.event-row { background: transparent; border-style: dashed; border-color: var(--line2, #3d4553); }
.event-row .ver-main b { color: var(--txt-dim, #cfd4dc); font-weight: 600; }

/* web Help uses the desktop engine's help CSS (.help-tabs/.help-side/etc. from
   css/app.css); the nested-tab guide lives in js/webhelp.js. */

/* Bump every button's font size by 1px over the engine defaults
   (.btn 12→13, .btn-sm 12→13, tab buttons 13→14). */
.btn { font-size: 13px; }
.btn-sm { font-size: 13px; }
.etab { font-size: 14px; }

/* disabled buttons (e.g. 3MF export without permission) */
.btn:disabled, .btn.is-disabled { opacity: .4; cursor: not-allowed; }
.btn:disabled:hover, .btn.is-disabled:hover { background: var(--bg3, #20252f); border-color: var(--line2, #3d4553); }

/* ---- history overlay ---- */
.overlay-card { width: 520px; max-width: 92vw; max-height: 82vh; display: flex; flex-direction: column;
  background: var(--bg2, #1a1e26); border: 1px solid var(--line, #333a47); border-radius: 12px; overflow: hidden; }
.overlay-card .overlay-head { display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; border-bottom: 1px solid var(--line, #333a47); font-weight: 600; }
.overlay-body { padding: 16px; overflow: auto; }
.ver-list { display: flex; flex-direction: column; gap: 6px; }
.ver-row { display: flex; align-items: center; justify-content: space-between; background: var(--bg, #14171d);
  border: 1px solid var(--line, #333a47); border-radius: 7px; padding: 9px 12px; }
.ver-sub { color: var(--txt-faint, #6b7484); font-size: 12px; margin-top: 2px; }

/* the Builder's HTTP library loaders don't apply on the web (parts arrive
   via the API); hide them to avoid confusion. */
#b-loadofficial, #b-loaddev, #b-loadlib { display: none !important; }
