/* ==========================================================================
   Collection Tiles — mock Analytics dashboard (marketing site only)
   --------------------------------------------------------------------------
   A faithful recreation of the app's Analytics tab (AnalyticsTab.jsx) with
   FAKE data: 3 stat cards, an SVG line chart, and a By tile / By collection
   performance table. Built in vanilla HTML/CSS/SVG (the app uses Polaris-Viz).
   ========================================================================== */

.ct-an { max-width: 1000px; margin: 40px auto 0; padding: 0 24px; }

/* The admin-style panel wrapper */
.ct-an__panel {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); padding: 26px; display: grid; gap: 22px;
}
/* Let grid items shrink below their content min-width (else the perf table
   forces the whole panel wider than a phone viewport). Layout-neutral on desktop. */
.ct-an__panel > * { min-width: 0; }
.ct-an__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.ct-an__head h3 { margin: 0; font-size: 1.2rem; }
.ct-an__range {
  display: inline-flex; align-items: center; gap: 8px; font-size: .88rem; font-weight: 600; color: var(--text-soft);
  background: var(--bg-soft); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 7px 13px;
}

/* Stat cards */
.ct-an__stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 640px) { .ct-an__stats { grid-template-columns: 1fr; } }
.ct-an__stat { background: var(--bg-soft); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; }
.ct-an__stat-label { font-size: .85rem; color: var(--text-soft); margin-bottom: 6px; }
.ct-an__stat-value { font-size: 2rem; font-weight: 800; color: var(--ink); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }

/* Chart card */
.ct-an__card { border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.ct-an__card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.ct-an__card-head h4 { margin: 0; font-size: 1rem; }
.ct-an__legend { display: flex; gap: 16px; font-size: .85rem; color: var(--text-soft); }
.ct-an__legend span { display: inline-flex; align-items: center; gap: 6px; }
.ct-an__legend i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.ct-an__chart { width: 100%; height: auto; display: block; }
.ct-an__chart .grid-line { stroke: var(--border); stroke-width: 1; }
.ct-an__chart .axis-label { fill: var(--text-faint); font-size: 11px; }
.ct-an__chart .line { fill: none; stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
/* Line draw-in animation */
.ct-an__chart .line.animate { stroke-dasharray: var(--len); stroke-dashoffset: var(--len); animation: ctDraw 1.1s ease forwards; }
@keyframes ctDraw { to { stroke-dashoffset: 0; } }

/* Performance table */
.ct-an__perf-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 4px; flex-wrap: wrap; }
.ct-an__perf-head h4 { margin: 0; font-size: 1rem; }
.ct-an__toggle { display: inline-flex; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.ct-an__toggle button {
  font: inherit; font-size: .86rem; font-weight: 600; padding: 7px 14px; border: 0; cursor: pointer;
  background: #fff; color: var(--text-soft); border-right: 1px solid var(--border);
}
.ct-an__toggle button:last-child { border-right: 0; }
.ct-an__toggle button.is-active { background: var(--accent); color: #fff; }
.ct-an__hint { color: var(--text-faint); font-size: .85rem; margin: 8px 0 14px; }

.ct-an__table { width: 100%; border-collapse: collapse; font-size: .94rem; }
.ct-an__table th, .ct-an__table td { padding: 11px 10px; border-bottom: 1px solid var(--border); }
.ct-an__table thead th { font-size: .78rem; letter-spacing: .04em; text-transform: uppercase; color: var(--text-faint); font-weight: 700; text-align: right; }
.ct-an__col-abbr { display: none; }
.ct-an__table thead th:first-child { text-align: left; }
.ct-an__table td.num { text-align: right; font-variant-numeric: tabular-nums; color: var(--text); }
.ct-an__table tbody tr:last-child td { border-bottom: 0; }
.ct-an__name { display: flex; align-items: center; gap: 12px; }
.ct-an__thumb {
  width: 64px; height: 48px; border-radius: 7px; overflow: hidden; flex: none;
  border: 1px solid var(--border); background: var(--bg-soft-2);
}
.ct-an__thumb .collection-tile-wrapper { width: 100%; height: 100%; }
.ct-an__thumb--swatch { display: grid; place-items: center; color: #fff; font-weight: 700; font-size: .7rem; }
.ct-an__name b { color: var(--ink); font-weight: 600; }
.ct-an__tag {
  font-size: .68rem; font-weight: 700; letter-spacing: .03em; text-transform: uppercase;
  padding: 3px 8px; border-radius: 999px; background: var(--bg-soft-2); color: var(--text-soft);
}
.ct-an__foot { color: var(--text-faint); font-size: .82rem; text-align: center; margin: 16px 0 0; }

@media (max-width: 560px) {
  /* Reclaim the stacked nested padding (.container + .ct-an + .ct-an__panel). */
  .ct-an { padding: 0 12px; }
  .ct-an__panel { padding: 18px; gap: 18px; }
  /* Shrink the perf table so all 4 columns fit without page overflow. */
  .ct-an__table { font-size: .82rem; }
  .ct-an__table th, .ct-an__table td { padding: 8px 5px; }
  .ct-an__table thead th { letter-spacing: 0; }
  .ct-an__thumb { width: 40px; height: 32px; }
  .ct-an__name { gap: 8px; }
  .ct-an__tag { display: none; }            /* COUNTDOWN/WIDE badges drop on mobile to save width */
  .ct-an__col-full { display: none; }
  .ct-an__col-abbr { display: inline; }
}
@media (max-width: 400px) {
  .ct-an__thumb { display: none; }           /* drop the thumbnail entirely on very small screens */
  .ct-an__table th, .ct-an__table td { padding: 7px 4px; }
}

@media (prefers-reduced-motion: reduce) {
  .ct-an__chart .line.animate { animation: none; stroke-dashoffset: 0; }
}
