/* ─────────────────────────────────────────
   AI Marketing Suite — Dashboard Styles
   ───────────────────────────────────────── */

:root {
  --bg:        #0f1117;
  --bg2:       #161b27;
  --bg3:       #1e2535;
  --border:    #2a3045;
  --accent:    #6366f1;
  --accent2:   #818cf8;
  --green:     #10b981;
  --yellow:    #f59e0b;
  --red:       #ef4444;
  --blue:      #3b82f6;
  --pink:      #ec4899;
  --text:      #e2e8f0;
  --muted:     #64748b;
  --muted2:    #94a3b8;
  --sidebar-w: 240px;
  --radius:    12px;
  --radius-sm: 8px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  height: 100vh;
  overflow: hidden;
  font-size: 14px;
}

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

/* ─────────────────── SIDEBAR ─────────────────── */
.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-header {
  padding: 1.25rem 1rem;
  border-bottom: 1px solid var(--border);
}

.logo {
  display: flex;
  align-items: center;
  gap: .75rem;
}

.logo-icon {
  font-size: 1.6rem;
  line-height: 1;
}

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

.logo-sub {
  font-size: .72rem;
  color: var(--muted);
  margin-top: 1px;
}

.sidebar-nav {
  flex: 1;
  padding: .75rem 0;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .6rem 1rem;
  color: var(--muted2);
  text-decoration: none;
  border-radius: 0;
  font-size: .85rem;
  font-weight: 500;
  position: relative;
  transition: color .15s, background .15s;
  cursor: pointer;
}

.nav-item:hover {
  color: var(--text);
  background: var(--bg3);
}

.nav-item.active {
  color: var(--accent2);
  background: rgba(99,102,241,.12);
  border-right: 2px solid var(--accent);
}

.nav-icon { font-size: 1rem; width: 1.2rem; text-align: center; }

.nav-badge {
  margin-left: auto;
  background: var(--accent);
  color: #fff;
  font-size: .68rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
}

.sidebar-footer {
  padding: 1rem;
  border-top: 1px solid var(--border);
  font-size: .75rem;
}

.sidebar-footer-label {
  color: var(--muted);
  margin-bottom: .4rem;
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.status-dot-row {
  display: flex;
  align-items: center;
  gap: .5rem;
  color: var(--muted2);
}

.dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  display: inline-block;
}
.dot.green  { background: var(--green); box-shadow: 0 0 6px var(--green); }
.dot.yellow { background: var(--yellow); }
.dot.red    { background: var(--red); }

/* ─────────────────── MAIN ─────────────────── */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ─────────────────── TOPBAR ─────────────────── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg2);
  flex-shrink: 0;
}

.topbar-title {
  font-weight: 700;
  font-size: 1.1rem;
}

/* ─────────────────── TABS ─────────────────── */
.tab-content {
  display: none;
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
}

.tab-content.active { display: block; }

/* ─────────────────── STATS GRID ─────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1rem;
  text-align: center;
  transition: border-color .2s;
}

.stat-card:hover { border-color: var(--accent); }

.stat-icon { font-size: 1.5rem; margin-bottom: .4rem; }

.stat-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
}

.stat-label {
  font-size: .75rem;
  color: var(--muted);
  margin-top: .3rem;
}

/* ─────────────────── SECTION TITLE ─────────────────── */
.section-title {
  font-weight: 700;
  font-size: .85rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  margin-bottom: 1rem;
}

.section-intro {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  color: var(--muted2);
  margin-bottom: 1.5rem;
  font-size: .88rem;
  line-height: 1.6;
}

.section-intro strong { color: var(--text); }

/* ─────────────────── TASK LIST ─────────────────── */
.task-list {
  display: flex;
  flex-direction: column;
  gap: .6rem;
}

.task-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: border-color .2s, background .15s;
  cursor: pointer;
}

.task-card:hover { border-color: var(--accent); background: var(--bg3); }

.task-icon { font-size: 1.4rem; flex-shrink: 0; }

.task-info { flex: 1; min-width: 0; }

.task-name {
  font-weight: 600;
  font-size: .9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.task-command {
  font-family: "Courier New", monospace;
  font-size: .78rem;
  color: var(--muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.task-meta {
  font-size: .72rem;
  color: var(--muted);
  margin-top: 3px;
}

.task-status-col {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: .4rem;
  flex-shrink: 0;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: .72rem;
  font-weight: 600;
}

.badge-pending   { background: rgba(100,116,139,.2); color: var(--muted2); }
.badge-running   { background: rgba(245,158,11,.15); color: var(--yellow); }
.badge-completed { background: rgba(16,185,129,.15); color: var(--green); }

.task-actions {
  display: flex;
  gap: .4rem;
}

/* ─────────────────── AGENTS GRID ─────────────────── */
.agents-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1rem;
}

.agent-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  transition: border-color .2s, transform .15s;
}

.agent-card:hover { transform: translateY(-2px); }

.agent-header {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-bottom: 1rem;
}

.agent-icon-wrap {
  width: 44px; height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}

.agent-name { font-weight: 700; font-size: .95rem; }

.agent-weight {
  font-size: .72rem;
  color: var(--muted);
  margin-top: 2px;
}

.agent-desc {
  font-size: .83rem;
  color: var(--muted2);
  line-height: 1.5;
  margin-bottom: 1rem;
}

.agent-dimensions {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  margin-bottom: .75rem;
}

.dim-chip {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px 8px;
  font-size: .72rem;
  color: var(--muted2);
}

.agent-stats {
  display: flex;
  gap: 1.5rem;
  font-size: .75rem;
  color: var(--muted);
  border-top: 1px solid var(--border);
  padding-top: .75rem;
  margin-top: .25rem;
}

.agent-stat-val { color: var(--text); font-weight: 600; }

/* ─────────────────── SKILLS GRID ─────────────────── */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: .75rem;
}

.skill-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  cursor: pointer;
  transition: border-color .2s, background .15s;
  display: flex;
  align-items: flex-start;
  gap: .75rem;
}

.skill-card:hover {
  border-color: var(--accent);
  background: var(--bg3);
}

.skill-card-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
  margin-top: 2px;
}

.skill-card-name {
  font-weight: 600;
  font-size: .88rem;
}

.skill-card-cmd {
  font-family: "Courier New", monospace;
  font-size: .72rem;
  color: var(--accent2);
  margin-top: 2px;
}

.skill-card-desc {
  font-size: .78rem;
  color: var(--muted);
  margin-top: 4px;
  line-height: 1.4;
}

/* ─────────────────── QUICK START ─────────────────── */
.quick-start-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: .6rem;
}

.qs-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .8rem 1rem;
  cursor: pointer;
  transition: border-color .2s;
  display: flex;
  align-items: center;
  gap: .6rem;
  font-size: .85rem;
}

.qs-card:hover { border-color: var(--accent); }

/* ─────────────────── REPORTS ─────────────────── */
.reports-list {
  display: flex;
  flex-direction: column;
  gap: .75rem;
}

.report-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  cursor: pointer;
  transition: border-color .2s;
}

.report-card:hover { border-color: var(--accent); }

.report-score {
  width: 56px; height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.1rem;
  flex-shrink: 0;
  border: 3px solid;
}

.report-score.score-high   { border-color: var(--green); color: var(--green); }
.report-score.score-mid    { border-color: var(--yellow); color: var(--yellow); }
.report-score.score-low    { border-color: var(--red); color: var(--red); }
.report-score.score-none   { border-color: var(--border); color: var(--muted); }

.report-info { flex: 1; min-width: 0; }

.report-filename { font-weight: 600; font-size: .9rem; }

.report-url {
  font-size: .78rem;
  color: var(--accent2);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.report-meta { font-size: .72rem; color: var(--muted); margin-top: 3px; }

/* Report detail */
.report-detail {
  position: absolute;
  inset: 0;
  background: var(--bg);
  z-index: 10;
  overflow-y: auto;
  padding: 1.5rem;
}

.report-detail-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.report-content {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem 2rem;
  font-family: "Courier New", monospace;
  font-size: .82rem;
  line-height: 1.7;
  color: var(--muted2);
  white-space: pre-wrap;
  word-break: break-word;
}

/* ─────────────────── FILTER BAR ─────────────────── */
.filter-bar {
  display: flex;
  gap: .4rem;
  margin-bottom: 1rem;
}

.filter-btn {
  background: var(--bg2);
  border: 1px solid var(--border);
  color: var(--muted2);
  padding: .35rem .9rem;
  border-radius: 20px;
  font-size: .8rem;
  cursor: pointer;
  transition: all .15s;
}

.filter-btn:hover, .filter-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ─────────────────── BUTTONS ─────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .45rem 1rem;
  border-radius: var(--radius-sm);
  font-size: .83rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: opacity .15s, background .15s;
}

.btn:hover { opacity: .85; }

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

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

.btn-danger {
  background: rgba(239,68,68,.15);
  color: var(--red);
  border: 1px solid rgba(239,68,68,.3);
}

.btn-sm { padding: .25rem .65rem; font-size: .75rem; }

/* ─────────────────── MODAL ─────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.7);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 1.5rem;
}

.modal-wide { max-width: 680px; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.modal-header h3 { font-weight: 700; font-size: 1rem; }

.modal-close {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 1rem;
  padding: .25rem;
  line-height: 1;
}

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

/* ─────────────────── FORM ─────────────────── */
.form-group { margin-bottom: 1.25rem; }

.form-group label {
  display: block;
  font-size: .8rem;
  font-weight: 600;
  color: var(--muted2);
  margin-bottom: .5rem;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.form-input {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: .6rem .9rem;
  font-size: .88rem;
  outline: none;
  transition: border-color .15s;
}

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

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: .6rem;
  margin-top: 1.5rem;
}

/* Skill select grid in modal */
.skill-select-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: .4rem;
  max-height: 220px;
  overflow-y: auto;
}

.skill-opt {
  background: var(--bg3);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .5rem .7rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: .4rem;
  font-size: .8rem;
  font-weight: 500;
  color: var(--muted2);
  transition: all .15s;
}

.skill-opt:hover { border-color: var(--accent2); color: var(--text); }

.skill-opt.selected {
  border-color: var(--accent);
  background: rgba(99,102,241,.15);
  color: var(--text);
}

/* Command preview */
.command-preview {
  margin-top: 1rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .75rem 1rem;
  font-size: .8rem;
}

.command-label {
  display: block;
  color: var(--muted);
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: .4rem;
}

.command-preview code {
  color: var(--accent2);
  font-family: "Courier New", monospace;
  word-break: break-all;
}

/* ─────────────────── TASK DETAIL MODAL ─────────────────── */
.task-detail-section { margin-bottom: 1.25rem; }

.task-detail-label {
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
  margin-bottom: .4rem;
  font-weight: 600;
}

.task-detail-value {
  font-size: .9rem;
  color: var(--text);
}

.task-detail-cmd {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .6rem 1rem;
  font-family: "Courier New", monospace;
  font-size: .82rem;
  color: var(--accent2);
  word-break: break-all;
}

.agents-used-list {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
}

.agent-chip {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: .25rem .7rem;
  font-size: .75rem;
  color: var(--muted2);
}

.status-change-row {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
  margin-top: .75rem;
  padding-top: .75rem;
  border-top: 1px solid var(--border);
}

/* ─────────────────── EMPTY STATE ─────────────────── */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--muted);
}

.empty-icon {
  font-size: 2.5rem;
  margin-bottom: .75rem;
}

/* ─────────────────── RESPONSIVE ─────────────────── */
@media (max-width: 640px) {
  .sidebar { display: none; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
