/* File: css/components.css
   Purpose: Shared component styles for NikaTS V2 UI.
*/

/* ═══════════════ CARD ═══════════════ */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 0;
  padding: var(--space-4);
}

.card--flat {
  border-radius: 0;
  border-left: 0;
  border-right: 0;
}

.card--interactive {
  cursor: pointer;
  transition: border-color var(--transition-fast), background var(--transition-fast);
}

.card--interactive:hover {
  border-color: var(--border-default);
  background: var(--bg-surface-2);
}

.card--active {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 1px rgba(79, 140, 255, 0.25);
}

/* ═══════════════ KPI CARD ═══════════════ */
.kpi-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.kpi-card__label {
  font-size: var(--text-xs);
  color: var(--text-secondary);
  font-weight: var(--weight-medium);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.kpi-card__value {
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
  line-height: var(--leading-tight);
  font-variant-numeric: tabular-nums;
}

.kpi-card__sub {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.kpi-card--long .kpi-card__value { color: var(--color-long); }
.kpi-card--short .kpi-card__value { color: var(--color-short); }

/* ═══════════════ BUTTON ═══════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-md);
  border: 0;
  background: var(--brand-gradient);
  color: #fff;
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  cursor: pointer;
  transition: opacity var(--transition-fast), transform var(--transition-fast);
  white-space: nowrap;
  line-height: 1.4;
}

.btn:hover { opacity: 0.9; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn--secondary {
  background: var(--bg-surface-2);
  border: 1px solid var(--border-default);
  color: var(--text-primary);
}
.btn--secondary:hover { border-color: var(--border-strong); }

.btn--ghost {
  background: transparent;
  color: var(--text-secondary);
}
.btn--ghost:hover { color: var(--text-primary); background: var(--hover-overlay); }

.btn--danger {
  background: var(--color-danger);
  color: #fff;
}

.btn--sm {
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-xs);
  border-radius: var(--radius-sm);
}

.btn--lg {
  padding: var(--space-3) var(--space-6);
  font-size: var(--text-base);
}

.btn--icon {
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: var(--radius-md);
  background: var(--bg-surface-2);
  border: 1px solid var(--border-default);
  color: var(--text-secondary);
}
.btn--icon:hover { color: var(--text-primary); border-color: var(--border-strong); }

.btn--icon-sm {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
}

.btn--icon svg { width: 16px; height: 16px; }

/* ═══════════════ INPUT ═══════════════ */
.input {
  width: 100%;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-default);
  background: var(--bg-surface-2);
  color: var(--text-primary);
  font-size: var(--text-sm);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  outline: none;
}

.input:focus {
  border-color: var(--brand-primary);
  box-shadow: var(--focus-ring);
}

.input::placeholder { color: var(--text-muted); }

.input--search {
  padding-left: 36px;
  border-radius: var(--radius-full);
}

select.input {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238b95a5' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
}

/* ═══════════════ TABLE ═══════════════ */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

.data-table th,
.data-table td {
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--border-subtle);
  text-align: left;
  white-space: nowrap;
}

.data-table th {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  position: sticky;
  top: 0;
  background: var(--bg-surface);
  z-index: 1;
  user-select: none;
}

.data-table th.sortable { cursor: pointer; }
.data-table th.sortable:hover { color: var(--text-primary); }

.data-table th .sort-icon {
  margin-left: 4px;
  font-size: 10px;
  opacity: 0.5;
}

.data-table th.sorted .sort-icon { opacity: 1; color: var(--brand-primary); }

.data-table td.numeric,
.data-table th.numeric {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.data-table__row--clickable {
  cursor: pointer;
  transition: background var(--transition-fast);
}

.data-table__row--clickable:hover {
  background: var(--hover-overlay);
}

.data-table__row--active {
  background: rgba(79, 140, 255, 0.08);
}

.table-scroll {
  overflow: auto;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}

/* ═══════════════ BADGE ═══════════════ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  border: 1px solid transparent;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.badge--long {
  background: var(--color-long-subtle);
  border-color: var(--color-long-border);
  color: var(--color-long-text);
}

.badge--short {
  background: var(--color-short-subtle);
  border-color: var(--color-short-border);
  color: var(--color-short-text);
}

.badge--neutral {
  background: var(--color-neutral-subtle);
  border-color: var(--color-neutral-border);
  color: var(--text-secondary);
}

.badge--success {
  background: var(--color-success-subtle);
  border-color: var(--color-success-border);
  color: var(--color-long-text);
}

.badge--warning {
  background: var(--color-warning-subtle);
  border-color: var(--color-warning-border);
  color: #fcd34d;
}

.badge--danger {
  background: var(--color-danger-subtle);
  border-color: var(--color-danger-border);
  color: var(--color-short-text);
}

.badge--info {
  background: var(--color-info-subtle);
  border-color: var(--color-info-border);
  color: #93c5fd;
}

/* Decision state badges */
.badge--buy, .badge--ready { background: var(--color-long-subtle); border-color: var(--color-long-border); color: var(--color-long); }
.badge--sell { background: var(--color-short-subtle); border-color: var(--color-short-border); color: var(--color-short); }
.badge--wait_setup, .badge--wait_confirmation { background: var(--color-warning-subtle); border-color: var(--color-warning-border); color: var(--color-warning); }
.badge--no_trade { background: var(--color-danger-subtle); border-color: var(--color-danger-border); color: var(--color-danger); }

/* ═══════════════ FLOW SELECTOR ═══════════════ */
.flow-selector {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  position: relative;
}

.flow-selector__select {
  appearance: none;
  -webkit-appearance: none;
  background: var(--bg-surface-2);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-full);
  color: var(--text-secondary);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  padding: 3px 22px 3px 10px;
  cursor: pointer;
  outline: none;
  white-space: nowrap;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%2394a3b8'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  transition: border-color 0.15s, background-color 0.15s;
}

.flow-selector__select:hover {
  border-color: var(--border-hover);
  background-color: var(--bg-surface-3);
}

.flow-selector__select:focus {
  border-color: var(--color-primary);
}

.flow-selector__status {
  display: none;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 16px;
  border-radius: var(--radius-full);
  font-size: 10px;
  font-weight: var(--weight-bold);
  line-height: 1;
  padding: 0 4px;
}

.flow-selector__status:not(:empty) { display: inline-flex; }

.flow-selector__status--info    { background: rgba(56, 189, 248, 0.15); color: #38bdf8; }
.flow-selector__status--success { background: rgba(74, 222, 128, 0.15); color: #4ade80; }
.flow-selector__status--warning { background: rgba(251, 191, 36, 0.15); color: #fbbf24; }
.flow-selector__status--danger  { background: rgba(248, 113, 113, 0.15); color: #f87171; }

/* ═══════════════ PILL ═══════════════ */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  background: var(--bg-surface-2);
  border: 1px solid var(--border-default);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  color: var(--text-secondary);
  white-space: nowrap;
}

/* ═══════════════ TAG ═══════════════ */
.tag {
  display: inline-block;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: var(--radius-full);
  background: var(--bg-surface-2);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  white-space: nowrap;
}

/* Timeframe tags */
.tag--tf-1m  { background: var(--tf-1m);  color: var(--tf-1m-text); }
.tag--tf-3m  { background: var(--tf-3m);  color: var(--tf-3m-text); }
.tag--tf-5m  { background: var(--tf-5m);  color: var(--tf-5m-text); }
.tag--tf-15m { background: var(--tf-15m); color: var(--tf-15m-text); }
.tag--tf-30m { background: var(--tf-30m); color: var(--tf-30m-text); }
.tag--tf-1h  { background: var(--tf-1h);  color: var(--tf-1h-text); }
.tag--tf-2h  { background: var(--tf-2h);  color: var(--tf-2h-text); }
.tag--tf-4h  { background: var(--tf-4h);  color: var(--tf-4h-text); }
.tag--tf-6h  { background: var(--tf-6h);  color: var(--tf-6h-text); }
.tag--tf-8h  { background: var(--tf-8h);  color: var(--tf-8h-text); }
.tag--tf-12h { background: var(--tf-12h); color: var(--tf-12h-text); }
.tag--tf-1d  { background: var(--tf-1d);  color: var(--tf-1d-text); }
.tag--tf-1w  { background: var(--tf-1w);  color: var(--tf-1w-text); }

/* ═══════════════ MODAL ═══════════════ */
.modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: var(--z-modal);
  opacity: 1;
  transition: opacity var(--transition-normal);
}

.modal.hidden { display: none; }

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: var(--bg-overlay);
}

.modal-card {
  position: relative;
  z-index: 1;
  width: min(520px, 92vw);
  max-height: 90vh;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  box-shadow: var(--shadow-xl);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.modal-card--wide {
  max-width: 1200px;
  width: calc(100vw - 48px);
}

.modal-card--tall {
  height: 90vh;
  max-height: 90vh;
}

/* modal-dialog variant (used by insight TF modal) */
.modal-dialog {
  position: relative;
  z-index: 1;
  width: min(640px, 92vw);
  max-height: 90vh;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  box-shadow: var(--shadow-xl);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.modal-dialog--lg {
  width: min(960px, 95vw);
}
.modal-dialog--xl {
  width: min(1200px, 95vw);
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
}

.modal-title {
  font-size: var(--text-md);
  font-weight: var(--weight-semibold);
}

.modal-subtitle {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-top: 2px;
}

.modal-body {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  min-height: 0;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-2);
}

/* ═══════════════ TOAST ═══════════════ */
.toast-container {
  position: fixed;
  bottom: var(--space-6);
  right: var(--space-6);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  background: var(--bg-surface-2);
  border: 1px solid var(--border-default);
  box-shadow: var(--shadow-lg);
  font-size: var(--text-sm);
  color: var(--text-primary);
  pointer-events: auto;
  animation: toast-in 300ms ease forwards;
  max-width: 400px;
}

.toast.removing { animation: toast-out 200ms ease forwards; }

.toast--success { border-color: var(--color-success-border); }
.toast--warning { border-color: var(--color-warning-border); }
.toast--error   { border-color: var(--color-danger-border); }
.toast--info    { border-color: var(--color-info-border); }

.toast__icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.toast--success .toast__icon { color: var(--color-success); }
.toast--warning .toast__icon { color: var(--color-warning); }
.toast--error   .toast__icon { color: var(--color-danger); }
.toast--info    .toast__icon { color: var(--color-info); }

.toast__close {
  margin-left: auto;
  background: none;
  border: 0;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px;
}

@keyframes toast-in {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}

@keyframes toast-out {
  from { transform: translateX(0); opacity: 1; }
  to   { transform: translateX(100%); opacity: 0; }
}

/* ═══════════════ PROGRESS BAR ═══════════════ */
.progress-bar {
  width: 100%;
  height: 4px;
  border-radius: var(--radius-full);
  background: var(--bg-base);
  border: 1px solid var(--border-subtle);
  overflow: hidden;
}

.progress-bar__fill {
  height: 100%;
  background: var(--brand-gradient);
  transition: width var(--transition-slow);
  border-radius: var(--radius-full);
}

.progress-bar--success .progress-bar__fill { background: var(--color-success); }
.progress-bar--warning .progress-bar__fill { background: var(--color-warning); }
.progress-bar--danger  .progress-bar__fill { background: var(--color-danger); }

/* ═══════════════ PILL TABS ═══════════════ */
.pill-tabs {
  display: inline-flex;
  padding: 3px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-2);
  gap: 2px;
}

.pill-tabs__btn {
  padding: 5px 14px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  cursor: pointer;
  color: var(--text-secondary);
  background: transparent;
  border: 0;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

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

.pill-tabs__btn.active {
  color: var(--text-primary);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
}

.pill-tabs__close {
  margin-left: 6px;
  font-size: 10px;
  color: var(--text-muted);
  cursor: pointer;
}

.pill-tabs__close:hover { color: var(--color-danger); }

/* ═══════════════ CHIP ═══════════════ */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: var(--radius-full);
  padding: 5px 12px;
  border: 1px solid var(--border-default);
  background: var(--bg-surface-2);
  color: var(--text-secondary);
  font-size: var(--text-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.chip:hover { color: var(--text-primary); border-color: var(--border-strong); }
.chip.active { color: #14c88c; border-color: #1c5a48; background: #0f2520; }
.chip.ghost { border-color: transparent; background: transparent; cursor: default; opacity: 0.5; }

/* ═══════════════ DOT INDICATOR ═══════════════ */
.dot {
  width: 7px;
  height: 7px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}

.dot--success { background: var(--color-success); }
.dot--warning { background: var(--color-warning); }
.dot--danger  { background: var(--color-danger); }
.dot--neutral { background: var(--text-muted); }

.dot--pulse {
  box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.6);
  animation: dot-pulse 2s infinite;
}

@keyframes dot-pulse {
  0%  { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.6); }
  70% { box-shadow: 0 0 0 8px rgba(34, 197, 94, 0); }
  100%{ box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

/* ═══════════════ SPARKLINE ═══════════════ */
.sparkline {
  width: 90px;
  height: 24px;
  display: block;
}

/* ═══════════════ SECTION ═══════════════ */
.section-title {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  margin: 0 0 var(--space-3);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

/* ═══════════════ SPINNER ═══════════════ */
.mini-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(79, 140, 255, 0.2);
  border-top-color: var(--brand-primary);
  border-radius: 50%;
  animation: nts-spin 1s linear infinite;
  display: inline-block;
}

.loading-spinner {
  width: 48px;
  height: 48px;
  border: 3px solid rgba(79, 140, 255, 0.2);
  border-top-color: var(--brand-primary);
  border-radius: 50%;
  animation: nts-spin 1s linear infinite;
}

/* Loading directive full layout */
.loading-directive {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 180px;
  padding: var(--space-6);
}

.loading-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 200px;
}

.loading-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
  text-align: center;
  max-width: 320px;
}

.loading-spinner-wrap {
  position: relative;
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.loading-spinner-wrap .loading-spinner {
  position: absolute;
  inset: 0;
  width: 56px;
  height: 56px;
}

.loading-spinner-wrap .loading-icon {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.loading-spinner-wrap .loading-icon img {
  width: 26px;
  height: 26px;
  object-fit: contain;
  border-radius: 50%;
}

.loading-title {
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--text-primary);
}

.loading-subtitle {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.loading-bars {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.loading-bar {
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.loading-bar.secondary {
  height: 3px;
  margin-top: var(--space-1);
}

.loading-bar-fill {
  height: 100%;
  border-radius: var(--radius-full);
  background: var(--brand-primary);
  transition: width 0.4s ease;
}

.loading-bar.secondary .loading-bar-fill {
  background: var(--brand-secondary);
}

.loading-label {
  font-size: 11px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.loading-label.secondary {
  font-size: 10px;
  color: var(--text-muted);
  opacity: 0.7;
}

@keyframes nts-spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* ═══════════════ EMPTY STATE ═══════════════ */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-8) var(--space-4);
  color: var(--text-muted);
  text-align: center;
  gap: var(--space-3);
}

.empty-state__icon {
  width: 48px;
  height: 48px;
  color: var(--text-muted);
  opacity: 0.5;
}

.empty-state__title {
  font-size: var(--text-base);
  font-weight: var(--weight-medium);
  color: var(--text-secondary);
}

.empty-state__text {
  font-size: var(--text-sm);
  max-width: 360px;
}

/* ═══════════════ FORM ═══════════════ */
.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.form-label {
  font-size: var(--text-xs);
  color: var(--text-secondary);
  font-weight: var(--weight-medium);
}

.form-hint {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

/* Password reveal */
.input-reveal-wrap {
  position: relative;
}

.input-reveal-wrap .input { padding-right: 40px; }

.input-reveal-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: 0;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
}

.input-reveal-btn:hover { color: var(--text-primary); }

/* ═══════════════ STAR / FAVORITE ═══════════════ */
.star-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 18px;
  transition: color var(--transition-fast);
}

.star-btn:hover { color: #f6c445; }
.star-btn.active { color: #f6c445; }

/* ═══════════════ ICON BUTTON ═══════════════ */
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-default);
  background: var(--bg-surface-2);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 16px;
  transition: all var(--transition-fast);
}

.icon-btn:hover { color: var(--text-primary); border-color: var(--border-strong); }
.icon-btn.small { width: 28px; height: 28px; font-size: 14px; border-radius: var(--radius-sm); }

.btn.secondary {
  background: var(--bg-surface-2);
  border: 1px solid var(--border-default);
  color: var(--text-primary);
}
.btn.secondary:hover { border-color: var(--border-strong); }

/* ═══════════════ PAIR DIRECTIVE ═══════════════ */
.pair-directive {
  display: flex;
  flex-direction: column;
  gap: 0;
  min-height: 0;
  height: 100%;
}

.pair-search {
  padding: var(--space-1) var(--space-2);
  border-bottom: 1px solid var(--border-subtle);
}

.pair-search-wrap {
  position: relative;
}

.pair-search-icon {
  position: absolute;
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 12px;
  pointer-events: none;
}

.pair-search-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
}

.pair-search-wrap input {
  flex: 1;
  min-width: 0;
  padding: 5px 8px 5px 28px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-default);
  background: var(--bg-surface-2);
  color: var(--text-primary);
  font-size: 10px;
  outline: none;
  transition: border-color var(--transition-fast);
}

.pair-collapse-btn {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-surface-3);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.pair-collapse-btn:hover {
  background: var(--brand-primary);
  color: #fff;
  border-color: var(--brand-primary);
}

.pair-search-wrap input:focus {
  border-color: var(--brand-primary);
  box-shadow: var(--focus-ring);
}

.pair-search-wrap input::placeholder { color: var(--text-muted); }

/* Quote chip row */
.pair-chip-row {
  display: flex;
  align-items: center;
  gap: 4px;
  overflow-x: auto;
  padding: 2px var(--space-2);
  border-bottom: 1px solid var(--border-subtle);
}

.pair-chip-row::-webkit-scrollbar { height: 4px; }
.pair-chip-row::-webkit-scrollbar-thumb { background: var(--border-default); border-radius: 2px; }

.pair-chip-row .chip {
  font-size: 9px;
  padding: 2px 6px;
}

/* Tab row (All / Favorites) */
.pair-tab-row {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 2px var(--space-2);
  border-bottom: 1px solid var(--border-subtle);
}

.pair-tab-row .chip { font-size: 9px; padding: 2px 6px; }

.pair-refresh-btn {
  margin-left: auto;
  background: none;
  border: 0;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 12px;
  padding: 1px;
}
.pair-refresh-btn:hover { color: var(--text-primary); }

/* Header row */
.pair-header-row {
  display: grid;
  grid-template-columns: 1fr 0.55fr 0.45fr;
  color: var(--text-muted);
  font-size: 9px;
  padding: 2px var(--space-2);
  border-bottom: 1px solid var(--border-subtle);
  user-select: none;
  font-weight: var(--weight-medium);
}

.pair-header-row .col-mid,
.pair-header-row .col-right { text-align: right; }

.pair-header-row .sort-icon {
  margin-left: 4px;
  font-size: 10px;
  color: var(--text-muted);
  cursor: pointer;
}

/* List container */
.pair-list {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
}

.pair-list::-webkit-scrollbar { width: 4px; }
.pair-list::-webkit-scrollbar-thumb { background: var(--border-default); border-radius: 2px; }

/* Pair rows */
.pair-row {
  display: grid;
  grid-template-columns: 1fr 0.55fr 0.45fr;
  align-items: center;
  padding: 3px var(--space-2);
  border-bottom: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: background var(--transition-fast);
  font-size: 10px;
}

.pair-row:hover { background: var(--hover-overlay); }
.pair-row.active { background: rgba(79, 140, 255, 0.08); border-color: #2a3b5c; }

.pair-left {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.pair-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.pair-symbol {
  display: flex;
  align-items: center;
  gap: 5px;
  font-weight: var(--weight-semibold);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-primary);
}

.pair-volume {
  color: var(--text-muted);
  font-size: 8px;
}

.pair-mid {
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
}

.pair-right {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.pair-right.positive { color: var(--color-long); }
.pair-right.negative { color: var(--color-short); }
.pair-right.neutral  { color: var(--text-muted); }

/* Simple pair name (no market data) */
.pair-name {
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
}

/* Pair loading shimmer */
.pair-shimmer {
  height: 12px;
  width: 60px;
  border-radius: var(--radius-sm);
  background: linear-gradient(90deg, var(--bg-surface-2) 25%, var(--bg-surface-3) 50%, var(--bg-surface-2) 75%);
  background-size: 200% 100%;
  animation: pair-shimmer 1.5s ease-in-out infinite;
}

@keyframes pair-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Responsive pair row */
@media (max-width: 720px) {
  .pair-header-row,
  .pair-row {
    grid-template-columns: 1fr 0.6fr 0.5fr;
  }
}

/* ═══════════════ ALLOCATION BAR ═══════════════ */
.alloc-bar {
  height: 4px;
  border-radius: var(--radius-full);
  background: var(--bg-base);
  overflow: hidden;
  min-width: 60px;
}

.alloc-bar__fill {
  height: 100%;
  background: var(--brand-primary);
  border-radius: var(--radius-full);
}

/* ═══════════════ CONFIDENCE BAR ═══════════════ */
.confidence-bar {
  display: inline-block;
  width: 50px;
  height: 4px;
  border-radius: var(--radius-full);
  background: var(--bg-base);
  border: 1px solid var(--border-subtle);
  overflow: hidden;
  vertical-align: middle;
}

.confidence-bar__fill {
  height: 100%;
  background: linear-gradient(90deg, var(--color-warning) 0%, var(--color-success) 100%);
}

/* ═══════════════ SVG ICON UTILITY ═══════════════ */
.icon {
  width: 16px;
  height: 16px;
  display: inline-block;
  vertical-align: middle;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon--sm { width: 14px; height: 14px; }
.icon--lg { width: 20px; height: 20px; }
.icon--xl { width: 24px; height: 24px; }
