/**
 * 8X Market Comparison Table — Blog Embed v2
 * Hosted on R2: ld/market-comparison.css
 *
 * Blueprint-inspired data tables with 8X brand accents.
 * Designed for the buyer's/seller's market blog post.
 */

/* ── Scope reset ── */
.mc-card, .mc-card * { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Card container ── */
.mc-card {
  font-family: Inter, system-ui, -apple-system, sans-serif;
  background: #fff;
  border: 1px solid #e2e4e9;
  border-radius: 10px;
  overflow: hidden;
  margin: 24px 0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 4px 12px rgba(0,0,0,0.02);
}

/* ── Card header bar ── */
.mc-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: #111827;
  color: #fff;
  gap: 12px;
}
.mc-card-title {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  display: flex;
  align-items: center;
  gap: 8px;
}
.mc-card-title::before {
  content: '';
  display: inline-block;
  width: 3px;
  height: 14px;
  background: #c8102e;
  border-radius: 2px;
  flex-shrink: 0;
}
.mc-header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}
.mc-search {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 6px;
  padding: 5px 10px;
  font-size: 12px;
  color: #fff;
  font-family: Inter, system-ui, sans-serif;
  width: 150px;
  outline: none;
  transition: background 0.15s, border-color 0.15s, width 0.2s;
}
.mc-search::placeholder { color: rgba(255,255,255,0.35); }
.mc-search:focus {
  background: rgba(255,255,255,0.15);
  border-color: rgba(255,255,255,0.3);
  width: 180px;
}
.mc-live-dot {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  font-weight: 500;
  color: rgba(255,255,255,0.5);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  flex-shrink: 0;
}
.mc-live-dot::before {
  content: '';
  width: 6px;
  height: 6px;
  background: #22c55e;
  border-radius: 50%;
  box-shadow: 0 0 6px rgba(34,197,94,0.5);
  animation: mc-pulse 2s ease-in-out infinite;
}
@keyframes mc-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ── Scroll wrapper ── */
.mc-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* ── Table ── */
.mc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
}

/* ── Header row ── */
.mc-table thead th {
  text-align: left;
  padding: 10px 14px;
  font-weight: 600;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #9ca3af;
  background: #f8f9fb;
  border-bottom: 1px solid #e5e7eb;
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 2;
}
.mc-table thead th.mc-r { text-align: right; }
.mc-table thead th:first-child { padding-left: 18px; }
.mc-table thead th:last-child { padding-right: 18px; }

/* ── Body cells ── */
.mc-table tbody td {
  padding: 10px 14px;
  border-bottom: 1px solid #f3f4f6;
  color: #374151;
  vertical-align: middle;
}
.mc-table tbody td:first-child { padding-left: 18px; }
.mc-table tbody td:last-child { padding-right: 18px; }
.mc-table tbody td.mc-r { text-align: right; }

/* ── Row interactions ── */
.mc-table tbody tr:hover td { background: #fafbfc; }
.mc-table tbody tr { transition: background 0.1s ease; }

/* ── Alternating row tint ── */
.mc-table tbody tr.mc-even td { background: #fcfcfd; }
.mc-table tbody tr.mc-even:hover td { background: #f5f6f8; }

/* ── Area name link ── */
.mc-area {
  color: #111827;
  text-decoration: none;
  font-weight: 500;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: color 0.15s;
}
.mc-area:hover { color: #c8102e; }
.mc-area::after {
  content: '\2192';
  font-size: 11px;
  opacity: 0;
  transform: translateX(-3px);
  transition: opacity 0.15s, transform 0.15s;
  color: #c8102e;
}
.mc-table tbody tr:hover .mc-area::after {
  opacity: 1;
  transform: translateX(0);
}

/* ── Market type badges ── */
.mc-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
  line-height: 1.4;
}
.mc-badge-seller {
  background: #c8102e;
  color: #fff;
}
.mc-badge-balanced {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
}
.mc-badge-buyer {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}

/* ── MOI cell ── */
.mc-moi {
  font-weight: 700;
  font-size: 13px;
  white-space: nowrap;
}
.mc-moi-seller { color: #c8102e; }
.mc-moi-balanced { color: #d97706; }
.mc-moi-buyer { color: #2563eb; }

/* ── YOY change ── */
.mc-up, .mc-down, .mc-flat { white-space: nowrap; }
.mc-up { color: #16a34a; font-weight: 600; }
.mc-down { color: #dc2626; font-weight: 600; }
.mc-flat { color: #9ca3af; }

/* ── Dim secondary numbers ── */
.mc-dim { color: #9ca3af; }

/* ── Municipality group headers ── */
.mc-group td {
  font-weight: 700;
  font-size: 11px;
  color: #111827;
  background: #f1f3f7 !important;
  padding: 12px 14px 8px 18px !important;
  border-bottom: 1px solid #dde0e6;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  position: relative;
}
.mc-group td::before {
  content: '';
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 3px;
  background: #c8102e;
  border-radius: 0 2px 2px 0;
}

/* ── Loading state ── */
.mc-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 48px 20px;
  color: #9ca3af;
  font-size: 13px;
  font-family: Inter, system-ui, sans-serif;
}
.mc-spin {
  width: 18px;
  height: 18px;
  border: 2px solid #e5e7eb;
  border-top-color: #c8102e;
  border-radius: 50%;
  animation: mc-rotate 0.6s linear infinite;
}
@keyframes mc-rotate { to { transform: rotate(360deg); } }

/* ── Card footer ── */
.mc-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 18px;
  background: #f8f9fb;
  border-top: 1px solid #e5e7eb;
  font-size: 11px;
  color: #9ca3af;
  gap: 8px;
  flex-wrap: wrap;
}
.mc-legend {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.mc-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.mc-legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.mc-legend-dot.mc-ld-s { background: #c8102e; }
.mc-legend-dot.mc-ld-b { background: #f59e0b; border: 1px solid #d97706; }
.mc-legend-dot.mc-ld-y { background: #2563eb; }
.mc-count {
  color: #b0b5bf;
  font-size: 10px;
  letter-spacing: 0.02em;
}

/* ── Responsive ── */
@media (max-width: 767px) {
  .mc-card { border-radius: 8px; margin: 16px 0; }
  .mc-card-header { padding: 12px 14px; }
  .mc-card-title { font-size: 12px; }
  .mc-search { width: 110px; font-size: 11px; padding: 4px 8px; }
  .mc-search:focus { width: 130px; }
  .mc-table { font-size: 12px; min-width: 680px; }
  .mc-table thead th { padding: 8px 10px; font-size: 9px; }
  .mc-table tbody td { padding: 8px 10px; }
  .mc-table thead th:first-child,
  .mc-table tbody td:first-child { padding-left: 14px; }
  .mc-table thead th:last-child,
  .mc-table tbody td:last-child { padding-right: 14px; }
  .mc-area { font-size: 12px; }
  .mc-badge { font-size: 9px; padding: 2px 7px; }
  .mc-card-footer { padding: 8px 14px; font-size: 10px; }
  .mc-group td { padding: 10px 10px 6px 14px !important; }
  .mc-group td::before { top: 4px; bottom: 4px; }
}
