/* panel.css — static, pixel-faithful recreation of the Nano Banana Fill
   Photoshop panel, used as the hero visual. All control values mirror the
   real plugin's own UI stylesheet (repo-root index.html). Scoped entirely
   under .nb-scene / .nb-panel so nothing leaks into the site. */

/* ---- reset the placeholder card that site.css gives .hero-mock ---- */
.hero-mock {
  min-height: 0;
  background: none;
  border: 0;
  border-radius: 0;
}

/* ================================================================
   Scene = the panel centered in the hero's right column, plus the
   floating explainer card and the hover hint.
   ================================================================ */
.nb-scene {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ================================================================
   Panel
   ================================================================ */
.nb-panel {
  position: relative;
  width: 380px;
  max-width: 100%;
  flex-shrink: 0;
  background: var(--ps-bg-panel);
  border-radius: 8px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.5), 0 2px 8px rgba(0, 0, 0, 0.4);
  color: var(--ps-text);
  font-family: var(--font-ui);
  font-size: var(--panel-font-size);
  line-height: 1.45;
  text-align: left;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

.nb-panel *,
.nb-panel *::before,
.nb-panel *::after { box-sizing: border-box; }

/* ---- 1. Tab strip ---- */
.nb-tabs {
  display: flex;
  align-items: stretch;
  background: #191919;
  padding: 0 6px;
  font-size: 11px;
}
.nb-tab {
  padding: 8px 10px 7px;
  color: var(--ps-text-muted);
  white-space: nowrap;
  border-bottom: 1px solid transparent;
}
.nb-tab-active {
  color: #e8e8e8;
  background: var(--ps-bg-panel);
  border-top: 2px solid var(--ps-blue);
  padding-top: 6px;
  border-radius: 3px 3px 0 0;
}
.nb-tab-menu {
  margin-left: auto;
  display: flex;
  align-items: center;
  padding: 0 6px;
  color: var(--ps-text-muted);
}

/* ---- panel body ---- */
.nb-body { padding: 14px; }

/* shared label style (.lbl in the plugin) */
.nb-lbl { font-weight: bold; }

/* ---- 2. Assistant header ---- */
.nb-assist-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.nb-new-edit {
  color: var(--ps-text-muted);
  font-size: 11px;
}

/* ---- 3. Conversation well ---- */
.nb-chat-well {
  min-height: 130px;
  border-radius: var(--radius-ctl);
  background: var(--ps-bg-well);
  border: 1px solid var(--ps-bg-chip);
}

/* ---- 4. Reference slots ---- */
.nb-refs {
  display: flex;
  margin-top: 10px;
}
.nb-refslot {
  flex: 1;
  min-width: 0;
  aspect-ratio: 1 / 1;
  position: relative;
  background: var(--ps-bg-well);
  border: 1px solid var(--ps-border);
  border-radius: var(--radius-ctl);
  display: flex;
  align-items: center;
  justify-content: center;
}
.nb-refslot + .nb-refslot { margin-left: 6px; }
.nb-refslot-sel { border-color: #5a8bff; }
.nb-ref-num {
  position: absolute;
  top: 3px;
  left: 3px;
  min-width: 15px;
  height: 15px;
  padding: 0 3px;
  border-radius: 3px;
  font-size: 9px;
  line-height: 15px;
  text-align: center;
  background: rgba(0, 0, 0, 0.55);
  color: #cfcfcf;
}
.nb-ref-glyph { opacity: 0.9; }

/* ---- 5. Describe input + send ---- */
.nb-describe {
  display: flex;
  align-items: stretch;
  gap: 6px;
  margin-top: 10px;
}
.nb-describe-input {
  flex: 1;
  min-width: 0;
  min-height: 48px;
  display: flex;
  align-items: flex-start;
  padding: 8px 10px;
  border-radius: var(--radius-ctl);
  font-size: 11px;
  color: var(--ps-text-muted);
  background: var(--ps-bg-well);
  border: 1px solid var(--ps-border);
}
.nb-send {
  flex-shrink: 0;
  width: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-ctl);
  background: var(--ps-blue);
  border: 1px solid var(--ps-blue);
  color: #fff;
}

/* ---- checkboxes (Spectrum sp-checkbox recreated) ---- */
.nb-check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  font-size: 12px;
}
.nb-check-gap { margin-top: 12px; }
.nb-box {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  border-radius: 3px;
  background: var(--ps-bg-well);
  border: 1px solid var(--ps-border-soft);
  position: relative;
}
.nb-check-on .nb-box {
  background: var(--ps-blue);
  border-color: var(--ps-blue);
}
.nb-check-on .nb-box::after {
  content: "";
  position: absolute;
  left: 4px;
  top: 1px;
  width: 4px;
  height: 8px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

/* ---- 7. Generate button (btn-primary, 7px 14px) ---- */
.nb-generate {
  display: block;
  width: 100%;
  margin: 12px 0 0;
  padding: 7px 14px;
  border-radius: var(--radius-ctl);
  font-size: 12px;
  font-family: inherit;
  color: #fff;
  background: var(--ps-blue);
  border: 1px solid var(--ps-blue);
  text-align: center;
  cursor: default;
}

/* ---- separators (.sep) ---- */
.nb-sep {
  border-top: 1px solid #444;
  margin: 16px 0;
  opacity: 0.5;
}

/* ---- 8. Generation settings ---- */
.nb-section-head {
  font-weight: bold;
  opacity: 0.9;
  margin: 4px 0 8px;
}
.nb-settings-well {
  min-height: 48px;
  padding: 8px;
  border-radius: var(--radius-ctl);
  background: var(--ps-bg-well);
  border: 1px solid var(--ps-border);
  font-size: 11px;
  line-height: 1.4;
  color: var(--ps-text);
  white-space: pre-line;
}

/* ---- 9. Dropdowns (select#recent / #saved) ---- */
.nb-select {
  position: relative;
  margin-top: 8px;
  padding: 5px 24px 5px 8px;
  border-radius: var(--radius-ctl);
  background: var(--ps-bg-well);
  border: 1px solid var(--ps-border-soft);
  font-size: 12px;
  color: var(--ps-text);
}
.nb-select::after {
  content: "";
  position: absolute;
  right: 9px;
  top: 50%;
  width: 7px;
  height: 7px;
  margin-top: -5px;
  border-right: 1.5px solid var(--ps-text-muted);
  border-bottom: 1.5px solid var(--ps-text-muted);
  transform: rotate(45deg);
}

/* ---- 10. Segmented resolution (seg / seg-btn) ---- */
.nb-seg { display: flex; margin-top: 8px; }
.nb-seg-btn {
  flex: 1;
  text-align: center;
  padding: 7px 0;
  border-radius: var(--radius-ctl);
  font-size: 12px;
  background: var(--ps-bg-chip);
  border: 1px solid var(--ps-border-soft);
}
.nb-seg-btn + .nb-seg-btn { margin-left: 6px; }
.nb-seg-active {
  background: #5e5e5e;
  border-color: #8f8f8f;
  color: #fff;
}

/* ---- 11. Aspect-ratio chips (ratios / ratio-btn) ---- */
.nb-ratios {
  display: flex;
  flex-wrap: wrap;
  margin-top: 8px;
}
.nb-ratio {
  flex: 1 1 0;
  min-width: 0;
  text-align: center;
  padding: 7px 0;
  margin: 0 6px 6px 0;
  border-radius: var(--radius-ctl);
  font-size: 11px;
  background: var(--ps-bg-chip);
  border: 1px solid var(--ps-border-soft);
}
.nb-ratio:last-child { margin-right: 0; }
.nb-ratio-active {
  background: #5e5e5e;
  border-color: #8f8f8f;
  color: #fff;
}

/* ---- 12. Feather row ---- */
.nb-feather {
  display: flex;
  align-items: center;
  margin-top: 12px;
}
.nb-feather-lbl {
  flex-shrink: 0;
  margin-right: 10px;
  font-weight: bold;
}
.nb-slider {
  flex: 1;
  min-width: 0;
  height: 4px;
  position: relative;
  border-radius: 2px;
  background: #4a4a4a;
}
.nb-knob {
  position: absolute;
  left: 5%;
  top: 50%;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #c8c8c8;
  transform: translate(-50%, -50%);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}
.nb-feather-val {
  flex-shrink: 0;
  margin-left: 10px;
  opacity: 0.6;
  font-size: 11px;
}

/* ---- 13. Status strip ---- */
.nb-status {
  padding: 7px 10px;
  min-height: 16px;
  border-radius: var(--radius-ctl);
  border-left: 3px solid rgba(150, 150, 150, 0.6);
  background: rgba(127, 127, 127, 0.15);
  font-size: 12px;
  opacity: 0.95;
}

/* ---- 14. Log ---- */
.nb-log-head {
  margin: 14px 0 6px;
  font-size: 10px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  opacity: 0.5;
}
.nb-log-row {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 7px 12px;
  border-radius: 3px;
  font-size: 11px;
  background: rgba(127, 127, 127, 0.08);
}
.nb-log-name {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nb-log-done {
  flex-shrink: 0;
  color: var(--ps-green);
}

/* ---- 15. Footer ---- */
.nb-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 14px;
}
.nb-credit {
  opacity: 0.6;
  font-size: 11px;
}
.nb-settings-toggle {
  opacity: 0.8;
  font-size: 11px;
}

/* ================================================================
   In-panel demo (runPanelDemo in main.js) — the "you say → assistant
   writes the prompt" moment plays inside the panel's own wells.
   ================================================================ */

/* typed user text: block flow (so the caret follows the last character
   across wrapped lines) and full text color instead of placeholder grey */
.nb-describe-input.is-typed {
  display: block;
  color: var(--ps-text);
}

/* send button: arrow swaps to a spinner while the assistant "works" */
.nb-send { position: relative; }
.nb-send.is-loading svg { visibility: hidden; }
.nb-send.is-loading::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 14px;
  height: 14px;
  margin: -7px 0 0 -7px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: nb-spin 0.7s linear infinite;
}
@keyframes nb-spin { to { transform: rotate(360deg); } }

/* settings well while/after streaming: height is frozen by JS so the
   panel never reflows — overflow scrolls instead (slim, panel-toned) */
.nb-settings-well.is-scrolling {
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--ps-bg-chip-hov) transparent;
}
.nb-settings-well.is-scrolling::-webkit-scrollbar { width: 8px; }
.nb-settings-well.is-scrolling::-webkit-scrollbar-thumb {
  background: var(--ps-bg-chip-hov);
  border-radius: 4px;
}

/* blinking caret used while the demo types */
.nb-caret {
  display: inline-block;
  width: 2px;
  height: 1em;
  margin-left: 1px;
  background: var(--ps-blue);
  vertical-align: text-bottom;
  animation: nb-blink 1s step-end infinite;
}
@keyframes nb-blink { 50% { opacity: 0; } }

/* ================================================================
   Hover-explainer system
   ================================================================ */

/* hovered/focused region feedback (hover-capable devices only). */
@media (hover: hover) {
  .nb-panel [data-explain] { cursor: help; }
  .nb-panel [data-explain]:hover,
  .nb-panel [data-explain]:focus-visible {
    filter: brightness(1.08);
  }
}

/* the active-region highlight lives INSIDE each region as an ::after
   inset ring. No measuring, no overlay: it is part of the region, so
   panel drift, scale media queries, zoom and resize can never
   desynchronise it (the previous body-fixed overlay measured rects
   and could end up on the wrong element). JS only toggles the
   .is-explained class. */
.nb-panel [data-explain] { position: relative; }
.nb-panel [data-explain]::after {
  content: "";
  position: absolute;
  inset: -5px;                            /* 5px breathing room */
  border: 1px solid var(--ps-blue);
  background: rgba(38, 128, 235, 0.07);
  /* fixed family radius: same 8px as the panel + explainer card
     (reads concentric around the 4px --radius-ctl chips + 5px pad) */
  border-radius: 8px;
  opacity: 0;
  pointer-events: none;
  z-index: 1;                             /* above the region's own children */
  transition: opacity 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}
/* z-index lift while explained, so the outset ring never disappears
   under a following sibling — the original stacking problem */
.nb-panel [data-explain].is-explained { z-index: 5; }
.nb-panel [data-explain].is-explained::after { opacity: 1; }
/* the tab strip sits flush with the panel edge (the panel's
   overflow:hidden would clip a -5px outset ring there) — its ring
   hugs the strip instead */
.nb-tabs[data-explain]::after { inset: 1px; }

/* the reusable floating glass card. Hero adaptation: position:fixed on
   <body> (the over-panel is transformed/scaled, so viewport coordinates
   from getBoundingClientRect place it directly) + above the fixed chrome */
.nb-explain {
  position: fixed;
  z-index: 60;
  max-width: 240px;
  padding: 12px 14px;
  border-radius: 8px;
  background: rgba(35, 35, 35, 0.8);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border: 1px solid var(--ps-border-soft);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
  font-family: var(--font-ui);
  pointer-events: none;
  /* base = the "before enter" state: below its spot, invisible */
  opacity: 0;
  transform: translateY(10px);
}
.nb-explain.is-showing {
  opacity: 1;
  transform: translateY(0);
  transition:
    opacity 0.22s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}
.nb-explain.is-hiding {
  opacity: 0;
  transform: translateY(-10px); /* leaves upward */
  /* hero house rule: ease-out only (site/ used ease-in here) */
  transition:
    opacity 0.18s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.18s cubic-bezier(0.22, 1, 0.36, 1);
}
.nb-explain-title {
  display: block;
  font-weight: bold;
  font-size: 12px;
  line-height: 1.4;
  color: var(--ps-text-bright);
  margin-bottom: 4px;
}
.nb-explain-body {
  display: block;
  font-size: 12px;
  line-height: 1.5;
  color: var(--ps-text);
}

/* hint under the panel — hover-capable devices only */
.nb-hint {
  display: none;
  margin: 14px 0 0;
  font-size: 12px;
  text-align: center;
  color: var(--ps-text-muted);
  font-family: var(--font-ui);
  transition: opacity 0.4s ease;
}
@media (hover: hover) {
  .nb-hint { display: block; }
}
.nb-hint.is-done {
  opacity: 0;
  pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
  .nb-explain,
  .nb-explain.is-showing,
  .nb-explain.is-hiding {
    transition: none;
    transform: none;
  }
  .nb-panel [data-explain]::after { transition: none; }
}

/* ================================================================
   Responsive
   ================================================================ */
@media (max-width: 900px) {
  .nb-panel { width: min(420px, 92vw); }
}
@media (max-width: 480px) {
  .nb-panel { width: 100%; }
  .nb-hint { display: none; }
  /* Narrow panel: collapse the tab strip to the active tab + overflow menu so
     it can never be wider than the viewport (was causing ~10px horizontal page
     scroll at <=375px). Mirrors how a narrow docked panel truncates its tabs. */
  .nb-tab:not(.nb-tab-active) { display: none; }
}
