/**
 * Chart Search Component - standalone, collapsible.
 * Icon only when folded; icon + input when expanded.
 * Unfolds on click, folds on blur (when focus removed).
 */

.chart-search {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}

.chart-search-trigger {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--text-muted, #9ca3af);
  cursor: pointer;
  transition: color 0.2s ease, background 0.2s ease;
}

.chart-search-trigger:hover {
  color: var(--text-main, #f9fafb);
  background: rgba(148, 163, 184, 0.15);
}

.chart-search-trigger svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
}

.chart-symbol {
  margin-left: 12px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main, #f9fafb);
  min-width: 0;
  cursor: pointer;
}

.chart-symbol:hover {
  color: var(--accent-primary, #32e5ff);
}

.chart-search.is-expanded .chart-symbol {
  display: none;
}

.chart-search-input-wrap {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  position: relative;
  width: 0;
  overflow: visible;
  opacity: 0;
  transition: width 0.25s ease, opacity 0.2s ease, margin-left 0.25s ease;
}

.chart-search.is-expanded .chart-search-input-wrap {
  width: 280px;
  opacity: 1;
  margin-left: 8px;
}

.chart-search-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  min-width: 280px;
  margin-top: 4px;
  max-height: 400px;
  overflow-y: auto;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.98);
  border: 1px solid rgba(148, 163, 184, 0.35);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  z-index: 100;
}

.chart-search-dropdown-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 8px 12px;
  border: none;
  background: transparent;
  color: var(--text-main, #f9fafb);
  font-size: 0.85rem;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease;
}

.chart-search-dropdown-option:hover {
  background: rgba(148, 163, 184, 0.2);
}

.chart-search-dropdown-option.is-active {
  background: rgba(168, 85, 247, 0.2);
  color: var(--accent-purple, #a855f7);
}

.chart-search-dropdown-option.is-active:hover {
  background: rgba(168, 85, 247, 0.3);
}

.chart-search-dropdown-symbol {
  font-weight: 600;
  min-width: 8em;
}

.chart-search-dropdown-volume {
  font-size: 0.65rem;
  color: var(--text-muted, #94a3b8);
  text-align: left;
  min-width: 5.5em;
  white-space: nowrap;
  flex-shrink: 0;
}

.chart-search-dropdown-vol-label {
  display: inline-block;
  width: 2.75em;
  text-align: left;
}

.chart-search-input {
  width: 100%;
  min-width: 0;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.3);
  background: rgba(15, 23, 42, 0.8);
  color: var(--text-main, #f9fafb);
  font-size: 0.85rem;
  font-family: inherit;
}

.chart-search-input::placeholder {
  color: var(--text-soft, #6b7280);
}

.chart-search-input:focus {
  outline: none;
  border-color: var(--accent-purple, #a855f7);
  box-shadow: 0 0 0 2px rgba(168, 85, 247, 0.2);
}

.chart-search-dropdown-upgrade {
  display: block;
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  margin: 0;
  border: none;
  border-top: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 0 0 10px 10px;
  background: linear-gradient(135deg, #a855f7, #6366f1);
  color: #0f172a;
  font-size: 0.8rem;
  font-weight: 600;
  font-family: inherit;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: filter 0.15s ease;
  box-shadow: none;
}
.chart-search-dropdown-upgrade:first-child {
  border-top: none;
  border-radius: 10px;
}
.chart-search-dropdown-upgrade:hover {
  filter: brightness(1.06);
}
