/* ═══════════════════════════════════════════════════════════════════════════
   CryptoGenie — styles.css
   Dark glassmorphism aesthetic. All components defined here.
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Reset & Base ──────────────────────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg-base: #060a10;
  --bg-surface: #0c1017;
  --bg-glass: rgba(12, 16, 23, 0.78);
  --border: rgba(255, 255, 255, 0.06);
  --border-glow: rgba(6, 182, 212, 0.25);
  --accent: #06b6d4;
  --accent-glow: rgba(6, 182, 212, 0.35);
  --accent-2: #14b8a6;
  --text: #f0f4f8;
  --muted: #7a8ba0;
  --green: #10b981;
  --red: #ef4444;
  --blue: #3b82f6;
  --purple: #8b5cf6;
  --orange: #f97316;
  --radius: 18px;
  --radius-sm: 12px;
  font-family: 'Inter', system-ui, sans-serif;
}

body {
  background: var(--bg-base);
  color: var(--text);
  min-height: 100vh;
  background-image:
    radial-gradient(ellipse at 10% 5%, rgba(6, 182, 212, 0.06) 0%, transparent 55%),
    radial-gradient(ellipse at 90% 90%, rgba(139, 92, 246, 0.04) 0%, transparent 55%),
    radial-gradient(ellipse at 50% 50%, rgba(20, 184, 166, 0.02) 0%, transparent 70%);
}

/* ── Animations ────────────────────────────────────────────────────────────── */
@keyframes fadeSlideUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes shimmerGlow {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

@keyframes pricePulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.04); }
  100% { transform: scale(1); }
}

.animate-in {
  animation: fadeSlideUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  opacity: 0;
}

.animate-in-d1 { animation-delay: 0.05s; }
.animate-in-d2 { animation-delay: 0.1s; }
.animate-in-d3 { animation-delay: 0.15s; }
.animate-in-d4 { animation-delay: 0.2s; }
.animate-in-d5 { animation-delay: 0.25s; }

/* ── Glass Card ────────────────────────────────────────────────────────────── */
.glass-card {
  background: var(--bg-glass);
  backdrop-filter: blur(24px) saturate(1.2);
  -webkit-backdrop-filter: blur(24px) saturate(1.2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow:
    0 4px 24px rgba(0, 0, 0, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
  transition: border-color 0.35s ease, box-shadow 0.35s ease, transform 0.35s ease;
}

.glass-card:hover {
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow:
    0 8px 40px rgba(0, 0, 0, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

/* ══════════════════════════════════════════════════════════════════════════════
   TOP BAR
   ══════════════════════════════════════════════════════════════════════════════ */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .75rem;
  padding: 0.85rem 2rem;
  background: rgba(6, 10, 16, 0.92);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(24px) saturate(1.3);
  position: sticky;
  top: 0;
  z-index: 40;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: .5rem;
}

.topbar-logo {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  box-shadow: 0 0 12px rgba(6, 182, 212, 0.2);
}

.topbar-name {
  font-size: 1.25rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -.5px;
}

.topbar-tagline {
  font-size: .6rem;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--accent);
  background: rgba(6, 182, 212, 0.08);
  padding: .2rem .6rem;
  border-radius: 20px;
  border: 1px solid rgba(6, 182, 212, 0.15);
}

/* Coin selector */
.topbar-center {
  display: flex;
  align-items: center;
}

.coin-selector-wrap {
  display: flex;
  gap: .3rem;
  background: rgba(255, 255, 255, .03);
  border-radius: 40px;
  padding: .25rem;
  border: 1px solid var(--border);
}

.coin-btn {
  padding: .4rem 1rem;
  border-radius: 30px;
  font-size: .82rem;
  font-weight: 600;
  cursor: pointer;
  background: transparent;
  border: none;
  color: var(--muted);
  transition: all .25s ease;
  white-space: nowrap;
}

.coin-btn:hover {
  color: var(--text);
  background: rgba(255, 255, 255, .06);
}

.coin-btn.active {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #000;
  font-weight: 700;
  box-shadow: 0 0 24px var(--accent-glow), 0 2px 8px rgba(6, 182, 212, 0.2);
}

/* Live price */
.topbar-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.live-price-wrap {
  display: flex;
  align-items: center;
  gap: .6rem;
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
  flex-shrink: 0;
  transition: all 0.3s;
}

.live-dot--active {
  background: var(--green);
  box-shadow: 0 0 10px var(--green), 0 0 20px rgba(16, 185, 129, 0.2);
  animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: .35; }
}

.live-price-label {
  font-size: .7rem;
  color: var(--muted);
  font-weight: 500;
  letter-spacing: .03em;
}

.live-price-value {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -.03em;
  transition: color .3s, transform .2s;
}

.price-up {
  color: var(--green);
  animation: pricePulse 0.4s ease;
}

.price-down {
  color: var(--red);
  animation: pricePulse 0.4s ease;
}

/* Timezone & Forecast Stamps */
.forecast-stamp {
  font-size: .72rem;
  color: var(--muted);
  background: rgba(255, 255, 255, .03);
  padding: .3rem .65rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: .35rem;
}

.tz-select {
  background: transparent;
  color: var(--muted);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  padding: .15rem .3rem;
  font-size: .7rem;
  font-family: inherit;
  outline: none;
  cursor: pointer;
  transition: border-color 0.2s;
}

.tz-select:focus {
  border-color: var(--accent);
}

.tz-select option {
  background: #111;
  color: var(--text);
}

.tz-clock {
  font-family: 'Inter', monospace;
  font-weight: 600;
  font-size: .72rem;
  color: var(--accent);
  letter-spacing: .02em;
}

/* ══════════════════════════════════════════════════════════════════════════════
   MAIN LAYOUT
   ══════════════════════════════════════════════════════════════════════════════ */
.main-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 1.25rem;
  padding: 1.25rem 1.5rem;
  max-width: 1600px;
  margin: 0 auto;
}

@media (max-width: 1024px) {
  .main-layout {
    grid-template-columns: 1fr;
  }
}

.left-col {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  min-width: 0;
}

.right-col {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* ══════════════════════════════════════════════════════════════════════════════
   CHART CARD
   ══════════════════════════════════════════════════════════════════════════════ */
.chart-card {
  padding: 1.5rem;
  position: relative;
  overflow: hidden;
}

.chart-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent-glow), transparent);
  opacity: 0;
  transition: opacity 0.4s;
}

.chart-card:hover::before {
  opacity: 1;
}

.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: .75rem;
  margin-bottom: 1rem;
}

.chart-title {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -.02em;
}

.chart-subtitle {
  font-size: .75rem;
  color: var(--muted);
  margin-top: .25rem;
}

.chart-header-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.chart-legend {
  display: flex;
  align-items: center;
  gap: .85rem;
  flex-shrink: 0;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: .35rem;
  font-size: .72rem;
  color: var(--muted);
}

.legend-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}

.legend-band {
  width: 18px;
  height: 9px;
  flex-shrink: 0;
  background: rgba(6, 182, 212, .18);
  border-radius: 3px;
  border-top: 1px solid rgba(6, 182, 212, .45);
  border-bottom: 1px solid rgba(6, 182, 212, .45);
}

/* Accuracy Button */
/* Accuracy Button */
.accuracy-btn {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .45rem 1.1rem;
  border-radius: 12px;
  font-size: .82rem;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid rgba(167, 139, 250, 0.3);
  background: linear-gradient(180deg, rgba(139, 92, 246, 0.15), rgba(139, 92, 246, 0.05));
  color: #e2e8f0;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
  box-shadow: 0 0 12px rgba(139, 92, 246, 0.1);
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

.accuracy-btn:hover {
  border-color: rgba(167, 139, 250, 0.6);
  color: #ffffff;
  background: linear-gradient(180deg, rgba(139, 92, 246, 0.25), rgba(139, 92, 246, 0.1));
  box-shadow: 0 0 20px rgba(139, 92, 246, 0.25);
  transform: translateY(-1px);
}

.accuracy-btn:active {
  transform: translateY(1px);
}

.accuracy-btn.active {
  border-color: rgba(167, 139, 250, 0.8);
  color: #fff;
  background: linear-gradient(180deg, rgba(139, 92, 246, 0.3), rgba(139, 92, 246, 0.15));
  box-shadow: 0 0 24px rgba(139, 92, 246, 0.4), inset 0 0 10px rgba(167, 139, 250, 0.2);
  animation: pulsePurple 2s infinite;
}

@keyframes pulsePurple {
  0% { box-shadow: 0 0 15px rgba(139, 92, 246, 0.3), inset 0 0 10px rgba(167, 139, 250, 0.2); }
  50% { box-shadow: 0 0 25px rgba(139, 92, 246, 0.6), inset 0 0 10px rgba(167, 139, 250, 0.2); }
  100% { box-shadow: 0 0 15px rgba(139, 92, 246, 0.3), inset 0 0 10px rgba(167, 139, 250, 0.2); }
}

.chart-container {
  height: 520px;
  position: relative;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: rgba(0, 0, 0, .3);
  border: 1px solid rgba(255, 255, 255, 0.03);
}

.chart-loading,
.chart-error {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .75rem;
  color: var(--muted);
  font-size: .9rem;
}

.chart-disclaimer {
  margin-top: .85rem;
  font-size: .72rem;
  color: var(--muted);
  padding: .5rem .75rem;
  border-radius: 8px;
  background: rgba(255, 255, 255, .02);
  border: 1px solid var(--border);
  line-height: 1.5;
}

/* ── Accuracy Stats Overlay ──────────────────────────────────────────────── */
.accuracy-stats {
  margin-top: 0.85rem;
  padding: 1rem 1.2rem;
  border-radius: var(--radius-sm);
  background: rgba(139, 92, 246, 0.06);
  border: 1px solid rgba(139, 92, 246, 0.18);
  animation: fadeSlideUp 0.35s ease forwards;
}

.accuracy-stats-title {
  font-size: .82rem;
  font-weight: 700;
  color: #c4b5fd;
  margin-bottom: .75rem;
  display: flex;
  align-items: center;
  gap: .4rem;
}

.accuracy-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: .6rem;
}

.accuracy-stat {
  text-align: center;
  padding: .65rem .5rem;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
}

.accuracy-stat-value {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -.03em;
  margin-bottom: .15rem;
}

.accuracy-stat-label {
  font-size: .68rem;
  color: var(--muted);
  font-weight: 500;
}

/* Spinner */
.spinner {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 3px solid rgba(6, 182, 212, .12);
  border-top-color: var(--accent);
  animation: spin 0.8s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ══════════════════════════════════════════════════════════════════════════════
   INTELLIGENCE GRID
   ══════════════════════════════════════════════════════════════════════════════ */
.intel-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

@media (max-width: 640px) {
  .intel-grid {
    grid-template-columns: 1fr;
  }
}

.span-2 {
  grid-column: span 2;
}

@media (max-width: 640px) {
  .span-2 {
    grid-column: span 1;
  }
}

.intel-card {
  padding: 1.3rem;
}

.intel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: .85rem;
}

.intel-title {
  font-size: 1rem;
  font-weight: 700;
}

.intel-subtitle {
  font-size: .9rem;
  font-weight: 600;
  margin-bottom: .85rem;
  color: var(--muted);
}

.intel-summary {
  font-size: .88rem;
  line-height: 1.65;
  color: var(--text);
}

/* Sentiment badge */
.sentiment-badge {
  font-size: .72rem;
  font-weight: 700;
  padding: .3rem .8rem;
  border-radius: 20px;
  letter-spacing: .06em;
}

.badge-bull {
  background: rgba(16, 185, 129, .12);
  color: var(--green);
  border: 1px solid rgba(16, 185, 129, .25);
}

.badge-bear {
  background: rgba(239, 68, 68, .12);
  color: var(--red);
  border: 1px solid rgba(239, 68, 68, .25);
}

.badge-neu {
  background: rgba(148, 163, 184, .08);
  color: var(--muted);
  border: 1px solid rgba(148, 163, 184, .15);
}

/* Confidence bar */
.confidence-wrap {
  margin-top: 1.1rem;
}

.confidence-label {
  display: flex;
  justify-content: space-between;
  font-size: .8rem;
  color: var(--muted);
  margin-bottom: .4rem;
}

.progress-track {
  background: rgba(255, 255, 255, .06);
  border-radius: 10px;
  height: 6px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 10px;
  background: linear-gradient(90deg, var(--accent), #a78bfa);
  transition: width .6s ease;
  box-shadow: 0 0 12px var(--accent-glow);
}

/* Stat Boxes */
.stat-box {
  padding: 1.4rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .35rem;
}

.stat-icon {
  font-size: 1.5rem;
}

.stat-label {
  font-size: .75rem;
  color: var(--muted);
  font-weight: 500;
}

.stat-value {
  font-size: 2.1rem;
  font-weight: 800;
  letter-spacing: -.04em;
  background: linear-gradient(135deg, var(--text), var(--muted));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.stat-value.text-green-400 {
  background: linear-gradient(135deg, #34d399, #10b981);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.stat-value.text-red-400 {
  background: linear-gradient(135deg, #f87171, #ef4444);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.stat-value.text-orange-400 {
  background: linear-gradient(135deg, #fb923c, #f97316);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.stat-sub {
  font-size: .68rem;
  color: var(--muted);
}

/* Risk */
.risk-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: .6rem;
}

.risk-label {
  font-size: .82rem;
  color: var(--muted);
}

.risk-badge {
  font-size: .72rem;
  font-weight: 700;
  padding: .2rem .6rem;
  border-radius: 20px;
  letter-spacing: .05em;
}

.risk-high {
  background: rgba(239, 68, 68, .12);
  color: var(--red);
  border: 1px solid rgba(239, 68, 68, .25);
}

.risk-medium {
  background: rgba(251, 191, 36, .12);
  color: #fbbf24;
  border: 1px solid rgba(251, 191, 36, .25);
}

.risk-low {
  background: rgba(16, 185, 129, .12);
  color: var(--green);
  border: 1px solid rgba(16, 185, 129, .25);
}

.risk-rationale {
  font-size: .78rem;
  color: var(--muted);
  line-height: 1.5;
  margin-top: .5rem;
}

/* Key Levels */
.levels-section {
  margin-bottom: .75rem;
}

.levels-label {
  font-size: .75rem;
  color: var(--muted);
  margin-bottom: .4rem;
  font-weight: 500;
}

.levels-pills {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
}

.level-pill {
  font-size: .75rem;
  font-weight: 600;
  padding: .25rem .65rem;
  border-radius: 20px;
}

.support-pill {
  background: rgba(16, 185, 129, .1);
  color: var(--green);
  border: 1px solid rgba(16, 185, 129, .2);
}

.resist-pill {
  background: rgba(239, 68, 68, .1);
  color: var(--red);
  border: 1px solid rgba(239, 68, 68, .2);
}

/* Catalysts */
.catalysts-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: .5rem;
}

.catalyst-item {
  font-size: .83rem;
  color: var(--text);
  padding: .6rem .85rem;
  background: rgba(255, 255, 255, .02);
  border-radius: 10px;
  border-left: 3px solid var(--accent);
  line-height: 1.55;
  transition: background 0.2s;
}

.catalyst-item:hover {
  background: rgba(255, 255, 255, .04);
}

/* No Data */
.no-data-card {
  padding: 3rem 2rem;
  text-align: center;
}

.no-data-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.no-data-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: .5rem;
}

.no-data-sub {
  font-size: .85rem;
  color: var(--muted);
}



/* ══════════════════════════════════════════════════════════════════════════════
   AI CHAT WIDGET
   ══════════════════════════════════════════════════════════════════════════════ */
.chat-widget {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: .75rem;
}

.chat-trigger {
  display: flex;
  align-items: center;
  gap: .5rem;
  background: linear-gradient(135deg, #0e7490, #0891b2);
  color: #fff;
  border: none;
  border-radius: 50px;
  padding: .7rem 1.2rem;
  cursor: pointer;
  font-size: .88rem;
  font-weight: 700;
  box-shadow: 0 4px 28px rgba(6, 182, 212, 0.35);
  transition: all .25s ease;
}

.chat-trigger:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 8px 36px rgba(6, 182, 212, 0.45);
}

.chat-trigger:active {
  transform: translateY(0) scale(0.98);
}

.chat-trigger-icon {
  font-size: 1.1rem;
}

.chat-drawer {
  width: 400px;
  height: 540px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(6, 182, 212, 0.2);
  box-shadow: 0 12px 56px rgba(0, 0, 0, .65);
}

@media (max-width: 480px) {
  .chat-drawer {
    width: calc(100vw - 2rem);
  }
}

.chat-drawer-header {
  padding: .9rem 1.1rem;
  border-bottom: 1px solid var(--border);
  background: rgba(6, 182, 212, .05);
  flex-shrink: 0;
}

.chat-drawer-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: .9rem;
  font-weight: 700;
}

.chat-context-badge {
  font-size: .68rem;
  background: rgba(249, 115, 22, .1);
  color: var(--orange);
  border: 1px solid rgba(249, 115, 22, .2);
  padding: .2rem .55rem;
  border-radius: 12px;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: .9rem;
  display: flex;
  flex-direction: column;
  gap: .6rem;
  scroll-behavior: smooth;
}

.chat-messages::-webkit-scrollbar {
  width: 4px;
}

.chat-messages::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 2px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.15);
}

.chat-msg {
  display: flex;
}

.chat-msg--user {
  justify-content: flex-end;
}

.chat-msg--assistant {
  justify-content: flex-start;
}

.chat-msg-bubble {
  max-width: 85%;
  padding: .6rem .85rem;
  border-radius: 14px;
  font-size: .84rem;
  line-height: 1.55;
}

.chat-msg--user .chat-msg-bubble {
  background: linear-gradient(135deg, #0e7490, #0891b2);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.chat-msg--assistant .chat-msg-bubble {
  background: rgba(255, 255, 255, .05);
  border: 1px solid var(--border);
  color: var(--text);
  border-bottom-left-radius: 4px;
}

/* Thinking dots */
.chat-thinking {
  display: flex;
  gap: .35rem;
  align-items: center;
  padding: .6rem .85rem;
}

.chat-thinking span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted);
  display: inline-block;
  animation: bounce-dot .9s ease-in-out infinite;
}

.chat-thinking span:nth-child(2) {
  animation-delay: .15s;
}

.chat-thinking span:nth-child(3) {
  animation-delay: .3s;
}

@keyframes bounce-dot {
  0%, 80%, 100% {
    transform: scale(.8);
    opacity: .4;
  }
  40% {
    transform: scale(1.1);
    opacity: 1;
  }
}

.chat-input-wrap {
  display: flex;
  align-items: flex-end;
  gap: .5rem;
  padding: .75rem;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.chat-input {
  flex: 1;
  background: rgba(255, 255, 255, .04);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  font-size: .84rem;
  padding: .55rem .75rem;
  font-family: inherit;
  resize: none;
  transition: border-color .25s;
}

.chat-input:focus {
  outline: none;
  border-color: rgba(6, 182, 212, .4);
}

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

.chat-send-btn {
  background: linear-gradient(135deg, #0e7490, #0891b2);
  color: #fff;
  border: none;
  border-radius: 12px;
  width: 38px;
  height: 38px;
  cursor: pointer;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all .2s;
}

.chat-send-btn:hover:not(:disabled) {
  transform: scale(1.08);
  box-shadow: 0 0 16px rgba(6, 182, 212, 0.3);
}

.chat-send-btn:active:not(:disabled) {
  transform: scale(0.95);
}

.chat-send-btn:disabled {
  opacity: .4;
  cursor: not-allowed;
}

.chat-footer-note {
  text-align: center;
  font-size: .62rem;
  color: var(--muted);
  padding: .3rem 0 .5rem;
  flex-shrink: 0;
}

/* Markdown Styles inside Chat Bubbles */
.markdown-body p {
  margin-bottom: 0.5rem;
}

.markdown-body p:last-child {
  margin-bottom: 0;
}

.markdown-body strong {
  font-weight: 600;
  color: #e2e8f0;
}

.markdown-body ul {
  list-style-type: disc;
  margin-left: 1.25rem;
  margin-bottom: 0.5rem;
}

.markdown-body ol {
  list-style-type: decimal;
  margin-left: 1.25rem;
  margin-bottom: 0.5rem;
}

.markdown-body li {
  margin-bottom: 0.25rem;
}

.markdown-body em {
  font-style: italic;
  opacity: 0.9;
}

/* ══════════════════════════════════════════════════════════════════════════════
   HISTORY SIDEBAR
   ══════════════════════════════════════════════════════════════════════════════ */
.history-card {
  padding: 1.3rem;
  height: fit-content;
  position: sticky;
  top: 80px;
}

.history-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: .2rem;
}

.history-sub {
  font-size: .72rem;
  color: var(--muted);
  margin-bottom: 1rem;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: .5rem;
  max-height: 70vh;
  overflow-y: auto;
}

.history-list::-webkit-scrollbar {
  width: 4px;
}

.history-list::-webkit-scrollbar-track {
  background: transparent;
}

.history-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.06);
  border-radius: 4px;
}

.history-list::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.12);
}

.history-empty {
  font-size: .82rem;
  color: var(--muted);
  text-align: center;
  padding: 1.5rem 0;
}

.history-entry {
  background: rgba(255, 255, 255, .02);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .7rem .85rem;
  transition: all .25s ease;
}

.history-entry:hover {
  border-color: rgba(6, 182, 212, 0.3);
  background: rgba(6, 182, 212, 0.04);
}

.history-entry--latest {
  border-color: rgba(6, 182, 212, .25);
  background: rgba(6, 182, 212, .04);
}

.history-date {
  font-size: .7rem;
  color: var(--muted);
  margin-bottom: .3rem;
}

.history-stats {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: .2rem;
}

.history-sentiment {
  font-size: .78rem;
  font-weight: 700;
}

.history-conf {
  font-size: .7rem;
  color: var(--muted);
}

.history-price {
  font-size: .76rem;
  color: var(--text);
}

.history-upside {
  font-size: .76rem;
  font-weight: 600;
}

/* Back to Live button */
.review-exit-btn {
  width: 100%;
  padding: .5rem;
  background: rgba(249, 115, 22, 0.1);
  border: 1px solid rgba(249, 115, 22, 0.3);
  color: var(--orange);
  border-radius: 10px;
  cursor: pointer;
  font-weight: 600;
  font-size: .82rem;
  transition: all 0.25s;
  margin-bottom: 1rem;
  font-family: inherit;
}

.review-exit-btn:hover {
  background: rgba(249, 115, 22, 0.18);
  box-shadow: 0 0 16px rgba(249, 115, 22, 0.15);
}

/* ══════════════════════════════════════════════════════════════════════════════
   RESPONSIVE — TABLET (≤ 1024px)
   ══════════════════════════════════════════════════════════════════════════════ */
@media (max-width: 1024px) {
  .main-layout {
    grid-template-columns: 1fr;
    padding: 1rem;
  }

  .topbar {
    padding: 0.75rem 1rem;
  }

  .chart-container {
    height: 420px;
  }

  .history-card {
    position: static;
  }
}

/* ══════════════════════════════════════════════════════════════════════════════
   RESPONSIVE — MOBILE (≤ 768px)
   ══════════════════════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  /* ── Top Bar ──────────────────────────────────────────────────────────── */
  .topbar {
    flex-wrap: wrap;
    padding: 0.6rem 0.75rem;
    gap: 0.5rem;
  }

  .topbar-brand {
    order: 1;
  }

  .topbar-center {
    order: 3;
    width: 100%;
    justify-content: center;
  }

  .topbar-right {
    order: 2;
    gap: 0.5rem;
    margin-left: auto;
    flex-wrap: wrap;
  }

  .topbar-name {
    font-size: 1.05rem;
  }

  .topbar-logo {
    width: 28px;
    height: 28px;
  }

  .coin-selector-wrap {
    width: 100%;
    justify-content: center;
  }

  .coin-btn {
    flex: 1;
    text-align: center;
    padding: .4rem .5rem;
    font-size: .78rem;
  }

  .live-price-value {
    font-size: 1rem;
  }

  .forecast-stamp {
    font-size: .65rem;
    padding: .25rem .5rem;
  }

  /* ── Main Layout ──────────────────────────────────────────────────────── */
  .main-layout {
    padding: 0.75rem;
    gap: 1rem;
  }

  /* ── Chart ────────────────────────────────────────────────────────────── */
  .chart-card {
    padding: 1rem;
    border-radius: 14px;
  }

  .chart-header {
    flex-direction: column;
    gap: 0.6rem;
    margin-bottom: 0.75rem;
  }

  .chart-header-right {
    width: 100%;
    justify-content: space-between;
  }

  .chart-title {
    font-size: 1rem;
  }

  .chart-subtitle {
    font-size: .68rem;
  }

  .chart-container {
    height: 320px;
    border-radius: 10px;
  }

  .chart-legend {
    gap: 0.5rem;
  }

  .legend-item {
    font-size: .65rem;
  }

  .accuracy-btn {
    font-size: .68rem;
    padding: .3rem .6rem;
  }

  /* ── Accuracy Stats ───────────────────────────────────────────────────── */
  .accuracy-stats {
    padding: 0.75rem;
  }

  .accuracy-stats-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
  }

  .accuracy-stat-value {
    font-size: 1.1rem;
  }

  .accuracy-stat-label {
    font-size: .6rem;
  }

  /* ── Intel Grid ───────────────────────────────────────────────────────── */
  .intel-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .span-2 {
    grid-column: span 1;
  }

  .intel-card {
    padding: 1rem;
    border-radius: 14px;
  }

  .stat-box {
    padding: 1rem;
    border-radius: 14px;
  }

  .stat-value {
    font-size: 1.6rem;
  }

  .stat-icon {
    font-size: 1.3rem;
  }

  /* ── Glass Card ───────────────────────────────────────────────────────── */
  .glass-card {
    border-radius: 14px;
  }

  /* ── History Sidebar ──────────────────────────────────────────────────── */
  .history-card {
    position: static;
    border-radius: 14px;
  }

  .history-list {
    max-height: 50vh;
  }

  /* ── Chat Widget ──────────────────────────────────────────────────────── */
  .chat-widget {
    bottom: 0.75rem;
    right: 0.75rem;
  }

  .chat-drawer {
    width: calc(100vw - 1.5rem);
    height: 480px;
    border-radius: 14px;
  }

  .chat-trigger {
    padding: .6rem 1rem;
    font-size: .82rem;
  }
}

/* ══════════════════════════════════════════════════════════════════════════════
   RESPONSIVE — SMALL MOBILE (≤ 480px)
   ══════════════════════════════════════════════════════════════════════════════ */
@media (max-width: 480px) {
  .topbar {
    padding: 0.5rem 0.6rem;
    gap: 0.4rem;
  }

  .topbar-tagline {
    display: none;
  }

  .topbar-right {
    width: 100%;
    justify-content: space-between;
    order: 3;
  }

  .topbar-center {
    order: 2;
  }

  .live-price-value {
    font-size: .92rem;
  }

  .live-price-label {
    font-size: .62rem;
  }

  /* Hide timezone on very small screens — auto is fine */
  .forecast-stamp:first-of-type {
    display: none;
  }

  .main-layout {
    padding: 0.5rem;
    gap: 0.75rem;
  }

  .chart-card {
    padding: 0.75rem;
    border-radius: 12px;
  }

  .chart-container {
    height: 260px;
    border-radius: 8px;
  }

  .chart-title {
    font-size: .9rem;
  }

  .chart-subtitle {
    font-size: .62rem;
  }

  .chart-legend {
    display: none;
  }

  .chart-header-right {
    justify-content: flex-end;
  }

  .accuracy-stats-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 0.4rem;
  }

  .accuracy-stat {
    padding: .5rem .3rem;
  }

  .accuracy-stat-value {
    font-size: 1rem;
  }

  .intel-card {
    padding: 0.85rem;
    border-radius: 12px;
  }

  .stat-box {
    padding: 0.85rem;
    border-radius: 12px;
  }

  .stat-value {
    font-size: 1.4rem;
  }

  .level-pill {
    font-size: .68rem;
    padding: .2rem .5rem;
  }

  .glass-card {
    border-radius: 12px;
  }

  .history-card {
    padding: 1rem;
    border-radius: 12px;
  }

  .history-entry {
    padding: .6rem .7rem;
  }

  .chat-drawer {
    width: calc(100vw - 1rem);
    height: 70vh;
    border-radius: 12px;
  }

  .chat-widget {
    bottom: 0.5rem;
    right: 0.5rem;
  }

  .chat-trigger {
    padding: .5rem .85rem;
    font-size: .78rem;
    border-radius: 40px;
  }

  .chat-trigger-label {
    display: none;
  }

  .chat-msg-bubble {
    max-width: 90%;
    font-size: .8rem;
  }
}
