/*
 * Market Indicator Widget CSS
 *
 * This stylesheet implements a modern card-based layout inspired by eletric.net. It provides
 * styles for indicator rows, status pills, optional bars, and an animated gauge. Colours are
 * defined with CSS variables for easy customization.
 */

/* Base card */
.miw-card {
  /* Colour palette */
  --bg: #ffffff;
  --bd: rgba(0, 0, 0, 0.08);
  --text: #111827;
  --muted: rgba(17, 24, 39, 0.65);
  --green: #16a34a;
  --yellow: #f59e0b;
  --red: #ef4444;
  --pillText: #0b1220;

  background: var(--bg);
  border: 1px solid var(--bd);
  border-radius: 16px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.06);
  padding: 18px;
  max-width: 1100px;
  margin: 18px auto;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color: var(--text);
}

/* Header */
.miw-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.miw-title {
  margin: 0;
  font-size: 22px;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.miw-visit {
  display: inline-block;
  margin-top: 6px;
  color: #2563eb;
  text-decoration: none;
  font-weight: 600;
  font-size: 13px;
}
.miw-visit:hover {
  text-decoration: underline;
}

/* Layout grid: left list, right gauge */
.miw-grid {
  display: grid;
  grid-template-columns: 1.35fr 0.65fr;
  gap: 16px;
}
@media (max-width: 880px) {
  .miw-grid {
    grid-template-columns: 1fr;
  }
}

/* Indicator list container */
.miw-list {
  display: grid;
  gap: 10px;
}

/* Individual indicator card */
.miw-item {
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 14px;
  padding: 12px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 1), rgba(249, 250, 251, 1));
}

/* Row layout inside indicator card */
.miw-item-row {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
}

.miw-item-label {
  font-size: 14px;
  font-weight: 650;
  line-height: 1.25;
  padding-right: 8px;
}

.miw-item-right {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.miw-item-value {
  font-variant-numeric: tabular-nums;
  font-size: 14px;
  font-weight: 800;
  min-width: 44px;
  text-align: right;
  color: rgba(17, 24, 39, 0.9);
}

/* Status pill base */
.miw-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: #fff;
  color: var(--pillText);
}

/* Status pill colours */
.miw-pill-green {
  background: rgba(22, 163, 74, 0.12);
  border-color: rgba(22, 163, 74, 0.22);
  color: #0b3b1b;
}
.miw-pill-yellow {
  background: rgba(245, 158, 11, 0.14);
  border-color: rgba(245, 158, 11, 0.26);
  color: #4a2b00;
}
.miw-pill-red {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.24);
  color: #4a0b0b;
}

/* Optional bars: shown only when show_bars="1" */
.miw-bar {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  margin-top: 10px;
}

.miw-bar-track {
  height: 10px;
  background: rgba(17, 24, 39, 0.08);
  border-radius: 999px;
  overflow: hidden;
}

.miw-bar-fill {
  height: 100%;
  border-radius: 999px;
}

.miw-bar-max {
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* Overall gauge container */
.miw-overall {
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 14px;
  padding: 12px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 1), rgba(249, 250, 251, 1));
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.miw-overall-title {
  font-size: 14px;
  font-weight: 800;
  color: rgba(17, 24, 39, 0.85);
}

/* Gauge styling */
.miw-gauge {
  position: relative;
  height: 150px;
  border-radius: 14px;
  background: rgba(17, 24, 39, 0.02);
  border: 1px solid rgba(0, 0, 0, 0.05);
  padding: 10px;
  overflow: hidden;
}

.miw-gauge-svg {
  width: 100%;
  height: 100%;
}

.miw-gauge-bg {
  fill: none;
  stroke: rgba(17, 24, 39, 0.12);
  stroke-width: 14;
  stroke-linecap: round;
}

.miw-gauge-val {
  fill: none;
  stroke-width: 14;
  stroke-linecap: round;
  stroke: rgba(22, 163, 74, 0.9);
  stroke-dasharray: 260;
  stroke-dashoffset: 260;
  transition: stroke-dashoffset 0.6s ease, stroke 0.3s ease;
}

.miw-gauge-needle {
  position: absolute;
  width: 2px;
  height: 62px;
  left: 50%;
  top: 60%;
  transform-origin: bottom center;
  transform: translateX(-50%) rotate(-90deg);
  background: rgba(17, 24, 39, 0.9);
  border-radius: 2px;
  transition: transform 0.6s ease;
}

.miw-gauge-center {
  position: absolute;
  width: 12px;
  height: 12px;
  left: 50%;
  top: 60%;
  transform: translate(-50%, -50%);
  border-radius: 999px;
  background: rgba(17, 24, 39, 0.9);
}

.miw-ticks {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 10px;
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: rgba(17, 24, 39, 0.65);
  font-variant-numeric: tabular-nums;
}

/* Score display */
.miw-score {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.miw-score-num {
  font-size: 28px;
  font-weight: 900;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

/* Gauge accent colours based on overall status */
.miw-green .miw-gauge {
  outline: 2px solid rgba(22, 163, 74, 0.10);
}
.miw-yellow .miw-gauge {
  outline: 2px solid rgba(245, 158, 11, 0.12);
}
.miw-red .miw-gauge {
  outline: 2px solid rgba(239, 68, 68, 0.10);
}