/* ═══════════════════════════════════════════════════════════════════════════
   LAYOUT V2 — boxed left/right panels
   Left: white card, scrollable controls
   Right: black card, flex column, controls pinned to bottom
═══════════════════════════════════════════════════════════════════════════ */

/* Override the main layout to full-height two-box split */
body.layout-v2 {
  background: #F0F0F0;
  overflow: hidden;
}

/* Allow scroll on admin/settings pages */
body.layout-v2.tab-admin,
body.layout-v2.tab-settings {
  overflow-y: auto;
}

body.layout-v2 nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: #fff;
  border-bottom: 1px solid rgba(0,0,0,.08);
}

body.layout-v2 #buildPage {
  display: grid;
  grid-template-columns: minmax(0,1fr) minmax(0,1fr);
  grid-template-rows: 1fr;
  gap: 0 7px;
  padding: 0 !important;
  /* fill viewport below nav */
  position: fixed;
  top: 54px;
  left: 0;
  right: 0;
  bottom: 0;
  box-sizing: border-box;
  overflow: hidden;
  margin-top: 0;
}

/* Undo main.css sticky on .right inside v2 */
body.layout-v2 .right {
  position: relative !important;
  top: 0 !important;
  height: calc(100vh - 66px) !important;
}

/* Undo overrides.css min-height on .left inside v2 */
body.layout-v2 .left {
  min-height: 0 !important;
  height: calc(100vh - 66px) !important;
  padding: 20px 24px 32px !important;
  border-right: none !important;
  overflow-y: auto !important;
}

/* ── Left white box ──────────────────────────────────────────────────────── */
.v2-left-box {
  background: #fff;
  border-radius: 8px;
  overflow-y: auto;
  padding: 0 16px 32px 16px;
  display: flex;
  flex-direction: column;
  gap: 0;
  box-shadow: 0 1px 3px rgba(0,0,0,.06), 0 0 0 1px rgba(0,0,0,.05);
  min-width: 0;
  min-height: 0;
  height: calc(100vh - 66px);
  margin: 5px 0 7px 7px;
  box-sizing: border-box;
  scrollbar-width: none;
}

.v2-left-box::-webkit-scrollbar {
  width: 5px;
}
.v2-left-box::-webkit-scrollbar-track {
  background: transparent;
}
.v2-left-box::-webkit-scrollbar-thumb {
  background: transparent;
  border-radius: 3px;
}
.v2-left-box:hover {
  scrollbar-width: thin;
  scrollbar-color: rgba(0,0,0,.18) transparent;
}
.v2-left-box:hover::-webkit-scrollbar-thumb {
  background: rgba(0,0,0,.18);
}

/* Scene library trigger sits at the very top of the left box */
body.layout-v2 #sceneLibraryBox {
  display: none !important;
}

/* ── Right black box ─────────────────────────────────────────────────────── */
.v2-right-box {
  background: #111;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
  min-width: 0;
  min-height: 0;
  height: calc(100vh - 66px);
  margin: 5px 7px 7px 0;
  box-sizing: border-box;
}

/* Toggle tabs — segmented pill control */
.v2-right-box .view-toggle {
  display: flex;
  flex-shrink: 0;
  background: transparent;
  border-bottom: none;
  padding: 14px 16px 10px;
  gap: 0;
}

.v2-right-box .view-toggle-inner {
  display: flex;
  width: 100%;
  background: rgba(255,255,255,.1);
  border-radius: 6px;
  padding: 3px;
  gap: 2px;
}

.v2-right-box .view-tab {
  flex: 1;
  text-align: center;
  background: transparent;
  border-radius: 5px;
  border: none;
  border-bottom: none;
  padding: 7px 20px;
  font-size: 13px;
  font-weight: 600;
  color: rgba(255,255,255,.4);
  cursor: pointer;
  transition: background .15s, color .15s;
  letter-spacing: -.01em;
  box-shadow: none;
}

.v2-right-box .view-tab:hover {
  background: rgba(255,255,255,.08);
  color: rgba(255,255,255,.7);
}

.v2-right-box .view-tab.active {
  background: #fff;
  color: #111;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
  border-bottom: none;
}

/* Status dot on Image tab */
.v2-right-box .tab-dot {
  display: inline-block;
  width: 5px;
  height: 5px;
  background: var(--green);
  border-radius: 999px;
  margin-left: 5px;
  vertical-align: middle;
  position: relative;
  top: -1px;
  opacity: 0;
}
.v2-right-box .tab-dot.visible { opacity: 1; }

/* Scrollable content area */
.v2-content-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 20px 20px 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.15) transparent;
  min-height: 0;
}

/* Prompt pane fills all available height */
#panePrompt {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* Prompt textarea in dark box */
.v2-right-box #output {
  background: transparent;
  color: rgba(255,255,255,.88);
  border: none;
  border-radius: 0;
  font-size: 13px;
  line-height: 1.65;
  min-height: 0;
  width: 100%;
  resize: none;
  padding: 0;
  outline: none;
  box-shadow: none;
  flex: 1;
}

.v2-right-box #output::placeholder {
  color: rgba(255,255,255,.2);
}

/* Prompt footer (Reset + note) */
.v2-right-box .prompt-footer {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 12px 0 20px;
  border-top: 1px solid rgba(255,255,255,.07);
  margin-top: 12px;
}

.v2-right-box .prompt-footer button {
  background: rgba(255,255,255,.08);
  color: rgba(255,255,255,.55);
  border: none;
  font-size: 11px;
  padding: 6px 11px;
  border-radius: 6px;
}
.v2-right-box .prompt-footer button:hover {
  background: rgba(255,255,255,.14);
  color: rgba(255,255,255,.8);
}

.v2-right-box .prompt-footer .tiny {
  color: rgba(255,255,255,.28);
}

/* Image pane in dark box */
.v2-right-box .image-preview-box {
  background: rgba(255,255,255,.04);
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,.07);
  height: 340px;
}

.v2-right-box .image-preview-placeholder {
  color: rgba(255,255,255,.2);
}

.v2-right-box .image-footer {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 12px 0 20px;
}

.v2-right-box .image-footer button,
.v2-right-box .image-footer a button {
  background: rgba(255,255,255,.08);
  color: rgba(255,255,255,.55);
  border: none;
  font-size: 12px;
  padding: 6px 11px;
  border-radius: 6px;
}
.v2-right-box .image-footer button:hover { background: rgba(255,255,255,.14); color: rgba(255,255,255,.8); }
.v2-right-box .image-footer button:disabled { opacity: .3; pointer-events: none; }

.v2-right-box .image-meta {
  font-size: 11px;
  color: rgba(255,255,255,.3);
  flex: 1;
}

/* ── Bottom control bar ──────────────────────────────────────────────────── */
.v2-bottom-bar {
  flex-shrink: 0;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  padding: 12px 16px 16px;
  border-top: 1px solid rgba(255,255,255,.08);
}

.v2-bottom-row {
  display: contents;
}

.v2-bottom-bar select {
  height: 34px;
  font-size: 12px;
  border-radius: 8px;
  background: rgba(255,255,255,.08);
  color: rgba(255,255,255,.75);
  border: 1px solid rgba(255,255,255,.1);
  padding: 0 28px 0 10px;
  cursor: pointer;
  outline: none;
  flex: 0 0 auto;
  width: auto;
  /* Strip native OS appearance (fixes Safari 3D look) */
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  /* Custom chevron arrow */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='rgba(255,255,255,0.5)' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}

.v2-bottom-bar select option {
  background: #222;
  color: #fff;
}

.v2-bottom-bar .v2-spacer { flex: 1; }

.v2-bottom-bar .gen-status-inline {
  font-size: 11px;
  color: rgba(255,255,255,.4);
}

.v2-bottom-bar .btn-copy {
  height: 40px;
  padding: 0 16px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 8px;
  background: rgba(255,255,255,.08);
  color: rgba(255,255,255,.6);
  border: 1px solid rgba(255,255,255,.1);
  cursor: pointer;
  transition: background .12s;
  white-space: nowrap;
}
.v2-bottom-bar .btn-copy:hover { background: rgba(255,255,255,.15); color: #fff; }

.v2-bottom-bar .btn-generate {
  height: 40px;
  flex: 1;
  min-width: 0;
  font-size: 13px;
  font-weight: 700;
  border-radius: 8px;
  background: #fff;
  color: #111;
  border: none;
  cursor: pointer;
  transition: opacity .12s;
  letter-spacing: -.01em;
}
.v2-bottom-bar .btn-generate:hover { opacity: .88; }
.v2-bottom-bar .btn-generate:disabled { opacity: .35; pointer-events: none; }

/* Scrollbar in left box */
.v2-left-box::-webkit-scrollbar { width: 4px; }
.v2-left-box::-webkit-scrollbar-track { background: transparent; }
.v2-left-box::-webkit-scrollbar-thumb { background: rgba(0,0,0,.12); border-radius: 4px; }

/* ── Left panel tweaks ───────────────────────────────────────────────────── */

/* Smaller dots, tighter gap to text */
body.layout-v2 .segment-dot.section-state-dot {
  width: 7px !important;
  height: 7px !important;
  min-width: 7px !important;
  margin-right: 0 !important;
}

/* Tighten dot-to-text gap on section titles */
body.layout-v2 .section-title-main,
body.layout-v2 .section-title-advanced {
  gap: 4px !important;
  align-items: center !important;
}

/* Beat overrides.css high-specificity gap:12px rules on each section */
body.layout-v2 #setup-section > .panel-head .panel-title.section-title-main,
body.layout-v2 #core-section > .panel-head .panel-title.section-title-main,
body.layout-v2 #product-section > .panel-head .panel-title.section-title-main,
body.layout-v2 #body-section > .panel-head .panel-title.section-title-main {
  gap: 4px !important;
}

/* Match "More control" title size to other section titles */
body.layout-v2 .section-title-advanced {
  font-size: 20px !important;
}

/* Tighter, vertically centered panel headers */
body.layout-v2 .section-accordion .panel-head {
  padding: 7px 0 !important;
  align-items: center !important;
}

/* Align "More control" header with other sections (remove .box left padding) */
body.layout-v2 .advanced-box .panel-head {
  padding: 7px 0 !important;
}

/* Reduce vertical gap between section accordions */
body.layout-v2 .section-accordion {
  margin-bottom: 2px !important;
}

body.layout-v2 #advancedBox {
  margin-bottom: 2px !important;
}

/* Scene Library title — same dot/gap/size treatment as section titles */
body.layout-v2 .scene-header {
  padding: 7px 0 !important;
}
body.layout-v2 .scene-title {
  display: flex !important;
  align-items: center !important;
  gap: 4px !important;
  font-size: 20px !important;
}

/* Scene library injected trigger (actual element shown in left panel) */
body.layout-v2 .trigger-label {
  gap: 4px !important;
}

/* Scene count — plain gray text, no pill */
body.layout-v2 .trigger-scene-count-plain {
  font-size: 13px;
  font-weight: 500;
  color: var(--text3);
  letter-spacing: 0;
  margin-left: 2px;
}

/* Sub-item panel titles — tighten dot-to-text gap, keep existing font size */
body.layout-v2 .panel-title:not(.section-title-main):not(.section-title-advanced) {
  gap: 4px !important;
}

/* Beat overrides.css gap:8px !important on setup/core sub-items */
body.layout-v2 #setup-section .panel-title:not(.section-title-main),
body.layout-v2 #core-section .panel-title:not(.section-title-main) {
  gap: 4px !important;
}
