/* dashboard/styles.css — стили AI-редакции */

:root {
  --bg: #0f1117;
  --bg2: #161b27;
  --bg3: #1e2535;
  --border: #2a3347;
  --accent: #4f8ef7;
  --accent2: #7c5af7;
  --green: #3ecf8e;
  --yellow: #f7c948;
  --red: #f76f6f;
  --text: #e4e8f0;
  --text2: #8a95a8;
  --text3: #4a5568;
  --radius: 10px;
  --sidebar-w: 220px;
}

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

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

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

/* ── Sidebar ─────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 100;
  padding: 20px 0;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 20px 20px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}

.logo-icon {
  font-size: 22px;
  color: var(--accent);
}

.logo-title {
  font-weight: 700;
  font-size: 13px;
  color: var(--text);
}

.logo-sub {
  font-size: 11px;
  color: var(--text2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 130px;
}

.nav {
  flex: 1;
  padding: 0 10px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border-radius: 7px;
  color: var(--text2);
  text-decoration: none;
  font-size: 13px;
  margin-bottom: 2px;
  transition: all 0.15s;
  cursor: pointer;
}

.nav-item:hover { background: var(--bg3); color: var(--text); }
.nav-item.active { background: rgba(79,142,247,0.15); color: var(--accent); }
.nav-icon { font-size: 16px; opacity: 0.7; }

.sidebar-status {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text2);
}

.status-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text3);
  flex-shrink: 0;
}

.status-dot.ok { background: var(--green); }
.status-dot.warn { background: var(--yellow); }
.status-dot.err { background: var(--red); }

/* ── Main ────────────────────────────────────────────────────── */
.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  padding: 32px;
  max-width: calc(100vw - var(--sidebar-w));
}

/* ── Page ────────────────────────────────────────────────────── */
.page { display: none; }
.page.active { display: block; }

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.page-header h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
}

.page-date, .badge-info {
  font-size: 12px;
  color: var(--text2);
  background: var(--bg3);
  padding: 4px 10px;
  border-radius: 20px;
}

/* ── Stats ───────────────────────────────────────────────────── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
}

.stat-num {
  font-size: 32px;
  font-weight: 800;
  color: var(--accent);
  line-height: 1;
  margin-bottom: 6px;
}

.stat-label {
  font-size: 12px;
  color: var(--text2);
}

/* ── Cards ───────────────────────────────────────────────────── */
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 14px;
}

.card-desc {
  font-size: 13px;
  color: var(--text2);
  margin-bottom: 18px;
  line-height: 1.7;
}

/* ── Article list compact ────────────────────────────────────── */
.article-list-compact {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.article-item-compact {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: 6px;
  background: var(--bg3);
  cursor: pointer;
  transition: background 0.15s;
}

.article-item-compact:hover { background: var(--border); }

.art-score {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  min-width: 30px;
  text-align: center;
}

.art-title {
  font-size: 12px;
  color: var(--text);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.art-status.approved { background: rgba(62,207,142,0.15); color: var(--green); }
.art-status.needs_revision { background: rgba(247,201,72,0.15); color: var(--yellow); }
.art-status.error { background: rgba(247,111,111,0.15); color: var(--red); }

/* ── Agents mini ─────────────────────────────────────────────── */
.agents-mini {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.agent-mini {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text);
}

.role-badge {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 800;
  flex-shrink: 0;
}

/* ── Agent cards ─────────────────────────────────────────────── */
.agents-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.agent-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.agent-avatar {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 800;
  margin-bottom: 12px;
}

.agent-name {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 2px;
}

.agent-role {
  font-size: 11px;
  color: var(--text2);
  margin-bottom: 10px;
}

.agent-desc {
  font-size: 12px;
  color: var(--text2);
  line-height: 1.6;
}

/* Agent colors */
.orchestrator { background: rgba(79,142,247,0.2); color: #4f8ef7; }
.producer { background: rgba(62,207,142,0.2); color: #3ecf8e; }
.researcher { background: rgba(247,201,72,0.2); color: #f7c948; }
.creative { background: rgba(124,90,247,0.2); color: #7c5af7; }
.copywriter { background: rgba(247,142,79,0.2); color: #f78e4f; }
.editor { background: rgba(247,111,111,0.2); color: #f76f6f; }
.seo { background: rgba(79,207,247,0.2); color: #4fcff7; }
.analyst { background: rgba(247,79,142,0.2); color: #f74f8e; }
.km { background: rgba(200,200,200,0.15); color: #b0b8c8; }

/* ── Form elements ───────────────────────────────────────────── */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 12px;
  color: var(--text2);
  margin-bottom: 6px;
  font-weight: 500;
}

.input {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 10px 14px;
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s;
}

.input:focus { border-color: var(--accent); }

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
  padding: 9px 18px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover { background: #3a7ef5; }

.btn-secondary {
  background: var(--bg3);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover { background: var(--border); }

.btn-outline {
  background: transparent;
  color: var(--text2);
  border: 1px solid var(--border);
}

.btn-outline:hover { background: var(--bg3); color: var(--text); }

.btn-wide { width: 100%; text-align: center; padding: 12px; }

.form-row {
  display: flex;
  gap: 10px;
}

.status-message {
  margin-top: 14px;
  padding: 12px;
  background: var(--bg3);
  border-radius: 7px;
  font-size: 13px;
  color: var(--text2);
  border-left: 3px solid var(--accent);
}

/* ── Tables ──────────────────────────────────────────────────── */
.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th {
  text-align: left;
  font-size: 11px;
  color: var(--text2);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}

.data-table td {
  padding: 12px 14px;
  font-size: 13px;
  border-bottom: 1px solid rgba(42,51,71,0.5);
}

.data-table tr:hover td { background: rgba(79,142,247,0.04); cursor: pointer; }

/* ── Tabs ────────────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 2px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px;
  margin-bottom: 16px;
  width: fit-content;
}

.tab {
  padding: 7px 16px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text2);
  cursor: pointer;
  border: none;
  background: transparent;
  transition: all 0.15s;
}

.tab:hover { color: var(--text); }
.tab.active { background: var(--bg3); color: var(--text); }

/* ── Memory JSON ─────────────────────────────────────────────── */
.memory-json {
  font-family: 'JetBrains Mono', 'Fira Code', 'Menlo', monospace;
  font-size: 12px;
  color: var(--text2);
  white-space: pre-wrap;
  max-height: 600px;
  overflow-y: auto;
  line-height: 1.8;
}

/* ── Reports list ────────────────────────────────────────────── */
.reports-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.report-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.report-info h4 { font-size: 14px; margin-bottom: 4px; }
.report-info p { font-size: 12px; color: var(--text2); }
.report-stats { text-align: right; }
.report-stats .count { font-size: 24px; font-weight: 800; color: var(--accent); }
.report-stats .label { font-size: 11px; color: var(--text2); }

/* ── Modal ───────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}

.modal {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 12px;
  width: 90%;
  max-width: 720px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
}

.modal-header h3 { font-size: 16px; font-weight: 600; }

.modal-close {
  background: none;
  border: none;
  color: var(--text2);
  font-size: 18px;
  cursor: pointer;
  padding: 4px 8px;
}

.modal-close:hover { color: var(--text); }

.modal-body {
  padding: 20px 22px;
  overflow-y: auto;
  flex: 1;
}

/* ── Loading ─────────────────────────────────────────────────── */
.loading {
  text-align: center;
  color: var(--text2);
  padding: 40px;
  font-size: 13px;
}

.empty-state {
  text-align: center;
  color: var(--text2);
  padding: 60px 20px;
}

.empty-state .empty-icon { font-size: 40px; margin-bottom: 12px; }
.empty-state p { font-size: 14px; }

/* ── Scrollbar ───────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text3); }

/* ── Editorial sections (Статьи: выложены / приоритет / отложить) ── */
.ed-section { margin-bottom: 32px; }

.ed-section-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.ed-badge {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .5px;
  text-transform: uppercase;
  padding: 4px 12px;
  border-radius: 20px;
}
.ed-badge-pub  { background: rgba(62,207,142,.12); color: var(--green); border: 1px solid rgba(62,207,142,.25); }
.ed-badge-pri  { background: rgba(79,142,247,.12); color: var(--accent); border: 1px solid rgba(79,142,247,.25); }
.ed-badge-post { background: rgba(138,149,168,.08); color: var(--text2); border: 1px solid var(--border); }

.ed-count { font-size: 12px; color: var(--text2); }

.ed-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 10px;
}

.ed-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  transition: border-color .15s, background .15s;
}
.ed-card-pri  { cursor: pointer; }
.ed-card-pri:hover  { border-color: var(--accent); background: rgba(79,142,247,.05); }
.ed-card-pub:hover  { border-color: rgba(62,207,142,.4); }
.ed-card-post { opacity: .75; }

.ed-card-title {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.5;
  margin-bottom: 8px;
  color: var(--text);
}

.ed-dzen-link { color: inherit; text-decoration: none; }
.ed-dzen-link:hover { color: var(--green); text-decoration: underline; }

.ed-card-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.ed-views      { font-size: 12px; color: var(--green); font-weight: 700; }
.ed-views-new  { font-size: 11px; color: var(--text2); background: var(--bg3); padding: 2px 8px; border-radius: 10px; }
.ed-date       { font-size: 11px; color: var(--text2); }
.ed-score      { font-size: 12px; color: var(--accent); font-weight: 700; flex-shrink: 0; }
.ed-score-dim  { font-size: 12px; color: var(--text2); flex-shrink: 0; }
.ed-reason     { font-size: 11px; color: var(--text2); line-height: 1.4; }
.ed-empty      { color: var(--text2); font-size: 13px; padding: 16px 0; }

.ed-btn-sm {
  font-size: 10px;
  padding: 2px 8px;
  border: 1px solid var(--border);
  background: none;
  color: var(--text2);
  border-radius: 6px;
  cursor: pointer;
  transition: border-color .15s, color .15s;
}
.ed-btn-sm:hover { border-color: var(--accent); color: var(--accent); }
