/* ── Reset & Base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Storybox brand palette */
  --pink:          #FF3362;
  --pink-dark:     #e8184a;
  --pink-bg:       rgba(255,51,98,0.07);
  --pink-border:   rgba(255,51,98,0.18);
  --yellow:        #F5B800;
  --yellow-bg:     rgba(245,184,0,0.09);
  --yellow-border: rgba(245,184,0,0.25);
  --blue:          #3DD8F5;
  --blue-bg:       rgba(61,216,245,0.08);

  /* Neutrals */
  --bg:      #ffffff;
  --bg2:     #f7f7f7;
  --bg3:     #efefef;
  --border:  #e8e8e8;
  --border2: #d4d4d4;
  --text:    #111111;
  --text2:   #3a3a3a;
  --text3:   #888888;

  /* Status */
  --green:    #16a34a;
  --green-bg: rgba(22,163,74,0.08);
  --amber:    #d97706;
  --amber-bg: rgba(217,119,6,0.08);
  --red:      #dc2626;
  --red-bg:   rgba(220,38,38,0.08);

  /* Platforms */
  --yt:    #cc0000;   --yt-bg:  rgba(204,0,0,0.07);
  --ig:    #c2185b;   --ig-bg:  rgba(194,24,91,0.07);
  --tt:    #26272c;   --tt-bg:  rgba(38,39,44,0.07);

  /* Aliases used by legacy component names */
  --accent:    var(--pink);
  --accent2:   var(--pink-dark);
  --accent-bg: var(--pink-bg);

  --radius:    10px;
  --radius-lg: 16px;
  --shadow:    0 1px 4px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 20px rgba(0,0,0,0.09);
}

html { font-size: 16px; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text2);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
textarea, input { font-family: inherit; }

/* ── Navbar ───────────────────────────────────────────────────────────────── */
.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 40px;
  height: 68px;
  background: var(--bg);
  border-bottom: 1.5px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.nav-logo {
  height: 36px;
  width: auto;
  display: block;
}

.brand-tag {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--pink);
  background: var(--pink-bg);
  border: 1px solid var(--pink-border);
  padding: 3px 10px;
  border-radius: 20px;
}

/* ── Main Layout ──────────────────────────────────────────────────────────── */
.main-content {
  max-width: 1100px;
  margin: 0 auto;
  padding: 48px 40px 80px;
}

/* ── Page Header ──────────────────────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 40px;
  gap: 16px;
}

.page-title {
  font-size: 2.2rem;
  font-weight: 900;
  letter-spacing: -0.05em;
  line-height: 1.1;
  color: var(--text);
}

/* Pink dot accent — matches storyboxhq.ca heading style */
.page-title::after {
  content: ".";
  color: var(--pink);
}

.page-subtitle {
  color: var(--text3);
  margin-top: 6px;
  font-size: 0.9rem;
  font-weight: 500;
}

.back-link {
  font-size: 0.82rem;
  color: var(--text3);
  display: block;
  margin-bottom: 6px;
  font-weight: 500;
  transition: color 0.15s;
}
.back-link:hover { color: var(--pink); }

.header-actions { display: flex; gap: 8px; align-items: center; }

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 22px;
  border-radius: 50px;
  font-size: 0.875rem;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
  white-space: nowrap;
  letter-spacing: -0.01em;
}

.btn-primary {
  background: var(--pink);
  color: #fff;
  box-shadow: 0 2px 10px rgba(255,51,98,0.28);
}
.btn-primary:hover {
  background: var(--pink-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 18px rgba(255,51,98,0.38);
}
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }

.btn-secondary {
  background: transparent;
  color: var(--text2);
  border: 1.5px solid var(--border2);
  border-radius: 50px;
}
.btn-secondary:hover { border-color: var(--text); color: var(--text); background: var(--bg2); }

.btn-ghost {
  background: transparent;
  color: var(--text2);
  border: 1.5px solid var(--border2);
  border-radius: 50px;
}
.btn-ghost:hover { border-color: var(--text); color: var(--text); background: var(--bg2); }

.btn-danger {
  background: transparent;
  color: var(--red);
  border: 1.5px solid rgba(220,38,38,0.25);
  border-radius: 50px;
}
.btn-danger:hover { background: var(--red-bg); border-color: var(--red); }

.btn-sm { padding: 6px 16px; font-size: 0.78rem; }
.btn-lg { padding: 14px 32px; font-size: 0.95rem; }

/* ── Platform Badges ──────────────────────────────────────────────────────── */
.platform-badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.platform-badge.yt { background: var(--yt-bg); color: var(--yt); }
.platform-badge.ig { background: var(--ig-bg); color: var(--ig); }
.platform-badge.tt { background: var(--tt-bg); color: var(--tt); }

/* ── Dashboard Grid ───────────────────────────────────────────────────────── */
.client-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

.client-card {
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 26px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
  cursor: pointer;
  box-shadow: var(--shadow);
}
.client-card:hover {
  border-color: var(--pink);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.client-card-header { display: flex; align-items: center; gap: 14px; }

.client-avatar {
  width: 48px; height: 48px;
  border-radius: 12px;
  background: var(--yellow-bg);
  color: var(--text);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem;
  font-weight: 900;
  flex-shrink: 0;
  border: 1.5px solid var(--yellow-border);
}

.client-name     { font-weight: 800; font-size: 1rem; color: var(--text); letter-spacing: -0.02em; }
.client-industry { font-size: 0.75rem; color: var(--text3); margin-top: 2px; font-weight: 500; }

.client-platforms { display: flex; gap: 6px; flex-wrap: wrap; }

.client-audience {
  font-size: 0.82rem;
  color: var(--text3);
  line-height: 1.5;
}

.client-card-footer { margin-top: auto; }
.card-cta { font-size: 0.82rem; color: var(--pink); font-weight: 700; }

/* ── Profile Grid ─────────────────────────────────────────────────────────── */
.profile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

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

.card-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--text3);
  margin-bottom: 8px;
}

.profile-card p {
  font-size: 0.875rem;
  color: var(--text2);
  line-height: 1.55;
}

.platform-list  { display: flex; flex-direction: column; gap: 8px; }
.platform-row   { display: flex; align-items: center; gap: 10px; overflow: hidden; }
.platform-handle {
  font-size: 0.8rem;
  color: var(--text2);
  font-family: monospace;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}

/* ── Stats Row ────────────────────────────────────────────────────────────── */
.stats-row {
  display: flex;
  gap: 16px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}

.stat-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 22px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
  min-width: 200px;
}

.stat-numbers { display: flex; gap: 24px; }
.stat-item    { display: flex; flex-direction: column; }
.stat-value   { font-size: 1.4rem; font-weight: 900; letter-spacing: -0.04em; color: var(--text); }
.stat-label   { font-size: 0.72rem; color: var(--text3); margin-top: 2px; font-weight: 500; }

/* ── Tabs ─────────────────────────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1.5px solid var(--border);
  margin-bottom: 28px;
}

.tab-btn {
  background: none;
  border: none;
  color: var(--text3);
  font-size: 0.875rem;
  font-weight: 700;
  padding: 10px 16px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1.5px;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  gap: 6px;
  letter-spacing: -0.01em;
}
.tab-btn:hover  { color: var(--text2); }
.tab-btn.active { color: var(--pink); border-bottom-color: var(--pink); }

.tab-count {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 0.68rem;
  padding: 1px 6px;
  color: var(--text3);
}

.tab-content { }
.tab-content.hidden { display: none; }

/* ── Generate Section ─────────────────────────────────────────────────────── */
.generate-section {
  background: var(--yellow-bg);
  border: 1.5px solid var(--yellow-border);
  border-radius: var(--radius-lg);
  padding: 26px;
  margin-bottom: 28px;
}

.generate-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
}

.section-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 4px;
  letter-spacing: -0.02em;
}

.section-subtitle {
  font-size: 0.82rem;
  color: var(--text3);
}

/* ── Agent Panel ──────────────────────────────────────────────────────────── */
.agent-panel {
  margin-top: 20px;
  border-top: 1px solid var(--yellow-border);
  padding-top: 16px;
}

.agent-panel-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  font-size: 0.85rem;
  color: var(--text2);
  font-weight: 700;
}

.agent-status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--pink);
  animation: pulse 1.4s ease infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.4; transform: scale(0.75); }
}

.agent-log {
  max-height: 240px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  scrollbar-width: thin;
  scrollbar-color: var(--border2) transparent;
}

.log-entry {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 0.82rem;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.log-thinking { background: var(--pink-bg);   border-left: 2px solid var(--pink); }
.log-tool     { background: var(--bg3);        border-left: 2px solid var(--border2); }
.log-result   { background: var(--green-bg);   border-left: 2px solid var(--green); }
.log-text     { background: var(--bg3); color: var(--text3); }

.log-main   { font-weight: 700; color: var(--text); }
.log-detail { color: var(--text3); font-size: 0.75rem; margin-top: 1px; }

.hidden { display: none !important; }

/* ── Ideas List ───────────────────────────────────────────────────────────── */
.ideas-list { display: flex; flex-direction: column; gap: 20px; }

.idea-card {
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: box-shadow 0.15s, border-color 0.15s;
}
.idea-card:hover { box-shadow: var(--shadow-md); border-color: var(--border2); }

.idea-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
}

.idea-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.idea-format {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--pink);
  background: var(--pink-bg);
  padding: 2px 9px;
  border-radius: 20px;
  border: 1px solid var(--pink-border);
}

.idea-platforms { display: flex; gap: 5px; }

.idea-title {
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.3;
  color: var(--text);
}

.idea-body {
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.idea-section-label {
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--text3);
  margin-bottom: 6px;
}

.idea-hook p {
  font-size: 0.9rem;
  color: var(--text);
  font-style: italic;
  line-height: 1.5;
}

.idea-concept p, .idea-rationale p {
  font-size: 0.875rem;
  color: var(--text2);
  line-height: 1.6;
}

.idea-rationale {
  background: var(--yellow-bg);
  border-radius: 8px;
  padding: 12px 16px;
  border: 1px solid var(--yellow-border);
}

/* ── Videos Table ─────────────────────────────────────────────────────────── */
.videos-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.videos-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.videos-table th {
  text-align: left;
  padding: 12px 16px;
  background: var(--bg2);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text3);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.videos-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  color: var(--text2);
}

.videos-table tr:last-child td { border-bottom: none; }
.videos-table tr:hover td      { background: var(--bg2); }

.video-title-cell { max-width: 300px; }
.video-link {
  color: var(--text);
  font-weight: 700;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.video-link:hover { color: var(--pink); }

.num    { font-variant-numeric: tabular-nums; color: var(--text2); font-weight: 600; }
.muted  { color: var(--text3); }

.engagement-pill {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 20px;
}
.engagement-pill.high { background: var(--green-bg); color: var(--green); }
.engagement-pill.mid  { background: var(--amber-bg); color: var(--amber); }
.engagement-pill.low  { background: var(--bg3);      color: var(--text3); }

/* ── Forms ────────────────────────────────────────────────────────────────── */
.form-container { max-width: 760px; }

.form-section {
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}

.form-section-title {
  font-size: 1rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
  letter-spacing: -0.02em;
}

.form-section-hint {
  font-size: 0.82rem;
  color: var(--text3);
  margin-top: -12px;
  margin-bottom: 20px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.form-group       { display: flex; flex-direction: column; gap: 6px; }
.form-group--full { grid-column: 1 / -1; }

label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 6px;
}

.required { color: var(--pink); }

input[type="text"],
textarea {
  background: var(--bg2);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 10px 14px;
  font-size: 0.875rem;
  transition: border-color 0.15s, box-shadow 0.15s;
  width: 100%;
  resize: vertical;
}

input[type="text"]:focus,
textarea:focus {
  outline: none;
  border-color: var(--pink);
  box-shadow: 0 0 0 3px var(--pink-bg);
}

input::placeholder,
textarea::placeholder { color: var(--text3); }

.field-hint {
  font-size: 0.75rem;
  color: var(--text3);
  margin-top: 2px;
}

.platform-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 2px 7px;
  border-radius: 4px;
}
.platform-label.yt { background: var(--yt-bg); color: var(--yt); }
.platform-label.ig { background: var(--ig-bg); color: var(--ig); }
.platform-label.tt { background: var(--tt-bg); color: var(--tt); }

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 8px;
}

/* ── Empty States ─────────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 80px 24px;
}

.empty-state--inline {
  padding: 48px 24px;
  background: var(--bg2);
  border: 1.5px dashed var(--border2);
  border-radius: var(--radius-lg);
}

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

.empty-state h2,
.empty-state h3 {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 8px;
  letter-spacing: -0.03em;
}

.empty-state p {
  color: var(--text3);
  font-size: 0.875rem;
  margin-bottom: 20px;
}

/* ── Client industry tag ──────────────────────────────────────────────────── */
.client-industry-tag {
  display: inline-block;
  font-size: 0.75rem;
  color: var(--text3);
  background: var(--bg3);
  border: 1px solid var(--border);
  padding: 3px 10px;
  border-radius: 20px;
  margin-top: 6px;
  font-weight: 500;
}

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .main-content   { padding: 28px 20px 60px; }
  .navbar         { padding: 0 20px; }
  .form-grid      { grid-template-columns: 1fr; }
  .page-header    { flex-direction: column; align-items: flex-start; }
  .generate-header { flex-direction: column; align-items: flex-start; }
  .stats-row      { flex-direction: column; }
  .profile-grid   { grid-template-columns: 1fr; }
}
