/* Market tab indicator cards and market tables. */
/* Market Tab */
.chart-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.chart-title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
}

.chart-subtitle {
  margin: 4px 0 0;
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: justify;
  text-align-last: left;
  text-justify: inter-word;
}

.chart-header {
  margin-bottom: 20px;
}

.market-indicator-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 24px;
}

.market-indicator-card {
  min-width: 0;
}

.indicator-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: -6px 0 14px;
}

.indicator-summary span {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-muted);
  font-size: 0.74rem;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.03);
}

.indicator-summary strong {
  color: var(--text);
  margin-right: 4px;
}

.market-table-wrap {
  overflow-x: auto;
}

.market-indicator-table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
}

.market-indicator-table th,
.market-indicator-table td {
  padding: 11px 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
  font-size: 0.82rem;
}

.market-indicator-table th {
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.market-indicator-table td strong {
  color: var(--text);
  font-weight: 800;
}

.market-indicator-table td small {
  display: block;
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 700;
}

.indicator-meter {
  width: 92px;
  height: 7px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(148, 163, 184, 0.22);
  margin-bottom: 5px;
}

.indicator-meter span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: #10b981;
}

.indicator-meter span.level-watch {
  background: #f59e0b;
}

.indicator-meter span.level-warning {
  background: #f97316;
}

.indicator-meter span.level-danger {
  background: #ef4444;
}

.indicator-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 850;
  white-space: nowrap;
  border: 1px solid rgba(16, 185, 129, 0.25);
  color: #10b981;
  background: rgba(16, 185, 129, 0.1);
}

.indicator-badge.level-watch {
  border-color: rgba(245, 158, 11, 0.32);
  color: #f59e0b;
  background: rgba(245, 158, 11, 0.12);
}

.indicator-badge.level-warning {
  border-color: rgba(249, 115, 22, 0.34);
  color: #f97316;
  background: rgba(249, 115, 22, 0.12);
}

.indicator-badge.level-danger {
  border-color: rgba(239, 68, 68, 0.35);
  color: #ef4444;
  background: rgba(239, 68, 68, 0.12);
}

.indicator-action {
  color: var(--text-muted);
  line-height: 1.45;
  max-width: 240px;
  text-align: justify;
  text-align-last: left;
  text-justify: inter-word;
}

.indicator-up {
  color: #ef4444;
}

.indicator-flat {
  color: var(--text-muted);
}

.indicator-empty-row {
  padding: 24px 12px !important;
  text-align: center !important;
  color: var(--text-muted);
}

.opportunity-card .chart-header {
  margin-bottom: 14px;
}

.opportunity-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 14px;
}

.opportunity-summary span {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-muted);
  font-size: 0.74rem;
  font-weight: 750;
  background: rgba(16, 185, 129, 0.07);
}

.opportunity-summary strong {
  color: var(--text);
  margin: 0 4px;
}

.opportunity-list-wrap {
  min-height: 260px;
}

.opportunity-list {
  display: grid;
  gap: 10px;
}

.opportunity-row {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
}

.opportunity-rank {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  color: #047857;
  background: rgba(16, 185, 129, 0.15);
  font-weight: 900;
}

.opportunity-main {
  min-width: 0;
}

.opportunity-top {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.opportunity-top h4 {
  margin: 0;
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 850;
}

.opportunity-top span {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  color: #047857;
  background: rgba(16, 185, 129, 0.12);
  font-size: 0.7rem;
  font-weight: 850;
  white-space: nowrap;
}

.opportunity-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.opportunity-metrics div {
  min-width: 0;
}

.opportunity-metrics strong,
.opportunity-metrics span {
  display: block;
}

.opportunity-metrics strong {
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 900;
}

.opportunity-metrics span {
  margin-top: 2px;
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 750;
}

.opportunity-row p {
  margin: 9px 0 0;
  color: var(--text-muted);
  font-size: 0.74rem;
  line-height: 1.45;
  text-align: justify;
  text-align-last: left;
  text-justify: inter-word;
}

.opportunity-btn {
  border: none;
  border-radius: 10px;
  padding: 9px 12px;
  background: var(--primary);
  color: white;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 850;
  cursor: pointer;
  white-space: nowrap;
}

.opportunity-btn:hover {
  filter: brightness(1.05);
}

.opportunity-empty {
  min-height: 220px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-align: center;
  color: var(--text-muted);
  border: 1px dashed var(--border);
  border-radius: 12px;
}

.opportunity-empty strong {
  color: var(--text);
}

@media (max-width: 720px) {
  .opportunity-row {
    grid-template-columns: 32px minmax(0, 1fr);
  }

  .opportunity-btn {
    grid-column: 2;
    width: fit-content;
  }

  .opportunity-metrics {
    grid-template-columns: 1fr;
  }
}

.period-pills {
  display: flex;
  background: rgba(255, 255, 255, 0.05);
  padding: 4px;
  border-radius: 10px;
  gap: 2px;
}

.p-pill {
  border: none;
  background: none;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 7px;
  cursor: pointer;
  transition: 0.2s;
  font-family: 'Plus Jakarta Sans', sans-serif;
}

.p-pill:hover {
  color: var(--text);
}

.p-pill.active {
  color: var(--primary);
  background: var(--surface-solid);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.chart-body {
  position: relative;
}

.chart-body.loading::after {
  content: "⌛ Đang tải...";
  position: absolute;
  inset: 0;
  background: rgba(18, 18, 18, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  border-radius: 8px;
  font-weight: 600;
  color: var(--primary);
}
