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

:root {
  --bg: #0c0d12;
  --panel: #121318;
  --surface: #181a21;
  --border: #1f2129;
  --text: #e2e5ec;
  --text-dim: #6c7186;
  --text-muted: #4a4e5e;
  --accent: #8b5cf6;
  --accent-soft: rgba(139,92,246,0.12);
  --green: #22c55e;
  --yellow: #f59e0b;
  --red: #ef4444;
  --twitch: #9147ff;
  --youtube: #ff0000;
  --radius: 12px;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', sans-serif;
}

body.light {
  --bg: #f4f5f7;
  --panel: #ffffff;
  --surface: #f0f1f4;
  --border: #e2e4ea;
  --text: #111318;
  --text-dim: #5a6070;
  --text-muted: #8a90a0;
  --accent: #7c3aed;
  --accent-soft: rgba(124,58,237,0.10);
  --green: #16a34a;
  --yellow: #d97706;
  --red: #dc2626;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  min-height: 100vh;
  line-height: 1.5;
  transition: background .2s, color .2s;
}

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

/* ─── Loading ─────────────────────────────────────────── */
.loading-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  gap: 16px;
  color: var(--text-muted);
}

/* ─── Login page ───────────────────────────────────────── */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}

.login-container {
  width: 100%;
  max-width: 400px;
  text-align: center;
}

.login-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 32px;
}

.logo-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: linear-gradient(135deg, #8b5cf6, #c084fc);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 900;
  color: #fff;
  flex-shrink: 0;
}

.logo-name { font-size: 20px; font-weight: 800; color: var(--text); text-align: left; }
.logo-sub  { font-size: 12px; color: var(--text-muted); text-align: left; }

.login-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
}

.login-card h1 { font-size: 22px; font-weight: 800; margin-bottom: 8px; }
.login-card p  { font-size: 14px; color: var(--text-dim); margin-bottom: 24px; }

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: opacity .15s, transform .1s;
}
.btn:hover { opacity: .9; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-twitch  { background: #9147ff; color: #fff; margin-bottom: 10px; }
.btn-youtube { background: #ff0000; color: #fff; }

.error-msg {
  background: rgba(239,68,68,.15);
  border: 1px solid var(--red);
  color: var(--red);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 16px;
}

.login-footer { font-size: 12px; color: var(--text-muted); margin-top: 20px; }

/* ─── App layout ───────────────────────────────────────── */
.app-layout {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-header {
  height: 56px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 10px;
}
.header-logo .logo-icon { width: 32px; height: 32px; border-radius: 8px; font-size: 15px; }
.header-logo .logo-name { font-size: 15px; font-weight: 800; }
.header-logo .logo-sub  { font-size: 10px; }

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

.header-avatar {
  width: 32px;
  height: 32px;
  border-radius: 16px;
  object-fit: cover;
  border: 2px solid var(--border);
}

.header-avatar-placeholder {
  width: 32px;
  height: 32px;
  border-radius: 16px;
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
}

.badge-platform {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
}
.badge-twitch  { background: rgba(145,71,255,.2); color: #9147ff; }
.badge-youtube { background: rgba(255,0,0,.15);   color: #ff4444; }

.logout-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 12px;
  cursor: pointer;
}
.logout-btn:hover { color: var(--text); border-color: var(--text-dim); }

.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 14px;
  cursor: pointer;
  line-height: 1;
  transition: border-color .15s;
}
.theme-toggle:hover { border-color: var(--text-dim); }

.app-main {
  flex: 1;
  padding: 32px 24px;
  max-width: 900px;
  margin: 0 auto;
  width: 100%;
}

/* ─── Empty state ──────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 80px 24px;
  color: var(--text-muted);
}
.empty-state .empty-icon { font-size: 48px; margin-bottom: 16px; opacity: .3; }
.empty-state h2 { font-size: 18px; color: var(--text-dim); margin-bottom: 8px; }
.empty-state p  { font-size: 14px; }

/* ─── Section title ────────────────────────────────────── */
.section-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 12px;
}

/* ─── Campaign cards ───────────────────────────────────── */
.campaigns-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.campaign-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color .15s;
  cursor: pointer;
}
.campaign-card:hover { border-color: var(--accent); }

.campaign-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
}

.campaign-client-logo {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  object-fit: contain;
  background: var(--surface);
  flex-shrink: 0;
  padding: 4px;
}

.campaign-client-placeholder {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.campaign-info { flex: 1; min-width: 0; }
.campaign-name { font-size: 16px; font-weight: 800; color: var(--text); margin-bottom: 4px; }
.campaign-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-dim);
  flex-wrap: wrap;
}

.status-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  text-transform: uppercase;
}
.status-active    { background: rgba(34,197,94,.15);  color: #22c55e; }
.status-pending   { background: rgba(245,158,11,.15); color: #f59e0b; }
.status-completed { background: rgba(139,92,246,.15); color: #8b5cf6; }
.status-draft     { background: rgba(74,78,94,.3);    color: #6c7186; }

.campaign-budget {
  text-align: right;
  flex-shrink: 0;
}
.budget-amount { font-size: 18px; font-weight: 800; color: var(--accent); }
.budget-label  { font-size: 10px; color: var(--text-muted); }

/* ─── Campaign detail ──────────────────────────────────── */
.back-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 13px;
  cursor: pointer;
  padding: 0;
  margin-bottom: 20px;
}
.back-btn:hover { color: var(--text); }

.tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}
.tab-btn {
  padding: 10px 18px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 500;
  margin-bottom: -1px;
}
.tab-btn.active {
  color: var(--text);
  font-weight: 700;
  border-bottom-color: var(--accent);
}

/* ─── Info grid ────────────────────────────────────────── */
.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  margin-bottom: 20px;
}
.info-item {
  background: var(--surface);
  border-radius: 8px;
  padding: 12px 14px;
}
.info-label { font-size: 10px; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: .5px; margin-bottom: 4px; }
.info-value { font-size: 14px; font-weight: 700; color: var(--text); }

/* ─── Description ──────────────────────────────────────── */
.description-block {
  background: var(--surface);
  border-radius: 8px;
  padding: 16px;
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.7;
  margin-bottom: 16px;
}

/* ─── PDF brief ────────────────────────────────────────── */
.pdf-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 16px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}
.pdf-btn:hover { border-color: var(--accent); }

/* ─── Deliverables ─────────────────────────────────────── */
.deliverables-list { display: flex; flex-direction: column; gap: 6px; }
.deliverable-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
}
.deliverable-type  { font-weight: 700; color: var(--text); flex: 1; }
.deliverable-date  { color: var(--text-muted); font-size: 12px; }
.deliverable-status { font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 4px; }
.del-planned    { background: rgba(74,78,94,.3);    color: #6c7186; }
.del-in_progress{ background: rgba(245,158,11,.15); color: #f59e0b; }
.del-completed  { background: rgba(34,197,94,.15);  color: #22c55e; }
.del-cancelled  { background: rgba(239,68,68,.15);  color: #ef4444; }

/* ─── Assets ───────────────────────────────────────────── */
.assets-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

@media (max-width: 600px) { .assets-grid { grid-template-columns: 1fr; } }

.asset-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
}
.asset-title { font-size: 11px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 12px; }

.link-url {
  font-family: monospace;
  font-size: 12px;
  color: var(--accent);
  background: var(--panel);
  border-radius: 6px;
  padding: 8px 10px;
  word-break: break-all;
  margin-bottom: 10px;
}

.copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
  cursor: pointer;
}
.copy-btn:hover { color: var(--text); border-color: var(--text-dim); }
.copy-btn.copied { color: var(--green); border-color: var(--green); }

.qr-img { display: block; border-radius: 8px; margin-bottom: 10px; }

.obs-link {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--accent);
  background: var(--panel);
  border-radius: 6px;
  padding: 8px 10px;
  word-break: break-all;
}

/* ─── Stats ────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--surface);
  border-radius: 10px;
  padding: 16px;
  text-align: center;
}
.stat-value { font-size: 28px; font-weight: 800; color: var(--accent); line-height: 1; }
.stat-label { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

.chart-container {
  background: var(--surface);
  border-radius: 10px;
  padding: 16px;
}
.chart-title { font-size: 12px; font-weight: 600; color: var(--text-dim); margin-bottom: 12px; }
.sparkline {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 60px;
}
.spark-bar {
  flex: 1;
  background: var(--accent);
  border-radius: 2px;
  opacity: .7;
  min-height: 2px;
  transition: opacity .15s;
}
.spark-bar:hover { opacity: 1; }
