/* ═══════════════════════════════════════════════════════
   Content Factory — Redesign Iteration 5
   Loaded AFTER redesign4.css
   • Breadcrumb bar ABOVE topbar
   • Square 60×60 topbar tiles
   • Mobile: overlay sidebar + backdrop
   • Generation panel cleanup
   • Shot panel cleanup
   • Remove apps section
═══════════════════════════════════════════════════════ */

/* ── DESIGN TOKENS UPDATE ── */
:root {
  --topbar-h: 60px;
  --breadcrumb-h: 40px;
  --header-total: 100px; /* breadcrumb + topbar */
}

/* ══════════════════════════════════
   1. BREADCRUMB BAR — поверх topbar
══════════════════════════════════ */
#hdr {
  position: fixed !important;
  top: 0 !important;
  left: var(--sb) !important;
  right: 0 !important;
  height: var(--breadcrumb-h) !important;
  min-height: var(--breadcrumb-h) !important;
  z-index: 990 !important;
  background: #080604 !important;
  border-bottom: 1px solid rgba(212,176,106,0.12) !important;
  display: flex !important;
  align-items: center !important;
  padding: 0 20px !important;
  gap: 0 !important;
  backdrop-filter: none !important;
}

/* Убрать ::after с брендом из redesign4 */
#hdr::after { display: none !important; }

/* Breadcrumb text */
#hdr-title {
  font-size: 12px !important;
  font-weight: 600 !important;
  color: #948777 !important;
  flex: 1 !important;
  line-height: 1.3 !important;
}

/* Бренд справа в breadcrumb */
#hdr-brand {
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.12em;
  color: rgba(212,176,106,0.3);
  text-transform: uppercase;
  text-align: right;
  line-height: 1.4;
  white-space: nowrap;
}

/* ── TOPBAR — теперь НИЖЕ breadcrumb ── */
#topbar {
  top: var(--breadcrumb-h) !important;
  left: var(--sb) !important;
  height: var(--topbar-h) !important;
  padding: 0 12px !important;
  z-index: 980 !important;
  border-top: 1px solid rgba(212,176,106,0.08) !important;
}

/* ── SIDEBAR logo — span обе полосы ── */
#sidebar {
  top: 0 !important;
  height: 100vh !important;
  z-index: 1050 !important;
}

#sb-logo {
  height: var(--header-total) !important;
  min-height: var(--header-total) !important;
  max-height: var(--header-total) !important;
  flex-direction: column !important;
  justify-content: center !important;
  align-items: center !important;
  gap: 6px !important;
  padding: 0 !important;
  border-bottom: 1px solid rgba(212,176,106,0.14) !important;
}

/* В sidebar показать бренд под иконкой (только desktop) */
#sb-logo-text {
  font-size: 7.5px;
  font-weight: 800;
  color: rgba(212,176,106,0.4);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-align: center;
  line-height: 1.5;
}

/* ── MAIN CONTENT — отступ от обеих полос ── */
#main {
  margin-top: var(--header-total) !important;
}

/* hdr sticky — теперь не нужен sticky (он fixed) */
#hdr + * { margin-top: 0; }

/* ══════════════════════════════════
   2. ТОПБАР КНОПКИ — квадраты 60×60
══════════════════════════════════ */
.tb-sc-btn {
  width: 60px !important;
  height: 52px !important;
  min-width: 52px !important;
  max-width: 70px !important;
  padding: 0 !important;
  border-radius: 10px !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 4px !important;
  font-size: 9px !important;
  font-weight: 700 !important;
  letter-spacing: 0.04em !important;
}

.tb-sc-btn svg {
  width: 20px !important;
  height: 20px !important;
}

.tb-sc-btn span {
  display: block !important; /* Показать подписи */
  font-size: 9px !important;
  line-height: 1 !important;
  text-align: center !important;
}

/* Правые утилитарные кнопки */
.tb-btn {
  width: 52px !important;
  height: 52px !important;
  min-width: 44px !important;
  padding: 0 !important;
  border-radius: 10px !important;
  flex-direction: column !important;
  gap: 3px !important;
}

.tb-btn svg {
  width: 20px !important;
  height: 20px !important;
}

.tb-btn span {
  font-size: 9px !important;
  line-height: 1 !important;
}

/* Разделитель */
.tb-divider {
  height: 36px !important;
  margin: 0 2px !important;
}

/* ══════════════════════════════════
   3. МОБИЛЬНЫЙ РЕЖИМ — overlay sidebar
══════════════════════════════════ */
@media (max-width: 640px) {
  :root {
    --sb: 0px !important;
    --header-total: 88px;
    --breadcrumb-h: 36px;
    --topbar-h: 52px;
  }

  /* Sidebar полностью скрыт, overlay при открытии */
  #sidebar {
    transform: translateX(-260px) !important;
    width: 260px !important;
    transition: transform 0.25s ease !important;
    z-index: 1200 !important;
    box-shadow: 6px 0 30px rgba(0,0,0,0.7) !important;
  }

  #sidebar.mobile-open {
    transform: translateX(0) !important;
  }

  /* Плитки в мобильном сайдбаре — горизонтальные */
  #sidebar.mobile-open .sbn {
    width: 260px !important;
    height: 52px !important;
    flex-direction: row !important;
    justify-content: flex-start !important;
    gap: 14px !important;
    padding: 0 20px !important;
    border-bottom: 1px solid rgba(212,176,106,0.07) !important;
    border-left: none !important;
  }
  #sidebar.mobile-open .sbn-l {
    display: block !important;
    font-size: 13px !important;
    text-align: left !important;
    padding: 0 !important;
  }
  #sidebar.mobile-open .sbn-ic { flex-shrink: 0 !important; }
  #sidebar.mobile-open .sb-section {
    display: block !important;
    text-align: left !important;
    padding: 12px 20px 6px !important;
    font-size: 9px !important;
  }

  /* sb-logo в мобильном */
  #sidebar.mobile-open #sb-logo {
    flex-direction: row !important;
    justify-content: flex-start !important;
    padding: 0 20px !important;
    height: var(--header-total) !important;
    gap: 12px !important;
  }

  /* Кнопки Users/Logout внутри мобильного сайдбара */
  #sidebar-mobile-actions {
    display: flex;
    flex-direction: column;
    border-top: 1px solid rgba(212,176,106,0.1);
    margin-top: auto;
    padding: 8px 0;
  }

  /* Backdrop */
  #sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.65);
    z-index: 1100;
    backdrop-filter: blur(2px);
  }

  #sidebar-backdrop.visible {
    display: block;
  }

  /* Бургер-кнопка */
  #tb-menu-btn {
    display: flex !important;
    width: 44px !important;
    height: 44px !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 10px !important;
    flex-shrink: 0;
    margin-right: 4px;
  }

  /* Убрать бренд и правые кнопки в мобильном */
  #tb-brand-name { display: none !important; }
  #hdr-brand { display: none !important; }
  #tb-right { display: none !important; }
  #tb-btn-users { display: none !important; }

  /* Сжать кнопки контекста в топбаре */
  .tb-sc-btn {
    width: 48px !important;
    height: 44px !important;
    min-width: 40px !important;
    border-radius: 8px !important;
    font-size: 8px !important;
  }

  .tb-sc-btn span { font-size: 8px !important; }
  .tb-sc-btn svg { width: 16px !important; height: 16px !important; }

  /* Контекстные кнопки топбара (section ctx / gen ctx) могут не влезать на узких
     экранах — включаем горизонтальный скролл с fade-подсказкой, вместо
     обрезания/переполнения за пределы вьюпорта. */
  #tb-left {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    scrollbar-width: none !important;
    -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 24px), transparent 100%) !important;
    mask-image: linear-gradient(to right, #000 calc(100% - 24px), transparent 100%) !important;
  }
  #tb-left::-webkit-scrollbar { display: none !important; }
  #tb-section-ctx, #tb-ctx {
    flex-wrap: nowrap !important;
    flex-shrink: 0 !important;
  }
  .tb-sc-btn, .tb-ctx-btn {
    flex-shrink: 0 !important;
  }

  /* Топбар */
  #topbar { padding: 0 8px !important; }
  #hdr { padding: 0 14px !important; }

  /* Подписи в сайдбаре скрыть когда закрыт */
  #sidebar:not(.mobile-open) .sbn-l,
  #sidebar:not(.mobile-open) .sb-section,
  #sidebar:not(.mobile-open) #sb-logo-text {
    display: none !important;
  }
  #sidebar:not(.mobile-open) #sb-logo {
    width: 0 !important;
    overflow: hidden !important;
  }
}

/* ══════════════════════════════════
   4. РАЗДЕЛ ГЕНЕРАЦИИ — clean up
══════════════════════════════════ */

/* Убрать большую иконку-заглушку */
#gen-result .empty > div:first-child {
  display: none !important;
}

/* Кнопка Генерировать — без иконки */
#gen-btn {
  background: linear-gradient(135deg, rgba(212,176,106,0.28) 0%, rgba(140,100,20,0.4) 100%) !important;
  border: 1px solid rgba(212,176,106,0.45) !important;
  color: #F0C86A !important;
  font-size: 14px !important;
  font-weight: 900 !important;
  height: 52px !important;
  border-radius: 12px !important;
  letter-spacing: 0.08em !important;
  text-transform: uppercase !important;
  box-shadow: 0 4px 20px rgba(212,176,106,0.12) !important;
  transition: all 0.2s !important;
}
#gen-btn:hover {
  box-shadow: 0 6px 28px rgba(212,176,106,0.22) !important;
  transform: translateY(-1px) !important;
}

/* Зона загрузки референсов */
.gen-ref-drop {
  border: 1.5px dashed rgba(212,176,106,0.3) !important;
  border-radius: 10px !important;
  background: rgba(212,176,106,0.03) !important;
  transition: border-color 0.15s, background 0.15s !important;
}
.gen-ref-drop:hover {
  border-color: rgba(212,176,106,0.5) !important;
  background: rgba(212,176,106,0.06) !important;
}

/* Форма генерации — общий стиль */
.gen-twocol-3col,
.gen-left-480 {
  background: transparent !important;
}

.gen-left-480 select,
.gen-left-480 textarea,
.gen-left-480 input[type=text] {
  background: #0C0A07 !important;
  border: 1px solid rgba(212,176,106,0.18) !important;
  color: #F8F4EA !important;
  border-radius: 8px !important;
}

.gen-left-480 select:focus,
.gen-left-480 textarea:focus {
  border-color: rgba(212,176,106,0.4) !important;
  outline: none !important;
}

/* Лейблы в форме */
.gen-left-480 > div > div[style*="font-size:12px"],
.gen-left-480 > div > div[style*="font-size:11px"] {
  color: rgba(212,176,106,0.7) !important;
}

/* Кнопка генерировать в видео разделе */
#vid-gen-btn {
  background: linear-gradient(135deg, rgba(78,164,255,0.2) 0%, rgba(30,90,165,0.3) 100%) !important;
  border: 1px solid rgba(78,164,255,0.35) !important;
  color: #4EA4FF !important;
  font-weight: 900 !important;
  font-size: 14px !important;
  height: 52px !important;
  border-radius: 12px !important;
  letter-spacing: 0.06em !important;
  text-transform: uppercase !important;
}

/* ══════════════════════════════════
   5. КНОПКИ В ПАНЕЛИ КАДРА — clean
══════════════════════════════════ */
.bmod-btn {
  background: rgba(212,176,106,0.08) !important;
  border: 1px solid rgba(212,176,106,0.2) !important;
  color: #D8CCBA !important;
  border-radius: 8px !important;
  padding: 8px 14px !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  height: 36px !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
  transition: all 0.13s !important;
  cursor: pointer !important;
}

.bmod-btn:hover {
  background: rgba(212,176,106,0.14) !important;
  border-color: rgba(212,176,106,0.35) !important;
  color: #F0C86A !important;
}

/* Кнопка генерации в shot detail */
#sp-img-gen-btn-,
[id^="sp-img-gen-btn-"],
[id^="sp-vid-gen-btn-"] {
  background: rgba(212,176,106,0.12) !important;
  border: 1px solid rgba(212,176,106,0.3) !important;
  color: #D4B06A !important;
  font-size: 12px !important;
  font-weight: 700 !important;
  height: 36px !important;
}

/* ══════════════════════════════════
   6. УБРАТЬ РАЗДЕЛ ПРИЛОЖЕНИЯ В ПРОЕКТЕ
══════════════════════════════════ */
#pp-s-apps { display: none !important; }

/* ══════════════════════════════════
   7. КАРТОЧКИ КАДРА В РАСКАДРОВКЕ — формат Э/С/Кадр
══════════════════════════════════ */
.sp-info-card-num {
  font-size: 18px !important;
  line-height: 1.2 !important;
}

.sp-info-card-num .shot-ep-scene {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: rgba(212,176,106,0.7);
  letter-spacing: 0.05em;
}
.sp-info-card-num .shot-label {
  display: block;
  font-size: 20px;
  font-weight: 900;
  color: #D4B06A;
}

/* ══════════════════════════════════
   8. SCRIPT TABLE — shot cards new format
══════════════════════════════════ */
.sc-shot-card2-num {
  font-size: 11px !important;
  line-height: 1.4 !important;
}

/* ══════════════════════════════════
   9. STUDIO FULLPAGE HEIGHT FIX
══════════════════════════════════ */
.studio-fullpage {
  height: calc(100vh - var(--header-total) - 52px) !important;
}

/* hdr sticky inside main */
#hdr.is-sticky { position: sticky !important; }

/* ══════════════════════════════════
   TABLET
══════════════════════════════════ */
@media (max-width: 900px) and (min-width: 641px) {
  .tb-sc-btn {
    width: 52px !important;
    height: 48px !important;
    font-size: 8px !important;
  }
  .tb-sc-btn span { font-size: 8px !important; }
}


/* ── sp-right top: учёт двух полос (breadcrumb + topbar) ── */
.sp-right {
  top: var(--header-total, 100px) !important;
  height: calc(100vh - var(--header-total, 100px)) !important;
}

/* ── sidebar-mobile-actions: только на мобильном ── */
#sidebar-mobile-actions {
  display: none !important;
}

@media (max-width: 640px) {
  #sidebar-mobile-actions {
    display: flex !important;
    flex-direction: column;
    border-top: 1px solid rgba(212,176,106,0.1);
    padding: 8px 0;
  }
}

/* ── Топбар выше — чтобы вмещать квадратные кнопки ── */
#topbar {
  height: 68px !important;
}

:root {
  --topbar-h: 68px;
  --header-total: 108px;
}

#hdr {
  height: 40px !important;
  min-height: 40px !important;
  max-height: 40px !important;
}

#sb-logo {
  height: 108px !important;
  min-height: 108px !important;
  max-height: 108px !important;
}

#main {
  margin-top: 108px !important;
}

/* ── Кнопки в топбаре ── */
.tb-sc-btn {
  height: 58px !important;
  width: 64px !important;
  min-width: 56px !important;
  border-radius: 10px !important;
  gap: 5px !important;
}

.tb-sc-btn svg {
  width: 22px !important;
  height: 22px !important;
}

.tb-sc-btn span {
  font-size: 9px !important;
  line-height: 1.15 !important;
  text-align: center !important;
  max-width: 64px !important;
  word-break: break-word !important;
  white-space: normal !important;
}

.tb-btn {
  height: 58px !important;
  width: 58px !important;
  min-width: 50px !important;
}

#tb-left {
  gap: 4px !important;
}

#tb-right {
  gap: 3px !important;
}

/* ── shot-ep-scene в sp-info-card: CSS fallback ── */
.sp-info-card-num .shot-ep-scene {
  display: block !important;
  font-size: 11px !important;
  font-weight: 700 !important;
  color: rgba(212,176,106,0.65) !important;
  letter-spacing: 0.04em !important;
  line-height: 1.2 !important;
}
.sp-info-card-num .shot-label {
  display: block !important;
  font-size: 20px !important;
  font-weight: 900 !important;
  color: #D4B06A !important;
  line-height: 1.1 !important;
}

/* Mobile sp-right fix */
@media (max-width: 640px) {
  :root {
    --header-total: 88px !important;
    --topbar-h: 52px !important;
    --breadcrumb-h: 36px !important;
  }

  .sp-right {
    top: 88px !important;
    height: calc(100vh - 88px) !important;
    width: 100vw !important;
    left: 0 !important;
  }

  #hdr { top: 0 !important; left: 0 !important; }
  #topbar { top: 36px !important; left: 0 !important; height: 52px !important; }
  #sb-logo { height: 88px !important; min-height: 88px !important; max-height: 88px !important; }
  #main { margin-top: 88px !important; margin-left: 0 !important; }
}

/* ═══ CRITICAL FIXES ═══ */

/* Backdrop: NEVER blocks clicks on desktop */
@media (min-width: 641px) {
  #sidebar-backdrop {
    display: none !important;
    pointer-events: none !important;
  }
}

/* Users mobile button hidden on desktop */
#sbn-users-mob { display: none; }
@media (max-width: 640px) {
  #sbn-users-mob { display: flex !important; }
}

/* ── LOGO: убрать текст, крупнее иконка ── */
#sb-logo-text { display: none !important; }

#sb-icon {
  width: 62px !important;
  height: 62px !important;
  border-radius: 16px !important;
}

/* VIDEO GEN button styled like image gen */
#vid-btn, #vid-gen-btn {
  background: linear-gradient(135deg, rgba(78,164,255,0.25) 0%, rgba(30,90,165,0.38) 100%) !important;
  border: 1px solid rgba(78,164,255,0.42) !important;
  color: #4EA4FF !important;
  font-size: 14px !important;
  font-weight: 900 !important;
  height: 52px !important;
  border-radius: 12px !important;
  letter-spacing: 0.08em !important;
  text-transform: uppercase !important;
  box-shadow: 0 4px 20px rgba(78,164,255,0.1) !important;
  transition: all 0.2s !important;
}
#vid-btn:hover, #vid-gen-btn:hover {
  box-shadow: 0 6px 28px rgba(78,164,255,0.2) !important;
  transform: translateY(-1px) !important;
}

/* Active duration/aspect buttons — gold */
label[style*="185FA5"],
label[style*="accent-color"] {
  border-color: rgba(212,176,106,0.4) !important;
  color: #D4B06A !important;
}

/* Flux-pulid option highlight */
#sp-img-model option[value="flux-pulid"],
select option[value="flux-pulid"] {
  font-weight: bold;
  color: #D4B06A;
}

