* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --secondary: #8b5cf6;
  --danger: #ef4444;
  --success: #10b981;
  --bg: #0f172a;
  --bg-light: #1e293b;
  --border: #334155;
  --text: #f1f5f9;
  --text-dim: #cbd5e1;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px;
}

/* Header */
.header {
  text-align: center;
  margin-bottom: 40px;
  padding-bottom: 24px;
  border-bottom: 2px solid var(--border);
}

.header h1 {
  font-size: 3rem;
  margin-bottom: 8px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.header .subtitle {
  font-size: 1.1rem;
  color: var(--text-dim);
}

/* Control Panel */
.control-panel {
  display: flex;
  gap: 12px;
  justify-content: center;
  align-items: center;
  margin-bottom: 32px;
  flex-wrap: wrap;
}

.btn {
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:hover {
  background: var(--primary-dark);
  transform: translateY(-2px);
  box-shadow: 0 8px 16px rgba(99, 102, 241, 0.3);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-secondary {
  background: var(--bg-light);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--border);
  border-color: var(--primary);
}

.scan-status {
  font-size: 0.95rem;
  color: var(--text-dim);
  min-height: 24px;
}

.scan-status.loading {
  color: var(--primary);
  animation: pulse 2s infinite;
}

.scan-status.success {
  color: var(--success);
}

.scan-status.error {
  color: var(--danger);
}

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

/* Stats Panel */
.stats-panel {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--bg-light);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  text-align: center;
  transition: all 0.3s ease;
}

.stat-card:hover {
  border-color: var(--primary);
  transform: translateY(-4px);
}

.stat-value {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 8px;
}

.stat-label {
  font-size: 0.9rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Tabs */
.tabs {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border);
}

.tab-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  padding: 12px 16px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  transition: all 0.3s ease;
  position: relative;
  bottom: -1px;
}

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

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

/* Tab Content */
.tab-content {
  display: none;
  animation: fadeIn 0.3s ease;
}

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

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.tab-content h2 {
  font-size: 1.8rem;
  margin-bottom: 24px;
  color: var(--text);
}

/* Candidates Grid */
.candidates-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 20px;
}

.candidate-card {
  background: var(--bg-light);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  transition: all 0.3s ease;
  cursor: pointer;
}

.candidate-card:hover {
  border-color: var(--primary);
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.2);
  transform: translateY(-4px);
}

.candidate-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  margin-bottom: 12px;
}

.candidate-title {
  flex: 1;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
  margin-right: 12px;
}

.candidate-subreddit {
  display: inline-block;
  background: var(--primary);
  color: white;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
}

.candidate-author {
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-bottom: 12px;
}

.candidate-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.metric {
  font-size: 0.9rem;
}

.metric-label {
  color: var(--text-dim);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.metric-value {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--primary);
}

.candidate-scores {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.score-bar {
  display: flex;
  align-items: center;
  gap: 8px;
}

.score-label {
  font-size: 0.8rem;
  color: var(--text-dim);
  min-width: 80px;
}

.score-bar-bg {
  flex: 1;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}

.score-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary) 0%, var(--secondary) 100%);
  border-radius: 3px;
}

.score-value {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--primary);
  min-width: 35px;
  text-align: right;
}

.candidate-final-score {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--success);
  text-align: center;
  padding: 12px;
  background: rgba(16, 185, 129, 0.1);
  border-radius: 8px;
  margin-bottom: 12px;
}

.candidate-actions {
  display: flex;
  gap: 8px;
}

.btn-small {
  flex: 1;
  padding: 8px 12px;
  font-size: 0.9rem;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.3s ease;
}

.btn-small.launch {
  background: var(--success);
  color: white;
}

.btn-small.launch:hover {
  background: #059669;
  transform: translateY(-1px);
}

.btn-small.view {
  background: transparent;
  color: var(--primary);
  border: 1px solid var(--primary);
}

.btn-small.view:hover {
  background: var(--primary);
  color: white;
}

/* Launches List */
.launches-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.launch-item {
  background: var(--bg-light);
  border: 1px solid var(--border);
  border-left: 4px solid var(--success);
  border-radius: 8px;
  padding: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all 0.3s ease;
}

.launch-item:hover {
  border-color: var(--success);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.2);
}

.launch-info h3 {
  font-size: 1.1rem;
  margin-bottom: 8px;
  color: var(--text);
}

.launch-meta {
  display: flex;
  gap: 20px;
  font-size: 0.9rem;
  color: var(--text-dim);
}

.launch-meta span {
  display: flex;
  align-items: center;
  gap: 4px;
}

.launch-token {
  font-family: 'Courier New', monospace;
  background: var(--bg);
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.85rem;
}

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-dim);
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: 12px;
}

.empty-state-text {
  font-size: 1.1rem;
}

/* Responsive */
@media (max-width: 768px) {
  .header h1 {
    font-size: 2rem;
  }

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

  .control-panel {
    flex-direction: column;
  }

  .btn {
    width: 100%;
  }

  .stats-panel {
    grid-template-columns: repeat(2, 1fr);
  }

  .launch-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .launch-meta {
    flex-direction: column;
    gap: 8px;
  }
}
