/* ================================
   TokenIntel AI Copilot Styles
   ================================ */

/* Variables - Copilot specific */
:root {
  --copilot-primary: #6366f1;
  --copilot-primary-dark: #4f46e5;
  --copilot-primary-light: #818cf8;
  --copilot-bg: #ffffff;
  --copilot-surface: #f8fafc;
  --copilot-border: #e2e8f0;
  --copilot-text: #1e293b;
  --copilot-text-secondary: #64748b;
  --copilot-text-tertiary: #94a3b8;
  --copilot-shadow: 0 10px 40px rgba(0, 0, 0, 0.12);
  --copilot-radius: 16px;
  --copilot-buy: #10b981;
  --copilot-hold: #f59e0b;
  --copilot-sell: #ef4444;
}

/* ================================
   Daily Brief Card (Dashboard)
   ================================ */
.copilot-daily-brief {
  background: var(--copilot-bg);
  border-radius: var(--copilot-radius);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--copilot-border);
  overflow: hidden;
  margin-bottom: var(--space-6);
}

.copilot-brief-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-5) var(--space-6);
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  color: white;
}

.copilot-brief-header-left {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.copilot-brief-icon {
  width: 40px;
  height: 40px;
  background: rgba(16, 185, 129, 0.15);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.copilot-brief-icon svg {
  width: 22px;
  height: 22px;
}

.copilot-brief-title {
  font-size: var(--text-lg);
  font-weight: 600;
}

.copilot-brief-date {
  font-size: var(--text-sm);
  opacity: 0.9;
}

.copilot-brief-badge {
  font-size: var(--text-xs);
  padding: var(--space-1) var(--space-2);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-full);
  font-weight: 500;
}

.copilot-brief-content {
  padding: var(--space-6);
}

/* Headline */
.copilot-brief-headline {
  font-size: var(--text-xl);
  font-weight: 600;
  color: var(--copilot-text);
  margin-bottom: var(--space-4);
  line-height: var(--leading-tight);
}

/* Market Summary */
.copilot-market-summary {
  padding: var(--space-4);
  background: var(--copilot-surface);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-4);
}

.copilot-market-regime {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-weight: 500;
  margin-bottom: var(--space-3);
}

.copilot-market-regime.risk-on {
  background: #d1fae5;
  color: #059669;
}

.copilot-market-regime.risk-off {
  background: #fee2e2;
  color: #dc2626;
}

.copilot-market-regime.neutral {
  background: #fef3c7;
  color: #d97706;
}

.copilot-market-overview {
  font-size: var(--text-sm);
  color: var(--copilot-text-secondary);
  line-height: var(--leading-relaxed);
}

/* Signal Summary */
.copilot-signal-summary {
  display: flex;
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}

.copilot-signal-stat {
  flex: 1;
  text-align: center;
  padding: var(--space-3);
  background: var(--copilot-surface);
  border-radius: var(--radius-lg);
}

.copilot-signal-stat-value {
  font-size: var(--text-2xl);
  font-weight: 700;
  line-height: 1;
}

.copilot-signal-stat-value.buy { color: var(--copilot-buy); }
.copilot-signal-stat-value.hold { color: var(--copilot-hold); }
.copilot-signal-stat-value.sell { color: var(--copilot-sell); }

.copilot-signal-stat-label {
  font-size: var(--text-xs);
  color: var(--copilot-text-tertiary);
  margin-top: var(--space-1);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Asset Highlights */
.copilot-asset-highlights {
  margin-bottom: var(--space-5);
}

.copilot-asset-highlights-title {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--copilot-text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-3);
}

.copilot-asset-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.copilot-asset-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3);
  background: var(--copilot-surface);
  border-radius: var(--radius-md);
  transition: background var(--transition-fast);
  cursor: pointer;
}

.copilot-asset-item:hover {
  background: #eef2ff;
}

.copilot-asset-symbol {
  font-weight: 600;
  color: var(--copilot-text);
  min-width: 50px;
}

.copilot-asset-signal {
  font-size: var(--text-xs);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  font-weight: 600;
  text-transform: uppercase;
}

.copilot-asset-signal.buy {
  background: #d1fae5;
  color: #059669;
}

.copilot-asset-signal.hold {
  background: #fef3c7;
  color: #d97706;
}

.copilot-asset-signal.sell {
  background: #fee2e2;
  color: #dc2626;
}

.copilot-asset-change {
  font-size: var(--text-sm);
  font-weight: 500;
  min-width: 60px;
  text-align: right;
}

.copilot-asset-change.positive { color: var(--copilot-buy); }
.copilot-asset-change.negative { color: var(--copilot-sell); }

.copilot-asset-summary {
  flex: 1;
  font-size: var(--text-sm);
  color: var(--copilot-text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Risk Monitor */
.copilot-risk-monitor {
  padding: var(--space-4);
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-5);
}

.copilot-risk-title {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  font-weight: 600;
  color: #dc2626;
  margin-bottom: var(--space-2);
}

.copilot-risk-title svg {
  width: 16px;
  height: 16px;
}

.copilot-risk-description {
  font-size: var(--text-sm);
  color: #7f1d1d;
  line-height: var(--leading-relaxed);
}

/* Actionable Insight */
.copilot-actionable-insight {
  padding: var(--space-4);
  background: linear-gradient(135deg, #eef2ff 0%, #e0e7ff 100%);
  border-radius: var(--radius-lg);
  border-left: 4px solid var(--copilot-primary);
}

.copilot-actionable-label {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--copilot-primary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-2);
}

.copilot-actionable-text {
  font-size: var(--text-sm);
  color: var(--copilot-text);
  line-height: var(--leading-relaxed);
}

/* ================================
   Compact Audio Player (in Daily Brief)
   ================================ */
.copilot-audio-player {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-4);
}

.copilot-audio-play {
  width: 36px;
  height: 36px;
  min-width: 36px;
  border-radius: 50%;
  background: var(--copilot-primary);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  transition: background 0.2s ease, transform 0.1s ease, opacity 0.2s ease;
}

.copilot-audio-play:disabled {
  opacity: 0.5;
  cursor: default;
}

.copilot-audio-play:not(:disabled):hover {
  background: var(--copilot-primary-dark);
  transform: scale(1.05);
}

.copilot-audio-play svg {
  width: 14px;
  height: 14px;
  margin-left: 2px;
}

.copilot-audio-main {
  flex: 1;
  min-width: 0;
}

.copilot-audio-waveform {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 28px;
  margin-bottom: 6px;
}

.copilot-audio-bar {
  flex: 1;
  min-width: 2px;
  background: rgba(99, 102, 241, 0.35);
  border-radius: 1px;
  transition: background 0.2s ease;
}

.copilot-audio-player:hover .copilot-audio-bar {
  background: rgba(99, 102, 241, 0.5);
}

.copilot-audio-controls {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.copilot-audio-track {
  width: 100%;
  height: 3px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 2px;
  overflow: hidden;
}

.copilot-audio-progress {
  height: 100%;
  background: var(--copilot-primary);
  border-radius: 2px;
  transition: width 0.2s ease;
}

.copilot-audio-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.copilot-audio-time {
  font-size: 10px;
  font-family: 'SF Mono', 'Fira Code', monospace;
  color: rgba(255, 255, 255, 0.5);
}

.copilot-audio-speed {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 0.7);
  font-size: 10px;
  font-weight: 700;
  font-family: 'SF Mono', 'Fira Code', monospace;
  padding: 1px 6px;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.copilot-audio-speed:hover {
  background: rgba(255, 255, 255, 0.18);
  color: rgba(255, 255, 255, 0.9);
}
.copilot-audio-speed:disabled {
  opacity: 0.3;
  cursor: default;
}

.copilot-audio-badge {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  color: rgba(255, 255, 255, 0.4);
  font-weight: 500;
}

.copilot-audio-badge svg {
  opacity: 0.6;
}

.copilot-audio-expand {
  width: 28px;
  height: 28px;
  min-width: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.4);
  border-radius: var(--radius-md);
  transition: color 0.2s ease, background 0.2s ease;
  text-decoration: none;
}

.copilot-audio-expand:hover {
  color: rgba(255, 255, 255, 0.8);
  background: rgba(255, 255, 255, 0.1);
}

.copilot-audio-expand svg {
  width: 14px;
  height: 14px;
}

/* Audio player responsive */
@media (max-width: 480px) {
  .copilot-audio-player {
    padding: var(--space-2) var(--space-3);
    gap: var(--space-2);
  }

  .copilot-audio-waveform {
    height: 20px;
  }

  .copilot-audio-expand {
    display: none;
  }
}

/* ================================
   Collapsible Daily Brief
   ================================ */
.copilot-daily-brief.collapsible {
  position: relative;
}

.copilot-daily-brief.collapsible .copilot-brief-headline {
  padding: var(--space-4) var(--space-6);
  padding-bottom: var(--space-3);
  margin-bottom: 0;
  background: var(--copilot-bg);
}

.copilot-daily-brief.collapsible.collapsed .copilot-brief-headline {
  padding-bottom: var(--space-4);
}

.copilot-daily-brief.collapsible .copilot-brief-content {
  max-height: 1000px;
  overflow: hidden;
  transition: max-height 0.3s ease, padding 0.3s ease, opacity 0.3s ease;
}

.copilot-daily-brief.collapsible .copilot-brief-content.collapsed {
  max-height: 0;
  padding-top: 0;
  padding-bottom: 0;
  opacity: 0;
}

.copilot-brief-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  width: 100%;
  padding: var(--space-3) var(--space-6);
  background: var(--copilot-surface);
  border: none;
  border-top: 1px solid var(--copilot-border);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--copilot-primary);
  cursor: pointer;
  transition: background 0.2s ease;
}

.copilot-brief-toggle:hover {
  background: #eef2ff;
}

.copilot-brief-toggle .toggle-icon {
  width: 16px;
  height: 16px;
  transition: transform 0.3s ease;
}

/* ================================
   Persistent Copilot Panel (FAB)
   ================================ */
.copilot-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--copilot-primary) 0%, var(--copilot-primary-dark) 100%);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(99, 102, 241, 0.4);
  transition: all 0.3s ease;
  z-index: 9998;
}

.copilot-fab:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 25px rgba(99, 102, 241, 0.5);
}

.copilot-fab svg {
  width: 28px;
  height: 28px;
  color: white;
  transition: transform 0.3s ease;
}

.copilot-fab.open svg {
  transform: rotate(45deg);
}

.copilot-fab-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 20px;
  height: 20px;
  background: var(--copilot-buy);
  border-radius: 50%;
  font-size: 11px;
  font-weight: 600;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid white;
}

/* ================================
   Copilot Panel
   ================================ */
.copilot-panel {
  position: fixed;
  bottom: 100px;
  right: 24px;
  width: 400px;
  max-height: 600px;
  background: var(--copilot-bg);
  border-radius: var(--copilot-radius);
  box-shadow: var(--copilot-shadow);
  display: flex;
  flex-direction: column;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px) scale(0.95);
  transition: all 0.3s ease;
  z-index: 9999;
  overflow: hidden;
}

.copilot-panel.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

/* Panel Header */
.copilot-panel-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  background: linear-gradient(135deg, var(--copilot-primary) 0%, var(--copilot-primary-dark) 100%);
  color: white;
}

.copilot-panel-icon {
  width: 36px;
  height: 36px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.copilot-panel-icon svg {
  width: 20px;
  height: 20px;
}

.copilot-panel-title {
  flex: 1;
  font-weight: 600;
  font-size: var(--text-base);
}

.copilot-panel-close {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
}

.copilot-panel-close:hover {
  background: rgba(255, 255, 255, 0.3);
}

.copilot-panel-close svg {
  width: 18px;
  height: 18px;
  color: white;
}

/* Panel Tabs */
.copilot-panel-tabs {
  display: flex;
  border-bottom: 1px solid var(--copilot-border);
  background: var(--copilot-surface);
}

.copilot-tab {
  flex: 1;
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--copilot-text-secondary);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.copilot-tab:hover {
  color: var(--copilot-text);
}

.copilot-tab.active {
  color: var(--copilot-primary);
  border-bottom-color: var(--copilot-primary);
}

.copilot-tab-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 6px;
  background: var(--copilot-primary);
  color: white;
  font-size: 11px;
  font-weight: 600;
  border-radius: var(--radius-full);
  margin-left: 6px;
}

/* Panel Content */
.copilot-panel-content {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-4);
}

.copilot-panel-content::-webkit-scrollbar {
  width: 6px;
}

.copilot-panel-content::-webkit-scrollbar-track {
  background: transparent;
}

.copilot-panel-content::-webkit-scrollbar-thumb {
  background: var(--copilot-border);
  border-radius: 3px;
}

/* Panel Tab Content */
.copilot-tab-content {
  display: none;
}

.copilot-tab-content.active {
  display: block;
}

/* ================================
   Decision Object Card
   ================================ */
.copilot-decision {
  background: var(--copilot-bg);
  border: 1px solid var(--copilot-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: var(--space-4);
}

.copilot-decision-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4);
  border-bottom: 1px solid var(--copilot-border);
}

.copilot-decision-asset {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.copilot-decision-symbol {
  font-weight: 600;
  font-size: var(--text-lg);
  color: var(--copilot-text);
}

.copilot-decision-name {
  font-size: var(--text-sm);
  color: var(--copilot-text-secondary);
}

.copilot-decision-action {
  font-size: var(--text-sm);
  font-weight: 700;
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-md);
  text-transform: uppercase;
}

.copilot-decision-action.buy,
.copilot-decision-action.accumulate {
  background: #d1fae5;
  color: #059669;
}

.copilot-decision-action.hold {
  background: #fef3c7;
  color: #d97706;
}

.copilot-decision-action.sell,
.copilot-decision-action.reduce {
  background: #fee2e2;
  color: #dc2626;
}

.copilot-decision-body {
  padding: var(--space-4);
}

/* Conviction Meter */
.copilot-conviction {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.copilot-conviction-label {
  font-size: var(--text-sm);
  color: var(--copilot-text-secondary);
}

.copilot-conviction-meter {
  flex: 1;
  height: 8px;
  background: var(--copilot-surface);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.copilot-conviction-fill {
  height: 100%;
  background: var(--copilot-primary);
  border-radius: var(--radius-full);
  transition: width 0.5s ease;
}

.copilot-conviction-score {
  font-weight: 600;
  color: var(--copilot-text);
  min-width: 30px;
  text-align: right;
}

/* Rationale */
.copilot-rationale {
  font-size: var(--text-sm);
  color: var(--copilot-text-secondary);
  line-height: var(--leading-relaxed);
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--copilot-border);
}

/* Key Levels */
.copilot-key-levels {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.copilot-level {
  padding: var(--space-3);
  background: var(--copilot-surface);
  border-radius: var(--radius-md);
}

.copilot-level-label {
  font-size: var(--text-xs);
  color: var(--copilot-text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-1);
}

.copilot-level-value {
  font-weight: 600;
  color: var(--copilot-text);
}

.copilot-level.support .copilot-level-value { color: var(--copilot-buy); }
.copilot-level.resistance .copilot-level-value { color: var(--copilot-sell); }

/* Sizing Band */
.copilot-sizing {
  padding: var(--space-3);
  background: #eef2ff;
  border-radius: var(--radius-md);
  margin-bottom: var(--space-4);
}

.copilot-sizing-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-2);
}

.copilot-sizing-label {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--copilot-primary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.copilot-sizing-value {
  font-weight: 600;
  color: var(--copilot-text);
}

.copilot-sizing-rationale {
  font-size: var(--text-xs);
  color: var(--copilot-text-secondary);
}

/* Disconfirming Evidence */
.copilot-disconfirming {
  margin-bottom: var(--space-4);
}

.copilot-disconfirming-title {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--copilot-text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-2);
}

.copilot-disconfirming-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.copilot-disconfirming-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--copilot-text-secondary);
}

.copilot-disconfirming-item::before {
  content: '!';
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  background: #fef3c7;
  color: #d97706;
  font-size: 11px;
  font-weight: 700;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 2px;
}

/* Time Horizon */
.copilot-time-horizon {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-2);
  background: var(--copilot-surface);
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  color: var(--copilot-text-secondary);
}

.copilot-time-horizon svg {
  width: 14px;
  height: 14px;
}

/* ================================
   Why Changed Section
   ================================ */
.copilot-why-changed {
  background: var(--copilot-surface);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  margin-bottom: var(--space-4);
}

.copilot-why-changed-header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

.copilot-why-changed-icon {
  width: 24px;
  height: 24px;
  background: var(--copilot-primary);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.copilot-why-changed-icon svg {
  width: 14px;
  height: 14px;
  color: white;
}

.copilot-why-changed-title {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--copilot-text);
}

.copilot-why-changed-signal-flow {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

.copilot-why-changed-signal {
  font-size: var(--text-sm);
  font-weight: 600;
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
}

.copilot-why-changed-arrow {
  color: var(--copilot-text-tertiary);
}

.copilot-why-changed-summary {
  font-size: var(--text-sm);
  color: var(--copilot-text-secondary);
  line-height: var(--leading-relaxed);
  margin-bottom: var(--space-3);
}

/* Drivers */
.copilot-drivers {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.copilot-driver {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-2);
  background: white;
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  color: var(--copilot-text);
}

.copilot-driver-impact {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.copilot-driver-impact.positive { background: var(--copilot-buy); }
.copilot-driver-impact.negative { background: var(--copilot-sell); }
.copilot-driver-impact.neutral { background: var(--copilot-hold); }

/* ================================
   Premium Teaser
   ================================ */
.copilot-premium-teaser {
  position: relative;
  padding: var(--space-6);
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  border-radius: var(--radius-lg);
  border: 1px dashed var(--copilot-border);
  text-align: center;
  overflow: hidden;
}

.copilot-premium-teaser::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 0%, rgba(255, 255, 255, 0.8) 100%);
  pointer-events: none;
}

.copilot-premium-content {
  position: relative;
  z-index: 1;
}

.copilot-premium-icon {
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, var(--copilot-primary) 0%, var(--copilot-primary-dark) 100%);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto var(--space-3);
}

.copilot-premium-icon svg {
  width: 24px;
  height: 24px;
  color: white;
}

.copilot-premium-title {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--copilot-text);
  margin-bottom: var(--space-2);
}

.copilot-premium-description {
  font-size: var(--text-sm);
  color: var(--copilot-text-secondary);
  margin-bottom: var(--space-4);
}

.copilot-premium-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  background: linear-gradient(135deg, var(--copilot-primary) 0%, var(--copilot-primary-dark) 100%);
  color: white;
  font-size: var(--text-sm);
  font-weight: 600;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.copilot-premium-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

/* ================================
   Loading States
   ================================ */
.copilot-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-8);
  gap: var(--space-3);
}

.copilot-loading-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--copilot-border);
  border-top-color: var(--copilot-primary);
  border-radius: 50%;
  animation: copilotSpin 0.8s linear infinite;
}

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

.copilot-loading-text {
  font-size: var(--text-sm);
  color: var(--copilot-text-secondary);
}

/* Skeleton Loading */
.copilot-skeleton {
  background: linear-gradient(90deg, var(--copilot-surface) 25%, #e2e8f0 50%, var(--copilot-surface) 75%);
  background-size: 200% 100%;
  animation: copilotShimmer 1.5s infinite;
  border-radius: var(--radius-md);
}

@keyframes copilotShimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.copilot-skeleton-text {
  height: 16px;
  margin-bottom: var(--space-2);
}

.copilot-skeleton-text:last-child {
  width: 60%;
}

.copilot-skeleton-heading {
  height: 24px;
  width: 70%;
  margin-bottom: var(--space-3);
}

/* ================================
   Error States
   ================================ */
.copilot-error {
  padding: var(--space-4);
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
}

.copilot-error-icon {
  width: 20px;
  height: 20px;
  color: #dc2626;
  flex-shrink: 0;
}

.copilot-error-content {
  flex: 1;
}

.copilot-error-title {
  font-size: var(--text-sm);
  font-weight: 600;
  color: #dc2626;
  margin-bottom: var(--space-1);
}

.copilot-error-message {
  font-size: var(--text-sm);
  color: #7f1d1d;
}

.copilot-error-retry {
  margin-top: var(--space-3);
  padding: var(--space-2) var(--space-4);
  background: white;
  border: 1px solid #fecaca;
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  color: #dc2626;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.copilot-error-retry:hover {
  background: #fef2f2;
}

/* ================================
   Mobile Responsive
   ================================ */
@media (max-width: 768px) {
  /* Daily Brief Card */
  .copilot-daily-brief {
    border-radius: var(--radius-lg);
  }

  .copilot-brief-header {
    padding: var(--space-4);
  }

  .copilot-brief-content {
    padding: var(--space-4);
  }

  .copilot-signal-summary {
    flex-wrap: wrap;
  }

  .copilot-signal-stat {
    min-width: 80px;
  }

  .copilot-asset-summary {
    display: none; /* Hide on mobile */
  }

  /* Panel */
  .copilot-panel {
    width: calc(100vw - 20px);
    max-height: calc(100vh - 120px);
    right: 10px;
    bottom: 90px;
    border-radius: var(--radius-lg);
  }

  .copilot-fab {
    bottom: 16px;
    right: 16px;
    width: 54px;
    height: 54px;
  }

  .copilot-fab svg {
    width: 24px;
    height: 24px;
  }

  /* Decision Object */
  .copilot-key-levels {
    grid-template-columns: 1fr;
  }
}

/* ================================
   Chat Interface
   ================================ */
.copilot-chat-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 400px;
}

.copilot-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-2);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

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

.copilot-chat-messages::-webkit-scrollbar-track {
  background: transparent;
}

.copilot-chat-messages::-webkit-scrollbar-thumb {
  background: var(--copilot-border);
  border-radius: 2px;
}

/* Welcome Message */
.copilot-chat-welcome {
  text-align: center;
  padding: var(--space-6) var(--space-4);
}

.copilot-chat-welcome-icon {
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, var(--copilot-primary) 0%, var(--copilot-primary-dark) 100%);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto var(--space-3);
}

.copilot-chat-welcome-icon svg {
  width: 24px;
  height: 24px;
  color: white;
}

.copilot-chat-welcome h3 {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--copilot-text);
  margin: 0 0 var(--space-2);
}

.copilot-chat-welcome p {
  font-size: var(--text-sm);
  color: var(--copilot-text-secondary);
  margin: 0;
  line-height: var(--leading-relaxed);
}

/* Chat Messages */
.copilot-chat-message {
  display: flex;
  gap: var(--space-2);
  animation: copilotMessageIn 0.2s ease;
}

@keyframes copilotMessageIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

.copilot-chat-message-user .copilot-chat-message-content {
  background: var(--copilot-primary);
  color: white;
  border-radius: 16px 16px 4px 16px;
  padding: var(--space-3) var(--space-4);
  max-width: 85%;
  font-size: var(--text-sm);
  line-height: var(--leading-relaxed);
}

.copilot-chat-message-assistant {
  align-items: flex-start;
}

.copilot-chat-message-avatar {
  width: 28px;
  height: 28px;
  background: linear-gradient(135deg, var(--copilot-primary) 0%, var(--copilot-primary-dark) 100%);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.copilot-chat-message-avatar svg {
  width: 16px;
  height: 16px;
  color: white;
}

.copilot-chat-message-body {
  flex: 1;
  min-width: 0;
}

.copilot-chat-message-assistant .copilot-chat-message-content {
  background: var(--copilot-surface);
  color: var(--copilot-text);
  border-radius: 4px 16px 16px 16px;
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm);
  line-height: var(--leading-relaxed);
}

.copilot-chat-message-content p {
  margin: 0 0 var(--space-2);
}

.copilot-chat-message-content p:last-child {
  margin-bottom: 0;
}

.copilot-chat-message-content ul {
  margin: var(--space-2) 0;
  padding-left: var(--space-4);
}

.copilot-chat-message-content li {
  margin-bottom: var(--space-1);
}

.copilot-chat-message-content strong {
  font-weight: 600;
}

/* Sources */
.copilot-chat-sources {
  margin-top: var(--space-2);
  padding-top: var(--space-2);
  border-top: 1px solid var(--copilot-border);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
  align-items: center;
}

.copilot-chat-sources-label {
  font-size: var(--text-xs);
  color: var(--copilot-text-tertiary);
}

.copilot-chat-source {
  font-size: var(--text-xs);
  padding: 2px 6px;
  background: white;
  border: 1px solid var(--copilot-border);
  border-radius: var(--radius-sm);
  color: var(--copilot-text-secondary);
}

/* Error Message */
.copilot-chat-message-error {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3);
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  color: #dc2626;
}

.copilot-chat-message-error svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* Typing Indicator */
.copilot-chat-typing {
  display: flex;
  gap: 4px;
  padding: var(--space-3) var(--space-4);
  background: var(--copilot-surface);
  border-radius: 4px 16px 16px 16px;
}

.copilot-chat-typing span {
  width: 8px;
  height: 8px;
  background: var(--copilot-text-tertiary);
  border-radius: 50%;
  animation: copilotTyping 1.4s ease infinite;
}

.copilot-chat-typing span:nth-child(2) {
  animation-delay: 0.2s;
}

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

@keyframes copilotTyping {
  0%, 60%, 100% {
    opacity: 0.3;
    transform: scale(0.8);
  }
  30% {
    opacity: 1;
    transform: scale(1);
  }
}

/* Input Area */
.copilot-chat-input-area {
  padding: var(--space-3);
  border-top: 1px solid var(--copilot-border);
  background: var(--copilot-bg);
}

.copilot-chat-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

.copilot-chat-suggestion {
  padding: var(--space-2) var(--space-3);
  background: var(--copilot-surface);
  border: 1px solid var(--copilot-border);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  color: var(--copilot-text);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.copilot-chat-suggestion:hover {
  background: #eef2ff;
  border-color: var(--copilot-primary);
  color: var(--copilot-primary);
}

.copilot-chat-input-wrapper {
  display: flex;
  align-items: flex-end;
  gap: var(--space-2);
  background: var(--copilot-surface);
  border: 1px solid var(--copilot-border);
  border-radius: 20px;
  padding: var(--space-2) var(--space-3);
  transition: border-color var(--transition-fast);
}

.copilot-chat-input-wrapper:focus-within {
  border-color: var(--copilot-primary);
}

.copilot-chat-input {
  flex: 1;
  border: none;
  background: transparent;
  resize: none;
  font-size: var(--text-sm);
  color: var(--copilot-text);
  line-height: 1.4;
  min-height: 20px;
  max-height: 100px;
  outline: none;
}

.copilot-chat-input::placeholder {
  color: var(--copilot-text-tertiary);
}

.copilot-chat-send {
  width: 32px;
  height: 32px;
  background: var(--copilot-primary);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.copilot-chat-send:hover {
  background: var(--copilot-primary-dark);
  transform: scale(1.05);
}

.copilot-chat-send:active {
  transform: scale(0.95);
}

.copilot-chat-send svg {
  width: 16px;
  height: 16px;
  color: white;
}

.copilot-chat-disclaimer {
  margin-top: var(--space-2);
  font-size: 10px;
  color: var(--copilot-text-tertiary);
  text-align: center;
}

/* ================================
   Copilot Nudge - New User Intro
   ================================ */

/* Pulse animation for FAB */
.copilot-fab.nudge {
  animation: copilotPulse 2s ease-in-out infinite;
}

@keyframes copilotPulse {
  0%, 100% {
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.4);
    transform: scale(1);
  }
  50% {
    box-shadow: 0 4px 30px rgba(99, 102, 241, 0.7), 0 0 0 12px rgba(99, 102, 241, 0.15);
    transform: scale(1.05);
  }
}

/* Nudge tooltip */
.copilot-nudge-tooltip {
  position: fixed;
  bottom: 95px;
  right: 24px;
  background: var(--copilot-bg);
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  max-width: 240px;
  z-index: 9997;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: all 0.3s ease;
  border: 1px solid var(--copilot-border);
}

.copilot-nudge-tooltip.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* Tooltip arrow pointing to FAB */
.copilot-nudge-tooltip::after {
  content: '';
  position: absolute;
  bottom: -8px;
  right: 24px;
  width: 16px;
  height: 16px;
  background: var(--copilot-bg);
  border: 1px solid var(--copilot-border);
  border-top: none;
  border-left: none;
  transform: rotate(45deg);
}

/* Tooltip header */
.copilot-nudge-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.copilot-nudge-icon {
  font-size: 20px;
}

.copilot-nudge-title {
  font-weight: 600;
  font-size: 15px;
  color: var(--copilot-text);
}

/* Tooltip text */
.copilot-nudge-text {
  font-size: 13px;
  color: var(--copilot-text-secondary);
  line-height: 1.4;
  margin: 0 0 12px 0;
}

/* CTA button */
.copilot-nudge-cta {
  width: 100%;
  padding: 10px 16px;
  background: linear-gradient(135deg, var(--copilot-primary) 0%, var(--copilot-primary-dark) 100%);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.copilot-nudge-cta:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

/* Dismiss button */
.copilot-nudge-dismiss {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  background: transparent;
  border: none;
  border-radius: 50%;
  font-size: 18px;
  color: var(--copilot-text-tertiary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  line-height: 1;
}

.copilot-nudge-dismiss:hover {
  background: var(--copilot-surface);
  color: var(--copilot-text);
}

/* Mobile responsive */
@media (max-width: 480px) {
  .copilot-nudge-tooltip {
    right: 16px;
    bottom: 85px;
    max-width: 200px;
    padding: 14px;
  }

  .copilot-nudge-tooltip::after {
    right: 20px;
  }
}

/* ================================
   Print Styles
   ================================ */
@media print {
  .copilot-fab,
  .copilot-panel,
  .copilot-nudge-tooltip {
    display: none !important;
  }
}
