/* TradeApp Search Widget — Dark Theme (Dual-Zone) */

#chatbot-root {
  --cb-bg: #0f172a;
  --cb-surface: #1e293b;
  --cb-border: #334155;
  --cb-text: #e2e8f0;
  --cb-muted: #94a3b8;
  --cb-accent: #38bdf8;
  --cb-accent-dim: rgba(56, 189, 248, 0.15);
  --cb-green: #22c55e;
  --cb-red: #ef4444;
  --cb-yellow: #eab308;
  --cb-radius: 12px;
  --cb-shadow: 0 8px 32px rgba(0,0,0,0.5);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ── Floating Button (Mascot) ── */
.cb-toggle {
  position: fixed;
  bottom: 20px;
  left: 20px;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--cb-accent);
  border: none;
  overflow: visible;
  cursor: pointer;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(56,189,248,0.3);
  transition: transform 0.25s, box-shadow 0.25s, background 0.3s;
}
.cb-toggle:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 24px rgba(56,189,248,0.45);
}
.cb-toggle svg {
  width: 56px;
  height: 56px;
}
.cb-toggle.cb-active {
  background: var(--cb-accent);
  box-shadow: 0 4px 20px rgba(56,189,248,0.5), 0 0 30px rgba(56,189,248,0.2);
}

/* ? / ! Badge */
.cb-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #1e293b;
  color: #38bdf8;
  font-size: 15px;
  font-weight: 800;
  font-family: Arial, sans-serif;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #38bdf8;
  pointer-events: none;
  line-height: 1;
}
.cb-badge-active {
  background: #fbbf24;
  color: #1a1a2e;
  border-color: #f59e0b;
  animation: cb-badge-pop 0.4s ease-out;
}
@keyframes cb-badge-pop {
  0% { transform: scale(0); }
  50% { transform: scale(1.3); }
  100% { transform: scale(1); }
}

/* Sparkle / exclaim animations (for SVG elements) */
@keyframes cb-exclaim-pop {
  0% { transform: translateY(6px) scale(0); opacity: 0; }
  50% { transform: translateY(-2px) scale(1.2); opacity: 1; }
  100% { transform: translateY(0) scale(1); opacity: 1; }
}
@keyframes cb-sparkle {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}
.cb-toggle.cb-active .cb-exclaim {
  animation: cb-exclaim-pop 0.4s ease-out forwards;
}
.cb-toggle.cb-active .cb-sparkle {
  animation: cb-sparkle 1.2s ease-in-out infinite;
}

/* ── Panel ── */
.cb-panel {
  position: fixed;
  bottom: 104px;
  left: 20px;
  width: 400px;
  max-height: 78vh;
  background: var(--cb-bg);
  border: 1px solid var(--cb-border);
  border-radius: var(--cb-radius);
  box-shadow: var(--cb-shadow);
  z-index: 9998;
  display: none;
  flex-direction: column;
  overflow: hidden;
}
.cb-panel.cb-open {
  display: flex;
}

/* ── Panel Header ── */
.cb-panel-header {
  padding: 12px 16px 10px;
  border-bottom: 1px solid var(--cb-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.cb-panel-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--cb-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.cb-shortcut {
  font-size: 11px;
  color: var(--cb-muted);
  background: var(--cb-surface);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--cb-border);
  flex-shrink: 0;
}

/* ── Dual Zones ── */
.cb-zones {
  padding: 10px 12px 8px;
  border-bottom: 1px solid var(--cb-border);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.cb-zone {
  border: 1px solid var(--cb-border);
  border-radius: 8px;
  padding: 8px 10px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}
.cb-zone:hover {
  border-color: rgba(56,189,248,0.4);
  background: rgba(30,41,59,0.5);
}
.cb-zone.cb-zone-active {
  border-color: var(--cb-accent);
  background: rgba(56,189,248,0.06);
}

.cb-zone-label {
  font-size: 11px;
  color: var(--cb-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 5px;
}
.cb-zone.cb-zone-active .cb-zone-label {
  color: var(--cb-accent);
}
.cb-zone-label svg {
  width: 13px;
  height: 13px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

.cb-zone-divider {
  text-align: center;
  font-size: 11px;
  color: var(--cb-border);
  line-height: 1;
  padding: 0;
  position: relative;
}
.cb-zone-divider::before,
.cb-zone-divider::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 40%;
  height: 1px;
  background: var(--cb-border);
}
.cb-zone-divider::before { left: 0; }
.cb-zone-divider::after { right: 0; }

/* ── Input Fields ── */
.cb-input {
  width: 100%;
  box-sizing: border-box;
  background: transparent;
  border: none;
  padding: 0;
  color: var(--cb-text);
  font-size: 14px;
  outline: none;
}
.cb-input::placeholder {
  color: var(--cb-muted);
  font-style: italic;
}

/* ── Autocomplete Suggestions ── */
.cb-suggestions {
  padding: 4px 8px 8px;
  border-bottom: 1px solid var(--cb-border);
  display: none;
}
.cb-suggestions.cb-show {
  display: block;
}
.cb-suggestion {
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  color: var(--cb-text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.cb-suggestion:hover, .cb-suggestion.cb-active {
  background: var(--cb-accent-dim);
}
.cb-suggestion-symbol {
  color: var(--cb-accent);
  font-weight: 600;
  min-width: 60px;
}
.cb-suggestion-name {
  color: var(--cb-muted);
  flex: 1;
}
.cb-suggestion-cat {
  font-size: 10px;
  color: var(--cb-muted);
  text-transform: uppercase;
}

/* ── Results Area ── */
.cb-results {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  min-height: 60px;
  max-height: calc(78vh - 200px);
}
.cb-results::-webkit-scrollbar { width: 6px; }
.cb-results::-webkit-scrollbar-track { background: transparent; }
.cb-results::-webkit-scrollbar-thumb { background: var(--cb-border); border-radius: 3px; }

/* ── Welcome screen ── */
.cb-welcome {
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.cb-welcome-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 12px;
  color: var(--cb-muted);
  line-height: 1.5;
}
.cb-welcome-icon {
  font-size: 18px;
  flex-shrink: 0;
  margin-top: 1px;
}
.cb-welcome-row strong {
  color: var(--cb-text);
  display: block;
  margin-bottom: 2px;
}

/* ── Section Heading ── */
.cb-section-head {
  padding: 6px 4px 4px;
  font-size: 11px;
  color: var(--cb-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.cb-empty {
  padding: 24px 16px;
  text-align: center;
  color: var(--cb-muted);
  font-size: 13px;
  line-height: 1.6;
}
.cb-loading {
  padding: 24px 16px;
  text-align: center;
  color: var(--cb-muted);
  font-size: 13px;
}

/* ── Asset Card ── */
.cb-card {
  background: var(--cb-surface);
  border: 1px solid var(--cb-border);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}
.cb-card:hover {
  border-color: var(--cb-accent);
  background: rgba(30, 41, 59, 0.8);
}
.cb-card:last-child {
  margin-bottom: 0;
}
.cb-guide-card {
  border-left: 3px solid #818cf8;
}
.cb-guide-card:hover {
  border-left-color: #818cf8;
  border-color: #818cf8;
}

.cb-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.cb-card-symbol {
  font-weight: 700;
  color: var(--cb-accent);
  font-size: 14px;
}
.cb-card-name {
  color: var(--cb-text);
  font-size: 13px;
  margin-left: 8px;
  flex: 1;
}
.cb-card-price {
  font-weight: 600;
  color: var(--cb-text);
  font-size: 14px;
}
.cb-card-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}
.cb-badge-buy { background: rgba(34,197,94,0.2); color: var(--cb-green); }
.cb-badge-sell { background: rgba(239,68,68,0.2); color: var(--cb-red); }
.cb-badge-neutral { background: rgba(234,179,8,0.2); color: var(--cb-yellow); }
.cb-badge-category {
  background: var(--cb-accent-dim);
  color: var(--cb-accent);
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ── Card Data Grid ── */
.cb-card-data {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 12px;
  margin-top: 8px;
  font-size: 12px;
}
.cb-datum {
  display: flex;
  justify-content: space-between;
  padding: 2px 0;
  border-bottom: 1px solid rgba(51,65,85,0.5);
}
.cb-datum-label {
  color: var(--cb-muted);
}
.cb-datum-value {
  color: var(--cb-text);
  font-weight: 500;
  text-align: right;
}
.cb-datum-value.cb-positive { color: var(--cb-green); }
.cb-datum-value.cb-negative { color: var(--cb-red); }

/* ── Expand/Collapse ── */
.cb-card-expand {
  margin-top: 8px;
}
.cb-expand-btn {
  background: none;
  border: none;
  color: var(--cb-accent);
  font-size: 12px;
  cursor: pointer;
  padding: 2px 0;
}
.cb-expand-btn:hover {
  text-decoration: underline;
}
.cb-card-details {
  display: none;
  margin-top: 8px;
}
.cb-card-details.cb-show {
  display: block;
}

/* ── Responsive ── */
@media (max-width: 480px) {
  .cb-panel {
    left: 8px;
    right: 8px;
    bottom: 82px;
    width: auto;
    max-height: 80vh;
  }
  .cb-toggle {
    bottom: 14px;
    left: 14px;
    width: 64px;
    height: 64px;
  }
  .cb-toggle svg {
    width: 48px;
    height: 48px;
  }
}
