/* Trade Chart Component Styles */

.trade-chart-wrapper {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  height: 600px;
  display: flex;
  flex-direction: column;
}

/* Chart Header */
.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-4) var(--space-6);
  border-bottom: 1px solid var(--border);
  background: var(--bg-muted);
}

.chart-controls {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.chart-symbol {
  padding: var(--space-2) var(--space-3);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  min-width: 120px;
}

.timeframe-buttons {
  display: flex;
  gap: var(--space-1);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 2px;
}

.tf-btn {
  padding: var(--space-2) var(--space-3);
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  cursor: pointer;
  transition: all var(--duration-150) var(--ease-out);
  min-width: 32px;
}

.tf-btn:hover {
  background: var(--bg-muted);
  color: var(--text-primary);
}

.tf-btn.active {
  background: var(--brand);
  color: white;
  box-shadow: var(--shadow-sm);
}

.chart-options {
  display: flex;
  gap: var(--space-4);
}

.chart-option {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  cursor: pointer;
}

.chart-option input[type="checkbox"] {
  margin: 0;
}

.chart-btn {
  padding: var(--space-2);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: var(--text-sm);
  transition: all 0.2s ease;
}

.chart-btn:hover {
  background: var(--bg-muted);
  color: var(--text-primary);
}

.chart-stats {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  font-family: monospace;
}

.ohlc-info span {
  margin-left: var(--space-2);
  color: var(--text-primary);
  font-weight: var(--font-medium);
}

.chart-info {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.price-info {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.current-price {
  font-size: var(--text-lg);
  font-weight: var(--font-bold);
  color: var(--text-primary);
}

.price-change {
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
}

.price-change.positive {
  color: var(--success);
  background: rgba(34, 197, 94, 0.1);
}

.price-change.negative {
  color: var(--error);
  background: rgba(239, 68, 68, 0.1);
}

/* Chart Container */
.chart-container {
  flex: 1;
  position: relative;
  background: var(--bg-surface);
  overflow: auto;
}

.chart-loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--bg-surface);
  z-index: 10;
}

.loading-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--brand);
  border-radius: var(--radius-full);
  animation: spin 1s linear infinite;
  margin-bottom: var(--space-4);
}

.chart-loading p {
  color: var(--text-secondary);
  font-size: var(--text-sm);
  margin: 0;
}

/* Mock Chart Styles */
.mock-chart {
  position: relative;
  width: 100%;
  height: 100%;
  background: linear-gradient(180deg, 
    rgba(var(--brand-rgb, 6, 182, 212), 0.05) 0%, 
    transparent 20%, 
    transparent 80%, 
    rgba(239, 68, 68, 0.05) 100%
  );
}

.mock-candlesticks {
  position: relative;
  height: 70%;
  width: 100%;
}

.candlestick {
  position: absolute;
  width: 3px;
  border-radius: 1px;
  bottom: 10%;
}

.candlestick.green {
  background: var(--success);
  box-shadow: 0 0 4px rgba(34, 197, 94, 0.3);
}

.candlestick.red {
  background: var(--error);
  box-shadow: 0 0 4px rgba(239, 68, 68, 0.3);
}

/* Trade Markers */
.trade-marker {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  cursor: pointer;
  z-index: 5;
  transition: transform var(--duration-150) var(--ease-out);
}

.trade-marker:hover {
  transform: scale(1.2);
}

.buy-marker {
  background: var(--success);
  border: 2px solid white;
  box-shadow: 0 0 0 2px var(--success), var(--shadow-md);
}

.sell-marker {
  border: 2px solid white;
  box-shadow: var(--shadow-md);
}

.profit-marker {
  background: var(--brand);
  box-shadow: 0 0 0 2px var(--brand), var(--shadow-md);
}

.loss-marker {
  background: var(--error);
  box-shadow: 0 0 0 2px var(--error), var(--shadow-md);
}

/* Chart Grid */
.chart-grid {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.grid-line {
  position: absolute;
  background: var(--border-light);
  opacity: 0.3;
}

.grid-line.horizontal {
  width: 100%;
  height: 1px;
}

.grid-line.vertical {
  height: 100%;
  width: 1px;
}

/* Crosshair Info */
.crosshair-info {
  position: absolute;
  top: var(--space-4);
  right: var(--space-4);
  background: rgba(0, 0, 0, 0.8);
  border-radius: var(--radius-md);
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
  color: white;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--duration-200) var(--ease-out);
}

.mock-chart:hover .crosshair-info {
  opacity: 1;
}

.price-line {
  font-weight: var(--font-bold);
  margin-bottom: var(--space-1);
}

.time-line {
  opacity: 0.7;
  font-size: var(--text-xs);
}

/* Volume Chart */
.volume-chart {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 25%;
  display: flex;
  align-items: flex-end;
  padding: 0 var(--space-2);
}

.volume-bar {
  position: absolute;
  width: 2px;
  background: rgba(var(--brand-rgb, 6, 182, 212), 0.4);
  border-radius: 1px;
  bottom: 0;
}

.volume-bar:hover {
  background: rgba(var(--brand-rgb, 6, 182, 212), 0.6);
}

/* Chart Footer */
.chart-footer {
  padding: var(--space-3) var(--space-6);
  border-top: 1px solid var(--border);
  background: var(--bg-muted);
}

.trade-markers-legend {
  display: flex;
  gap: var(--space-6);
  align-items: center;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-xs);
  color: var(--text-secondary);
}

.marker {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  border: 1px solid white;
}

.marker-buy {
  background: var(--success);
}

.marker-sell {
  background: var(--text-muted);
}

.marker-profit {
  background: var(--brand);
}

.marker-loss {
  background: var(--error);
}

/* Animations */
@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Responsive */
@media (max-width: 1024px) {
  .chart-header {
    flex-direction: column;
    gap: var(--space-4);
    align-items: stretch;
  }
  
  .chart-controls {
    flex-wrap: wrap;
  }
  
  .trade-chart-wrapper {
    height: 500px;
  }
}

@media (max-width: 768px) {
  .chart-header {
    padding: var(--space-3) var(--space-4);
  }
  
  .chart-controls {
    gap: var(--space-3);
  }
  
  .timeframe-buttons {
    gap: 0;
  }
  
  .tf-btn {
    padding: var(--space-2);
    min-width: 28px;
    font-size: 10px;
  }
  
  .chart-options {
    gap: var(--space-3);
  }
  
  .trade-markers-legend {
    gap: var(--space-4);
    flex-wrap: wrap;
  }
  
  .trade-chart-wrapper {
    height: 400px;
  }
}

/* Market Intelligence Dashboard Styles */
.market-context {
  padding: var(--space-6);
  min-height: 100%;
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
  background: var(--bg-surface);
}

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

.context-header h3 {
  margin: 0;
  color: var(--text-primary);
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
}

.context-symbol {
  background: var(--color-primary);
  color: white;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  font-weight: var(--font-medium);
  font-size: var(--text-sm);
}

.context-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-4);
}

.metric {
  background: var(--bg-muted);
  padding: var(--space-4);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

.metric .label {
  display: block;
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-bottom: var(--space-2);
}

.metric .value {
  display: block;
  font-size: var(--text-xl);
  font-weight: var(--font-bold);
  color: var(--text-primary);
}

.metric .value.positive {
  color: var(--success);
}

.metric .value.negative {
  color: var(--error);
}

.context-note {
  background: var(--bg-muted);
  padding: var(--space-4);
  border-radius: var(--radius-md);
  border-left: 4px solid var(--color-primary);
}

.context-note p {
  margin: 0 0 var(--space-2) 0;
  color: var(--text-secondary);
  font-size: var(--text-sm);
  line-height: 1.5;
}

.context-note p:last-child {
  margin-bottom: 0;
}

/* Intelligence Grid Layout */
.intel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--space-5);
  margin-bottom: var(--space-6);
}

.intel-section {
  background: var(--bg-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  transition: all var(--duration-200) var(--ease-out);
}

.intel-section:hover {
  border-color: var(--brand);
  box-shadow: var(--shadow-md);
}

.intel-section h4 {
  margin: 0 0 var(--space-4) 0;
  color: var(--text-primary);
  font-size: var(--text-base);
  font-weight: var(--font-semibold);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.intel-metrics {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.intel-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-3);
  background: var(--bg-surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
}

.intel-item .label {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  font-weight: var(--font-medium);
}

.intel-item .value {
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
  font-family: monospace;
  text-align: right;
}

.intel-item .value.positive {
  color: var(--success);
}

.intel-item .value.negative {
  color: var(--error);
}

.intel-item .value.neutral {
  color: var(--text-muted);
}

/* Intelligence Insights */
.intel-insights {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--space-4);
}

.insight-card {
  background: linear-gradient(135deg, var(--bg-muted) 0%, var(--bg-surface) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  position: relative;
  overflow: hidden;
}

.insight-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--brand) 0%, var(--color-primary) 100%);
}

.insight-card h5 {
  margin: 0 0 var(--space-3) 0;
  color: var(--text-primary);
  font-size: var(--text-base);
  font-weight: var(--font-semibold);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.insight-card p {
  margin: 0;
  color: var(--text-secondary);
  font-size: var(--text-sm);
  line-height: 1.6;
  min-height: 3em;
}

/* Intelligence Section Icons */
.intel-section h4::before {
  content: '';
  width: 16px;
  height: 16px;
  border-radius: var(--radius-sm);
}

.intel-section:nth-child(1) h4::before {
  background: linear-gradient(135deg, var(--success) 0%, #10b981 100%);
  content: '📈';
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
}

.intel-section:nth-child(2) h4::before {
  background: linear-gradient(135deg, var(--brand) 0%, #3b82f6 100%);
  content: '🎯';
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
}

.intel-section:nth-child(3) h4::before {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  content: '⚡';
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
}

.intel-section:nth-child(4) h4::before {
  background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
  content: '🧠';
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
}

/* Loading states */
.intel-item .value:empty::after {
  content: '...';
  color: var(--text-muted);
  animation: pulse 1.5s ease-in-out infinite;
}

/* Responsive Intelligence Grid */
@media (max-width: 1200px) {
  .intel-grid {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--space-4);
  }

  .intel-insights {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .market-context {
    padding: var(--space-4);
    gap: var(--space-4);
  }

  .intel-grid {
    grid-template-columns: 1fr;
    gap: var(--space-3);
  }

  .intel-section {
    padding: var(--space-4);
  }

  .intel-item {
    padding: var(--space-2);
  }

  .insight-card {
    padding: var(--space-4);
  }
}

/* Pulse animation for loading */
@keyframes pulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}

/* New Intelligence Header Styles */
.refresh-controls {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.refresh-btn {
  padding: var(--space-2) var(--space-3);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  cursor: pointer;
  transition: all var(--duration-150) var(--ease-out);
}

.refresh-btn:hover {
  background: var(--bg-muted);
  border-color: var(--brand);
}

.last-update {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.intel-title {
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.intel-status {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.status-indicator {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  background: var(--success);
  animation: pulse 2s ease-in-out infinite;
}

/* Advanced Intelligence Features */
.advanced-intelligence {
  margin-top: var(--space-6);
  padding-top: var(--space-6);
  border-top: 2px solid var(--border);
}

.alpha-dashboard-container {
  margin-bottom: var(--space-6);
}

.intelligence-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: var(--space-6);
  margin-bottom: var(--space-6);
}

.intel-feature-section {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

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

.feature-header h4 {
  margin: 0;
  color: var(--text-primary);
  font-size: var(--text-base);
  font-weight: var(--font-semibold);
}

.feature-status {
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-md);
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  background: var(--bg-surface);
  border: 1px solid var(--border);
}

.feature-status.connected {
  background: rgba(34, 197, 94, 0.1);
  border-color: rgba(34, 197, 94, 0.3);
  color: var(--success);
}

.feature-status.connecting {
  background: rgba(251, 191, 36, 0.1);
  border-color: rgba(251, 191, 36, 0.3);
  color: var(--warning);
}

.feature-status.disconnected {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.3);
  color: var(--error);
}

.feature-container {
  min-height: 300px;
  max-height: 500px;
  overflow-y: auto;
}

.feature-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 300px;
  color: var(--text-secondary);
  font-size: var(--text-sm);
}

.feature-loading:before {
  content: '';
  width: 16px;
  height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-right: var(--space-2);
}

/* Mobile responsive for advanced features */
@media (max-width: 768px) {
  .intelligence-grid {
    grid-template-columns: 1fr;
    gap: var(--space-4);
  }
  
  .feature-container {
    min-height: 250px;
    max-height: 400px;
  }
}
