/* ============================================
   MARKET STATUS PAGE — Page-specific styles
   Requires home.css loaded first for CSS vars,
   nav, footer, reveal, and button styles.
   ============================================ */

/* Hero (compact) */
.ms-hero {
  padding: 140px 0 60px;
  position: relative;
}

.ms-hero-inner {
  max-width: 680px;
}

.ms-hero .section-body {
  max-width: 580px;
}

.ms-hero + .section {
  padding: 0;
}

.ms-smc-link {
  color: var(--blue-light);
  text-decoration: underline;
  text-decoration-color: rgba(96, 165, 250, 0.3);
  text-underline-offset: 3px;
  transition: text-decoration-color var(--transition);
}

.ms-smc-link:hover {
  text-decoration-color: var(--blue-light);
}

/* ============================================
   CONTROLS
   ============================================ */
.mkt-controls {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 24px;
}

.mkt-controls .mkt-meta {
  margin-left: auto;
}

.mkt-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.mkt-filter {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 20px;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 400;
  color: var(--text-secondary);
  letter-spacing: 0.03em;
  cursor: pointer;
  transition: all var(--transition);
}

.mkt-filter:hover {
  border-color: var(--border-hover);
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.03);
}

.mkt-filter.active {
  background: var(--blue-dim);
  border-color: rgba(96, 165, 250, 0.35);
  color: var(--blue-light);
}

/* Regime toggle buttons */
.mkt-regime-toggles {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.mkt-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 14px;
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 400;
  color: var(--text-muted);
  letter-spacing: 0.03em;
  cursor: pointer;
  transition: all var(--transition);
  opacity: 0.5;
}

.mkt-toggle:hover {
  border-color: var(--border-hover);
  color: var(--text-secondary);
  opacity: 0.8;
}

.mkt-toggle.active {
  opacity: 1;
  color: var(--text-primary);
  border-color: var(--border-hover);
  background: rgba(255, 255, 255, 0.03);
}

.mkt-toggle .mkt-regime-pip {
  width: 6px;
  height: 6px;
}

/* Strength slider */
.mkt-strength-control {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--text-muted);
  letter-spacing: 0.03em;
}

.mkt-strength-control label {
  white-space: nowrap;
}

.mkt-strength-control input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100px;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}

.mkt-strength-control input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--blue-light);
  border: 2px solid rgba(96, 165, 250, 0.4);
  cursor: pointer;
}

.mkt-strength-control input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--blue-light);
  border: 2px solid rgba(96, 165, 250, 0.4);
  cursor: pointer;
}

#mkt-strength-value {
  min-width: 30px;
  text-align: right;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-secondary);
}

/* Live pulse + updated timestamp */
.mkt-meta {
  display: flex;
  align-items: center;
  gap: 10px;
}

.mkt-live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #34d399;
  box-shadow: 0 0 10px rgba(52, 211, 153, 0.6);
  animation: mkt-pulse 2s ease-in-out infinite;
  flex-shrink: 0;
}

.mkt-live-dot.stale {
  background: #fbbf24;
  box-shadow: 0 0 10px rgba(251, 191, 36, 0.6);
}

.mkt-live-dot.offline {
  background: #ef4444;
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.6);
  animation: none;
}

@keyframes mkt-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.6; transform: scale(0.8); }
}

.mkt-updated-label {
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

/* ============================================
   LEGEND
   ============================================ */
.mkt-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  margin-bottom: 40px;
  padding: 14px 20px;
  background: rgba(255, 255, 255, 0.015);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.mkt-legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
  letter-spacing: 0.03em;
}

.mkt-regime-pip {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.mkt-pip--bullish       { background: #34d399; box-shadow: 0 0 6px rgba(52, 211, 153, 0.5); }
.mkt-pip--bearish       { background: #f87171; box-shadow: 0 0 6px rgba(248, 113, 113, 0.5); }
.mkt-pip--ranging       { background: #60a5fa; box-shadow: 0 0 6px rgba(96, 165, 250, 0.5); }
.mkt-pip--transitioning { background: #fbbf24; box-shadow: 0 0 6px rgba(251, 191, 36, 0.5); }
.mkt-pip--contested     { background: #a78bfa; box-shadow: 0 0 6px rgba(167, 139, 250, 0.5); }

/* ============================================
   MATRIX TABLE
   ============================================ */
.mkt-grid {
  margin-bottom: 48px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.mkt-matrix {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  min-width: 700px;
}

/* Header row */
.mkt-matrix-header {
  display: grid;
  background: rgba(255, 255, 255, 0.04);
  border-bottom: 1px solid var(--border);
}

.mkt-pair-head {
  padding: 11px 16px;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  border-right: 1px solid var(--border);
  position: sticky;
  left: 0;
  background: #11141c;
  z-index: 10;
  cursor: pointer;
  user-select: none;
  transition: background var(--transition);
}

.mkt-pair-head:hover {
  background: rgba(255, 255, 255, 0.03);
}

.mkt-tf-head {
  padding: 11px 0;
  text-align: center;
  font-family: var(--font-heading);
  font-size: 12px;
  font-weight: 600;
  color: var(--blue-light);
  letter-spacing: 0.07em;
  border-right: 1px solid var(--border);
  cursor: pointer;
  user-select: none;
  transition: background var(--transition);
}

.mkt-tf-head:hover {
  background: rgba(255, 255, 255, 0.03);
}

.mkt-tf-head:last-child {
  border-right: none;
}

.mkt-sort-arrow {
  opacity: 0;
  display: inline-block;
  margin-left: 4px;
  font-size: 10px;
  transition: all 0.2s ease;
  color: var(--blue-light);
}

/* Body */
.mkt-matrix-body {
  display: flex;
  flex-direction: column;
}

/* Data row */
.mkt-row {
  display: grid;
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
  position: relative;
  cursor: pointer;
}

.mkt-row:last-child {
  border-bottom: none;
}

.mkt-row:hover {
  background: rgba(255, 255, 255, 0.025);
}

.mkt-row.hidden {
  display: none;
}

/* Confluence highlighting */
.mkt-row.confluence-bullish {
  background: linear-gradient(90deg, rgba(16, 185, 129, 0.08) 0%, transparent 60%);
  box-shadow: inset 2px 0 0 rgba(16, 185, 129, 0.8);
}

.mkt-row.confluence-bearish {
  background: linear-gradient(90deg, rgba(239, 68, 68, 0.08) 0%, transparent 60%);
  box-shadow: inset 2px 0 0 rgba(239, 68, 68, 0.8);
}

.mkt-row.confluence-bullish:hover {
  background: linear-gradient(90deg, rgba(16, 185, 129, 0.15) 0%, transparent 80%);
}

.mkt-row.confluence-bearish:hover {
  background: linear-gradient(90deg, rgba(239, 68, 68, 0.15) 0%, transparent 80%);
}

/* Pair label column */
.mkt-pair-col {
  padding: 18px 24px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  justify-content: center;
  border-right: 1px solid var(--border);
  position: sticky;
  left: 0;
  background: var(--bg-card);
  z-index: 5;
}

.mkt-row:hover .mkt-pair-col {
  background: #181b23;
}

.mkt-row.confluence-bullish .mkt-pair-col { background: #131921; }
.mkt-row.confluence-bearish .mkt-pair-col { background: #1c151a; }

.mkt-pair-col .mkt-symbol {
  font-family: var(--font-heading);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text-primary);
}

.mkt-cat-label {
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}

/* Timeframe cell */
.mkt-cell {
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  justify-content: center;
  border-right: 1px solid var(--border);
  position: relative;
}

.mkt-cell:last-child {
  border-right: none;
}

/* Cell background tints */
.mkt-cell--bullish       { background: rgba(16, 185, 129, 0.05); }
.mkt-cell--bearish       { background: rgba(239, 68, 68, 0.05); }
.mkt-cell--ranging       { background: rgba(59, 130, 246, 0.05); }
.mkt-cell--transitioning { background: rgba(245, 158, 11, 0.05); }
.mkt-cell--empty         { background: transparent; }

/* Fade non-trending cells */
.mkt-cell--ranging,
.mkt-cell--empty {
  filter: opacity(0.5);
  transition: filter 0.3s ease;
}

.mkt-cell--ranging:hover,
.mkt-cell--empty:hover {
  filter: opacity(1);
}

/* Cell content */
.mkt-cell-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
}

.mkt-cell-regime {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
}

.mkt-cell-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mkt-cell--bullish .mkt-cell-label       { color: #34d399; }
.mkt-cell--bearish .mkt-cell-label       { color: #f87171; }
.mkt-cell--ranging .mkt-cell-label       { color: var(--blue-light); }
.mkt-cell--transitioning .mkt-cell-label { color: #fbbf24; }
.mkt-cell--empty .mkt-cell-label         { color: var(--text-muted); }

.mkt-cell-pct {
  font-family: var(--font-heading);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-primary);
  opacity: 0.8;
  white-space: nowrap;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
  min-width: 32px;
  text-align: right;
}

/* Strength bar */
.mkt-cell-bar {
  height: 2px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 1px;
  overflow: hidden;
}

.mkt-cell-fill {
  height: 100%;
  border-radius: 1px;
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.mkt-fill--bullish       { background: linear-gradient(90deg, #059669, #34d399); }
.mkt-fill--bearish       { background: linear-gradient(90deg, #dc2626, #f87171); }
.mkt-fill--ranging       { background: linear-gradient(90deg, var(--blue), var(--blue-light)); }
.mkt-fill--transitioning { background: linear-gradient(90deg, #d97706, #fbbf24); }
.mkt-fill--empty         { background: rgba(200, 215, 255, 0.15); }

/* ============================================
   DETAIL PANEL (Accordion per pair)
   ============================================ */
.mkt-detail {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.015);
}

.mkt-detail.open {
  border-bottom: 1px solid var(--border-hover);
}

.mkt-detail-inner {
  padding: 24px 32px;
  display: flex;
  flex-wrap: wrap;
  gap: 24px 48px;
}

.mkt-detail-grid {
  gap: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

.mkt-detail-tf {
  padding: 16px 20px;
  border-right: 1px solid var(--border);
}

.mkt-detail-tf:last-child {
  border-right: none;
}

.mkt-detail-tf-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.mkt-detail-tf-name {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--text-primary);
}

.mkt-detail-tf-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.mkt-detail-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.mkt-detail-label {
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}

.mkt-detail-value {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
}

.mkt-detail-value.contested {
  color: #a78bfa;
}

.mkt-detail-value.stable {
  color: #34d399;
}

.mkt-detail-value.shifting {
  color: #fbbf24;
}

.mkt-detail-value.aligned {
  color: #34d399;
}

.mkt-detail-value.diverging {
  color: #f87171;
}

/* Expand indicator on pair col */
.mkt-expand-icon {
  display: inline-block;
  width: 16px;
  height: 16px;
  position: relative;
  opacity: 0.4;
  flex-shrink: 0;
  transition: opacity var(--transition), transform var(--transition);
}

.mkt-expand-icon::before,
.mkt-expand-icon::after {
  content: '';
  position: absolute;
  background: var(--text-primary);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.mkt-expand-icon::before { width: 10px; height: 1.5px; }
.mkt-expand-icon::after  { height: 10px; width: 1.5px; transition: opacity var(--transition), transform var(--transition); }

.mkt-row:hover .mkt-expand-icon { opacity: 1; }

.mkt-row.expanded .mkt-expand-icon::after {
  transform: translate(-50%, -50%) rotate(90deg);
  opacity: 0;
}

.mkt-row.expanded .mkt-expand-icon::before {
  background: var(--blue-light);
}

/* ============================================
   EMPTY & ERROR STATES
   ============================================ */
.mkt-empty,
.mkt-error {
  text-align: center;
  padding: 80px 0;
  color: var(--text-secondary);
  font-size: 15px;
  line-height: 1.7;
}

.mkt-empty-title,
.mkt-error-title {
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 12px;
}

/* ============================================
   SKELETON LOADER
   ============================================ */
.mkt-skeleton-matrix {
  border: none;
}

.skeleton-row {
  animation: skeleton-pulse 1.8s infinite ease-in-out;
}

@keyframes skeleton-pulse {
  0%   { opacity: 0.4; }
  50%  { opacity: 0.8; }
  100% { opacity: 0.4; }
}

.skel-text {
  height: 12px;
  background: var(--blue-dim);
  border-radius: 4px;
  margin-bottom: 6px;
}

.skel-text.short { width: 50%; height: 14px; }
.skel-text.tiny  { width: 30%; height: 10px; margin-bottom: 0; }

.skel-block {
  width: 100%;
  height: 24px;
  background: rgba(200, 215, 255, 0.05);
  border-radius: 4px;
}

/* ============================================
   FOOTER NOTE
   ============================================ */
.mkt-footer {
  max-width: 680px;
  margin: 0 auto;
  text-align: center;
  padding-top: 8px;
}

.mkt-footer p {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.8;
  font-style: italic;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
  .ms-hero {
    padding: 120px 0 40px;
  }

  .mkt-grid {
    -webkit-overflow-scrolling: touch;
  }

  .mkt-detail-inner {
    padding: 20px 24px;
    gap: 16px 32px;
  }

  .mkt-detail-grid {
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0;
  }

  .mkt-detail-tf {
    padding: 12px 14px;
  }
}

@media (max-width: 480px) {
  .ms-hero {
    padding: 100px 0 32px;
  }

  .mkt-controls {
    flex-direction: column;
    align-items: flex-start;
  }
}
