/* Social channel overview — platform-card grid. */

.platform-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px;
}

.platform-card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.platform-card.is-not-configured { opacity: 0.55; }

.platform-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--color-line);
}
.platform-badge {
  width: 32px; height: 32px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: 14px;
  color: white;
  font-family: var(--font-serif);
}
.platform-badge.facebook  { background: #1877F2; }
.platform-badge.instagram { background: linear-gradient(135deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%); }
.platform-badge.threads   { background: #000000; }
.platform-badge.x         { background: #000000; }
.platform-badge.youtube   { background: #FF0000; }
.platform-badge.linkedin  { background: #0A66C2; }

.platform-name {
  font-family: var(--font-serif);
  font-size: 16px;
  font-weight: 600;
  line-height: 1.2;
}
.platform-handle { font-size: 12px; color: var(--color-muted); }

.platform-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.platform-stat {
  background: var(--color-bg-subtle);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
}
.platform-stat-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--color-muted); font-weight: 600; }
.platform-stat-value { font-family: var(--font-serif); font-size: 18px; font-weight: 700; }
.platform-stat-delta { font-size: 11px; margin-top: 2px; color: var(--color-muted); font-weight: 600; }
.platform-stat-delta.good { color: var(--color-good); }
.platform-stat-delta.bad  { color: var(--color-bad); }
.platform-stat-delta.neutral { color: var(--color-muted); }

.platform-top-post {
  border-top: 1px solid var(--color-line);
  padding-top: 10px;
  font-size: 13px;
  color: var(--color-ink-soft);
}
.platform-top-post-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-muted);
  font-weight: 600;
  margin-bottom: 4px;
}
.platform-top-post-text {
  font-style: italic;
  line-height: 1.4;
  margin-bottom: 4px;
}
.platform-top-post-meta { font-size: 11px; color: var(--color-muted); }

.not-configured-note {
  font-size: 13px;
  color: var(--color-muted);
  padding: 12px;
  background: var(--color-bg-subtle);
  border-radius: var(--radius-sm);
  text-align: center;
}

.status-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.status-pill.live    { background: var(--color-good-bg); color: var(--color-good); }
.status-pill.sample  { background: var(--color-bg-subtle); color: var(--color-muted); }
.status-pill.pending { background: var(--color-warn-bg); color: var(--color-warn); }
.status-pill.error   { background: var(--color-bad-bg); color: var(--color-bad); }
.status-pill.publish-only { background: var(--color-accent-bg, #e7f0fe); color: var(--color-accent, #1f6feb); }

/* Publishing column in the side-by-side table + the explanatory footnote. */
.data-table td.pub-col { font-weight: 600; }
.table-foot-note {
  font-size: 11px;
  color: var(--color-muted);
  margin: 10px 2px 0;
  line-height: 1.4;
}

/* Publishing-activity block inside each platform card. */
.platform-publish {
  border-top: 1px solid var(--color-line);
  padding-top: 10px;
  margin-top: 2px;
}
.platform-publish-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-muted);
  font-weight: 600;
  margin-bottom: 6px;
}
.platform-publish-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  font-size: 13px;
  color: var(--color-ink-soft);
}
.pp-stat strong { font-family: var(--font-serif); font-size: 15px; color: var(--color-ink); }
.platform-publish-empty { font-size: 12px; color: var(--color-muted); font-style: italic; }

.platform-card.is-publish-only { opacity: 0.92; }
.platform-card.is-publish-only .not-configured-note { margin-top: 10px; }

/* Sample-sourced platform cards: subtle visual softening + corner badge. */
.platform-card.is-sample-data {
  position: relative;
  opacity: 0.85;
  background: repeating-linear-gradient(
    135deg,
    var(--color-bg-card) 0px,
    var(--color-bg-card) 10px,
    var(--color-bg-subtle) 10px,
    var(--color-bg-subtle) 11px
  );
}
.platform-sample-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 3px 7px;
  border-radius: 3px;
  color: var(--color-muted);
  background: var(--color-bg-subtle);
  border: 1px solid var(--color-line);
}

/* Dim sample-data numbers in the comparison table so it's clear at a glance
   that those rows aren't real. */
.data-table td.is-sample-num {
  color: var(--color-muted);
  font-style: italic;
}

/* =================================================================
   Publishing insights (Hootsuite Phase 3) — velocity + mix + themes
   ================================================================= */
.insights-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 24px;
}
@media (max-width: 860px) {
  .insights-grid { grid-template-columns: 1fr; }
}
.insight-title {
  font-family: var(--font-serif);
  font-size: 14px;
  font-weight: 600;
  margin: 0 0 2px;
}
.insight-sub {
  font-size: 11px;
  color: var(--color-muted);
  margin: 0 0 12px;
}

/* Velocity — vertical bar chart, one column per week. */
.velocity-chart {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 150px;
}
.vel-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
}
.vel-bar-track {
  width: 100%;
  flex: 1;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.vel-bar {
  width: 70%;
  max-width: 18px;
  background: var(--color-accent, #1f6feb);
  border-radius: 3px 3px 0 0;
  min-height: 2px;
  transition: height 200ms;
}
.vel-count { font-size: 10px; font-weight: 600; color: var(--color-ink-soft); margin-top: 3px; }
.vel-label {
  font-size: 9px;
  color: var(--color-muted);
  margin-top: 2px;
  white-space: nowrap;
  transform: rotate(-45deg);
  transform-origin: center;
  height: 20px;
}

/* Horizontal bar lists — shared by platform-mix + content-themes. */
.bar-list { display: flex; flex-direction: column; gap: 8px; }
.bar-row {
  display: grid;
  grid-template-columns: 96px 1fr 28px;
  align-items: center;
  gap: 8px;
}
.bar-row-label {
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--color-ink-soft);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.bar-row-label.theme { grid-column: 1 / 2; }
.bar-row-track {
  background: var(--color-bg-subtle);
  border-radius: 999px;
  height: 10px;
  overflow: hidden;
}
.bar-row-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--color-accent, #1f6feb);
  min-width: 2px;
  transition: width 200ms;
}
.bar-row-value { font-size: 12px; font-weight: 600; text-align: right; color: var(--color-ink); }

/* Platform-tinted fills (mirror the badge palette). */
.bar-row-fill.facebook  { background: #1877F2; }
.bar-row-fill.instagram { background: #c13584; }
.bar-row-fill.threads   { background: #555; }
.bar-row-fill.x         { background: #111; }
.bar-row-fill.youtube   { background: #FF0000; }
.bar-row-fill.linkedin  { background: #0A66C2; }
.bar-row-fill.tiktok    { background: #25F4EE; }
.bar-row-fill.bluesky   { background: #0085FF; }
.bar-row-fill.pinterest { background: #E60023; }
.bar-row-fill.unknown   { background: var(--color-muted); }

/* Theme swatch palette (cycled by index). */
.theme-dot { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; display: inline-block; }
.t0, .theme-dot.t0 { background: #2c6e9b; }
.t1, .theme-dot.t1 { background: #c97f3a; }
.t2, .theme-dot.t2 { background: #4a8b5e; }
.t3, .theme-dot.t3 { background: #8a5fa8; }
.t4, .theme-dot.t4 { background: #b5536b; }
.t5, .theme-dot.t5 { background: #7a8290; }
.bar-row-fill.t0 { background: #2c6e9b; }
.bar-row-fill.t1 { background: #c97f3a; }
.bar-row-fill.t2 { background: #4a8b5e; }
.bar-row-fill.t3 { background: #8a5fa8; }
.bar-row-fill.t4 { background: #b5536b; }
.bar-row-fill.t5 { background: #7a8290; }

.publishing-insights[hidden] { display: none; }

.velocity-empty, .bar-empty {
  font-size: 12px;
  color: var(--color-muted);
  padding: 16px 4px;
  font-style: italic;
}
.cs-sub .good { color: var(--color-good); font-weight: 600; }
.insight-sub .good { color: var(--color-good); font-weight: 600; }
.insight-sub .bad  { color: var(--color-bad);  font-weight: 600; }
.insight-sub .neutral { color: var(--color-muted); }

/* =================================================================
   Content calendar (Hootsuite Phase 1)
   Two-column timeline + detail. Timeline is scroll-contained so the
   page doesn't stretch when there are 50+ campaigns.
   ================================================================= */

.content-calendar .card-head-meta {
  display: flex;
  align-items: center;
  gap: 14px;
}

.calendar-tabs {
  display: inline-flex;
  background: var(--color-bg-subtle);
  border-radius: var(--radius-sm);
  padding: 2px;
}
.calendar-tab {
  border: 0;
  background: transparent;
  color: var(--color-muted);
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  border-radius: calc(var(--radius-sm) - 2px);
  cursor: pointer;
  letter-spacing: 0.03em;
}
.calendar-tab.is-active {
  background: var(--color-bg-card);
  color: var(--color-ink);
  box-shadow: var(--shadow-sm);
}

.calendar-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
.calendar-summary-tile {
  background: var(--color-bg-subtle);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}
.cs-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--color-muted); font-weight: 600; }
.cs-value { font-family: var(--font-serif); font-size: 22px; font-weight: 700; line-height: 1.1; margin-top: 2px; }
.cs-sub   { font-size: 11px; color: var(--color-muted); margin-top: 2px; }
.cs-sub .good { color: var(--color-good); font-weight: 600; }
.cs-sub .bad  { color: var(--color-bad);  font-weight: 600; }

.calendar-split {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) 2fr;
  gap: 16px;
  align-items: stretch;
  /* Pin to a sensible default; the timeline scrolls inside this height. */
  min-height: 480px;
}
@media (max-width: 720px) {
  .calendar-split { grid-template-columns: 1fr; }
}

.calendar-timeline {
  border: 1px solid var(--color-line);
  border-radius: var(--radius-sm);
  background: var(--color-bg-card);
  overflow-y: auto;
  max-height: 560px;
}
.calendar-timeline-empty {
  padding: 24px 16px;
  text-align: center;
  color: var(--color-muted);
  font-size: 13px;
}

.calendar-day-head {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-muted);
  padding: 10px 12px 4px;
  background: var(--color-bg-subtle);
  position: sticky;
  top: 0;
  z-index: 1;
  border-bottom: 1px solid var(--color-line);
}

.calendar-row {
  display: flex;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--color-line);
  padding: 10px 12px;
  gap: 12px;
  cursor: pointer;
  transition: background 80ms;
}
.calendar-row:hover { background: var(--color-bg-subtle); }
.calendar-row.is-selected {
  background: var(--color-accent-bg, var(--color-bg-subtle));
  box-shadow: inset 3px 0 0 var(--color-accent, #1f6feb);
}
.calendar-row-time {
  font-family: var(--font-serif);
  font-size: 13px;
  font-weight: 600;
  color: var(--color-ink);
  width: 64px;
  flex-shrink: 0;
  padding-top: 2px;
}
.calendar-row-body { min-width: 0; flex: 1; }
.calendar-row-platforms { display: flex; gap: 4px; margin-bottom: 4px; }
.calendar-row-preview {
  font-size: 13px;
  line-height: 1.4;
  color: var(--color-ink-soft);
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

/* Compact platform badges used inside the timeline + detail. */
.platform-badge.mini {
  width: 22px;
  height: 22px;
  font-size: 11px;
  border-radius: 5px;
}
.platform-badge.tiktok    { background: linear-gradient(135deg, #25F4EE 0%, #000 50%, #FE2C55 100%); }
.platform-badge.bluesky   { background: #0085FF; }
.platform-badge.pinterest { background: #E60023; }
.platform-badge.unknown   { background: var(--color-muted); }

.calendar-detail {
  border: 1px solid var(--color-line);
  border-radius: var(--radius-sm);
  background: var(--color-bg-card);
  padding: 16px;
  overflow-y: auto;
  max-height: 560px;
}

.cdv-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--color-line);
}
.cdv-when {
  font-family: var(--font-serif);
  font-size: 16px;
  font-weight: 700;
}
.cdv-count {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-muted);
  font-weight: 600;
}

/* Media grid above the canonical text. Hootsuite's images are usually
   square or rectangular; 100px tiles give a glanceable thumbnail bar
   without dominating the detail panel. */
.cdv-media-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}
.cdv-media-thumb {
  position: relative;
  width: 100px;
  height: 100px;
  padding: 0;
  border: 1px solid var(--color-line);
  border-radius: var(--radius-sm);
  background: var(--color-bg-subtle);
  overflow: hidden;
  cursor: zoom-in;
  transition: transform 80ms, box-shadow 80ms;
}
.cdv-media-thumb:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}
.cdv-media-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.cdv-media-thumb.is-video::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.25);
}
.cdv-media-play {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  color: white;
  text-shadow: 0 1px 4px rgba(0,0,0,0.6);
  z-index: 1;
}

.cdv-canonical {
  font-size: 14px;
  line-height: 1.55;
  color: var(--color-ink);
  margin-bottom: 16px;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.cdv-variants {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.cdv-variant {
  background: var(--color-bg-subtle);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}
.cdv-variant-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.cdv-variant-name { font-weight: 600; font-size: 13px; }
.cdv-handle { font-size: 12px; color: var(--color-muted); }
.cdv-variant-meta { margin-left: auto; font-size: 12px; }
.cdv-link  { color: var(--color-accent, #1f6feb); text-decoration: none; font-weight: 600; }
.cdv-link:hover { text-decoration: underline; }
.cdv-state {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 700;
  background: var(--color-warn-bg);
  color: var(--color-warn);
}
.cdv-variant-text {
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-wrap: break-word;
  color: var(--color-ink-soft);
}
.cdv-media-flag {
  font-size: 11px;
  color: var(--color-muted);
  margin-top: 4px;
}

.calendar-empty {
  padding: 24px;
  text-align: center;
  color: var(--color-muted);
  font-size: 14px;
  background: var(--color-bg-subtle);
  border-radius: var(--radius-sm);
}
.content-calendar.is-empty .calendar-split,
.content-calendar.is-empty .calendar-summary { display: none; }

.content-calendar.is-sample .calendar-detail,
.content-calendar.is-sample .calendar-timeline {
  background: repeating-linear-gradient(
    135deg,
    var(--color-bg-card) 0px,
    var(--color-bg-card) 14px,
    var(--color-bg-subtle) 14px,
    var(--color-bg-subtle) 15px
  );
}

/* =================================================================
   Lightbox — full-screen image/video preview, click anywhere outside
   the asset (or press ESC) to close.
   ================================================================= */
.cdv-lightbox {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(15, 22, 28, 0.85);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4vh 4vw;
}
.cdv-lightbox[hidden] { display: none; }
body.is-lightbox-open { overflow: hidden; }

.cdv-lightbox-body {
  max-width: 92vw;
  max-height: 92vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.cdv-lightbox-body img,
.cdv-lightbox-body video {
  max-width: 92vw;
  max-height: 92vh;
  width: auto;
  height: auto;
  display: block;
  border-radius: var(--radius);
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

.cdv-lightbox-close {
  position: absolute;
  top: 16px;
  right: 18px;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: rgba(255,255,255,0.12);
  color: white;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  transition: background 80ms;
}
.cdv-lightbox-close:hover { background: rgba(255,255,255,0.22); }
