/* ==========================================================================
   Watchlist Desk - 观察仓 (实时股票价格追踪与自选池中枢)
   Ultra-Premium Dark Fintech Glassmorphic Design System
   ========================================================================== */

.wl-desk-wrap {
  display: flex;
  flex-direction: column;
  gap: 18px;
  color: #f1f5f9;
  font-family: var(--font-sans, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif);
  padding-bottom: 24px;
}

/* 1. Top KPI Summary Grid */
.wl-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}

.wl-kpi-card {
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  backdrop-filter: blur(10px);
  position: relative;
  overflow: hidden;
  transition: border-color 0.2s, transform 0.15s;
}

.wl-kpi-card:hover {
  border-color: rgba(56, 189, 248, 0.35);
  transform: translateY(-1px);
}

.wl-kpi-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, transparent, rgba(56, 189, 248, 0.4), transparent);
}

.wl-kpi-label {
  font-size: 11.5px;
  color: #94a3b8;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
}

.wl-kpi-val {
  font-family: var(--font-mono, monospace);
  font-size: 20px;
  font-weight: 700;
  color: #f8fafc;
  margin: 6px 0 2px 0;
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.wl-kpi-sub {
  font-size: 11px;
  color: #64748b;
}

/* 2. Quick Add Ticker Bar */
.wl-add-card {
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.7) 0%, rgba(15, 23, 42, 0.9) 100%);
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: 14px;
  padding: 14px 18px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
}

.wl-add-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.wl-add-title {
  font-size: 13.5px;
  font-weight: 700;
  color: #38bdf8;
  display: flex;
  align-items: center;
  gap: 8px;
}

.wl-add-hint {
  font-size: 11px;
  color: #94a3b8;
}

.wl-add-form {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  flex-wrap: wrap;
  position: relative;
}

.wl-field-wrap {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.wl-field-label {
  font-size: 11px;
  font-weight: 600;
  color: #94a3b8;
  display: flex;
  align-items: center;
  gap: 4px;
}

.wl-field-wrap.type-wrap {
  flex: 0 0 135px;
}

.wl-field-wrap.market-wrap {
  flex: 0 0 145px;
}

.wl-field-wrap.ticker-wrap {
  flex: 1 1 240px;
  min-width: 220px;
  position: relative;
}

.wl-field-wrap.target-wrap {
  flex: 0 0 110px;
}

.wl-field-wrap.notes-wrap {
  flex: 1 1 180px;
  min-width: 160px;
}

.wl-field-wrap.btn-wrap {
  flex: 0 0 135px;
}

@media (max-width: 768px) {
  .wl-field-wrap.type-wrap,
  .wl-field-wrap.market-wrap,
  .wl-field-wrap.ticker-wrap,
  .wl-field-wrap.target-wrap,
  .wl-field-wrap.notes-wrap,
  .wl-field-wrap.btn-wrap {
    flex: 1 1 100%;
    min-width: 100%;
  }
}

.wl-input, .wl-select {
  background: rgba(10, 15, 29, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 8px 12px;
  color: #f8fafc;
  font-size: 12.5px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  width: 100%;
  box-sizing: border-box;
}

.wl-input:focus, .wl-select:focus {
  border-color: #38bdf8;
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.2);
}

.wl-input.ticker {
  font-family: var(--font-mono, monospace);
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.wl-btn-add {
  background: linear-gradient(135deg, #0284c7 0%, #2563eb 100%);
  border: 1px solid rgba(56, 189, 248, 0.5);
  border-radius: 8px;
  color: #ffffff;
  font-weight: 700;
  font-size: 12.5px;
  padding: 8px 16px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.15s ease;
  box-shadow: 0 2px 10px rgba(37, 99, 235, 0.35);
  height: 100%;
  min-height: 36px;
}

.wl-btn-add:hover {
  background: linear-gradient(135deg, #0369a1 0%, #1d4ed8 100%);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.45);
}

.wl-btn-add:active {
  transform: translateY(0);
}

/* 3. Toolbar & Filters */
.wl-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  padding: 10px 14px;
}

.wl-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
}

.wl-tab-pill {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 5px 12px;
  color: #94a3b8;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.wl-tab-pill:hover {
  color: #f1f5f9;
  background: rgba(255, 255, 255, 0.05);
}

.wl-tab-pill.active {
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.12);
  border-color: rgba(56, 189, 248, 0.35);
}

.wl-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.wl-search-input {
  max-width: 220px;
  padding: 6px 10px;
  font-size: 12px;
}

.wl-btn-refresh {
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.3);
  color: #38bdf8;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s;
}

.wl-btn-refresh:hover {
  background: rgba(56, 189, 248, 0.2);
  border-color: rgba(56, 189, 248, 0.5);
}

/* 4. Watchlist Table */
.wl-table-card {
  background: #0d1322;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
}

.wl-table-wrap {
  width: 100%;
  overflow-x: auto;
}

.wl-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
  text-align: left;
}

.wl-table thead th {
  background: #111827;
  color: #94a3b8;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  white-space: nowrap;
}

.wl-table tbody tr {
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  transition: background-color 0.12s ease;
}

.wl-table tbody tr:hover {
  background: rgba(30, 41, 59, 0.5);
}

.wl-table tbody td {
  padding: 10px 14px;
  vertical-align: middle;
  color: #e2e8f0;
}

.wl-pin-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 14px;
  opacity: 0.35;
  transition: opacity 0.15s, transform 0.15s;
  padding: 0;
}

.wl-pin-btn.pinned {
  opacity: 1;
  filter: drop-shadow(0 0 4px rgba(250, 204, 21, 0.6));
}

.wl-pin-btn:hover {
  opacity: 1;
  transform: scale(1.15);
}

.wl-ticker-badge {
  display: inline-block;
  font-family: var(--font-mono, monospace);
  font-weight: 700;
  font-size: 13.5px;
  color: #f8fafc;
  background: rgba(255, 255, 255, 0.06);
  padding: 2px 7px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.wl-company-name {
  font-size: 11.5px;
  color: #94a3b8;
  margin-top: 2px;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wl-holding-pill {
  display: inline-block;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 600;
  margin-left: 6px;
}

.wl-holding-pill.held {
  background: rgba(56, 189, 248, 0.18);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.35);
}

.wl-holding-pill.watch {
  background: rgba(148, 163, 184, 0.12);
  color: #94a3b8;
  border: 1px solid rgba(148, 163, 184, 0.2);
}

.wl-price-val {
  font-family: var(--font-mono, monospace);
  font-size: 14.5px;
  font-weight: 700;
  color: #ffffff;
  display: block;
}

.wl-prev-val {
  font-family: var(--font-mono, monospace);
  font-size: 11px;
  color: #64748b;
  margin-top: 1px;
}

.wl-chg-pill {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px 8px;
  border-radius: 6px;
  font-family: var(--font-mono, monospace);
  font-size: 12px;
  font-weight: 700;
}

.wl-chg-pill.up {
  background: rgba(52, 211, 153, 0.15);
  color: #34d399;
  border: 1px solid rgba(52, 211, 153, 0.3);
}

.wl-chg-pill.down {
  background: rgba(244, 63, 94, 0.15);
  color: #fb7185;
  border: 1px solid rgba(244, 63, 94, 0.3);
}

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

.wl-upside-badge {
  font-family: var(--font-mono, monospace);
  font-size: 11px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  margin-top: 3px;
  display: inline-block;
}

.wl-upside-badge.positive {
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.3);
}

.wl-upside-badge.reached {
  background: rgba(52, 211, 153, 0.15);
  color: #34d399;
  border: 1px solid rgba(52, 211, 153, 0.3);
}

.wl-notes-cell {
  max-width: 280px;
  font-size: 11.5px;
  color: #cbd5e1;
  white-space: normal;
  word-break: break-word;
  line-height: 1.4;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 4px;
  transition: background 0.15s;
}

.wl-notes-cell:hover {
  background: rgba(255, 255, 255, 0.06);
}

.wl-action-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #cbd5e1;
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 11.5px;
  cursor: pointer;
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  text-decoration: none;
}

.wl-action-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

.wl-action-btn.del:hover {
  background: rgba(244, 63, 94, 0.2);
  border-color: rgba(244, 63, 94, 0.4);
  color: #fda4af;
}

/* Spinner */
@keyframes wl-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.wl-spin {
  animation: wl-spin 0.8s linear infinite;
}

/* TradingView-Style Autocomplete Container & Dropdown */
.wl-autocomplete-wrapper {
  position: relative;
  width: 100%;
}

.wl-autocomplete-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  min-width: 380px;
  max-width: 520px;
  background: rgba(15, 23, 42, 0.98);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(56, 189, 248, 0.45);
  border-radius: 10px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.8), 0 0 20px rgba(56, 189, 248, 0.2);
  z-index: 1000;
  max-height: 320px;
  overflow-y: auto;
  display: none;
}

.wl-autocomplete-dropdown.active {
  display: block;
}

.wl-autocomplete-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.04);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 11px;
  color: #94a3b8;
  font-family: ui-monospace, monospace;
}

.wl-autocomplete-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease;
}

.wl-autocomplete-item:last-child {
  border-bottom: none;
}

.wl-autocomplete-item:hover,
.wl-autocomplete-item.selected {
  background: rgba(56, 189, 248, 0.18);
}

.wl-auto-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.wl-auto-sym {
  font-family: var(--font-mono, monospace);
  font-weight: 800;
  font-size: 13px;
  color: #f8fafc;
  min-width: 60px;
}

.wl-auto-sym .match {
  color: #38bdf8;
  text-decoration: underline;
}

.wl-auto-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.wl-auto-name {
  font-size: 12px;
  font-weight: 600;
  color: #e2e8f0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
}

.wl-auto-sub {
  font-size: 10.5px;
  color: #94a3b8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
}

.wl-auto-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.wl-auto-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  white-space: nowrap;
}

.wl-auto-badge.market {
  background: rgba(56, 189, 248, 0.12);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.3);
}

.wl-auto-badge.type {
  background: rgba(168, 85, 247, 0.12);
  color: #c084fc;
  border: 1px solid rgba(168, 85, 247, 0.3);
}

.wl-selected-preview {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.35);
  border-radius: 6px;
  font-size: 11px;
  color: #38bdf8;
  margin-top: 4px;
}
