/**
 * Market Pulse Styles — FR-017.1 / FR-017.1A
 *
 * Simple, clean, readable metric cards.
 * Layout:
 *   Desktop:  □ □ □ □ □  (single row flex)
 *   Tablet:   □ □ □  /  □ □  (2 rows)
 *   Mobile:   □ □  /  □ □  /  ██████  (card 5 full-width)
 *
 * Features:
 *   - LIVE indicator with CSS-only soft glow
 *   - Counter animation (700ms ease-out)
 *   - Status colors for trend direction
 *   - Confidence badge
 *
 * @package XOS\Presentation\Styles
 * @version 2.0.0
 * @since   FR-017.1A
 */

/* ===========================================================
     MARKET PULSE SECTION
   =========================================================== */

.ep12-market-pulse {
  padding: 4px 0 8px;
}

.ep12-market-pulse .mp-container {
  width: 100%;
  max-width: 1024px;
  margin: 0 auto;
  padding: 0 8px;
}

/* ===========================================================
     HEADER ROW
   =========================================================== */

.mp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.mp-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: #1F2937;
}

.mp-header-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.6875rem;
  color: #6B7280;
}

/* ── LIVE Indicator ─────────────────────────────── */

.mp-live-indicator {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 600;
  font-size: 0.625rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #9CA3AF;
  transition: color 200ms ease;
}

.mp-live-indicator--active {
  color: #10B981;
}

.mp-live-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  transition: box-shadow 200ms ease;
}

.mp-live-indicator--active .mp-live-dot {
  box-shadow: 0 0 4px rgba(16, 185, 129, 0.5);
  animation: mp-pulse-glow 2s ease-in-out infinite;
}

@keyframes mp-pulse-glow {
  0%, 100% {
    box-shadow: 0 0 4px rgba(16, 185, 129, 0.3);
  }
  50% {
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.6);
  }
}

/* ── Confidence badge ───────────────────────────── */

.mp-confidence {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 4px;
  background: #E7EEF7;
  color: #64748B;
  font-weight: 500;
  font-size: 0.625rem;
  line-height: 1.4;
}

/* ── Last update ────────────────────────────────── */

.mp-last-update {
  color: #9CA3AF;
  font-size: 0.625rem;
}

/* ===========================================================
     GRID: 5-column desktop flex
   =========================================================== */

.mp-grid {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.mp-grid::-webkit-scrollbar {
  display: none;
}

/* ===========================================================
     INDIVIDUAL CARD
   =========================================================== */

.mp-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 3px;
  flex: 1 1 0;
  min-width: 0;
  padding: 12px 8px;
  background: #FFFFFF;
  border-radius: 14px;
  border: 1px solid #E7EEF7;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.03);
  text-align: left;
  transition: box-shadow 150ms ease, transform 150ms ease;
}

.mp-card:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
  transform: translateY(-1px);
}

/* Featured card (card 5 — market trend) */
.mp-card--featured {
  background: linear-gradient(135deg, #FFFFFF 0%, #F3F6FA 100%);
  border-color: #D4DFEC;
}

/* ── Card Top Row: Icon + Trend ─────────────────── */

.mp-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  margin-bottom: 1px;
}

.mp-card-icon {
  font-size: 1.125rem;
  line-height: 1;
}

.mp-card-trend {
  font-size: 0.625rem;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
}

.mp-card-trend--up {
  color: #10B981;
}

.mp-card-trend--down {
  color: #EF4444;
}

.mp-card-trend--neutral {
  color: #6B7280;
}

/* ── Big Number ─────────────────────────────────── */

.mp-card-value {
  display: block;
  font-size: 1.375rem;
  font-weight: 800;
  color: #1F2937;
  line-height: 1.15;
  letter-spacing: -0.01em;
  /* Counter animation via JS will update content */
}

/* ── Vietnamese Label ───────────────────────────── */

.mp-card-label {
  font-size: 0.625rem;
  font-weight: 500;
  color: #64748B;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

/* ===========================================================
     MOBILE: < 640px
     2-column grid, card 5 full-width
   =========================================================== */

@media (max-width: 640px) {
  .mp-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    overflow-x: visible;
  }

  .mp-card {
    flex: none;
    width: auto;
    padding: 12px 8px;
  }

  /* Card 5 (market trend) full-width */
  .mp-card:nth-child(5) {
    grid-column: 1 / -1;
  }

  .mp-card-value {
    font-size: 1.25rem;
  }

  .mp-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }
}

/* ===========================================================
     TABLET: 641px — 768px
     3+2 grid (cards 1-3 row 1, 4-5 row 2)
   =========================================================== */

@media (min-width: 641px) and (max-width: 768px) {
  .mp-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    overflow-x: visible;
  }

  .mp-card {
    flex: none;
    width: auto;
  }

  /* Cards 4,5 span 1.5 cols each to fill row 2 */
  .mp-card:nth-child(4) {
    grid-column: 1 / 3;
  }

  .mp-card:nth-child(5) {
    grid-column: 3 / 4;
  }

  .mp-card-value {
    font-size: 1.25rem;
  }
}

/* ===========================================================
     SMALL DESKTOP: 769px — 1024px
     Keep 5-column but tighter padding
   =========================================================== */

@media (min-width: 769px) and (max-width: 1024px) {
  .mp-card {
    padding: 10px 6px;
  }

  .mp-card-value {
    font-size: 1.25rem;
  }
}

/* ===========================================================
     COUNTER ANIMATION (via JS class, CSS as trigger)
   =========================================================== */

.mp-card-value.mp-counter-animate {
  animation: mp-count-up 700ms ease-out both;
}

@keyframes mp-count-up {
  0% {
    opacity: 0.6;
    transform: translateY(4px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}