/**
 * Hub boot + tab loader — shared by P0004 Tool Hub and P0020 Data-Box.
 * Boot: link from index.html (/hub-boot.css in public). App: import in main.tsx.
 */

:root {
  --hub-sidebar-width: 15rem;
  --hub-main-chrome-top: 0px;
  --hub-boot-bg: #0b1020;
  --hub-boot-sidebar-bg: #0f1219;
}

/* Pane boot leaves a 15rem gutter for the React sidebar — without this, that strip is
   browser-default white until hub-app paints (visible flash on slow/dynamic module load). */
html,
body {
  background: var(--hub-boot-bg);
}

/* --- index.html boot overlay (before React) --- */
#hub-boot-loader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  pointer-events: none;
  background: var(--hub-boot-bg);
}

#hub-boot-loader.hub-boot-loader--pane {
  left: var(--hub-sidebar-width);
  top: var(--hub-main-chrome-top, 0px);
  width: auto;
  right: 0;
  bottom: 0;
}

/* Dark sidebar placeholder under the pane-scoped orb (matches HubSidebarShell --panel). */
#hub-boot-loader.hub-boot-loader--pane::before {
  content: "";
  position: fixed;
  z-index: 9998;
  left: 0;
  top: 0;
  bottom: 0;
  width: var(--hub-sidebar-width);
  background: var(--hub-boot-sidebar-bg);
  border-right: 1px solid rgba(255, 255, 255, 0.05);
  pointer-events: none;
}

@media (max-width: 767.98px) {
  :root {
    --hub-sidebar-width: 0px;
    --hub-loader-inset-left: 0px;
  }

  #hub-boot-loader.hub-boot-loader--pane,
  .hub-tab-loader-fill {
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
  }

  #hub-boot-loader.hub-boot-loader--pane::before {
    display: none !important;
    content: none !important;
    width: 0 !important;
  }
}

.hub-boot-orb {
  position: relative;
  width: 6rem;
  height: 6rem;
}

.hub-boot-orb__ring {
  position: absolute;
  inset: 0;
  border-radius: 9999px;
  border: 1px solid rgba(129, 140, 248, 0.25);
}

.hub-boot-orb__ring--dash {
  inset: 0.25rem;
  border-style: dashed;
  border-color: rgba(34, 211, 238, 0.3);
  animation: hub-boot-spin 12s linear infinite;
}

.hub-boot-orb__ring--inner {
  inset: 0.75rem;
  border-color: rgba(99, 102, 241, 0.35);
  animation: hub-boot-spin 6s linear infinite reverse;
}

.hub-boot-orb__core {
  position: absolute;
  inset: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.75rem;
  border: 1px solid rgba(129, 140, 248, 0.35);
  background: rgba(15, 18, 32, 0.95);
  box-shadow: 0 0 20px rgba(99, 102, 241, 0.25);
}

.hub-boot-orb__core svg {
  width: 1.25rem;
  height: 1.25rem;
  color: #a5b4fc;
}

@keyframes hub-boot-spin {
  to {
    transform: rotate(360deg);
  }
}

/* --- React portaled loader (center of main pane below chrome stack) --- */
.hub-tab-loader-fill {
  position: fixed;
  z-index: 35;
  top: var(--hub-main-chrome-top, 0px);
  right: 0;
  bottom: 0;
  left: var(--hub-sidebar-width, 15rem);
  display: grid;
  place-items: center;
  pointer-events: none;
  margin: 0;
  padding: 0;
}

.hub-tab-loader-fill--dim {
  background: color-mix(in srgb, var(--bg, #0b1020) 45%, transparent);
  backdrop-filter: blur(2px);
}

/* Inline loader — modals / nested panels (parent must be position:relative + min-height) */
.hub-tab-loader-inline {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  pointer-events: none;
  margin: 0;
  padding: 0;
}

.hub-tab-loader-inline--dim {
  background: color-mix(in srgb, var(--bg, #0b1020) 45%, transparent);
  backdrop-filter: blur(2px);
}

/* Detail modal Save/busy — block form clicks while orb spins */
.hub-tab-loader-inline--blocking {
  pointer-events: auto;
  cursor: wait;
}

/* Collapse chrome stack when all banner slots render null — no ResizeObserver flicker */
.hub-main-chrome-stack:empty {
  display: none;
}

/* Searchbar Lite — tighter chrome than full directory FilterBar */
.hub-filter-bar--lite {
  --hub-filter-lite-pad-y: 0.375rem;
}
.hub-filter-bar--lite .hub-filter-bar__lite-row {
  min-height: var(--hub-control-h, 31px);
  row-gap: 0.375rem;
}

.hub-loader-orb {
  position: relative;
  width: 6rem;
  height: 6rem;
  margin: 0;
}

.hub-loader-orb__ring {
  position: absolute;
  inset: 0;
  border-radius: 9999px;
  border: 1px solid rgba(129, 140, 248, 0.2);
}

.hub-loader-orb__ring--dash {
  inset: 0.25rem;
  border-style: dashed;
  border-color: rgba(34, 211, 238, 0.25);
  animation: hub-boot-spin 12s linear infinite;
}

.hub-loader-orb__ring--inner {
  inset: 0.75rem;
  border-color: rgba(99, 102, 241, 0.3);
  animation: hub-boot-spin 6s linear infinite reverse;
}

.hub-loader-orb__glow {
  position: absolute;
  inset: 1.25rem;
  border-radius: 9999px;
  background: linear-gradient(to bottom right, rgba(99, 102, 241, 0.2), rgba(34, 211, 238, 0.1));
  filter: blur(8px);
}

.hub-loader-orb__icon-box {
  position: absolute;
  inset: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.75rem;
  border: 1px solid rgba(129, 140, 248, 0.35);
  background: var(--panel, rgba(15, 18, 32, 0.95));
  box-shadow: 0 0 20px rgba(99, 102, 241, 0.25);
}

.hub-loader-orb__icon-box svg {
  display: block;
}

.hub-loader-orb__tool-icon {
  display: block;
  width: 1.25rem;
  height: 1.25rem;
  object-fit: contain;
}

.hub-boot-orb__core img {
  display: block;
  width: 1.25rem;
  height: 1.25rem;
  object-fit: contain;
}

.hub-loader-orb__gauge {
  position: absolute;
  top: 0.35rem;
  right: 0.35rem;
  color: rgba(34, 211, 238, 0.9);
  animation: hub-boot-spin 3s linear infinite;
}

/* Visited-tab SSOT — skip paint/layout for inactive keep-alive directory panels */
.hub-inactive-tab-content {
  min-height: 0;
  min-width: 0;
}

.hub-inactive-tab-content--hidden {
  content-visibility: hidden;
  contain: strict;
  pointer-events: none;
  user-select: none;
}

.hub-inactive-tab-content--active {
  content-visibility: visible;
}
