/* ==============================================================================
   Quant PWA: Confluence Radar Tab Styling (Unified Matrix Table)
   ============================================================================== */

.radar-view-container {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  padding: 1rem;
  height: 100%;
  overflow-y: auto;
  box-sizing: border-box;
}

/* Header Bar */
.radar-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: rgba(18, 24, 38, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  backdrop-filter: blur(12px);
}

.radar-title-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.radar-badge-icon {
  font-size: 1.25rem;
}

.radar-title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: #fff;
  text-transform: uppercase;
}

.radar-session-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.2rem 0.5rem;
  background: rgba(0, 230, 153, 0.1);
  border: 1px solid rgba(0, 230, 153, 0.3);
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  color: #00e699;
  white-space: nowrap;
}

/* Controls Group */
.radar-controls-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.radar-date-picker-wrap {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.radar-control-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: #64748b;
  letter-spacing: 0.05em;
}

.radar-date-select {
  background: #0f172a;
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #f8fafc;
  padding: 0.35rem 0.65rem;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  outline: none;
  transition: border-color 0.2s;
}

.radar-date-select:hover,
.radar-date-select:focus {
  border-color: #38bdf8;
}

.radar-refresh-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #cbd5e1;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s;
}

.radar-refresh-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #38bdf8;
  border-color: #38bdf8;
}

/* Info Ribbon */
.radar-info-ribbon {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 0.6rem 1rem;
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 6px;
  font-size: 0.75rem;
}

.radar-ribbon-item {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.ribbon-label {
  color: #64748b;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.ribbon-val {
  color: #f1f5f9;
  font-weight: 700;
}

.accent-gold {
  color: #f59e0b;
}

.radar-ribbon-hint {
  margin-left: auto;
  color: #94a3b8;
  font-size: 0.72rem;
  font-style: italic;
}

/* Table Card */
.radar-table-card {
  background: rgba(18, 24, 38, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.radar-table-wrapper {
  max-height: calc(100vh - 220px);
  overflow-y: auto;
  overflow-x: auto;
}

.radar-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
  text-align: left;
}

.radar-table thead th {
  position: sticky;
  top: 0;
  background: #0d1322;
  color: #94a3b8;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.65rem 0.75rem;
  border-bottom: 2px solid rgba(255, 255, 255, 0.1);
  white-space: nowrap;
  user-select: none;
  z-index: 2;
}

.radar-table thead th.sortable {
  cursor: pointer;
  transition: color 0.15s, background-color 0.15s;
}

.radar-table thead th.sortable:hover {
  color: #38bdf8;
  background-color: rgba(56, 189, 248, 0.06);
}

.radar-table thead th.sortable::after {
  content: " ⇅";
  opacity: 0.35;
  font-size: 0.65rem;
  display: inline-block;
  margin-left: 4px;
  vertical-align: middle;
}

.radar-table thead th.sort-desc::after {
  content: " ▼";
  opacity: 1;
  color: #38bdf8;
  font-size: 0.65rem;
  display: inline-block;
  margin-left: 4px;
  vertical-align: middle;
}

.radar-table thead th.sort-asc::after {
  content: " ▲";
  opacity: 1;
  color: #38bdf8;
  font-size: 0.65rem;
  display: inline-block;
  margin-left: 4px;
  vertical-align: middle;
}

/* Column Alignments */
.radar-table .col-ticker {
  text-align: left;
  min-width: 85px;
}

.radar-table .col-num {
  text-align: right;
  min-width: 75px;
  font-variant-numeric: tabular-nums;
}

.radar-table .col-ratio {
  text-align: center;
  min-width: 80px;
}

.radar-table .col-prem {
  text-align: right;
  min-width: 95px;
  font-variant-numeric: tabular-nums;
}

.radar-table .col-regime {
  text-align: center;
  min-width: 100px;
}

.radar-table tbody tr {
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  transition: background-color 0.15s;
  cursor: pointer;
}

.radar-table tbody tr:hover {
  background: rgba(56, 189, 248, 0.06);
}

.radar-table tbody td {
  padding: 0.55rem 0.75rem;
  color: #e2e8f0;
  white-space: nowrap;
}

/* Ticker Button */
.radar-ticker-btn {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.45rem;
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: 4px;
  color: #38bdf8;
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  transition: all 0.15s;
}

.radar-ticker-btn:hover {
  background: #38bdf8;
  color: #0f172a;
  border-color: #38bdf8;
}

/* Pills & Badges */
.radar-ratio-pill {
  display: inline-block;
  padding: 0.18rem 0.45rem;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 600;
  color: #94a3b8;
  min-width: 44px;
  text-align: center;
  transition: all 0.15s ease-in-out;
}

.radar-ratio-pill.ratio-high,
.radar-ratio-pill.ratio-green {
  background: rgba(16, 185, 129, 0.16);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.4);
  font-weight: 700;
}

.radar-ratio-pill.ratio-low,
.radar-ratio-pill.ratio-red {
  background: rgba(239, 68, 68, 0.16);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.4);
  font-weight: 700;
}

.radar-ratio-pill.ratio-mid,
.radar-ratio-pill.ratio-yellow {
  background: rgba(245, 158, 11, 0.16);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.4);
  font-weight: 700;
}

.radar-regime-pill {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.regime-bull {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.regime-bear {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.regime-neutral {
  background: rgba(148, 163, 184, 0.15);
  color: #94a3b8;
  border: 1px solid rgba(148, 163, 184, 0.3);
}

.metric-gold {
  color: #f59e0b;
}

.radar-loading-cell,
.radar-empty-cell {
  text-align: center;
  padding: 3rem 1rem;
  color: #94a3b8;
  font-size: 0.85rem;
}

.radar-empty-cell.error {
  color: #ef4444;
}

/* ==============================================================================
   Segmented Source Filter Pills & Badges
   ============================================================================== */
.radar-filter-bar {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  margin-top: -0.15rem;
}

.radar-filter-group {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  padding: 0.25rem 0.35rem;
}

.radar-filter-pill {
  background: transparent;
  border: none;
  color: #94a3b8;
  padding: 0.35rem 0.75rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 700;
  font-family: var(--font-mono, monospace);
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 28px;
  white-space: nowrap;
  flex-shrink: 0;
}

.radar-filter-pill:hover {
  color: #f8fafc;
  background: rgba(255, 255, 255, 0.06);
}

.radar-filter-pill.active {
  background: #38bdf8;
  color: #0b0f19;
}

.radar-pill-label {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
}

.radar-pill-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.12);
  color: #94a3b8;
  font-size: 0.68rem;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 9999px;
  min-width: 16px;
  line-height: 1.2;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.radar-filter-pill:hover .radar-pill-badge {
  color: #f8fafc;
  background: rgba(255, 255, 255, 0.18);
}

.radar-filter-pill.active .radar-pill-badge {
  background: rgba(11, 15, 25, 0.25);
  color: #0b0f19;
  font-weight: 900;
}

.radar-ticker-cell {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.radar-tag-pill.tag-watchlist {
  display: inline-flex;
  align-items: center;
  padding: 0.1rem 0.4rem;
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.4);
  border-radius: 3px;
  font-size: 0.65rem;
  font-weight: 800;
  color: #fbbf24;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

/* ==============================================================================
   Mobile Responsive Layout (@media max-width: 640px)
   ============================================================================== */
@media (max-width: 640px) {
  .radar-view-container {
    padding: 0.5rem;
    gap: 0.6rem;
  }

  .radar-filter-bar {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .radar-filter-bar::-webkit-scrollbar {
    display: none;
  }

  .radar-filter-group {
    width: 100%;
    display: flex;
    justify-content: space-between;
    box-sizing: border-box;
    padding: 0.2rem;
    gap: 0.25rem;
  }

  .radar-filter-pill {
    flex: 1 1 0;
    justify-content: center;
    padding: 0.35rem 0.4rem;
    font-size: 0.7rem;
    gap: 0.25rem;
    min-height: 32px;
  }

  .radar-pill-badge {
    padding: 1px 4px;
    font-size: 0.65rem;
  }
}
