/* ═══ POLYSTATS — Analysis Page (Orange Theme) ═══ */

:root {
  --orange:       #ff8c00;
  --orange-dim:   #cc6e00;
  --orange-glow:  rgba(255,140,0,0.18);
  --orange-light: #ffb347;
  --orange-dark:  #7a3e00;
}

/* ── Layout ── */
.az-wrap {
  display: flex;
  flex-direction: column;
  gap: 16px;
  animation: fadeIn 0.3s ease;
}

/* ── Tabs ── */
.az-tabs {
  display: flex;
  gap: 6px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0;
  flex-wrap: wrap;
}
.az-tab {
  padding: 8px 18px;
  background: transparent;
  border: 1px solid transparent;
  border-bottom: none;
  border-radius: 6px 6px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  cursor: pointer;
  letter-spacing: 0.03em;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
  position: relative;
  bottom: -1px;
}
.az-tab:hover { color: var(--orange-light); }
.az-tab.active {
  color: var(--orange);
  border-color: var(--orange-dim);
  background: var(--panel);
  border-bottom-color: var(--panel);
  box-shadow: 0 -2px 8px var(--orange-glow);
}

/* ── Summary Cards ── */
.az-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 12px;
}
.az-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 18px;
  position: relative;
  overflow: hidden;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.az-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--orange-dim), var(--orange), var(--orange-light));
}
.az-card:hover {
  border-color: var(--orange-dim);
  box-shadow: 0 0 16px var(--orange-glow);
}
.az-card-label {
  font-size: 0.72rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
  font-family: 'JetBrains Mono', monospace;
}
.az-card-value {
  font-size: 1.55rem;
  font-weight: 700;
  color: var(--orange);
  font-family: 'JetBrains Mono', monospace;
  line-height: 1;
}
.az-card-sub {
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 6px;
}
.az-card-value.green { color: var(--green); }
.az-card-value.red   { color: var(--red); }
.az-card-value.cyan  { color: var(--cyan); }

/* ── Section header ── */
.az-section-title {
  font-size: 0.75rem;
  font-family: 'JetBrains Mono', monospace;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--orange);
  padding: 4px 0 8px;
  border-bottom: 1px solid var(--orange-dark);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.az-section-title::before {
  content: '';
  display: inline-block;
  width: 3px;
  height: 14px;
  background: var(--orange);
  border-radius: 2px;
  box-shadow: 0 0 8px var(--orange-glow);
}

/* ── Tables ── */
.az-table-wrap {
  overflow-x: auto;
  border-radius: 8px;
  border: 1px solid var(--border);
}
.az-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  font-family: 'JetBrains Mono', monospace;
}
.az-table thead th {
  background: var(--panel2);
  color: var(--orange);
  padding: 10px 14px;
  text-align: left;
  font-weight: 600;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--orange-dark);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  transition: color 0.15s;
}
.az-table thead th:hover { color: var(--orange-light); }
.az-table thead th.sort-active { color: var(--orange-light); }
.az-table thead th .sort-arrow { opacity: 0.5; font-size: 0.7em; }
.az-table thead th.sort-active .sort-arrow { opacity: 1; }

.az-table tbody tr {
  border-bottom: 1px solid rgba(26,58,74,0.5);
  transition: background 0.1s;
}
.az-table tbody tr:hover { background: var(--orange-glow); }
.az-table tbody tr:last-child { border-bottom: none; }
.az-table tbody td {
  padding: 9px 14px;
  color: var(--text);
  vertical-align: middle;
}
.az-table .td-muted  { color: var(--muted); font-size: 0.75rem; }
.az-table .td-orange { color: var(--orange); font-weight: 600; }
.az-table .td-green  { color: var(--green); }
.az-table .td-red    { color: var(--red); }
.az-table .td-cyan   { color: var(--cyan); }

/* ── Win rate bar ── */
.az-bar-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 140px;
}
.az-bar {
  flex: 1;
  height: 6px;
  background: var(--panel2);
  border-radius: 3px;
  overflow: hidden;
}
.az-bar-fill {
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--orange-dim), var(--orange));
  transition: width 0.4s ease;
}
.az-bar-fill.green { background: linear-gradient(90deg, var(--green-dim), var(--green)); }
.az-bar-label { font-size: 0.78rem; color: var(--orange); min-width: 38px; text-align: right; font-weight: 600; }

/* ── Filters ── */
.az-filters {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: flex-end;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 16px;
}
.az-filter-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.az-filter-label {
  font-size: 0.68rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-family: 'JetBrains Mono', monospace;
}
.az-filter-input,
.az-filter-select {
  background: var(--panel2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 5px;
  padding: 6px 10px;
  font-size: 0.8rem;
  font-family: 'JetBrains Mono', monospace;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.az-filter-input { width: 160px; }
.az-filter-input:focus,
.az-filter-select:focus {
  border-color: var(--orange-dim);
  box-shadow: 0 0 0 2px var(--orange-glow);
}
.az-filter-select option { background: var(--panel); }

/* ── Pagination ── */
.az-pagination {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
  padding-top: 8px;
}
.az-page-btn {
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 5px 12px;
  border-radius: 5px;
  font-size: 0.8rem;
  font-family: 'JetBrains Mono', monospace;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.az-page-btn:hover:not(:disabled) { border-color: var(--orange-dim); color: var(--orange); }
.az-page-btn:disabled { opacity: 0.35; cursor: default; }
.az-page-info { font-size: 0.75rem; color: var(--muted); font-family: 'JetBrains Mono', monospace; }

/* ── Hour heatmap ── */
.az-heatmap {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.az-hour-cell {
  width: 38px;
  height: 52px;
  border-radius: 5px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-family: 'JetBrains Mono', monospace;
  gap: 2px;
  border: 1px solid transparent;
  transition: transform 0.15s, box-shadow 0.15s;
  cursor: default;
}
.az-hour-cell:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px var(--orange-glow);
  border-color: var(--orange-dim);
  z-index: 1;
}
.az-hour-cell .h-label { color: var(--muted); font-size: 0.6rem; }
.az-hour-cell .h-rate  { font-weight: 700; }

/* ── Spinner ── */
.az-spinner {
  text-align: center;
  padding: 40px;
  color: var(--orange);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
  letter-spacing: 0.08em;
}
.az-spinner::after {
  content: '';
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid var(--orange-dark);
  border-top-color: var(--orange);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin-left: 10px;
  vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Price bar chart ── */
.az-price-chart {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 120px;
  padding: 0 4px;
}
.az-price-bar-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  height: 100%;
}
.az-price-bar {
  width: 100%;
  border-radius: 3px 3px 0 0;
  min-height: 4px;
  transition: height 0.4s ease;
  position: relative;
  cursor: default;
}
.az-price-bar:hover::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--panel2);
  border: 1px solid var(--orange-dim);
  color: var(--orange-light);
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.7rem;
  white-space: nowrap;
  z-index: 10;
  font-family: 'JetBrains Mono', monospace;
}
.az-price-bar-label {
  font-size: 0.58rem;
  color: var(--muted);
  font-family: 'JetBrains Mono', monospace;
  text-align: center;
  white-space: nowrap;
}

/* ── Badge ── */
.az-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.7rem;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
}
.az-badge-resolved { background: rgba(0,255,136,0.1); color: var(--green); border: 1px solid rgba(0,255,136,0.2); }
.az-badge-active   { background: var(--orange-glow); color: var(--orange-light); border: 1px solid var(--orange-dark); }
.az-badge-yes      { background: rgba(0,255,136,0.1); color: var(--green); }
.az-badge-no       { background: rgba(255,68,102,0.1); color: var(--red); }

/* ── Top volume list ── */
.az-top-list { display: flex; flex-direction: column; gap: 6px; }
.az-top-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--panel2);
  border: 1px solid var(--border);
  border-radius: 6px;
  transition: border-color 0.15s;
}
.az-top-item:hover { border-color: var(--orange-dim); }
.az-top-rank {
  font-size: 0.75rem;
  color: var(--orange);
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  min-width: 20px;
}
.az-top-title { flex: 1; font-size: 0.78rem; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.az-top-vol   { font-size: 0.75rem; color: var(--orange-light); font-family: 'JetBrains Mono', monospace; font-weight: 600; }

/* ── Two-column grid ── */
.az-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 900px) { .az-grid-2 { grid-template-columns: 1fr; } }

/* ── Content area ── */
.az-tab-content { animation: fadeIn 0.2s ease; }
