/* Phase 129 - targeted fixes only: Cutting Room, scroll locks, tutorial spotlight, mobile dock */

/* Cutting Room legibility + film-strip cards */
#cbs-cutting-room-section > div:first-child {
  background: linear-gradient(135deg, rgba(17,24,39,.94), rgba(55,65,81,.90)) !important;
  border: 1px solid rgba(255,255,255,.16) !important;
  border-radius: 16px !important;
  padding: 12px 14px !important;
  box-shadow: 0 14px 32px rgba(17,24,39,.18) !important;
}
#cbs-cutting-room-section > div:first-child div[style*="color:#374151"] { color: #fff7ed !important; }
#cbs-cutting-room-section > div:first-child div[style*="color:#9ca3af"] { color: #fde68a !important; text-shadow: 0 1px 1px rgba(0,0,0,.35); }
#cbs-cr-grid > div {
  position: relative !important;
  overflow: hidden !important;
  isolation: isolate !important;
  background: linear-gradient(90deg,#111827 0 16px,#f8fafc 16px calc(100% - 16px),#111827 calc(100% - 16px)) !important;
  border: 2px solid #111827 !important;
  border-radius: 10px !important;
  box-shadow: 0 10px 26px rgba(17,24,39,.16) !important;
  opacity: 1 !important;
  padding: 16px 22px !important;
}
#cbs-cr-grid > div::before,
#cbs-cr-grid > div::after {
  content: "";
  position: absolute;
  top: 7px;
  bottom: 7px;
  width: 8px;
  z-index: 0;
  background: repeating-linear-gradient(to bottom, rgba(255,255,255,.92) 0 7px, transparent 7px 14px);
  border-radius: 3px;
}
#cbs-cr-grid > div::before { left: 4px; }
#cbs-cr-grid > div::after { right: 4px; }
#cbs-cr-grid > div > * { position: relative; z-index: 1; }
#cbs-cr-grid > div div[style*="color:#374151"] { color: #111827 !important; }
#cbs-cr-grid > div div[style*="color:#9ca3af"] { color: #4b5563 !important; font-weight: 700 !important; }

/* Production Command Center / Wardrobe page scroll fixes */
#pcc-app, #pcc-app .pcc-wrap { min-height: 0 !important; overflow-y: auto !important; -webkit-overflow-scrolling: touch; }
body[data-active-view="pcc-app"] .view-container,
body[data-active-view="production-command-center-app"] .view-container { overflow-y: auto !important; }
#wardrobe-app, #wardrobe-app .wdp2-body, #wardrobe-app .wdp2-shell { min-height: 0 !important; overflow-y: auto !important; -webkit-overflow-scrolling: touch; }
body[data-active-view="wardrobe-app"] .view-container { overflow-y: auto !important; }

/* Make build visibly affect paper doll proportions without changing assets */
.pde2-stage[data-build="small"] { transform: scaleX(.94); transform-origin: center bottom; }
.pde2-stage[data-build="large"] { transform: scaleX(1.07); transform-origin: center bottom; }
.pde2-stage[data-build="medium"] { transform: none; }

/* Media tabs: keep old specialty panels hidden while the active refresh hydrates */
body.cbs-phase129-specialty-loading .media-tabs-old,
body.cbs-phase129-specialty-loading [data-legacy-media],
body.cbs-phase129-specialty-loading .legacy-media-panel,
body.cbs-phase129-specialty-loading .cine-stabs,
body.cbs-phase129-specialty-loading .cine-stab,
body.cbs-phase129-specialty-loading #cine-subtabs,
body.cbs-phase129-specialty-loading #cine-panel-blueprint,
body.cbs-phase129-specialty-loading #cine-panel-shots,
body.cbs-phase129-specialty-loading #cine-panel-gaffer,
body.cbs-phase129-specialty-loading #cine-panel-analytics { visibility: hidden !important; }

/* Tutorial: dim background but keep spotlight target clear/readable */
#cbs-tut-overlay {
  background: rgba(8, 12, 28, .55) !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}
.cbs-tut-spotlight {
  box-shadow: 0 0 0 3px rgba(255,215,0,.9), 0 0 32px 12px rgba(255,215,0,.4) !important;
  border: 2px solid rgba(255,215,0,.6) !important;
}
/* Ensure tutorial note and its buttons always receive pointer events */
.cbs-tut-note { pointer-events: all !important; touch-action: auto !important; }
.cbs-tut-note button { pointer-events: auto !important; touch-action: manipulation !important; cursor: pointer !important; }
/* Phase 131: target glow when tutorial highlights an element */
.cbs-phase131-target-glow {
  outline: 3px solid rgba(255,215,0,.85) !important;
  outline-offset: 4px !important;
  box-shadow: 0 0 18px 6px rgba(255,215,0,.28) !important;
  transition: outline .2s, box-shadow .2s;
}

/* Storyboard fullscreen positioning */
#sb-fs-overlay.open { left: 0 !important; right: 0 !important; transform: none !important; }
#sb-fs-overlay .sb-fs-shell, #sb-fs-overlay .sb-fs-panel { margin-left: auto !important; margin-right: auto !important; }

/* Phase 131: director's board / spatial scroll fix */
#spatial-app, .spatial-scene-blocking, .spatial-floor-plan-wrap,
#spatial-app .view-container { min-height: 0 !important; overflow-y: auto !important; -webkit-overflow-scrolling: touch; }
.spatial-shelf, .spatial-stage-plan { max-height: 60vh; overflow-y: auto; }

/* Phase 131: storyboard stickers - semi-transparent badge background */
.cbs129-sticker-btn { border: 1px solid rgba(17,24,39,.14); background: #fff; border-radius: 8px; padding: 5px 7px; font-size: .72rem; cursor: pointer; }
.cbs129-sticker-btn:hover { background: #fef3c7; }
.cbs129-sticker-drawer { display: flex; gap: 5px; flex-wrap: wrap; margin: 6px 0; padding: 6px; background: rgba(17,24,39,.07); border-radius: 10px; }

/* Mobile home: no bottom dock on project hub */
@media (max-width: 760px) {
  body.cbs-phase129-home #bottom-nav,
  body.cbs-phase129-home #bottom-nav-inner,
  body.cbs-phase129-home .phase103-more-sheet { display: none !important; }
  body.cbs-phase129-home { --phase103-dock: 0px; }
}

/* Art Dept Pantone Color Tracker (Phase 131) */
.adp-scene-row { transition: box-shadow .15s; }
.adp-scene-row:hover { box-shadow: 0 2px 8px rgba(0,0,0,.06); }
.adp-swatch-rect { transition: transform .12s, box-shadow .12s; }
.adp-swatch-rect:hover { transform: scale(1.2); box-shadow: 0 2px 8px rgba(0,0,0,.2); z-index:1; }
.adp-scene-add { font-size:.7rem; }

/* Storyboard sticker drawer */
.cbs129-sticker-drawer{display:flex;gap:4px;flex-wrap:wrap;margin:4px 0 0;padding:5px 6px;background:rgba(17,24,39,.05);border-radius:8px;border:1px solid rgba(17,24,39,.09);}
.cbs129-sticker-btn{border:1px solid rgba(17,24,39,.14);background:#fff;border-radius:6px;padding:4px 6px;font-size:.68rem;cursor:pointer;white-space:nowrap;min-width:0;}
.cbs129-sticker-btn:hover{background:#fef3c7;border-color:#f59e0b;}

/* ── Production app padding fixes ──────────────────────────────────────── */
/* Director's Board: remove extra top padding that creates brown gap */
#spatial-app { padding-top: 0 !important; }
/* Reduce oversized bottom padding on production apps (was max(120px,...)) */
#spatial-app,
#storyboard-app,
#schedule-app,
#safety-app,
#media-app,
#continuity-app,
#pcc-app,
#callsheet-app,
#stripboard-app,
#shotlist-app,
#budget-app,
#reports-app,
#artdept-app,
#props-app { padding-bottom: 24px !important; }

/* ── Smooth page transitions — eliminate brown flash on view switch ──── */
body > [id$="-app"],
body > #writer-app,
body > #project-hub {
  transition: opacity 120ms ease !important;
}
/* Prevent PCC old-version flash by keeping it invisible until JS hydrates */
#pcc-app:not(.pcc-ready) .ra77-card { display: none !important; }

/* Scene Outfits: ensure card canvas has enough room for full model */
.wdp2-scene-card,
.wdp2-scene-doll-wrap {
  min-height: 260px !important;
  height: 260px !important;
}
.wdp2-scene-card .pde2-stage {
  transform-origin: center top !important;
}
