/* FCCF Marketing Dashboard — Styles */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

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

:root {
  --blue:       #006fb9;
  --blue-light: #e8f2fa;
  --blue-mid:   #cce0f2;
  --green:      #2a6e3f;
  --green-bg:   #edf6f0;
  --amber:      #92600a;
  --amber-bg:   #fef4e0;
  --red:        #8b2020;
  --red-bg:     #fdf0f0;
  --ink:        #111214;
  --ink-mid:    #4a4f58;
  --ink-light:  #8a919e;
  --rule:       #e4e7ec;
  --surface:    #ffffff;
  --canvas:     #f4f6f9;
  --font:       'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

html { scroll-behavior: smooth; font-size: 15px; }

body {
  font-family: var(--font);
  background: var(--canvas);
  color: var(--ink);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ─── Header ────────────────────────────────────────────────────────── */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--rule);
  padding: 0 2.5rem;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 0 var(--rule);
}

.header-left { display: flex; align-items: baseline; gap: 1rem; }
.logo { font-size: 1rem; font-weight: 700; color: var(--blue); letter-spacing: -0.01em; }
.header-title { font-size: 0.78rem; font-weight: 500; color: var(--ink-mid); }
.header-right { font-size: 0.72rem; color: var(--ink-light); }
.header-right span { color: var(--ink-mid); font-weight: 500; }

/* ─── Navigation ────────────────────────────────────────────────────── */
.site-nav {
  background: var(--surface);
  border-bottom: 1px solid var(--rule);
  padding: 0 2.5rem;
  height: 34px;
  display: flex;
  align-items: center;
  gap: 0;
  position: sticky;
  top: 44px;
  z-index: 99;
  overflow-x: auto;
}

.site-nav a {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--ink-light);
  text-decoration: none;
  padding: 0 0.9rem;
  height: 34px;
  display: flex;
  align-items: center;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s;
  letter-spacing: 0.01em;
}
.site-nav a:hover { color: var(--blue); }
.site-nav a.active { color: var(--blue); border-bottom-color: var(--blue); }

/* ─── Layout ────────────────────────────────────────────────────────── */
.page { max-width: 1320px; margin: 0 auto; padding: 0 2.5rem 5rem; }

.section {
  padding-top: 3.5rem;
  padding-bottom: 1rem;
}

.section-header {
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--rule);
}

.section-number {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--blue);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 0.3rem;
}

.section-title {
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.02em;
}

.subsection-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ink-mid);
  letter-spacing: -0.01em;
  margin-bottom: 1.25rem;
  margin-top: 2.25rem;
}

/* ─── Intro Block ───────────────────────────────────────────────────── */
.intro-block {
  background: var(--blue-light);
  border-left: 3px solid var(--blue);
  padding: 1.1rem 1.4rem;
  border-radius: 0 6px 6px 0;
  margin-bottom: 2rem;
  max-width: 780px;
}
.intro-block p {
  font-size: 0.85rem;
  color: var(--ink-mid);
  line-height: 1.7;
  text-wrap: pretty;
}

/* ─── Metric Cards ──────────────────────────────────────────────────── */
.metric-grid {
  display: grid;
  gap: 1px;
  background: var(--rule);
  border: 1px solid var(--rule);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 2rem;
}
.metric-grid-7  { grid-template-columns: repeat(7, 1fr); }
.metric-grid-3  { grid-template-columns: repeat(3, 1fr); }
.metric-grid-4  { grid-template-columns: repeat(4, 1fr); }
.metric-grid-5  { grid-template-columns: repeat(5, 1fr); }

.metric-card {
  background: var(--surface);
  padding: 1.4rem 1.5rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.metric-label {
  font-size: 0.73rem;
  font-weight: 500;
  color: var(--ink-light);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  line-height: 1.3;
}

.metric-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--blue);
  letter-spacing: -0.03em;
  line-height: 1;
}
.metric-value.sm { font-size: 1.6rem; }
.metric-value.xs { font-size: 1.3rem; }

.metric-deltas {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.delta-row {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
}
.delta-label {
  color: var(--ink-light);
  font-weight: 400;
  min-width: 32px;
}
.delta-val {
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.15rem;
}
.delta-val.up   { color: var(--green); }
.delta-val.down { color: var(--red); }
.delta-val.neutral { color: var(--amber); }

.benchmark-note {
  font-size: 0.7rem;
  color: var(--ink-light);
  margin-top: 0.1rem;
}
.benchmark-note span { color: var(--blue); font-weight: 600; }

.sparkline-wrap { margin-top: 0.5rem; }
.sparkline-wrap canvas { display: block; width: 100% !important; height: 36px !important; }

/* ─── Charts ────────────────────────────────────────────────────────── */
.chart-block {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 1.5rem 1.75rem;
  margin-bottom: 2rem;
}

.chart-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink-mid);
  margin-bottom: 1.25rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.chart-row {
  display: grid;
  gap: 1rem;
}
.chart-row-2 { grid-template-columns: 1fr 1fr; }
.chart-row-60-40 { grid-template-columns: 3fr 2fr; }
.chart-row-55-45 { grid-template-columns: 11fr 9fr; }

.chart-container { position: relative; }
.chart-container canvas { width: 100% !important; }

/* ─── Filter Chips ──────────────────────────────────────────────────── */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
  align-items: center;
}
.filter-group-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--ink-light);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-right: 0.25rem;
}
.chip {
  padding: 0.3rem 0.8rem;
  border-radius: 999px;
  border: 1px solid var(--rule);
  background: var(--surface);
  font-size: 0.76rem;
  font-weight: 500;
  color: var(--ink-mid);
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
  user-select: none;
}
.chip:hover { background: var(--blue-light); border-color: var(--blue-mid); color: var(--blue); }
.chip.active { background: var(--blue); border-color: var(--blue); color: white; }
.filter-divider { width: 1px; height: 20px; background: var(--rule); margin: 0 0.25rem; }

/* ─── Table ─────────────────────────────────────────────────────────── */
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 2rem;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

thead th {
  padding: 0.75rem 1rem;
  text-align: left;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--ink-light);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--canvas);
  border-bottom: 1px solid var(--rule);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}
thead th:hover { color: var(--blue); }
thead th.sorted { color: var(--blue); }
thead th .sort-arrow { margin-left: 0.3rem; opacity: 0.4; }
thead th.sorted .sort-arrow { opacity: 1; }

tbody tr {
  border-bottom: 1px solid var(--rule);
  transition: background 0.1s;
}
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--canvas); }

tbody td {
  padding: 0.7rem 1rem;
  color: var(--ink);
  vertical-align: middle;
}
td.num { text-align: right; font-variant-numeric: tabular-nums; }
td.date-col { color: var(--ink-light); white-space: nowrap; }
td.name-col { font-weight: 500; max-width: 280px; }
td.name-col a { color: var(--ink); text-decoration: none; }

.type-badge {
  display: inline-block;
  padding: 0.18rem 0.55rem;
  border-radius: 3px;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.badge-fn       { background: var(--blue-light); color: var(--blue); }
.badge-appeal   { background: #f0f0f8; color: #4040a0; }
.badge-event    { background: var(--green-bg); color: var(--green); }
.badge-pac      { background: var(--amber-bg); color: var(--amber); }
.badge-fh       { background: #f5f0fb; color: #6b3ea0; }
.badge-untagged { background: #f0f0f0; color: #888; }

/* ─── Top Pages Movers ──────────────────────────────────────────────── */
.movers-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 1px;
  background: var(--rule);
  border: 1px solid var(--rule);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 2rem;
}

.movers-col {
  background: var(--surface);
  padding: 1.25rem 1.4rem;
}

.movers-col-title {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 1rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--rule);
}
.movers-col-title.up   { color: var(--green); }
.movers-col-title.down { color: var(--red); }
.movers-col-title.new  { color: var(--blue); }

.mover-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--canvas);
  gap: 0.75rem;
}
.mover-row:last-child { border-bottom: none; }

.mover-page {
  font-size: 0.78rem;
  color: var(--ink-mid);
  font-family: 'SF Mono', 'Fira Code', monospace;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mover-delta {
  font-size: 0.76rem;
  font-weight: 700;
  white-space: nowrap;
}
.mover-delta.up   { color: var(--green); }
.mover-delta.down { color: var(--red); }
.mover-delta.new  { color: var(--blue); background: var(--blue-light); padding: 0.1rem 0.4rem; border-radius: 3px; font-size: 0.68rem; }

.mover-sessions {
  font-size: 0.72rem;
  color: var(--ink-light);
  white-space: nowrap;
}

/* ─── Platform Cards ────────────────────────────────────────────────── */
.platform-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 2rem;
}

.platform-card {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 1.4rem 1.5rem 1.1rem;
}

.platform-name {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-mid);
  margin-bottom: 1.1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.platform-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  display: inline-block;
}
.dot-fb { background: #1877F2; }
.dot-ig { background: #E1306C; }
.dot-li { background: #0A66C2; }

.platform-audience {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--blue);
  letter-spacing: -0.03em;
  line-height: 1;
  margin-bottom: 0.3rem;
}
.platform-audience-label {
  font-size: 0.7rem;
  color: var(--ink-light);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 1rem;
}

.platform-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
  margin-bottom: 0.75rem;
}
.pstat-label {
  font-size: 0.68rem;
  color: var(--ink-light);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.15rem;
}
.pstat-val {
  font-size: 1rem;
  font-weight: 600;
  color: var(--ink);
}

/* ─── Paid Section ──────────────────────────────────────────────────── */
.paid-divider {
  border: none;
  border-top: 2px dashed var(--rule);
  margin: 2.5rem 0;
}
.paid-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}
.paid-tag {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: white;
  background: var(--blue);
  padding: 0.25rem 0.6rem;
  border-radius: 3px;
}
.paid-source {
  font-size: 0.75rem;
  color: var(--ink-light);
}

/* ─── Channel Bar ───────────────────────────────────────────────────── */
.channel-list { list-style: none; }
.channel-row {
  display: grid;
  grid-template-columns: 130px 1fr 60px;
  align-items: center;
  gap: 0.75rem;
  padding: 0.45rem 0;
}
.channel-label { font-size: 0.8rem; color: var(--ink-mid); }
.channel-bar-wrap { height: 8px; background: var(--canvas); border-radius: 4px; overflow: hidden; }
.channel-bar { height: 100%; background: var(--blue); border-radius: 4px; transition: width 0.5s ease; }
.channel-pct { font-size: 0.78rem; font-weight: 600; color: var(--blue); text-align: right; font-variant-numeric: tabular-nums; }

/* ─── New/Returning ─────────────────────────────────────────────────── */
.nr-wrap { display: flex; gap: 0; border: 1px solid var(--rule); border-radius: 6px; overflow: hidden; height: 36px; }
.nr-bar { display: flex; align-items: center; justify-content: center; font-size: 0.72rem; font-weight: 600; transition: flex 0.5s; }
.nr-new  { background: var(--blue); color: white; }
.nr-ret  { background: var(--blue-light); color: var(--blue); }
.nr-legend { display: flex; gap: 1.5rem; margin-top: 0.75rem; }
.nr-dot { width: 10px; height: 10px; border-radius: 2px; display: inline-block; margin-right: 0.35rem; }

/* ─── Footer ────────────────────────────────────────────────────────── */
.site-footer {
  border-top: 1px solid var(--rule);
  padding: 1.5rem 2.5rem;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  font-size: 0.74rem;
  color: var(--ink-light);
  background: var(--surface);
  gap: 2rem;
}
.footer-credit { font-weight: 500; color: var(--ink-mid); }
.footer-sources { max-width: 600px; line-height: 1.6; }
.footer-sources strong { color: var(--ink-mid); }

/* ─── Responsive ────────────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .metric-grid-7 { grid-template-columns: repeat(4, 1fr); }
  .movers-grid { grid-template-columns: 1fr; }
  .chart-row-2, .chart-row-60-40, .chart-row-55-45 { grid-template-columns: 1fr; }
  .platform-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 720px) {
  .page { padding: 0 1.25rem 4rem; }
  .metric-grid-7, .metric-grid-4 { grid-template-columns: repeat(2, 1fr); }
  .metric-grid-3 { grid-template-columns: 1fr 1fr; }
  .platform-grid { grid-template-columns: 1fr; }
  .site-header, .site-nav { padding: 0 1.25rem; }
  .site-footer { flex-direction: column; padding: 1.25rem; }
}
