.sidebar-header {
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  user-select: none;
  -webkit-user-select: none;
}

.sidebar-header-text {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.sidebar-header h2 {
  font-size: 19px;
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.4px;
  color: var(--text-primary);
  line-height: 1.2;
}

.sidebar-header p {
  font-size: 12px;
  color: var(--text-secondary);
  margin: 0;
  font-weight: 500;
  line-height: 1.3;
}

/* Finrix brand mark — logo, not market green */
.finrix-logo {
  width: 42px;
  height: 42px;
  border-radius: 11px;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: none;
  overflow: hidden;
  flex-shrink: 0;
}

.finrix-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  filter: brightness(0) invert(1);
}

:root[data-theme="light"] .finrix-logo img {
  filter: none;
}

.finrix-logo--lg {
  width: 72px;
  height: 72px;
  border-radius: 18px;
  box-shadow: 0 6px 20px var(--brand-soft);
}

.finrix-logo--md {
  width: 54px;
  height: 54px;
  border-radius: 14px;
}

.new-chat-btn {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 11px;
  background-color: var(--active-bg);
  border: 1px solid var(--panel-border);
  color: var(--text-primary);
  padding: 10px 14px;
  border-radius: var(--radius-sm, 10px);
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: -0.15px;
  cursor: pointer;
  width: 100%;
  margin-bottom: 6px;
  transition: all 0.18s ease;
}

.new-chat-btn:hover {
  background-color: var(--active-border);
  border-color: var(--active-border);
}

.analysis-nav-btn.active {
  background-color: var(--active-bg);
  border-color: var(--brand);
  color: var(--brand);
}

.new-chat-btn svg {
  flex-shrink: 0;
  width: 19px;
  height: 19px;
}

.sidebar-title {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-secondary);
  letter-spacing: 0.8px;
  margin-bottom: 9px;
  margin-top: 16px;
}

.history-section-title {
  border-top: 1px solid var(--panel-border);
  padding-top: 8px;
  margin-top: 4px;
}

/* FAVORİLER başlık satırı + ＋ (varlık ara/ekle) butonu */
.favorites-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.favorites-add-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  border: 1px solid var(--panel-border);
  background: var(--tag-bg, transparent);
  color: var(--text-secondary);
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.favorites-add-btn:hover {
  color: var(--text-primary);
  background: var(--hover-bg);
}

/* Katlanabilir başlık (canlı kripto/BİST) */
.collapsible-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  background: transparent;
  border: none;
  border-top: 1px solid var(--panel-border);
  cursor: pointer;
  font: inherit;
  /* buton varsayılan fontunu ez; .sidebar-title boyut/rengi geçerli */
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
  letter-spacing: 0.8px;
  
  padding: 18px 0 0 0;
  /* buton varsayılan yatay padding'ini sıfırla (metin hizası) */
  text-align: left;
}

.collapsible-title:hover {
  color: var(--text-primary);
}

.collapse-chevron {
  font-size: 10px;
  transition: transform 0.2s ease;
  opacity: 0.7;
}

.collapsible-title.collapsed .collapse-chevron {
  transform: rotate(-90deg);
}

.collapsible-content {
  overflow: hidden;
  transition: max-height 0.2s ease;
  flex-shrink: 0;
  /* KRİTİK: sidebar flex-column; overflow:hidden olduğu için flex bunu
                       0'a sıkıştırıp içeriği (ticker'ları) kırpıyordu -> sıkışmayı engelle */
}

.collapsible-content.collapsed {
  max-height: 0 !important;
  margin: 0;
}

#investorProfile {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.investor-profile-question {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.investor-profile-options {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.investor-profile-option {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  background: var(--panel);
  color: var(--text-primary);
  text-align: left;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.investor-profile-option:hover,
.investor-profile-option.active {
  background: var(--active-bg);
  border-color: var(--active-border);
}

.investor-profile-label {
  font-size: 12px;
  font-weight: 700;
}

.investor-profile-description,
.investor-profile-selected {
  font-size: 10px;
  color: var(--text-secondary);
  line-height: 1.35;
}

.investor-profile-selected {
  padding: 2px 2px 0;
}

#assetPicker {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
}

.asset-picker-header {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.asset-picker-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.asset-picker-subtitle {
  font-size: 11px;
  color: var(--text-secondary);
}

.asset-picker-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex-shrink: 0;
}

.asset-picker-categories {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 8px;
  /* Slightly more padding for scrollbar */
  flex-shrink: 0;
}

.asset-picker-categories::-webkit-scrollbar {
  height: 4px;
}

.asset-picker-categories::-webkit-scrollbar-thumb {
  background-color: var(--panel-border);
  border-radius: 4px;
}

.asset-picker-chip {
  border: 1px solid var(--panel-border);
  background: transparent;
  color: var(--text-secondary);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 11px;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}

.asset-picker-chip.active {
  background-color: var(--active-bg);
  color: var(--text-primary);
  border-color: var(--active-border);
}

.asset-picker-search-wrap {
  width: 100%;
  flex-shrink: 0;
}

.asset-picker-search {
  width: 100%;
  background: var(--panel);
  color: var(--text-primary);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13px;
  outline: none;
}

.asset-picker-results {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 240px;
  overflow-y: auto;
}

.asset-result-item-wrap {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.asset-result-item {
  width: 100%;
  border: 1px solid var(--panel-border);
  background: var(--panel);
  border-radius: 10px;
  padding: 10px 12px;
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  text-align: left;
}

.asset-result-item:hover {
  border-color: var(--active-border);
  background: var(--active-bg);
}

.asset-result-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.asset-result-leading {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 9px;
}

.asset-result-symbol {
  font-size: 13px;
  font-weight: 700;
}

.asset-result-name,
.asset-result-category,
.asset-result-type,
.asset-picker-empty {
  font-size: 11px;
  color: var(--text-secondary);
}

.asset-result-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  white-space: nowrap;
}

.asset-favorite-btn {
  min-width: 40px;
  border: 1px solid var(--panel-border);
  background: var(--panel);
  color: var(--text-secondary);
  border-radius: 10px;
  cursor: pointer;
  font-size: 16px;
}

.asset-favorite-btn.active {
  color: #fbbf24;
  border-color: #f59e0b;
}

#watchlist,
#watchlistMini {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.watchlist-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.watchlist-open-btn {
  flex: 1;
  border: 1px solid rgba(56, 189, 248, 0.14);
  background-color: rgba(16, 24, 38, 0.85);
  color: var(--text-primary);
  border-radius: 8px;
  padding: 10px 12px;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 9px;
}

.watchlist-identity {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.watchlist-open-btn:hover,
.watchlist-mini-chip:hover {
  background-color: rgba(20, 31, 50, 0.95);
  border-color: rgba(56, 189, 248, 0.35);
  box-shadow: 0 4px 12px rgba(0, 12, 30, 0.3);
}

.watchlist-symbol {
  font-size: 13px;
  font-weight: 700;
}

.watchlist-name,
.watchlist-empty {
  font-size: 11px;
  color: var(--text-secondary);
}

.watchlist-remove-btn {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 500;
  opacity: 0.35;
  transition: all 0.15s ease;
}

.watchlist-item:hover .watchlist-remove-btn {
  opacity: 0.75;
}

.watchlist-remove-btn:hover {
  opacity: 1;
  background: rgba(239, 68, 68, 0.15);
  color: var(--accent-red, #ef4444);
}

.watchlist-mini-chip {
  border: 1px solid rgba(56, 189, 248, 0.14);
  background: rgba(16, 24, 38, 0.85);
  color: var(--text-primary);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 11px;
  cursor: pointer;
  text-align: left;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 7px;
}

#cryptoTicker,
#cryptoTickerMini,
#bistTicker,
#bistTickerMini {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.crypto-ticker-card {
  position: relative;
  border: 1px solid rgba(56, 189, 248, 0.14);
  background-color: rgba(16, 24, 38, 0.85);
  border-radius: 10px;
  padding: 12px;
  transition: all 0.2s ease;
}

.crypto-ticker-card:hover {
  background-color: rgba(20, 31, 50, 0.95);
  border-color: rgba(56, 189, 248, 0.35);
  box-shadow: 0 4px 12px rgba(0, 12, 30, 0.3);
}

.bist-ticker-card .crypto-ticker-badge {
  color: var(--text-primary);
}

.crypto-ticker-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.crypto-ticker-identity {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.crypto-ticker-symbol {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}

.crypto-ticker-name {
  font-size: 11px;
  color: var(--text-secondary);
  max-width: 140px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.crypto-ticker-badge {
  font-size: 10.5px;
  font-weight: 500;
  line-height: 1;
  color: var(--text-secondary);
  border: 1px solid var(--panel-border);
  background: var(--hover-bg, rgba(255, 255, 255, 0.04));
  border-radius: 999px;
  padding: 3px 8px;
  margin-top: 1px;
  flex-shrink: 0;
}

.ticker-remove-btn {
  position: absolute;
  top: 2px;
  right: 3px;
  width: 15px;
  height: 15px;
  border-radius: 3px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  padding: 0;
  opacity: 0.25;
  transition: all 0.15s ease;
  z-index: 2;
}

.crypto-ticker-card:hover .ticker-remove-btn {
  opacity: 0.7;
}

.ticker-remove-btn:hover {
  opacity: 1 !important;
  background: rgba(239, 68, 68, 0.15);
  color: var(--accent-red, #ef4444);
}

.crypto-ticker-badge {
  border: 1px solid var(--panel-border);
  border-radius: 999px;
  padding: 4px 8px;
}

.crypto-ticker-price {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.crypto-ticker-change {
  font-size: 12px;
  font-weight: 600;
}

.crypto-ticker-change.positive {
  color: var(--accent-green);
}

.crypto-ticker-change.negative {
  color: var(--accent-red);
}


/* Geçmiş Sohbetler Kutusu */
.history-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 32vh;
  /* yukarı alındı -> uzun geçmiş altındaki bölümleri itmesin */
  overflow-y: auto;
  flex-shrink: 0;
  /* KRİTİK: overflow-y:auto flex min-height'i 0 yapıyor; sidebar
                            flex-column'da geçmişi 0'a sıkıştırıp gizliyordu -> engelle */
}

.history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  background-color: transparent;
  border: 1px solid transparent;
  transition: all 0.2s ease;
}

.history-item:hover {
  background-color: var(--hover-bg);
}

.history-item.active {
  background-color: var(--active-bg);
  border-color: var(--active-border);
}

.history-item-content {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  overflow: hidden;
  margin-right: 8px;
}

.history-item-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-item-time {
  font-size: 10px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.history-delete-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  opacity: 0;
}

.history-item:hover .history-delete-btn {
  opacity: 1;
}

.history-delete-btn:hover {
  background-color: rgba(239, 68, 68, 0.1);
  color: #ef4444;
}

/* Light Theme Overrides for Watchlist and Ticker Cards */
:root[data-theme="light"] .watchlist-open-btn,
:root[data-theme="light"] .watchlist-mini-chip,
:root[data-theme="light"] .crypto-ticker-card {
  background-color: #ffffff;
  border-color: #e2e8f0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
}

:root[data-theme="light"] .watchlist-open-btn:hover,
:root[data-theme="light"] .watchlist-mini-chip:hover,
:root[data-theme="light"] .crypto-ticker-card:hover {
  background-color: #f8fafc;
  border-color: #0284c7;
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.1);
}
