/**
 * COT Analytics Frontend Styles
 */

/* Theme Variables */
:root {
    /* Light Theme Colors */
    --primary: 222.2 84% 4.9%;
    --primary-foreground: 210 40% 98%;
    --secondary: 210 40% 96%;
    --secondary-foreground: 222.2 84% 4.9%;
    --muted: 210 40% 96%;
    --muted-foreground: 215.4 16.3% 46.9%;
    --accent: 210 40% 96%;
    --accent-foreground: 222.2 84% 4.9%;
    --destructive: 0 84.2% 60.2%;
    --destructive-foreground: 210 40% 98%;
    --border: 214.3 31.8% 91.4%;
    --input: 214.3 31.8% 91.4%;
    --ring: 222.2 84% 4.9%;
    --background: 0 0% 100%;
    --foreground: 222.2 84% 4.9%;
    --card: 0 0% 100%;
    --card-foreground: 222.2 84% 4.9%;
    --popover: 0 0% 100%;
    --popover-foreground: 222.2 84% 4.9%;
    
    /* Trading Specific Colors */
    --bullish: 142 76% 36%;
    --bearish: 0 84% 60%;
    --neutral: 45 93% 47%;
    --chart-primary: 222.2 84% 4.9%;
    --chart-secondary: 210 40% 98%;
    --gradient-primary: linear-gradient(135deg, hsl(222.2 84% 4.9%) 0%, hsl(222.2 84% 15%) 100%);
}

/* Dark Theme */
[data-theme="dark"] {
    --primary: 210 40% 98%;
    --primary-foreground: 222.2 84% 4.9%;
    --secondary: 222.2 84% 4.9%;
    --secondary-foreground: 210 40% 98%;
    --muted: 217.2 32.6% 17.5%;
    --muted-foreground: 215 20.2% 65.1%;
    --accent: 217.2 32.6% 17.5%;
    --accent-foreground: 210 40% 98%;
    --destructive: 0 62.8% 30.6%;
    --destructive-foreground: 210 40% 98%;
    --border: 217.2 32.6% 17.5%;
    --input: 217.2 32.6% 17.5%;
    --ring: 212.7 26.8% 83.9%;
    --background: 222.2 84% 4.9%;
    --foreground: 210 40% 98%;
    --card: 222.2 84% 4.9%;
    --card-foreground: 210 40% 98%;
    --popover: 222.2 84% 4.9%;
    --popover-foreground: 210 40% 98%;
    
    --bullish: 142 71% 45%;
    --bearish: 0 91% 71%;
    --neutral: 48 96% 64%;
}

/* Base Styles */
* {
    box-sizing: border-box;
}

.cot-dashboard-wrapper {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    color: hsl(var(--foreground));
    background: hsl(var(--background));
    min-height: 100vh;
}

.cot-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* Header Styles */
.cot-trading-header {
  background-color: hsl(var(--card));
  border-bottom: 1px solid hsl(var(--border));
  padding: 1.5rem 0;
}

.cot-header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.cot-header-brand h1 {
  font-size: 2rem;
  font-weight: 700;
  margin: 0 0 0.25rem 0;
  color: hsl(var(--foreground));
}

.cot-header-brand p {
  color: hsl(var(--muted-foreground));
  margin: 0;
}

.cot-header-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.cot-currency-selector {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.cot-currency-selector label {
  font-weight: 500;
  color: hsl(var(--foreground));
}

/* Form Elements */
.cot-select,
.cot-input {
  background-color: hsl(var(--background));
  border: 1px solid hsl(var(--border));
  border-radius: 0.375rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  color: hsl(var(--foreground));
  transition: border-color 0.2s ease;
}

.cot-select:focus,
.cot-input:focus {
  outline: none;
  border-color: hsl(var(--ring));
  box-shadow: 0 0 0 2px hsl(var(--ring));
}

/* Button Styles */
.cot-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.2s ease;
  cursor: pointer;
  border: none;
  padding: 0.5rem 1rem;
  text-decoration: none;
}

.cot-button-primary {
  background-color: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
}

.cot-button-primary:hover {
  background-color: hsl(var(--primary) / 0.9);
}

.cot-button-secondary {
  background-color: hsl(var(--secondary));
  color: hsl(var(--secondary-foreground));
}

.cot-button-secondary:hover {
  background-color: hsl(var(--secondary) / 0.8);
}

/* Theme Toggle */
.cot-theme-toggle {
  background: hsl(var(--secondary));
  border: 1px solid hsl(var(--border));
  border-radius: 0.375rem;
  width: 2.5rem;
  height: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.cot-theme-toggle:hover {
  background-color: hsl(var(--accent));
}

.theme-icon {
  font-size: 1.25rem;
  transition: opacity 0.2s ease;
}

[data-theme="light"] .dark-icon,
[data-theme="dark"] .light-icon {
  display: none;
}

/* Main Content */
.cot-main-content {
  padding: 2rem 0;
}

.cot-section {
  margin-bottom: 3rem;
}

.cot-section-header {
  margin-bottom: 1.5rem;
}

.cot-section-header h2 {
  font-size: 1.5rem;
  font-weight: 600;
  margin: 0 0 0.5rem 0;
  color: hsl(var(--foreground));
}

.cot-section-header p {
  color: hsl(var(--muted-foreground));
  margin: 0;
}

/* Metrics Grid */
.cot-metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
}

.cot-metric-card {
  background-color: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: 0.375rem;
  padding: 1.5rem;
}

.cot-metric-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.cot-metric-title {
  font-size: 0.875rem;
  font-weight: 500;
  color: hsl(var(--muted-foreground));
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

.cot-metric-value {
  font-size: 2rem;
  font-weight: 700;
  color: hsl(var(--foreground));
  margin-bottom: 0.5rem;
}

.cot-metric-change {
  font-size: 0.875rem;
  font-weight: 500;
}

.cot-metric-change.positive {
  color: hsl(var(--bullish));
}

.cot-metric-change.negative {
  color: hsl(var(--bearish));
}

.cot-metric-change.neutral {
  color: hsl(var(--neutral));
}

/* Date Range Controls */
.cot-date-range-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding: 1.5rem;
  background-color: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: 0.375rem;
}

.cot-form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.cot-form-group label {
  font-size: 0.875rem;
  font-weight: 500;
  color: hsl(var(--foreground));
}

/* Analysis Results */
.cot-analysis-results {
  background-color: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: 0.375rem;
  padding: 1.5rem;
}

.cot-analysis-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1rem;
}

.cot-analysis-item {
  padding: 1rem;
  background-color: hsl(var(--secondary));
  border-radius: 0.375rem;
}

.cot-analysis-label {
  font-size: 0.875rem;
  color: hsl(var(--muted-foreground));
  margin-bottom: 0.5rem;
}

.cot-analysis-value {
  font-size: 1.25rem;
  font-weight: 600;
  color: hsl(var(--foreground));
}

/* Chart Container */
.cot-chart-container {
  background-color: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: 0.375rem;
  padding: 1.5rem;
  position: relative;
  height: 400px;
}

#cot-chart {
  width: 100% !important;
  height: 100% !important;
}

/* Insights Grid */
.cot-insights-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
}

.cot-insight-card {
  background-color: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: 0.375rem;
  padding: 1.5rem;
}

.cot-insight-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: hsl(var(--foreground));
  margin-bottom: 0.75rem;
}

.cot-insight-content {
  color: hsl(var(--muted-foreground));
  line-height: 1.6;
}

/* Trading Signals Styling */
.cot-trading-signals {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.cot-signal-main {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem;
  background-color: hsl(var(--secondary));
  border-radius: 0.375rem;
}

.cot-signal-details {
  padding: 0.5rem 0;
}

.cot-analysis-points {
  margin: 0;
  padding-left: 1.25rem;
  list-style-type: disc;
}

.cot-analysis-points li {
  margin-bottom: 0.5rem;
  color: hsl(var(--foreground));
}

.cot-key-insight {
  padding: 0.75rem;
  background-color: hsl(var(--accent));
  border-radius: 0.375rem;
  border-left: 4px solid hsl(var(--primary));
}

/* Status Indicators */
.cot-status {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.75rem;
  border-radius: calc(var(--radius) - 2px);
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

.cot-status.bullish {
  background-color: hsl(var(--bullish) / 0.1);
  color: hsl(var(--bullish));
}

.cot-status.bearish {
  background-color: hsl(var(--bearish) / 0.1);
  color: hsl(var(--bearish));
}

.cot-status.neutral {
  background-color: hsl(var(--neutral) / 0.1);
  color: hsl(var(--neutral));
}

.cot-status.mixed {
  background-color: hsl(var(--neutral) / 0.1);
  color: hsl(var(--neutral));
}

/* Loading States */
.cot-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  color: hsl(var(--muted-foreground));
}

.cot-spinner {
  width: 2rem;
  height: 2rem;
  border: 2px solid hsl(var(--border));
  border-top: 2px solid hsl(var(--primary));
  border-radius: 50%;
  animation: cot-spin 1s linear infinite;
  margin-right: 0.75rem;
}

@keyframes cot-spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Responsive Design */
@media (max-width: 768px) {
  .cot-container {
    padding: 0 1rem;
  }
  
  .cot-header-content {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .cot-header-controls {
    width: 100%;
    justify-content: space-between;
  }
  
  .cot-date-range-controls {
    flex-direction: column;
  }
  
  .cot-metrics-grid {
    grid-template-columns: 1fr;
  }
  
  .cot-insights-grid {
    grid-template-columns: 1fr;
  }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Focus visible styles */
.cot-button:focus-visible,
.cot-select:focus-visible,
.cot-input:focus-visible {
  outline: 2px solid hsl(var(--ring));
  outline-offset: 2px;
}