/* =========================================================================
   AXION TERMINAL: PREDICTIVE RECESSION MATRIX MOTION LAB
   ========================================================================= */

.matrix-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
  padding: 16px;
  background: var(--bg);
  container-type: inline-size;
  container-name: matrix;
}

.matrix-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  flex: 1;
  min-height: 0;
}

/* Fluid Typography & Layout via Container Queries */
@container matrix (max-width: 900px) {
  .matrix-grid {
    grid-template-columns: 1fr;
  }
  .matrix-card-title {
    font-size: 14px !important;
  }
}

@container matrix (max-width: 600px) {
  .matrix-card-title {
    font-size: 13px !important;
  }
  .matrix-card-subtitle {
    font-size: 9px !important;
  }
}

/* =========================================================================
   HOVER PHYSICS & BORDERS
   ========================================================================= */

.matrix-card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0;
  position: relative;
  overflow: hidden;
  transition: border-color 0.4s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.matrix-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  border: 1px solid transparent;
  pointer-events: none;
  z-index: 5;
  transition: border-color 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.matrix-card:hover {
  border-color: #C6E310;
  box-shadow: 0 0 15px rgba(198, 227, 16, 0.1);
  z-index: 10;
}

.matrix-card:hover::before {
  border-color: rgba(198, 227, 16, 0.2);
}

/* Active Hover Ring (Pulse) */
@keyframes matrix-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(198, 227, 16, 0.2); }
  70%  { box-shadow: 0 0 0 6px rgba(198, 227, 16, 0); }
  100% { box-shadow: 0 0 0 0 rgba(198, 227, 16, 0); }
}

.matrix-card:hover {
  animation: matrix-pulse 2s infinite;
}

/* =========================================================================
   HEADER TYPOGRAPHY
   ========================================================================= */

.matrix-card-header {
  padding: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  z-index: 2;
}

.matrix-card-title {
  font-family: var(--sans);
  font-weight: 600;
  font-size: 15px;
  color: var(--t1);
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.matrix-card-subtitle {
  font-family: var(--mono);
  font-weight: 400;
  font-size: 10px;
  color: var(--t3);
  margin-top: 4px;
}

.matrix-tag-live {
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 700;
  color: #C6E310;
  background: rgba(198, 227, 16, 0.1);
  border: 1px solid rgba(198, 227, 16, 0.2);
  padding: 2px 6px;
  border-radius: 0;
  display: inline-block;
  margin-left: 8px;
  vertical-align: middle;
}

/* =========================================================================
   21ST.DEV INSPIRED SKELETON LOADER
   Fluid shimmer transitioning from #1A1A1A to #262626
   ========================================================================= */

.matrix-skeleton {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(90deg, #1A1A1A 0%, #262626 50%, #1A1A1A 100%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite ease-in-out;
  z-index: 10;
  pointer-events: none;
  opacity: 1;
  transition: opacity 0.5s ease-out;
}

.matrix-skeleton.hydrated {
  opacity: 0;
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* Hide TradingView Watermark to maintain premium aesthetic */
.tv-lightweight-charts-watermark {
  display: none !important;
}

.matrix-chart-area {
  flex: 1;
  min-height: 200px;
  position: relative;
  z-index: 1;
  cursor: crosshair;
}

.matrix-latest-value {
  position: absolute;
  top: 16px;
  right: 16px;
  text-align: right;
  z-index: 2;
  pointer-events: none;
}

.matrix-latest-val {
  font-family: var(--mono);
  font-size: 22px;
  font-weight: 700;
  color: var(--t1);
}

.matrix-latest-desc {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--t3);
  margin-top: 2px;
}

/* Conditional Blood Red Colors */
.matrix-blood-red {
  color: #FF004D !important;
  text-shadow: 0 0 10px rgba(255, 0, 77, 0.4);
}
