/* FilmAI Production Hub — design tokens */
:root {
  /* Нейтральные серые (тёплые, как DaVinci) */
  --bg-0: #0E0E10;
  --bg-1: #151518;
  --bg-2: #1C1C21;
  --bg-3: #24242A;
  --bg-4: #2D2D34;
  --bg-5: #383840;

  --line-1: #26262C;
  --line-2: #31313A;
  --line-3: #3E3E48;

  /* Текст */
  --fg-0: #F2F0EA;
  --fg-1: #D8D5CC;
  --fg-2: #9A9892;
  --fg-3: #6B6965;
  --fg-4: #48464A;

  /* Акценты — переопределяются на корне .app через inline style={{'--amber': ...}}
     при смене accent-цвета проекта. --amber-dim и --amber-bg зависят от --amber
     через color-mix, поэтому подстраиваются автоматически. */
  --amber: #E8A87C;
  --amber-dim: color-mix(in srgb, var(--amber) 60%, #1a1a1a);
  --amber-bg:  color-mix(in srgb, var(--amber) 8%, transparent);

  /* Статусные цвета */
  --s-draft: #6B6965;
  --s-prompt: #D4A574;
  --s-gen: #7FB3D5;
  --s-review: #C38D9E;
  --s-approved: #8FB9AA;
  --s-reshoot: #D97757;

  /* Типографика */
  --font-sans: 'Inter', -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', Menlo, monospace;
  --font-display: 'Space Grotesk', 'Inter', sans-serif;

  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 10px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body, #root {
  height: 100%;
  background: var(--bg-0);
  color: var(--fg-1);
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
input, textarea { font: inherit; color: inherit; background: none; border: none; outline: none; }

/* Generic spinner for AI-generation loading states */
@keyframes filmai-spin { to { transform: rotate(360deg); } }
.filmai-spinner {
  display: inline-block;
  width: 12px; height: 12px;
  border: 2px solid color-mix(in srgb, var(--amber) 25%, transparent);
  border-top-color: var(--amber);
  border-radius: 50%;
  animation: filmai-spin 0.8s linear infinite;
  vertical-align: -2px;
}

/* === APP SHELL === */
.app {
  display: grid;
  grid-template-columns: 220px 1fr;
  grid-template-rows: 44px 1fr;
  grid-template-areas: "brand topbar" "nav main";
  height: 100vh;
  width: 100vw;
  transition: grid-template-columns 0.18s ease;
}
/* Режим фокусировки: внешний сайдбар свёрнут до 0, максимум экрана под контент. */
.app.focus-mode {
  grid-template-columns: 0 1fr;
}
.app.focus-mode .brand,
.app.focus-mode .nav { display: none; }

.brand {
  grid-area: brand;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  border-right: 1px solid var(--line-1);
  border-bottom: 1px solid var(--line-1);
  background: var(--bg-1);
}
.brand-mark {
  width: 22px; height: 22px; border-radius: 4px;
  background: linear-gradient(135deg, var(--amber), #C77B4D);
  display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 700; font-size: 11px; color: #1a1a1a;
}
.brand-name { font-family: var(--font-display); font-weight: 600; font-size: 13px; letter-spacing: 0.02em; color: var(--fg-0); }
.brand-sub { font-family: var(--font-mono); font-size: 10px; color: var(--fg-3); margin-left: auto; }

.topbar {
  grid-area: topbar;
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 16px;
  border-bottom: 1px solid var(--line-1);
  background: var(--bg-1);
}
.topbar .crumbs {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--fg-2);
}
.topbar .crumbs .sep { color: var(--fg-4); }
.topbar .crumbs .current { color: var(--fg-0); font-weight: 500; }
.topbar .search {
  flex: 1; max-width: 360px;
  height: 28px; padding: 0 10px;
  background: var(--bg-2); border: 1px solid var(--line-2);
  border-radius: var(--radius-md);
  display: flex; align-items: center; gap: 8px;
  color: var(--fg-3); font-size: 12px;
}
.topbar .search input { flex: 1; color: var(--fg-1); }
.topbar-actions { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.topbar-action {
  height: 28px; padding: 0 10px;
  background: var(--bg-2); border: 1px solid var(--line-2);
  border-radius: var(--radius-md); font-size: 12px; color: var(--fg-1);
  display: inline-flex; align-items: center; gap: 6px;
  transition: all 0.15s;
}
.topbar-action:hover { background: var(--bg-3); border-color: var(--line-3); }
.topbar-action.primary { background: var(--amber); color: #1a1a1a; border-color: var(--amber); font-weight: 500; }
.topbar-action.primary:hover { filter: brightness(1.1); }

.avatars { display: flex; }
.avatar {
  width: 24px; height: 24px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 10px; font-weight: 600; color: #1a1a1a;
  border: 2px solid var(--bg-1);
  margin-left: -6px;
}
.avatar:first-child { margin-left: 0; }

/* === SIDEBAR NAV === */
.nav {
  grid-area: nav;
  background: var(--bg-1);
  border-right: 1px solid var(--line-1);
  padding: 12px 8px;
  overflow-y: auto;
  display: flex; flex-direction: column; gap: 2px;
}
.nav-section {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fg-3);
  padding: 12px 10px 6px;
}
.nav-section:first-child { padding-top: 2px; }

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px;
  border-radius: var(--radius-md);
  color: var(--fg-1);
  font-size: 12.5px;
  cursor: pointer;
  width: 100%;
  text-align: left;
  transition: background 0.12s;
}
.nav-item:hover { background: var(--bg-2); }
.nav-item.active { background: var(--bg-3); color: var(--fg-0); }
.nav-item.active .nav-icon { color: var(--amber); }
.nav-icon { width: 16px; height: 16px; flex-shrink: 0; color: var(--fg-2); }
.nav-count { margin-left: auto; font-family: var(--font-mono); font-size: 10px; color: var(--fg-3); }

/* === MAIN === */
.main {
  grid-area: main;
  overflow: hidden;
  background: var(--bg-0);
  display: flex; flex-direction: column;
}

/* === COMMON === */
.icon {
  width: 14px; height: 14px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

.status-dot {
  width: 6px; height: 6px; border-radius: 50%;
  display: inline-block;
}
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 500;
  background: var(--bg-3);
  border: 1px solid var(--line-2);
  color: var(--fg-1);
}
.chip.status {
  padding-left: 7px;
}
.chip.status .dot {
  width: 6px; height: 6px; border-radius: 50%;
}

.tag {
  display: inline-flex; align-items: center;
  padding: 2px 7px;
  font-size: 10.5px;
  font-family: var(--font-mono);
  background: var(--bg-3);
  border: 1px solid var(--line-2);
  color: var(--fg-2);
  border-radius: 3px;
  letter-spacing: 0.02em;
}

/* Scrollbars */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg-4); border-radius: 5px; border: 2px solid var(--bg-0); }
::-webkit-scrollbar-thumb:hover { background: var(--bg-5); }

/* Placeholder image */
.placeholder-img {
  background:
    repeating-linear-gradient(
      45deg,
      var(--bg-3) 0 8px,
      var(--bg-2) 8px 16px
    );
  display: flex; align-items: center; justify-content: center;
  color: var(--fg-3);
  font-family: var(--font-mono);
  font-size: 10px;
  text-align: center;
  padding: 8px;
  position: relative;
  overflow: hidden;
}
.placeholder-img::after {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at center, transparent 40%, rgba(0,0,0,0.35) 100%);
  pointer-events: none;
}
.placeholder-img .ph-label {
  position: relative;
  z-index: 1;
  background: rgba(14,14,16,0.7);
  padding: 3px 6px;
  border-radius: 3px;
  white-space: nowrap;
}
