/* ===== Базовые переменные ===== */
:root {
  --bg: #0d0d12;
  --bg-card: #14141c;
  --bg-input: #1a1a26;
  --border: #2a2a3a;
  --accent: #7c5cfc;
  --accent-hover: #9b7dff;
  --accent-glow: rgba(124, 92, 252, 0.25);
  --text: #e8e8f0;
  --text-muted: #6b6b85;
  --text-dim: #3a3a50;
  --success: #34d399;
  --warning: #fbbf24;
  --error: #f87171;
  --radius: 12px;
  --radius-sm: 8px;
  --sidebar-w: 220px;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
}

/* ===== Layout ===== */
.layout {
  display: flex;
  min-height: 100vh;
}

/* ===== Sidebar ===== */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 24px 16px;
  position: fixed;
  top: 0; left: 0; bottom: 0;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 8px 28px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}
.logo-icon { font-size: 22px; }
.logo-text { font-size: 13px; font-weight: 700; line-height: 1.3; color: var(--text); }

.nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.15s;
  cursor: pointer;
}
.nav-item:hover { background: var(--bg-input); color: var(--text); }
.nav-item.active { background: var(--accent-glow); color: var(--accent-hover); }
.nav-icon { font-size: 16px; }

.sidebar-footer {
  margin-top: auto;
  font-size: 11px;
  color: var(--text-dim);
  padding: 0 8px;
}

/* ===== Project Switcher ===== */
.project-switcher {
  position: relative;
  margin-bottom: 12px;
}
.project-current {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  text-align: left;
  transition: border-color .15s;
}
.project-current:hover { border-color: var(--accent); }
.project-current-icon { font-size: 15px; flex-shrink: 0; }
.project-current-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.project-current-arrow { font-size: 10px; color: var(--text-dim); flex-shrink: 0; }
.project-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0; right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 24px rgba(0,0,0,.4);
  z-index: 200;
  overflow: hidden;
}
.project-list { max-height: 200px; overflow-y: auto; }
.project-list-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  font-size: 13px;
  cursor: pointer;
  color: var(--text);
  transition: background .1s;
}
.project-list-item:hover { background: var(--bg-input); }
.project-list-item.active { color: var(--accent-hover); font-weight: 600; }
.project-list-item-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.project-list-item-delete {
  font-size: 11px;
  color: var(--text-dim);
  padding: 2px 5px;
  border-radius: 4px;
  opacity: 0;
  transition: opacity .15s;
  background: none;
  border: none;
  cursor: pointer;
}
.project-list-item:hover .project-list-item-delete { opacity: 1; }
.project-list-item-delete:hover { color: #ef4444; background: rgba(239,68,68,.1); }
.project-dropdown-divider { height: 1px; background: var(--border); margin: 4px 0; }
.project-new-btn {
  width: 100%;
  padding: 9px 12px;
  text-align: left;
  font-size: 13px;
  color: var(--accent);
  background: none;
  border: none;
  cursor: pointer;
  transition: background .1s;
}
.project-new-btn:hover { background: var(--bg-input); }
.project-create-form {
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.project-name-input, .project-desc-input {
  padding: 7px 10px;
  font-size: 12px;
}
.project-create-actions {
  display: flex;
  gap: 6px;
}
.project-no-selection {
  text-align: center;
  padding: 32px 16px;
  color: var(--text-muted);
  font-size: 14px;
}
.project-no-selection h3 { color: var(--text); margin-bottom: 8px; font-size: 16px; }

/* ===== Main ===== */
.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  padding: 40px 48px;
  max-width: 1200px;
}

.view { display: none; }
.view.active { display: block; }

.page-header { margin-bottom: 32px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.page-header h1 { font-size: 24px; font-weight: 700; flex: 1 1 100%; margin: 0; }
.page-header .subtitle { flex: 1 1 auto; }
.subtitle { color: var(--text-muted); font-size: 13px; }
.btn-danger-sm { font-size: 12px; padding: 5px 12px; background: transparent; border: 1px solid var(--error); color: var(--error); border-radius: 6px; cursor: pointer; opacity: 0.6; white-space: nowrap; }
.btn-danger-sm:hover { opacity: 1; }

/* ===== Content grid ===== */
.content-grid {
  display: grid;
  grid-template-columns: 420px 1fr;
  gap: 24px;
  align-items: start;
}

/* ===== Cards ===== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
}
.card-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 24px;
  color: var(--text);
}

/* ===== Form ===== */
.input-row { margin-bottom: 16px; }
.input-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
}
.input-icon { font-size: 14px; }

.input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: var(--text);
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.input::placeholder { color: var(--text-dim); }
.textarea { resize: vertical; min-height: 90px; font-family: inherit; }
select.input { cursor: pointer; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b6b85' d='M6 8L1 3h10z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
select.input option { background: #1a1a26; color: #e8e8f0; }

.btn-primary {
  width: 100%;
  margin-top: 8px;
  padding: 13px 24px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-text, .btn-loader { display: inline-block; }
.hidden { display: none !important; }

/* ===== Status card ===== */
.result-panel { position: relative; }
.status-card { min-height: 120px; }
.status-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 20px 0;
}

.status-spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.status-text { color: var(--text-muted); font-size: 13px; }

/* ===== Brand Profile Card ===== */
.profile-card { animation: fadeIn 0.3s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; } }

.profile-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.profile-niche {
  font-size: 18px;
  font-weight: 700;
}
.profile-saved-hint {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: -12px;
  margin-bottom: 18px;
}
.profile-saved-link {
  color: var(--accent);
  text-decoration: none;
}
.profile-saved-link:hover { text-decoration: underline; }
.badge {
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.badge-success { background: rgba(52,211,153,0.15); color: var(--success); }
.badge-processing { background: rgba(251,191,36,0.15); color: var(--warning); }
.badge-error { background: rgba(248,113,113,0.15); color: var(--error); }

.profile-section { margin-bottom: 20px; }
.profile-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-bottom: 10px;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.tag {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 12px;
  color: var(--text);
}

.profile-text { font-size: 13px; color: var(--text-muted); line-height: 1.6; }

.profile-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}
.stat-box {
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  padding: 14px;
}
.stat-label { font-size: 11px; color: var(--text-muted); margin-bottom: 4px; }
.stat-value { font-size: 16px; font-weight: 700; color: var(--text); }

.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 20px 0;
}

/* ===== Кнопка деталей ===== */
.btn-outline {
  padding: 9px 18px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }

/* ===== History ===== */
.history-list { display: flex; flex-direction: column; gap: 12px; }
.history-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: border-color 0.15s;
}
.history-item:hover { border-color: var(--accent); }
.history-item-left { display: flex; flex-direction: column; gap: 4px; }
.history-item-niche { font-weight: 600; font-size: 14px; }
.history-item-meta { font-size: 12px; color: var(--text-muted); }
.history-item-right { display: flex; align-items: center; gap: 12px; }

.empty-state {
  text-align: center;
  padding: 60px;
  color: var(--text-dim);
  font-size: 14px;
}

/* ===== Modal ===== */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal.hidden { display: none; }

.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.7);
}
.modal-content {
  position: relative;
  z-index: 1;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  width: 680px;
  max-width: 95vw;
  max-height: 90vh;
  overflow-y: auto;
}
.modal-close {
  position: absolute;
  top: 16px; right: 16px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 16px;
  cursor: pointer;
  padding: 4px 8px;
}
.modal-close:hover { color: var(--text); }

/* ===== Рекомендации ===== */
.reco-list { display: flex; flex-direction: column; gap: 8px; }
.reco-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 13px;
}
.reco-num {
  width: 20px; height: 20px;
  background: var(--accent-glow);
  color: var(--accent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 1px;
}

/* ===== Статистика публикаций ===== */
.pub-stats-grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.pub-stat {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
}
.pub-icon {
  font-size: 16px;
  width: 24px;
  text-align: center;
  flex-shrink: 0;
}
.pub-info {
  flex: 1;
  min-width: 0;
}
.pub-label {
  font-size: 13px;
  color: var(--text);
}
.pub-detail {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 1px;
}
.pub-count {
  font-size: 18px;
  font-weight: 700;
  color: var(--accent);
  flex-shrink: 0;
}

/* ===== Статистика платформ (карточки) ===== */
.plat-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.plat-card {
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  border: 1px solid var(--border);
}
.plat-card--error {
  opacity: 0.6;
}
.plat-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.plat-icon { font-size: 15px; }
.plat-name { font-size: 13px; font-weight: 600; flex: 1; }
.plat-error-badge {
  font-size: 10px;
  background: rgba(248,113,113,0.15);
  color: var(--error);
  border-radius: 4px;
  padding: 2px 6px;
}
.plat-error-msg {
  font-size: 11px;
  color: var(--text-muted);
}
.plat-pub {
  display: flex;
  align-items: baseline;
  gap: 5px;
  margin-bottom: 8px;
}
.plat-pub-num {
  font-size: 22px;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
}
.plat-pub-label {
  font-size: 11px;
  color: var(--text-muted);
}
.plat-pub-detail {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
  width: 100%;
}
.plat-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.plat-chip {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 12px;
  color: var(--text);
}
.plat-chip-label {
  color: var(--text-muted);
  font-size: 10px;
  margin-right: 4px;
}

/* ===== Транскрипция ===== */
.transcript-badge {
  margin-top: 8px;
  font-size: 11px;
  color: var(--accent);
  background: rgba(124,92,252,0.08);
  border: 1px solid rgba(124,92,252,0.2);
  border-radius: 6px;
  padding: 4px 8px;
  display: inline-block;
}

/* ===== Контентные инсайты ===== */
.content-formula {
  background: linear-gradient(135deg, rgba(124,92,252,0.12), rgba(124,92,252,0.05));
  border: 1px solid rgba(124,92,252,0.3);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-bottom: 14px;
}
.content-formula-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 6px;
}
.content-formula-text {
  font-size: 13px;
  color: var(--text);
  line-height: 1.6;
}

.tag-success {
  background: rgba(52,211,153,0.1);
  border-color: rgba(52,211,153,0.25);
  color: var(--success);
}
.tag-error {
  background: rgba(248,113,113,0.1);
  border-color: rgba(248,113,113,0.25);
  color: var(--error);
}

/* ===== Анализ конкурентов ===== */
.comp-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}
.comp-card {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}
.comp-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.comp-card-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  flex: 1;
}
.comp-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.comp-status-spinner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
}

/* Форма добавления конкурентов */
.comp-form-card {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  margin-bottom: 10px;
}
.comp-form-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.comp-form-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
}
.comp-remove-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  padding: 2px 6px;
  border-radius: 4px;
  transition: color 0.15s;
}
.comp-remove-btn:hover { color: var(--error); }
.comp-url-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.input--sm {
  font-size: 12px;
  padding: 8px 10px;
}

.comp-strengths-list {
  margin: 0;
  padding-left: 16px;
  list-style: disc;
}
.comp-strengths-list li {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 4px;
  line-height: 1.4;
}
@media (max-width: 480px) {
  .comp-url-grid { grid-template-columns: 1fr; }
}

/* ===== Ідеї контенту ===== */
.ideas-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.idea-card {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  transition: border-color 0.15s, background 0.15s;
}
.idea-card:hover {
  border-color: var(--accent);
  background: rgba(124,92,252,0.05);
}

.work-card {
  border-left: 2px solid var(--accent);
}

.exclusions-block {
  margin: 12px 0;
  padding: 10px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.exclusions-label {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.exclusions-input {
  width: 100%;
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 12px;
  resize: none;
  outline: none;
  font-family: inherit;
  min-height: 40px;
  box-sizing: border-box;
}
.btn-regen-voice {
  margin-top: 8px;
  font-size: 12px;
  padding: 4px 12px;
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--accent);
  border-radius: 6px;
  cursor: pointer;
  opacity: 0.8;
}
.btn-regen-voice:hover:not(:disabled) { opacity: 1; }
.btn-regen-voice:disabled { opacity: 0.4; cursor: default; }

.idea-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
}

.btn-production {
  font-size: 12px;
  padding: 4px 12px;
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--accent);
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.btn-production:hover:not(:disabled) {
  background: var(--accent);
  color: #fff;
}
.btn-production:disabled {
  opacity: 0.6;
  cursor: default;
}

.btn-idea-delete {
  background: none;
  border: none;
  font-size: 14px;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 4px;
  color: var(--error);
  opacity: 0.5;
  transition: opacity 0.15s;
}
.btn-idea-delete:hover { opacity: 1; }

.idea-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.idea-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
}

.idea-badge {
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.idea-badge--format {
  background: rgba(107,107,133,0.15);
  color: var(--text-muted);
}

.idea-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
}

/* Форма ідей */
.ideas-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 16px;
}

.ideas-formats-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.checkbox-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  padding: 2px 0;
}
.checkbox-item input { cursor: pointer; accent-color: var(--accent); }

.format-sub {
  margin-top: 4px;
  margin-bottom: 4px;
}

/* Прогрес-бар генерації ідей */
.ideas-progress-track {
  width: 220px;
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}
.ideas-progress-bar {
  height: 100%;
  width: 0%;
  background: var(--accent);
  border-radius: 2px;
  animation: ideas-fill 15s ease-out forwards;
}
@keyframes ideas-fill {
  0%   { width: 0%; }
  60%  { width: 75%; }
  90%  { width: 88%; }
  100% { width: 90%; }
}

/* Кнопка видалення в Історії */
.history-delete-btn {
  background: none;
  border: none;
  font-size: 15px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  opacity: 0.5;
  transition: opacity 0.15s;
}
.history-delete-btn:hover { opacity: 1; }

/* ===== Video generation ===== */
.btn-video-gen {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, rgba(124,92,252,0.15), rgba(124,92,252,0.05));
  border: 1px solid var(--accent);
  color: var(--accent);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  padding: 7px 14px;
  cursor: pointer;
  margin-top: 10px;
  transition: background 0.2s, opacity 0.2s;
  width: 100%;
  justify-content: center;
}
.btn-video-gen:hover { background: rgba(124,92,252,0.2); }
.btn-video-gen:disabled { opacity: 0.5; cursor: not-allowed; }

.video-status-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding: 8px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--text-muted);
}
.video-status-text { flex: 1; }
.video-status-error { border-color: rgba(248,113,113,0.3); color: var(--error); }

.video-result { margin-top: 10px; }
.video-player {
  width: 100%;
  border-radius: var(--radius-sm);
  background: #000;
  max-height: 280px;
}
.video-result-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  flex-wrap: wrap;
}

/* ===== Video progress steps ===== */
.video-progress {
  margin-top: 12px;
  padding: 14px 16px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.video-progress-steps {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: 12px;
}

.vp-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

.vp-step-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  transition: all 0.3s;
}

.vp-step-label {
  font-size: 10px;
  color: var(--text-muted);
  white-space: nowrap;
  transition: color 0.3s;
}

.vp-step-num {
  font-size: 11px;
  color: var(--text-dim);
  font-weight: 600;
}

/* idle */
.vp-step--idle .vp-step-icon {
  background: var(--bg);
  border: 1px solid var(--border);
}

/* active */
.vp-step--active .vp-step-icon {
  background: rgba(124,92,252,0.15);
  border: 1px solid var(--accent);
}
.vp-step--active .vp-step-label {
  color: var(--accent);
  font-weight: 600;
}

/* done */
.vp-step--done .vp-step-icon {
  background: rgba(52,211,153,0.15);
  border: 1px solid var(--success);
  color: var(--success);
}
.vp-step--done .vp-step-label { color: var(--success); }

.vp-connector {
  flex: 1;
  height: 1px;
  background: var(--border);
  margin: 0 4px;
  margin-bottom: 18px;
  transition: background 0.3s;
}
.vp-connector--done { background: var(--success); }

/* mini spinner inside step */
.vp-spinner {
  width: 12px;
  height: 12px;
  border: 2px solid rgba(124,92,252,0.3);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* progress bar */
.vp-bar-track {
  height: 3px;
  background: var(--border);
  border-radius: 99px;
  overflow: hidden;
}
.vp-bar-fill {
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--accent), #a78bfa);
  transition: width 1s ease;
}
.vp-bar-fill--p1 {
  width: 20%;
  animation: pulse-bar 2s ease-in-out infinite;
}
.vp-bar-fill--p2 {
  width: 60%;
  animation: pulse-bar 2s ease-in-out infinite;
}
.vp-bar-fill--p3 {
  width: 70%;
  animation: pulse-bar 2s ease-in-out infinite;
}
.vp-bar-fill--p4 {
  width: 90%;
  animation: pulse-bar 2s ease-in-out infinite;
}

@keyframes pulse-bar {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

/* ===== B-roll ===== */
.btn-broll-gen {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(0,200,100,0.06);
  border: 1px solid rgba(52,211,153,0.4);
  color: var(--success);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  padding: 7px 14px;
  cursor: pointer;
  margin-top: 8px;
  width: 100%;
  justify-content: center;
  transition: background 0.2s;
}
.btn-broll-gen:hover { background: rgba(52,211,153,0.12); }

.broll-progress {
  margin-top: 8px;
  padding: 12px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.broll-progress-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.broll-result { margin-top: 8px; }
.broll-result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.broll-clips-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.broll-clip-placeholder {
  aspect-ratio: 9/16;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transition: border-color 0.3s;
}
.broll-clip-placeholder.broll-clip--done {
  border-color: var(--success);
}

.broll-clip {
  aspect-ratio: 9/16;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  position: relative;
  cursor: pointer;
}
.broll-clip:hover .broll-download { opacity: 1; }
.broll-clip--error {
  display: flex;
  align-items: center;
  justify-content: center;
  border-color: rgba(248,113,113,0.3);
}

.broll-download {
  position: absolute;
  bottom: 4px;
  right: 4px;
  background: rgba(0,0,0,0.6);
  color: #fff;
  border-radius: 4px;
  padding: 2px 5px;
  font-size: 11px;
  opacity: 0;
  transition: opacity 0.2s;
  text-decoration: none;
}

/* ===== Карусель ===== */
.carousel-preview {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 4px;
  margin-bottom: 10px;
}

.carousel-slide-thumb {
  border-radius: 4px;
  overflow: hidden;
  background: var(--bg-input);
  position: relative;
  cursor: pointer;
  transition: opacity 0.15s;
}

.carousel-slide-thumb:hover { opacity: 0.85; }

.carousel-slide-thumb img {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  display: block;
}

/* текстовый оверлей на миниатюре */
.slide-text-overlay {
  position: absolute;
  bottom: 10%;
  left: 0;
  right: 0;
  padding: 12px 4px 4px;
  background: linear-gradient(transparent, rgba(0,0,0,0.72));
}

.slide-overlay-title {
  color: #fff;
  font-size: 7px;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.slide-error {
  aspect-ratio: 4 / 5;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--error);
  font-size: 18px;
}

.carousel-dialog {
  background: transparent;
  border: none;
  padding: 0;
  max-width: 90vw;
  max-height: 90vh;
}

.carousel-dialog::backdrop {
  background: rgba(0, 0, 0, 0.88);
}

.carousel-dialog-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.carousel-dialog-image-wrap {
  position: relative;
  display: inline-block;
  border-radius: 10px;
  overflow: hidden;
}

.carousel-dialog-image-wrap img {
  max-height: 78vh;
  max-width: 80vw;
  display: block;
  object-fit: contain;
}

.carousel-dialog-overlay {
  position: absolute;
  bottom: 10%;
  left: 0;
  right: 0;
  padding: 50px 24px 24px;
  background: linear-gradient(transparent, rgba(0,0,0,0.78));
  text-align: center;
}

.carousel-dialog-overlay-title {
  color: #fff;
  font-size: 26px;
  font-weight: 800;
  line-height: 1.25;
  margin-bottom: 8px;
  text-shadow: 0 2px 6px rgba(0,0,0,0.6);
  letter-spacing: -0.3px;
}

.carousel-dialog-overlay-text {
  color: rgba(255,255,255,0.92);
  font-size: 15px;
  line-height: 1.5;
  text-shadow: 0 1px 4px rgba(0,0,0,0.6);
}

.carousel-dialog-nav {
  display: flex;
  align-items: center;
  gap: 16px;
}

.carousel-nav-btn {
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 6px;
  color: #fff;
  font-size: 22px;
  line-height: 1;
  padding: 4px 14px;
  cursor: pointer;
  transition: background 0.15s;
}

.carousel-nav-btn:hover:not(:disabled) { background: rgba(255,255,255,0.22); }
.carousel-nav-btn:disabled { opacity: 0.3; cursor: default; }

/* ===== Чекбокси слайдів ===== */
.slide-checkbox-wrap {
  position: absolute;
  top: 4px;
  left: 4px;
  z-index: 2;
  cursor: pointer;
  padding: 2px;
}

.slide-checkbox {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255,255,255,0.8);
  border-radius: 3px;
  background: rgba(0,0,0,0.3);
  transition: all 0.15s;
}

.slide-checkbox--checked {
  background: var(--accent);
  border-color: var(--accent);
}

.slide-checkbox--checked::after {
  content: "✓";
  display: block;
  color: #fff;
  font-size: 9px;
  line-height: 11px;
  text-align: center;
  font-weight: 700;
}

.slide-checkbox-wrap--checked .slide-checkbox { box-shadow: 0 0 0 2px rgba(124,92,252,0.4); }

/* ===== Кнопка Постити + рядок вибору ===== */
.carousel-post-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 6px;
  margin-bottom: 2px;
  gap: 8px;
}

.slide-select-info {
  font-size: 11px;
  color: var(--text-muted);
}

.btn-post {
  background: linear-gradient(135deg, #7c5cfc, #5c8afc);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
  white-space: nowrap;
}

.btn-post:hover:not(:disabled) { opacity: 0.88; }
.btn-post:disabled { opacity: 0.35; cursor: default; }

/* ===== Тост постингу ===== */
.posting-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 300;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 13px;
  color: var(--text);
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
}

.posting-toast--visible { opacity: 1; transform: translateY(0); }
.posting-toast--error { color: var(--error); }

/* ===== Картки черги постингу ===== */
.posting-card { border-left: 3px solid var(--accent); }

.posting-slides-preview {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.posting-slide-wrap {
  position: relative;
  width: 64px;
  height: 80px;
  flex-shrink: 0;
}

.posting-slide-thumb {
  width: 64px;
  height: 80px;
  object-fit: cover;
  border-radius: 4px;
  background: var(--bg-input);
  display: block;
}

.posting-slide-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 10px 3px 3px;
  background: linear-gradient(transparent, rgba(0,0,0,0.72));
  color: #fff;
  font-size: 6px;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  border-radius: 0 0 4px 4px;
  overflow: hidden;
}

.posting-slide-thumb--error {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

.posting-video-preview {
  width: 100%;
  max-height: 200px;
  border-radius: 8px;
  margin-top: 10px;
  background: #000;
}

.posting-status {
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 4px;
  font-weight: 600;
}

.posting-status--queued { background: rgba(124,92,252,0.15); color: var(--accent); }
.posting-status--posted { background: rgba(34,197,94,0.15); color: #22c55e; }
.posting-status--error  { background: rgba(239,68,68,0.15); color: var(--error); }

/* ===== Підпис до посту ===== */
.post-caption-block {
  margin-top: 10px;
  padding: 10px 12px;
  background: var(--bg-input);
  border-radius: 8px;
  border-left: 3px solid var(--accent);
}

.post-caption-text {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 8px;
  white-space: pre-line;
}

.post-hashtags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.post-hashtag {
  font-size: 11px;
  color: var(--accent);
  background: rgba(124, 92, 252, 0.12);
  border-radius: 4px;
  padding: 2px 6px;
}

/* ===== Стиль-пикер для генерации видео ===== */
.style-picker {
  margin-bottom: 10px;
}

.style-picker-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.style-picker-options {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.style-btn {
  font-size: 12px;
  padding: 4px 10px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: 20px;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.style-btn:hover {
  border-color: var(--accent);
  color: var(--text);
}

.style-btn--active {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(124, 92, 252, 0.1);
}

/* ===== Вкладки каталогу ===== */
.catalog-tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-size: 13px;
  font-family: inherit;
  padding: 8px 14px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.catalog-tab:hover {
  color: var(--text);
}
.catalog-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
.catalog-tab-count {
  display: inline-block;
  background: rgba(124, 92, 252, 0.15);
  color: var(--accent);
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 10px;
  margin-left: 4px;
}

/* ===== Слайди карусельного сценарію ===== */
.slides-row {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 8px;
  scrollbar-width: thin;
}
.slide-card {
  flex-shrink: 0;
  width: 160px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--bg-input);
}
.slide-photo-wrap {
  position: relative;
  width: 160px;
  height: 120px;
}
.slide-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.slide-photo--empty {
  background: var(--bg-card);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
}
.slide-overlay {
  position: absolute;
  top: 6px;
  left: 6px;
}
.slide-num {
  background: rgba(0,0,0,0.55);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.slide-text-block {
  padding: 8px;
}
.slide-title {
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 4px;
  line-height: 1.3;
}
.slide-body {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.4;
}
.script-caption {
  margin-top: 10px;
  padding: 10px 12px;
  background: var(--bg-input);
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.5;
}
