/* ═══════════════════════════════════════════════════════
   AI CREATIVE LAB — Content Factory: Redesign Iteration 2
   Loaded AFTER redesign.css — overrides previous styles
═══════════════════════════════════════════════════════ */

/* ── Design Tokens Update ───────────────────────────── */
:root {
  --sb: 116px;
  --topbar-h: 64px;
  --cf-sidebar:       #120F0B;
  --cf-topbar:        #100D09;
  --cf-surface-2:     #211B14;
  --cf-surface-3:     #2A2118;
  --cf-border-strong: rgba(212, 176, 106, 0.34);
  --cf-gold-strong:   #F0C86A;
  --cf-gold-soft:     #E8CC8B;
  --cf-gold-dark:     #8F690F;
  --cf-text-soft:     #D8CCBA;
  --cf-green:         #25D07D;
  --cf-red-dark:      #7A2222;
  --cf-orange:        #F0A53A;
  --cf-blue:          #4EA4FF;
  --cf-radius-sm:     8px;
  --cf-radius-md:     12px;
  --cf-radius-lg:     18px;
  --cf-radius-xl:     24px;
  --cf-shadow-gold:   0 0 22px rgba(212, 176, 106, 0.16);
}

/* ═══════════════════════════════════════════════════════
   TOP BAR
═══════════════════════════════════════════════════════ */
#topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 64px;
  z-index: 1000;
  background: #100D09;
  border-bottom: 1px solid rgba(212, 176, 106, 0.18);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px 0 calc(var(--sb) + 18px);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

#tb-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}

#tb-right {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

/* Contextual generation buttons */
#tb-ctx {
  display: none;
  align-items: center;
  gap: 8px;
}
#tb-ctx.visible { display: flex; }

.tb-ctx-btn {
  height: 44px;
  min-width: 78px;
  padding: 6px 12px;
  border-radius: 12px;
  border: 1px solid rgba(212, 176, 106, 0.18);
  background: transparent;
  color: #948777;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  line-height: 1.15;
  transition: all 0.15s;
  font-family: inherit;
  white-space: nowrap;
}
.tb-ctx-btn svg { width: 20px; height: 20px; flex-shrink: 0; }
.tb-ctx-btn:hover {
  background: rgba(212, 176, 106, 0.09);
  color: #D8CCBA;
  border-color: rgba(212, 176, 106, 0.3);
}
.tb-ctx-btn.active {
  background: rgba(212, 176, 106, 0.15);
  color: #D4B06A;
  border-color: rgba(212, 176, 106, 0.38);
  box-shadow: 0 0 18px rgba(212, 176, 106, 0.12);
}
.tb-ctx-btn.tb-ctx-disabled {
  opacity: 0.3;
  cursor: default;
  pointer-events: none;
}

/* Top-right utility buttons */
.tb-btn {
  height: 44px;
  min-width: 60px;
  padding: 6px 10px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: transparent;
  color: #948777;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  line-height: 1.15;
  transition: all 0.15s;
  font-family: inherit;
  white-space: nowrap;
}
.tb-btn svg { width: 20px; height: 20px; flex-shrink: 0; }
.tb-btn:hover {
  background: rgba(212, 176, 106, 0.09);
  color: #D8CCBA;
}
.tb-btn.tb-btn-danger { color: rgba(226, 74, 74, 0.5); }
.tb-btn.tb-btn-danger:hover {
  background: rgba(226, 74, 74, 0.08);
  color: #E24A4A;
}
.tb-btn.tb-btn-disabled {
  opacity: 0.3;
  cursor: default;
  pointer-events: none;
}

.tb-divider {
  width: 1px;
  height: 28px;
  background: rgba(212, 176, 106, 0.14);
  margin: 0 4px;
  flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════
   SIDEBAR UPDATE
═══════════════════════════════════════════════════════ */
#sidebar {
  top: 64px !important;
  height: calc(100vh - 64px) !important;
  width: 116px;
}

/* Section labels — gold, uppercase, visible */
.sb-section {
  font-size: 10px !important;
  font-weight: 800 !important;
  color: #D4B06A !important;
  letter-spacing: 0.12em !important;
  text-transform: uppercase !important;
  padding: 16px 10px 8px !important;
  opacity: 1 !important;
  margin: 0 !important;
  line-height: 1;
}

/* Nav tile icon bigger */
.sbn-ic svg {
  width: 26px !important;
  height: 26px !important;
}

/* Nav label bigger */
.sbn-l {
  font-size: 10.5px !important;
  font-weight: 700 !important;
  line-height: 1.15 !important;
}

/* Active state: border + glow instead of indicator line */
.sbn.active {
  background: rgba(212, 176, 106, 0.15) !important;
  border: 1px solid rgba(212, 176, 106, 0.28) !important;
  box-shadow: var(--cf-shadow-gold) !important;
  color: #D4B06A !important;
}
.sbn.active::before { display: none !important; }

/* Logo update — PNG icon */
#sb-icon {
  width: 52px !important;
  height: 52px !important;
  border-radius: 14px !important;
  background: none !important;
  box-shadow: none !important;
  overflow: hidden;
}
#sb-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 14px;
}
#sb-icon > svg { display: none !important; }

.sb-logo-brand {
  font-size: 9px !important;
  font-weight: 800 !important;
  letter-spacing: 0.09em !important;
  color: var(--cf-gold) !important;
}
.sb-logo-name {
  font-size: 7.5px !important;
  font-weight: 600 !important;
}

/* ═══════════════════════════════════════════════════════
   MAIN LAYOUT — account for topbar
═══════════════════════════════════════════════════════ */
#main {
  margin-top: 64px !important;
}
/* hdr sticky below topbar */
#hdr {
  top: 64px !important;
  z-index: 100 !important;
}

/* ═══════════════════════════════════════════════════════
   BUTTON SYSTEM
═══════════════════════════════════════════════════════ */
.cf-btn {
  min-height: 40px;
  padding: 8px 16px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 800;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s;
  line-height: 1.1;
  white-space: nowrap;
}
.cf-btn svg { width: 18px; height: 18px; flex-shrink: 0; }

.cf-btn-primary {
  background: linear-gradient(135deg, #D4B06A, #CBA45A);
  color: #0D0800;
}
.cf-btn-primary:hover {
  background: linear-gradient(135deg, #F0C86A, #D4B06A);
  box-shadow: 0 4px 16px rgba(212, 176, 106, 0.28);
}

.cf-btn-secondary {
  background: transparent;
  color: #D8CCBA;
  border-color: rgba(212, 176, 106, 0.34);
}
.cf-btn-secondary:hover {
  background: rgba(212, 176, 106, 0.09);
  color: #D4B06A;
  border-color: rgba(212, 176, 106, 0.5);
}

.cf-btn-ghost {
  background: transparent;
  color: #948777;
  border-color: transparent;
}
.cf-btn-ghost:hover {
  background: rgba(212, 176, 106, 0.07);
  color: #D8CCBA;
}

.cf-btn-danger {
  background: rgba(122, 34, 34, 0.25);
  color: #FFD7D7;
  border-color: rgba(226, 74, 74, 0.38);
}
.cf-btn-danger:hover {
  background: rgba(122, 34, 34, 0.45);
  color: #FF9999;
  border-color: rgba(226, 74, 74, 0.6);
}

.cf-btn:disabled,
.cf-btn.cf-btn-off {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
}

/* Icon above label */
.cf-icon-btn {
  min-width: 72px;
  min-height: 58px;
  padding: 8px 10px;
  border-radius: 14px;
  flex-direction: column;
  gap: 5px;
}
.cf-icon-btn svg { width: 24px !important; height: 24px !important; }
.cf-icon-btn span { font-size: 11px; line-height: 1.1; }

/* ═══════════════════════════════════════════════════════
   PROJECT PAGE IMPROVEMENTS
═══════════════════════════════════════════════════════ */
.pp-title {
  font-size: 32px !important;
  font-weight: 850 !important;
  line-height: 1.15 !important;
  letter-spacing: -0.01em;
}
.pp-hdr {
  border-radius: 18px !important;
  padding: 28px 30px !important;
}
.pp-stage-title {
  font-size: 18px !important;
  font-weight: 800 !important;
}
.pp-stage-icon { font-size: 0 !important; }
.pp-stage { border-radius: 18px !important; }
.pp-stage-hdr { padding: 18px 24px !important; }
.pp-stage-body { padding: 24px !important; }

/* Delete project button improved */
.pp-del-btn {
  border-radius: 10px !important;
  font-size: 12px !important;
  font-weight: 700 !important;
  padding: 7px 14px !important;
  color: rgba(226, 74, 74, 0.6) !important;
  border-color: rgba(226, 74, 74, 0.3) !important;
}
.pp-del-btn:hover {
  background: rgba(122, 34, 34, 0.3) !important;
  color: #FFD7D7 !important;
  border-color: rgba(226, 74, 74, 0.6) !important;
}

/* Project dates meta — calendar icon  */
.pp-meta-item {
  font-size: 13px !important;
  color: #948777 !important;
  display: flex;
  align-items: center;
  gap: 5px;
}
.pp-meta-item svg {
  width: 14px;
  height: 14px;
  opacity: 0.6;
}

/* Desktop 2-col grid */
@media (min-width: 1180px) {
  .pp-wrap { max-width: 1320px !important; }

  .pp-stages-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(340px, 0.85fr);
    gap: 24px;
    align-items: start;
  }
  .pp-stages-col-full { grid-column: 1 / -1; }
}

/* ═══════════════════════════════════════════════════════
   SCENARIO TABLE
═══════════════════════════════════════════════════════ */
.sc-table {
  font-size: 14px !important;
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
}
.sc-table th {
  font-size: 12px !important;
  font-weight: 850 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.06em !important;
  padding: 12px 14px !important;
  color: #948777 !important;
  background: #1A1510 !important;
  border-bottom: 2px solid rgba(212, 176, 106, 0.2) !important;
  position: sticky;
  top: 0;
  z-index: 10;
}
.sc-table td {
  padding: 12px 14px !important;
  vertical-align: top !important;
  line-height: 1.45 !important;
  border-bottom: 1px solid rgba(212, 176, 106, 0.07) !important;
}
.sc-sc-row:hover td {
  background: rgba(212, 176, 106, 0.04) !important;
}
.sc-ep-row td {
  background: rgba(18, 15, 11, 0.9) !important;
  font-size: 13px !important;
  font-weight: 800 !important;
  color: #D4B06A !important;
  padding: 10px 14px !important;
}
.sc-ep-num, .sc-sc-num {
  font-size: 15px !important;
  font-weight: 850 !important;
  color: #D4B06A !important;
  min-width: 72px !important;
}
/* Fix Свет column wrapping */
.sc-table th:nth-child(5),
.sc-table td:nth-child(5) {
  min-width: 160px !important;
  white-space: normal !important;
  word-break: break-word !important;
  overflow-wrap: anywhere !important;
}
/* Description column */
.sc-table td:nth-child(7) {
  min-width: 280px !important;
  white-space: normal !important;
  word-break: break-word !important;
}

/* Mode toggle buttons */
.sv-mode-toggle {
  display: flex;
  gap: 6px;
  margin-bottom: 14px;
  padding: 0 2px;
}
.sv-mode-btn {
  height: 36px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid rgba(212, 176, 106, 0.18);
  background: transparent;
  color: #948777;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: inherit;
  transition: all 0.13s;
}
.sv-mode-btn.active {
  background: rgba(212, 176, 106, 0.15);
  color: #D4B06A;
  border-color: rgba(212, 176, 106, 0.35);
}
.sv-mode-btn:hover:not(.active) {
  background: rgba(212, 176, 106, 0.07);
  color: #D8CCBA;
}
.sv-mode-btn svg { width: 16px; height: 16px; }

/* Scenario card grid */
.scenario-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 18px;
  padding: 4px 2px;
}
.scenario-card {
  padding: 18px;
  border-radius: 18px;
  background: #1A1510;
  border: 1px solid rgba(212, 176, 106, 0.18);
  transition: border-color 0.13s;
}
.scenario-card:hover { border-color: rgba(212, 176, 106, 0.3); }
.sc-card-num {
  font-size: 12px;
  font-weight: 800;
  color: #D4B06A;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
}
.sc-card-title {
  font-size: 15px;
  font-weight: 750;
  color: #F8F4EA;
  margin-bottom: 10px;
  line-height: 1.3;
}
.sc-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}
.sc-card-tag {
  font-size: 12px;
  color: #948777;
  background: rgba(212, 176, 106, 0.06);
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid rgba(212, 176, 106, 0.1);
}
.sc-card-desc {
  font-size: 13px;
  color: #D8CCBA;
  line-height: 1.5;
  margin-top: 8px;
  border-top: 1px solid rgba(212, 176, 106, 0.08);
  padding-top: 8px;
}
.sc-card-actions {
  margin-top: 12px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

/* ═══════════════════════════════════════════════════════
   SHOT PLAN TABLE
═══════════════════════════════════════════════════════ */
.sp-scene-row td {
  background: rgba(18, 15, 11, 0.9) !important;
  color: #D4B06A !important;
  font-weight: 800 !important;
  font-size: 13px !important;
}
.sp-shot-row:hover td {
  background: rgba(212, 176, 106, 0.04) !important;
}

/* Shot right panel wider */
.sp-right {
  width: min(50vw, 860px) !important;
  min-width: 480px !important;
}
@media (max-width: 1180px) {
  .sp-right {
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
  }
}
@media (max-width: 760px) {
  .sp-right.open {
    position: fixed !important;
    inset: 64px 0 0 0 !important;
    width: 100% !important;
    z-index: 1100 !important;
    overflow-y: auto !important;
    min-width: 0 !important;
  }
}

/* Shot detail panel header bigger */
.sp-right .bmod-hdr-title {
  font-size: 16px !important;
  font-weight: 800 !important;
}
.sp-right .bmod-section-title {
  font-size: 14px !important;
  font-weight: 800 !important;
  color: #D8CCBA !important;
}

/* Shot card list */
.shot-card-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}
.shot-card {
  border-radius: 18px;
  padding: 18px;
  background: #1A1510;
  border: 1px solid rgba(212, 176, 106, 0.18);
  transition: border-color 0.13s;
}
.shot-card:hover { border-color: rgba(212, 176, 106, 0.3); }
.shot-card-scene {
  font-size: 12px;
  font-weight: 800;
  color: #D4B06A;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
}
.shot-card-desc {
  font-size: 14px;
  color: #F8F4EA;
  line-height: 1.45;
  margin-bottom: 10px;
}
.shot-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.shot-card-tag {
  font-size: 12px;
  color: #948777;
  background: rgba(212, 176, 106, 0.06);
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid rgba(212, 176, 106, 0.1);
}
@media (min-width: 1440px) {
  .shot-card-list.is-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ═══════════════════════════════════════════════════════
   FORM INPUTS (larger)
═══════════════════════════════════════════════════════ */
.cf-input,
.cf-select {
  height: 46px !important;
  padding: 0 14px !important;
  font-size: 15px !important;
}
.cf-textarea {
  min-height: 160px !important;
  padding: 14px !important;
  font-size: 15px !important;
  line-height: 1.45 !important;
}
.cf-input:focus,
.cf-select:focus,
.cf-textarea:focus {
  border-color: var(--cf-gold) !important;
  box-shadow: 0 0 0 3px rgba(212, 176, 106, 0.14) !important;
}

/* ═══════════════════════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════════════════════ */
@media (max-width: 760px) {
  #topbar { padding: 0 14px 0 14px; }
  .pp-hdr { padding: 16px !important; }
  .pp-title { font-size: 22px !important; }
  #sv { padding: 14px 14px 60px !important; }
  .scenario-card-grid { grid-template-columns: 1fr; }
  .tb-ctx-btn span,
  .tb-btn span { display: none; }
  .tb-ctx-btn, .tb-btn { min-width: 44px; }
}

/* ═══════════════════════════════════════════════════════
   MODAL POSITION FIX — leave sidebar + topbar visible
═══════════════════════════════════════════════════════ */
#script-modal,
#brief-modal {
  left: var(--sb, 116px) !important;
  top: var(--topbar-h, 64px) !important;
  width: calc(100vw - var(--sb, 116px)) !important;
  height: calc(100vh - var(--topbar-h, 64px)) !important;
}

/* ═══════════════════════════════════════════════════════
   SHOT DETAIL PANEL — fix top so it does not hide topbar
═══════════════════════════════════════════════════════ */
.sp-right {
  top: var(--topbar-h, 64px) !important;
  height: calc(100vh - var(--topbar-h, 64px)) !important;
}

/* ═══════════════════════════════════════════════════════
   SCRIPT + SHOTPLAN MODAL BUTTONS & TABS — bigger
═══════════════════════════════════════════════════════ */
.bmod-btn {
  font-size: 13px !important;
  padding: 8px 16px !important;
  border-radius: 8px !important;
  font-weight: 500 !important;
}
.smod-tab {
  font-size: 14px !important;
  padding: 7px 18px !important;
  font-weight: 600 !important;
}
.smod-hdr {
  padding: 14px 20px !important;
  min-height: 58px !important;
}
.smod-hdr .bmod-btn {
  font-size: 14px !important;
}
.sp-toolbar .bmod-btn {
  font-size: 13px !important;
  padding: 9px 18px !important;
}

/* ═══════════════════════════════════════════════════════
   SCENARIO TABLE — fix Svet column, larger fonts
═══════════════════════════════════════════════════════ */
/* col-light width: moved to Stage A (360px) */
.sc-table td.sc-light .editable-cell {
  font-size: 12px !important;
  color: var(--t) !important;
}
.sc-table th {
  font-size: 12px !important;
  font-weight: 700 !important;
  padding: 10px 10px !important;
  white-space: nowrap;
}
.sc-table td {
  font-size: 13px !important;
  padding: 9px 10px !important;
  line-height: 1.45 !important;
}
.sc-table .sc-sh-row td {
  font-size: 12px !important;
}
.sc-table .editable-cell {
  font-size: 12px !important;
}
.sc-table .sc-ep-row td {
  font-size: 15px !important;
  font-weight: 700 !important;
}
.sc-table .sc-sc-row td {
  font-size: 13px !important;
}

/* ═══════════════════════════════════════════════════════
   SHOT PLAN TABLE — bigger fonts
═══════════════════════════════════════════════════════ */
.sp-table th {
  font-size: 12px !important;
  padding: 10px 8px !important;
  font-weight: 700 !important;
}
.sp-table td {
  font-size: 13px !important;
  padding: 9px 8px !important;
  line-height: 1.4 !important;
}
.sp-table .sp-scene-row td {
  font-size: 14px !important;
  font-weight: 700 !important;
}

/* ═══════════════════════════════════════════════════════
   MODE TOGGLE BAR (scenario + shotplan)
═══════════════════════════════════════════════════════ */
.cf-mode-bar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--bd);
  background: var(--s2);
  flex-shrink: 0;
}
.cf-mode-btn {
  padding: 6px 16px;
  border: 1px solid var(--bd);
  border-radius: 7px;
  background: none;
  color: var(--m);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.13s;
}
.cf-mode-btn.active {
  background: var(--a);
  color: #0D0B09;
  border-color: var(--a);
}
.cf-mode-btn:not(.active):hover {
  border-color: var(--a);
  color: var(--a);
}

/* ═══════════════════════════════════════════════════════
   SCENARIO CARD GRID
═══════════════════════════════════════════════════════ */
.sc-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
  padding: 20px;
  overflow-y: auto;
}
.sc-scene-card {
  background: #1A1510;
  border: 1px solid rgba(212,176,106,0.18);
  border-radius: 14px;
  padding: 18px;
  cursor: pointer;
  transition: border-color 0.13s;
}
.sc-scene-card:hover { border-color: rgba(212,176,106,0.35); }
.sc-scene-card-num {
  font-size: 11px;
  font-weight: 800;
  color: #D4B06A;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
}
.sc-scene-card-title {
  font-size: 15px;
  font-weight: 700;
  color: #F8F4EA;
  margin-bottom: 8px;
}
.sc-scene-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}
.sc-scene-card-tag {
  font-size: 11px;
  color: #948777;
  background: rgba(212,176,106,0.07);
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid rgba(212,176,106,0.1);
}
.sc-scene-card-shots {
  font-size: 12px;
  color: #948777;
  border-top: 1px solid rgba(212,176,106,0.1);
  padding-top: 8px;
  margin-top: 4px;
}

/* ═══════════════════════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════════════════════ */
@media (max-width: 760px) {
  #script-modal, #brief-modal {
    left: 0 !important;
    width: 100vw !important;
    top: var(--topbar-h, 64px) !important;
    height: calc(100vh - var(--topbar-h, 64px)) !important;
  }
  .sc-card-grid { grid-template-columns: 1fr; padding: 14px; }
  .sp-right {
    position: fixed !important;
    top: var(--topbar-h, 64px) !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    min-width: 0 !important;
    height: calc(100vh - var(--topbar-h, 64px)) !important;
    z-index: 1100 !important;
  }
}

/* ═══════════════════════════════════════════════════════
   SHOT PLAN TABLE — additional cell classes
═══════════════════════════════════════════════════════ */
.sp-table .sp-scene-label {
  font-size: 12px !important;
  color: var(--m) !important;
  white-space: nowrap;
}
.sp-table .sp-shot-desc {
  font-size: 13px !important;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ═══════════════════════════════════════════════════════
   STAGE A CSS ADDITIONS
═══════════════════════════════════════════════════════ */

/* ── A7: Svet column 4x wider (360px vs original 90px) ── */
.sc-table th.col-light,
.sc-table td.sc-light {
  min-width: 360px !important;
  width: 360px !important;
}

/* ── Section context in topbar (A3, A4) ── */
#tb-section-ctx {
  display: none;
  align-items: center;
  gap: 4px;
  flex-wrap: nowrap;
}
#tb-section-ctx.visible {
  display: flex;
}

/* Section ctx buttons — same size as .tb-btn */
.tb-sc-btn {
  height: 40px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid rgba(212, 176, 106, 0.2);
  background: transparent;
  color: #948777;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  transition: all 0.14s;
  font-family: inherit;
}
.tb-sc-btn svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}
.tb-sc-btn:hover {
  background: rgba(212, 176, 106, 0.09);
  color: #D8CCBA;
  border-color: rgba(212, 176, 106, 0.3);
}
.tb-sc-btn.active {
  background: rgba(212, 176, 106, 0.15);
  color: #F0C86A;
  border-color: rgba(212, 176, 106, 0.45);
}
.tb-sc-btn.primary {
  background: rgba(212, 176, 106, 0.12);
  color: #D4B06A;
  border-color: rgba(212, 176, 106, 0.3);
}
.tb-sc-btn.danger {
  color: #E24A4A;
  border-color: rgba(226, 74, 74, 0.3);
}
.tb-sc-btn.danger:hover {
  background: rgba(226, 74, 74, 0.08);
  border-color: rgba(226, 74, 74, 0.5);
}
.tb-sc-btn.back {
  color: #D8CCBA;
  font-weight: 700;
}
/* Disabled section button */
.tb-sc-btn:disabled,
.tb-sc-btn.disabled {
  opacity: 0.38;
  cursor: not-allowed;
  pointer-events: none;
}

/* ── Script modal: hide hdr toolbar when topbar is active ── */
#script-modal.topbar-active .smod-hdr > button:first-child,
#script-modal.topbar-active .smod-hdr > div:last-child {
  display: none !important;
}
#script-modal.topbar-active .smod-hdr {
  justify-content: flex-start !important;
  padding: 10px 18px !important;
}
#script-modal.topbar-active .smod-tab-bar {
  display: none !important;
}
/* Hide mode bar inside content when topbar handles it */
#script-modal.topbar-active .cf-mode-bar {
  display: none !important;
}
#script-modal.topbar-active #sp-mode-bar {
  display: none !important;
}

/* ── A8: Scenario cards layout with right panel ── */
.sc-cards-layout {
  display: flex;
  height: 100%;
  overflow: hidden;
}
.sc-cards-list {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  transition: max-width 0.2s;
}
#smod-content:has(#sp-right.open) .sc-cards-list {
  max-width: 50vw;
}
/* One card per row in scenario cards (A8 spec) */
.sc-card-grid-single {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 860px;
}
/* Episode title card */
.sc-ep-card {
  background: rgba(200, 169, 110, 0.18);
  border: 1px solid rgba(212, 176, 106, 0.4);
  border-radius: 10px;
  padding: 12px 18px;
  margin-top: 8px;
}
.sc-ep-card-title {
  font-size: 15px;
  font-weight: 800;
  color: #F0C86A;
  letter-spacing: 0.04em;
}
/* Scene title card */
.sc-sc-card-row {
  background: var(--bg-panel, #0C0A07);
  border: 1px solid rgba(212, 176, 106, 0.15);
  border-left: 3px solid rgba(212, 176, 106, 0.5);
  border-radius: 8px;
  padding: 10px 16px;
  margin-top: 4px;
}
.sc-sc-card-title {
  font-size: 13px;
  font-weight: 700;
  color: #D8CCBA;
}
.sc-sc-card-meta {
  font-size: 11px;
  color: #948777;
  margin-top: 2px;
}
/* Shot card in scenario cards view */
.sc-shot-card-row {
  background: #1A1510;
  border: 1px solid rgba(212, 176, 106, 0.1);
  border-radius: 8px;
  padding: 10px 16px 10px 28px;
  cursor: pointer;
  transition: border-color 0.13s, background 0.13s;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.sc-shot-card-row:hover {
  border-color: rgba(212, 176, 106, 0.28);
  background: rgba(212, 176, 106, 0.04);
}
.sc-shot-card-row.selected {
  border-color: rgba(212, 176, 106, 0.5);
  background: rgba(212, 176, 106, 0.07);
}
.sc-shot-num {
  font-size: 11px;
  font-weight: 700;
  color: #D4B06A;
  white-space: nowrap;
  min-width: 40px;
  margin-top: 1px;
}
.sc-shot-body {
  flex: 1;
  min-width: 0;
}
.sc-shot-type-row {
  font-size: 12px;
  font-weight: 600;
  color: #D8CCBA;
}
.sc-shot-desc-row {
  font-size: 12px;
  color: #948777;
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.sc-shot-prompt-badge {
  font-size: 10px;
  background: rgba(212, 176, 106, 0.12);
  color: #D4B06A;
  padding: 2px 7px;
  border-radius: 5px;
  margin-top: 4px;
  display: inline-block;
}

/* ── A9: Shot plan cards with title cards ── */
.sp-ep-card {
  background: rgba(200, 169, 110, 0.2);
  border: 1px solid rgba(212, 176, 106, 0.4);
  border-radius: 10px;
  padding: 12px 18px;
  margin-bottom: 6px;
  margin-top: 8px;
}
.sp-ep-card-title {
  font-size: 14px;
  font-weight: 800;
  color: #100D09;
  background: #C8A96E;
  display: inline-block;
  padding: 2px 10px;
  border-radius: 6px;
  letter-spacing: 0.04em;
}
.sp-sc-card {
  background: var(--bg-panel, #0C0A07);
  border: 1px solid rgba(212, 176, 106, 0.15);
  border-left: 3px solid #C8A96E;
  border-radius: 8px;
  padding: 8px 16px;
  margin-bottom: 6px;
}
.sp-sc-card-label {
  font-size: 12px;
  font-weight: 700;
  color: #D8CCBA;
}
.sp-sc-card-title {
  font-size: 11px;
  color: #948777;
}

/* ── Add/Delete modal (A5, A6) ── */
.cf-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: rgba(0, 0, 0, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
}
.cf-modal-box {
  background: #1A1510;
  border: 1px solid rgba(212, 176, 106, 0.22);
  border-radius: 16px;
  padding: 28px;
  width: min(520px, 92vw);
  max-height: 82vh;
  overflow-y: auto;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6);
}
.cf-modal-title {
  font-size: 18px;
  font-weight: 800;
  color: #F8F4EA;
  margin-bottom: 20px;
}
.cf-modal-label {
  font-size: 12px;
  font-weight: 600;
  color: #948777;
  margin-bottom: 6px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.cf-modal-section {
  margin-bottom: 16px;
}
.cf-modal-footer {
  display: flex;
  gap: 10px;
  margin-top: 22px;
}
.cf-modal-select {
  width: 100%;
  background: #0C0A07;
  border: 1px solid rgba(212, 176, 106, 0.2);
  border-radius: 8px;
  color: #F8F4EA;
  padding: 10px 14px;
  font-size: 13px;
  font-family: inherit;
}
.cf-modal-radio-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 8px;
}
.cf-modal-radio-opt {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 13px;
  color: #D8CCBA;
}
.cf-modal-warning {
  background: rgba(226, 74, 74, 0.08);
  border: 1px solid rgba(226, 74, 74, 0.25);
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 13px;
  color: #E87878;
  margin: 12px 0;
}
.cf-modal-type-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
}
.cf-modal-type-tab {
  flex: 1;
  padding: 10px;
  border: 1px solid rgba(212, 176, 106, 0.2);
  border-radius: 8px;
  background: transparent;
  color: #948777;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: all 0.13s;
  font-family: inherit;
}
.cf-modal-type-tab.active {
  background: rgba(212, 176, 106, 0.15);
  color: #F0C86A;
  border-color: rgba(212, 176, 106, 0.4);
}


/* ── C1: Photo wrap with category below ── */
.cf-photo-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.cf-photo-cat-sel {
  width: 100%;
  background: var(--cf-surface-2, #1A1510);
  border: 1px solid rgba(212,176,106,0.2);
  border-radius: 6px;
  color: var(--cf-muted, #948777);
  padding: 4px 8px;
  font-size: 10px;
  font-family: inherit;
  cursor: pointer;
}
.cf-photo-cat-sel:hover {
  border-color: rgba(212,176,106,0.4);
  color: #D8CCBA;
}

/* ── C3: Translation field ── */
.cf-translation-box {
  margin-top: 8px;
}
.cf-translation-hdr {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}
.cf-translation-lbl {
  font-size: 11px;
  color: var(--cf-muted, #948777);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.cf-translation-copy {
  background: none;
  border: 1px solid rgba(212,176,106,0.2);
  color: var(--cf-muted, #948777);
  border-radius: 5px;
  padding: 2px 8px;
  font-size: 11px;
  cursor: pointer;
  font-family: inherit;
}
.cf-translation-copy:hover {
  background: rgba(212,176,106,0.08);
  color: #D8CCBA;
}
.cf-translation-text {
  width: 100%;
  box-sizing: border-box;
  background: var(--cf-surface-2, #1A1510);
  border: 1px solid rgba(212,176,106,0.15);
  border-radius: 8px;
  color: var(--cf-muted, #948777);
  font-size: 12px;
  padding: 10px 12px;
  resize: vertical;
  min-height: 72px;
  font-family: inherit;
}

/* ── C4: Adaptive layout — wide screen ── */
@media (min-width: 1200px) {
  .cf-form-page {
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 32px;
    align-items: start;
  }
  .cf-page-header,
  .cf-bottom-actions,
  .cf-form-page > div[id$="-msg"] {
    grid-column: 1 / -1;
  }
  .cf-form-section:not(.cf-form-section-photos) {
    grid-column: 1;
  }
  .cf-form-section-photos {
    grid-column: 2;
    grid-row: 2 / span 8;
    position: sticky;
    top: 80px;
  }
}

/* ── Hide sp-toolbar when topbar-active (buttons moved to topbar) ── */
#script-modal.topbar-active .sp-toolbar {
  display: none !important;
}


/* ── 0+1: Sidebar square tiles ── */
#sb-nav {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 4px 8px;
  gap: 4px;
}
.sb-section {
  width: 100%;
  padding: 10px 4px 4px !important;
  text-align: center;
}
.sbn {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  width: 96px !important;
  height: 80px !important;
  padding: 6px 4px !important;
  gap: 5px !important;
  border-radius: 12px !important;
  border: 1px solid transparent;
  text-align: center;
  white-space: normal !important;
  line-height: 1.2 !important;
}
.sbn-ic {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 32px !important;
  height: 32px !important;
  flex-shrink: 0;
}
.sbn-ic svg {
  width: 26px !important;
  height: 26px !important;
}
.sbn-l {
  font-size: 10px !important;
  font-weight: 700 !important;
  line-height: 1.2 !important;
  word-break: break-word;
  max-width: 88px;
}
.sbn.active {
  border-color: rgba(212,176,106,0.35) !important;
}

/* ── 2: Hide in-content nav buttons when topbar has section context ── */
body:has(#tb-section-ctx.visible) .cf-top-actions { display: none !important; }
body:has(#tb-section-ctx.visible) .cf-bottom-actions { display: none !important; }

/* ── 4: New scenario shot cards ── */
.sc-shot-card2 {
  background: #1A1510;
  border: 1px solid rgba(212,176,106,0.1);
  border-left: 3px solid rgba(212,176,106,0.3);
  border-radius: 8px;
  padding: 10px 14px;
  cursor: pointer;
  transition: border-color 0.13s, background 0.13s;
  display: flex;
  gap: 14px;
  align-items: flex-start;
}
.sc-shot-card2:hover {
  border-color: rgba(212,176,106,0.3);
  border-left-color: rgba(212,176,106,0.6);
  background: rgba(212,176,106,0.04);
}
.sc-shot-card2.selected {
  border-color: rgba(212,176,106,0.5);
  border-left-color: #C8A96E;
  background: rgba(212,176,106,0.07);
}
.sc-shot-card2-num {
  font-size: 15px;
  font-weight: 900;
  color: #D4B06A;
  white-space: nowrap;
  min-width: 90px;
  line-height: 1.3;
  padding-top: 2px;
}
.sc-shot-card2-body { flex: 1; min-width: 0; }
.sc-shot-card2-row1 {
  font-size: 12px;
  color: #D8CCBA;
  margin-bottom: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sc-shot-card2-row2 {
  font-size: 12px;
  font-weight: 600;
  color: #C8A96E;
  margin-bottom: 3px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.sc-shot-card2-row3 {
  font-size: 11px;
  color: #5A5040;
  margin-bottom: 4px;
}
.sc-shot-card2-badge {
  display: inline-block;
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 5px;
  font-weight: 700;
}
.sc-shot-card2-badge.has-prompt {
  background: rgba(29,158,117,0.15);
  color: #1D9E75;
}
.sc-shot-card2-badge.no-prompt {
  background: rgba(90,80,64,0.25);
  color: #5A5040;
}

/* ── 5: Shot plan informational card view ── */
.sp-info-list {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.sp-info-card {
  background: #1A1510;
  border: 1px solid rgba(212,176,106,0.15);
  border-radius: 12px;
  overflow: hidden;
}
.sp-info-card-header {
  padding: 12px 18px;
  border-bottom: 1px solid rgba(212,176,106,0.1);
  display: flex;
  align-items: baseline;
  gap: 16px;
}
.sp-info-card-num {
  font-size: 18px;
  font-weight: 900;
  color: #D4B06A;
  white-space: nowrap;
}
.sp-info-card-desc {
  font-size: 13px;
  color: #D8CCBA;
  line-height: 1.5;
}
.sp-info-card-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: rgba(212,176,106,0.08);
}
.sp-info-card-img, .sp-info-card-vid {
  background: #0C0A07;
  aspect-ratio: 16/9;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}
.sp-info-card-img img, .sp-info-card-vid video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.sp-info-card-empty {
  font-size: 11px;
  color: #3A3020;
  font-weight: 600;
}

/* ── Class aliases for JS-generated names (tasks 4+5) ── */
.sc-shot-card2-rows { flex: 1; min-width: 0; }
.sp-info-card-hdr {
  padding: 12px 18px;
  border-bottom: 1px solid rgba(212,176,106,0.1);
}
.sp-info-media {
  background: #0C0A07;
  aspect-ratio: 16/9;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}
.sp-info-img, .sp-info-vid {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.sp-info-loading {
  font-size: 18px;
  color: #3A3020;
  letter-spacing: 4px;
}
