/* ─── Site Header ───────────────────────────────────── */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
}

.site-header .logo {
  font-family: var(--font-head);
  font-size: 1.5rem;
  letter-spacing: 0.08em;
  color: var(--accent);
  flex-shrink: 0;
}

.site-header .header-spacer { flex: 1; }

.site-header .header-meta {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
}

/* ─── Page Container ────────────────────────────────── */

.page-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ─── Project Grid ──────────────────────────────────── */

.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
  padding: 24px;
}

/* ─── Filter Bar ────────────────────────────────────── */

.filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 16px 24px 0;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

/* ─── Project Page Layout ───────────────────────────── */

.project-layout {
  display: flex;
  min-height: calc(100vh - var(--header-h));
}

.project-main {
  flex: 1;
  min-width: 0;
  padding: 32px 40px;
  overflow-y: auto;
}

.ai-sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  border-left: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--header-h));
  position: sticky;
  top: var(--header-h);
}

/* ─── Section Blocks on Project Page ────────────────── */

.project-section {
  margin-bottom: 40px;
  animation: fadeUp 0.4s ease both;
}

.section-label {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

/* ─── Hero Block ────────────────────────────────────── */

.project-hero {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 40px;
  margin-bottom: 48px;
}

.hero-poster {
  aspect-ratio: 2/3;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  position: relative;
}

.hero-poster img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero-poster .upload-btn {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  font-size: 11px;
}

.hero-info {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-top: 4px;
}

.hero-title-ru {
  font-size: 3.5rem;
  line-height: 1;
  margin-bottom: 4px;
}

.hero-title-en {
  font-family: var(--font-head);
  font-size: 1.3rem;
  color: var(--text-muted);
  letter-spacing: 0.06em;
}

.hero-logline {
  font-size: 15px;
  color: var(--text);
  max-width: 560px;
  line-height: 1.7;
  margin-top: 8px;
}

.hero-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.hero-actions {
  display: flex;
  gap: 10px;
  margin-top: auto;
  padding-top: 16px;
}

/* ─── Meta Grid ─────────────────────────────────────── */

.meta-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px 32px;
}

.meta-item {}
.meta-item .meta-key {
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 2px;
}
.meta-item .meta-val {
  font-size: 14px;
  font-weight: 400;
  color: var(--text);
}

/* ─── Login Page ────────────────────────────────────── */

.page-login {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--bg);
}

.login-wrap {
  width: 100%;
  max-width: 360px;
  padding: 0 16px;
}

.login-logo {
  font-family: var(--font-head);
  font-size: 3rem;
  letter-spacing: 0.1em;
  color: var(--accent);
  text-align: center;
  margin-bottom: 8px;
}

.login-sub {
  text-align: center;
  color: var(--text-muted);
  font-size: 12px;
  letter-spacing: 0.06em;
  margin-bottom: 40px;
}

/* ─── Chat Sidebar Internals ────────────────────────── */

.sidebar-head {
  display: flex;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  gap: 8px;
  flex-shrink: 0;
}

.sidebar-head .sidebar-title {
  font-family: var(--font-head);
  font-size: 1rem;
  letter-spacing: 0.06em;
  flex: 1;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chat-message {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.chat-message.user { align-items: flex-end; }
.chat-message.assistant { align-items: flex-start; }

.chat-bubble {
  max-width: 90%;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 13px;
  line-height: 1.5;
}

.chat-message.user .chat-bubble {
  background: var(--accent);
  color: #fff;
  border-bottom-right-radius: var(--radius);
}

.chat-message.assistant .chat-bubble {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-bottom-left-radius: var(--radius);
}

.chat-message.error .chat-bubble {
  background: rgba(229, 62, 62, 0.1);
  border: 1px solid rgba(229, 62, 62, 0.3);
  color: var(--danger);
}

.chat-input-area {
  border-top: 1px solid var(--border);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}

.chat-input-area textarea {
  resize: none;
  height: 80px;
}

.chat-input-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* ─── Diff Modal ─────────────────────────────────────── */

.diff-description {
  font-size: 14px;
  color: var(--text);
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.diff-list { display: flex; flex-direction: column; gap: 8px; }

.diff-row {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
}

.diff-path {
  font-size: 11px;
  font-family: monospace;
  color: var(--accent);
  display: block;
  margin-bottom: 6px;
}

.diff-values {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 8px;
  align-items: start;
  font-size: 12px;
}

.diff-before { color: var(--danger); word-break: break-word; }
.diff-after  { color: var(--success); word-break: break-word; }
.diff-arrow  { color: var(--text-muted); align-self: center; }

.diff-no-changes {
  color: var(--text-muted);
  font-size: 13px;
  text-align: center;
  padding: 20px;
}

/* ─── Toast notifications ────────────────────────────── */

#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  padding: 12px 18px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 400;
  min-width: 200px;
  max-width: 340px;
  animation: fadeUp 0.25s ease;
  pointer-events: auto;
}

.toast.success {
  background: rgba(74, 222, 128, 0.12);
  border: 1px solid rgba(74, 222, 128, 0.25);
  color: var(--success);
}

.toast.error {
  background: rgba(229, 62, 62, 0.12);
  border: 1px solid rgba(229, 62, 62, 0.3);
  color: var(--danger);
}

/* ─── Responsive ────────────────────────────────────── */

@media (max-width: 1024px) {
  .project-layout { flex-direction: column; }
  .ai-sidebar {
    width: 100%;
    height: auto;
    position: static;
    border-left: none;
    border-top: 1px solid var(--border);
  }
  .chat-messages { max-height: 300px; }
  .project-hero { grid-template-columns: 180px 1fr; gap: 24px; }
}

@media (max-width: 768px) {
  .project-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; padding: 16px; }
  .project-main { padding: 20px; }
  .project-hero { grid-template-columns: 1fr; }
  .hero-poster { max-width: 220px; }
  .site-header { padding: 0 16px; }
  .filter-bar { padding: 12px 16px 0; flex-wrap: wrap; }
  .meta-grid { grid-template-columns: 1fr; }
}
