/* Videostudio — оформление по visual.md */

:root {
  --bg:            #0E1014;
  --surface:       #161922;
  --surface-2:     #1E2230;
  --border:        rgba(255,255,255,0.08);

  --text:          #FFFFFF;
  --text-secondary:#9CA3B4;
  --text-muted:    #6B7280;

  --primary:       #6354F0;
  --primary-hover: #7568FF;
  --accent-blue:   #3B82F6;

  --status-queued:     #6B7280;
  --status-processing: #E0A23C;
  --status-done:       #3FB37F;
  --status-failed:     #E0564B;

  --radius-card:   14px;
  --radius-field:  10px;
  --radius-badge:  6px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text-secondary);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.55;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent-blue); text-decoration: none; }
a:hover { color: var(--primary-hover); }

h1, h2, h3 { color: var(--text); font-weight: 600; margin: 0 0 12px; }
h1 { font-size: 22px; }
h2 { font-size: 18px; }
h3 { font-size: 15px; }

button, input, select, textarea {
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
}

/* ── шапка ──────────────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  color: var(--text);
  font-size: 15px;
}
.topbar-brand .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--primary);
}
.topbar-nav { display: flex; gap: 4px; }
.topbar-nav a {
  padding: 8px 14px;
  border-radius: 10px;
  color: var(--text-secondary);
  font-weight: 500;
}
.topbar-nav a.active {
  background: var(--surface-2);
  color: var(--text);
}
.topbar-actions { display: flex; gap: 12px; align-items: center; }
.balance-chip {
  font-size: 12px;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 6px 10px;
  border-radius: 8px;
}
.balance-chip b { color: var(--text); }

.logout-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
}
.logout-btn:hover { background: var(--surface-2); color: var(--text); }

/* ── основной контейнер ─────────────────────────── */
.layout {
  display: grid;
  grid-template-columns: minmax(360px, 420px) 1fr;
  gap: 20px;
  padding: 20px 24px;
  max-width: 1480px;
  margin: 0 auto;
}
@media (max-width: 960px) {
  .layout { grid-template-columns: 1fr; }
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 18px;
}
.card + .card { margin-top: 16px; }
.card-title { color: var(--text); font-weight: 600; font-size: 15px; margin-bottom: 14px; }

/* ── сегментированный контрол ────────────────────── */
.segmented {
  display: flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-field);
  padding: 4px;
  gap: 4px;
}
.segmented button {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-weight: 500;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.segmented button.active {
  background: var(--surface-2);
  color: var(--text);
}

/* ── поля формы ──────────────────────────────────── */
.field { margin-bottom: 14px; }
.field-label {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.input, .select, textarea, .file-drop {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-field);
  color: var(--text);
  padding: 10px 12px;
  outline: none;
  transition: border-color 0.15s;
}
.input:focus, .select:focus, textarea:focus, .file-drop:focus {
  border-color: var(--primary);
}
textarea {
  resize: vertical;
  min-height: 90px;
  font-family: inherit;
  line-height: 1.5;
}
.select {
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'><path fill='%239CA3B4' d='M6 8L2 4h8z'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}
.row { display: flex; gap: 10px; }
.row > * { flex: 1; }
.checkbox { display: inline-flex; align-items: center; gap: 8px; color: var(--text-secondary); cursor: pointer; user-select: none; }
.checkbox input { width: 16px; height: 16px; accent-color: var(--primary); }

/* ── загрузка файлов ─────────────────────────────── */
.file-drop {
  display: flex; flex-direction: column; gap: 6px;
  align-items: center; justify-content: center;
  padding: 22px 14px;
  border: 1px dashed var(--border);
  cursor: pointer;
  color: var(--text-muted);
  font-size: 13px;
  text-align: center;
}
.file-drop:hover { border-color: var(--primary); color: var(--text-secondary); }
.file-drop input[type=file] { display: none; }
.file-preview {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 8px;
}
.file-preview img {
  width: 100%;
  aspect-ratio: 1/1;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
}

/* ── кнопки ──────────────────────────────────────── */
.btn-primary, .btn-secondary {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px;
  border-radius: 10px;
  padding: 12px 18px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  border: 1px solid transparent;
}
.btn-primary {
  background: var(--primary);
  color: #fff;
  width: 100%;
}
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); }
.btn-primary:disabled {
  background: var(--surface-2);
  color: var(--text-muted);
  cursor: not-allowed;
}
.btn-secondary {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border);
  padding: 8px 14px;
  font-weight: 500;
  font-size: 13px;
}
.btn-secondary:hover { background: var(--surface-2); color: var(--text); }

/* ── блок стоимости ─────────────────────────────── */
.cost {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 14px 0 12px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-field);
  background: var(--surface-2);
}
.cost-line { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; }
.cost-money { color: var(--text); font-weight: 600; font-size: 16px; }
.cost-detail { color: var(--text-muted); font-size: 12px; }

/* ── статусы / бейджи ───────────────────────────── */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: var(--radius-badge);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.badge-queued     { color: var(--status-queued);     background: rgba(107,114,128,0.15); }
.badge-processing { color: var(--status-processing); background: rgba(224,162,60,0.15); }
.badge-done       { color: var(--status-done);       background: rgba(63,179,127,0.15); }
.badge-failed     { color: var(--status-failed);     background: rgba(224,86,75,0.15); }

/* ── превью ─────────────────────────────────────── */
.preview {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.preview-frame {
  background: #000;
  border-radius: var(--radius-card);
  border: 1px solid var(--border);
  aspect-ratio: 16 / 9;
  overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
}
.preview-frame video, .preview-frame audio, .preview-frame img {
  width: 100%; height: 100%; object-fit: contain; background: #000;
}
.preview-empty { font-size: 13px; }

/* ── список задач ────────────────────────────────── */
.task-list { display: flex; flex-direction: column; gap: 8px; }
.task-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-field);
}
.task-row:hover { border-color: var(--primary); cursor: pointer; }
.task-row-main {
  flex: 1;
  display: flex; flex-direction: column;
  min-width: 0;
}
.task-row-title {
  color: var(--text);
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.task-row-sub {
  color: var(--text-muted);
  font-size: 12px;
}
.task-row .progress {
  width: 80px;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}
.task-row .progress > div {
  height: 100%;
  background: var(--primary);
  transition: width 0.3s;
}

/* ── галерея ────────────────────────────────────── */
.gallery-toolbar {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 18px;
}
.gallery-toolbar .input { max-width: 360px; }
.gallery-toolbar .segmented { width: auto; }

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.gallery-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.gallery-card-thumb {
  background: #000;
  aspect-ratio: 16 / 9;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
}
.gallery-card-thumb video, .gallery-card-thumb img {
  width: 100%; height: 100%; object-fit: cover;
}
.gallery-card-thumb audio { width: 90%; }
.gallery-card-body { padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; }
.gallery-card-prompt {
  color: var(--text);
  font-size: 13px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.gallery-card-meta {
  display: flex; justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
}
.gallery-card-cost { color: var(--text); font-weight: 600; font-size: 13px; }
.gallery-card-actions { display: flex; gap: 8px; padding: 0 12px 12px; }
.gallery-card-actions .btn-secondary { flex: 1; padding: 6px; font-size: 12px; }

/* ── логин ──────────────────────────────────────── */
.login-wrap {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 28px;
}
.login-card h1 { font-size: 20px; margin-bottom: 4px; }
.login-card .sub { color: var(--text-muted); font-size: 13px; margin-bottom: 22px; }
.login-error {
  color: var(--status-failed);
  font-size: 13px;
  margin-bottom: 10px;
  padding: 8px 10px;
  background: rgba(224,86,75,0.1);
  border-radius: 8px;
}

.flash {
  margin: 0 24px 12px;
  padding: 10px 14px;
  border-radius: var(--radius-field);
  background: rgba(224,86,75,0.1);
  color: var(--status-failed);
  border: 1px solid rgba(224,86,75,0.3);
  font-size: 13px;
  display: none;
}
.flash.visible { display: block; }

.note { color: var(--text-muted); font-size: 12px; margin-top: 4px; }
.spacer { height: 12px; }
