/* =====================================================
   Earnings Beat - Premium Dark Theme Styles
   ===================================================== */

:root {
  /* Color Palette */
  --bg-primary: #0a0a0f;
  --bg-secondary: #12121a;
  --bg-card: #1a1a24;
  --bg-card-hover: #22222e;
  
  --text-primary: #ffffff;
  --text-secondary: #a0a0b0;
  --text-muted: #6b6b7b;
  
  --accent-primary: #6366f1;
  --accent-secondary: #818cf8;
  --accent-glow: rgba(99, 102, 241, 0.3);
  
  --success: #22c55e;
  --success-bg: rgba(34, 197, 94, 0.15);
  --warning: #f59e0b;
  --warning-bg: rgba(245, 158, 11, 0.15);
  --danger: #ef4444;
  --danger-bg: rgba(239, 68, 68, 0.15);
  
  --border-color: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(255, 255, 255, 0.15);
  
  /* Typography */
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  
  /* Spacing */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  
  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 30px var(--accent-glow);
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-family);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* App Container */
.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.header {
  background: rgba(18, 18, 26, 0.8);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

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

.logo h1 {
  font-size: 1.5rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.nav {
  display: flex;
  gap: 2rem;
}

.nav-link {
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s ease;
  position: relative;
}

.nav-link:hover,
.nav-link.active {
  color: var(--text-primary);
}

.nav-link.active::after {
  content: '';
  position: absolute;
  bottom: -1rem;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent-primary);
}

/* Main Content */
.main {
  flex: 1;
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
  width: 100%;
}

/* Search Section */
.search-section {
  margin-bottom: 3rem;
}

.search-container {
  max-width: 700px;
  margin: 0 auto;
}

.search-box {
  display: flex;
  gap: 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 0.5rem;
  transition: all 0.3s ease;
}

.search-box:focus-within {
  border-color: var(--accent-primary);
  box-shadow: var(--shadow-glow);
}

.search-box input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  padding: 1rem 1.5rem;
  font-size: 1.1rem;
  color: var(--text-primary);
}

.search-box input::placeholder {
  color: var(--text-muted);
}

.btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem 2rem;
  border: none;
  border-radius: var(--radius-lg);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  color: white;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow);
}

/* Loading State */
.loading-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 3rem;
  color: var(--text-secondary);
}

.spinner {
  width: 48px;
  height: 48px;
  border: 3px solid var(--border-color);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

.hidden {
  display: none !important;
}

/* Prediction Card */
.prediction-section {
  margin-bottom: 3rem;
}

.prediction-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 2rem;
  animation: fadeIn 0.5s ease;
}

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

.prediction-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 2rem;
}

.company-info h2 {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.ticker {
  display: inline-block;
  background: var(--bg-secondary);
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.9rem;
  margin-right: 0.5rem;
}

.period {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.prediction-badge {
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 1.25rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.prediction-badge.beat {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid var(--success);
}

.prediction-badge.miss {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid var(--danger);
}

.prediction-badge.meet {
  background: var(--warning-bg);
  color: var(--warning);
  border: 1px solid var(--warning);
}

/* Confidence Bar */
.confidence-section {
  margin-bottom: 2rem;
}

.confidence-label {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.5rem;
  font-weight: 500;
}

.confidence-bar {
  height: 12px;
  background: var(--bg-secondary);
  border-radius: 6px;
  overflow: hidden;
}

.confidence-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
  border-radius: 6px;
  transition: width 0.5s ease;
}

/* Reasoning Section */
.reasoning-section {
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  margin-bottom: 2rem;
}

.reasoning-section h3 {
  font-size: 0.9rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 0.75rem;
}

.reasoning-section p {
  color: var(--text-secondary);
  line-height: 1.7;
}

/* Data Grid */
.data-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.data-card {
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  transition: all 0.2s ease;
}

.data-card:hover {
  transform: translateY(-2px);
  background: var(--bg-card-hover);
}

.data-card-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.data-icon {
  font-size: 1.25rem;
}

.data-card-header h4 {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.data-value {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.big-number {
  font-size: 2rem;
  font-weight: 700;
}

.big-number.positive {
  color: var(--success);
}

.big-number.negative {
  color: var(--danger);
}

.data-label {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.quality-badge {
  display: inline-block;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.875rem;
  text-transform: uppercase;
}

.quality-badge.high {
  background: var(--success-bg);
  color: var(--success);
}

.quality-badge.medium {
  background: var(--warning-bg);
  color: var(--warning);
}

.quality-badge.low {
  background: var(--danger-bg);
  color: var(--danger);
}

/* Analyst Section */
.analyst-section h3 {
  font-size: 1rem;
  margin-bottom: 1rem;
  color: var(--text-secondary);
}

.analyst-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.75rem;
}

.analyst-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-secondary);
  padding: 1rem;
  border-radius: var(--radius-sm);
}

.analyst-name {
  font-weight: 500;
}

.analyst-accuracy {
  font-weight: 600;
  color: var(--accent-secondary);
}

/* Markets Section */
.markets-section {
  margin-top: 3rem;
}

.markets-section h2 {
  font-size: 1.5rem;
  margin-bottom: 1.5rem;
}

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

.market-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.market-card:hover {
  border-color: var(--accent-primary);
  transform: translateY(-2px);
}

.market-question {
  font-weight: 600;
  margin-bottom: 1rem;
  line-height: 1.4;
}

.market-meta {
  display: flex;
  justify-content: space-between;
  color: var(--text-muted);
  font-size: 0.875rem;
}

.beat-prob {
  font-weight: 600;
  color: var(--success);
}

/* Footer */
.footer {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  padding: 2rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.875rem;
}

.footer-note {
  margin-top: 0.5rem;
  font-size: 0.75rem;
}

/* Responsive */
@media (max-width: 768px) {
  .header-content {
    flex-direction: column;
    gap: 1rem;
  }

  .nav {
    gap: 1rem;
  }

  .main {
    padding: 1rem;
  }

  .search-box {
    flex-direction: column;
  }

  .btn {
    justify-content: center;
  }

  .prediction-header {
    flex-direction: column;
    gap: 1rem;
  }

  .data-grid {
    grid-template-columns: 1fr;
  }
}
