/* ===== CSS Variables ===== */
:root {
  --bg-primary: #0f1419;
  --bg-secondary: #1a1f2e;
  --bg-card: #242b3d;
  --text-primary: #ffffff;
  --text-secondary: #8b949e;
  --accent: #58a6ff;
  --accent-hover: #79b8ff;
  --success: #3fb950;
  --warning: #d29922;
  --error: #f85149;
  --border: #30363d;
  --shadow: rgba(0, 0, 0, 0.3);
  --radius: 8px;
}

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

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

/* ===== App Layout ===== */
.app {
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px;
}

/* ===== Header ===== */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}

.header h1 {
  font-size: 1.5rem;
  font-weight: 600;
}

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

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

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

/* ===== Navigation ===== */
.nav {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  background: var(--bg-secondary);
  padding: 8px;
  border-radius: var(--radius);
}

.nav-btn {
  padding: 10px 20px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.2s;
}

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

.nav-btn.active {
  background: var(--accent);
  color: white;
}

/* ===== Views ===== */
.view {
  display: none;
}

.view.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

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

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

.stat-card {
  background: var(--bg-card);
  padding: 24px;
  border-radius: var(--radius);
  text-align: center;
  border: 1px solid var(--border);
  transition: transform 0.2s, border-color 0.2s;
  cursor: pointer;
}

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

.stat-card.terminal {
  opacity: 0.7;
}

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

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

/* ===== Section ===== */
.section {
  background: var(--bg-secondary);
  padding: 24px;
  border-radius: var(--radius);
  margin-bottom: 24px;
}

.section h2 {
  font-size: 1.1rem;
  margin-bottom: 16px;
  color: var(--text-primary);
}

/* ===== Stage Bars ===== */
.stage-bars {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.stage-bar {
  display: flex;
  align-items: center;
  gap: 12px;
}

.stage-bar .label {
  width: 80px;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.stage-bar .bar-container {
  flex: 1;
  height: 28px;
  background: var(--bg-card);
  border-radius: 4px;
  overflow: hidden;
}

.stage-bar .bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #79b8ff);
  border-radius: 4px;
  transition: width 0.5s ease;
  display: flex;
  align-items: center;
  padding-left: 10px;
  font-size: 0.8rem;
  font-weight: 500;
}

/* ===== Filters ===== */
.filters {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.input, .select {
  padding: 10px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 0.9rem;
}

.input {
  min-width: 200px;
}

.input:focus, .select:focus {
  outline: none;
  border-color: var(--accent);
}

/* ===== Buttons ===== */
.btn {
  padding: 10px 20px;
  border: none;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

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

.btn-primary:hover {
  background: var(--accent-hover);
}

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

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

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

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

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

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
}

/* ===== Table ===== */
.table-container {
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th,
.table td {
  padding: 14px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.table th {
  background: var(--bg-card);
  font-weight: 600;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
}

.table tr:hover {
  background: var(--bg-card);
}

.table td {
  font-size: 0.9rem;
}

/* ===== Status Badge ===== */
.badge {
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}

.badge-active {
  background: rgba(88, 166, 255, 0.2);
  color: var(--accent);
}

.badge-cold {
  background: rgba(139, 148, 158, 0.2);
  color: var(--text-secondary);
}

.badge-completed {
  background: rgba(63, 185, 80, 0.2);
  color: var(--success);
}

.badge-unsub, .badge-bounced {
  background: rgba(248, 81, 73, 0.2);
  color: var(--error);
}

.badge-stopped {
  background: rgba(210, 153, 34, 0.2);
  color: var(--warning);
}

/* ===== Upload Zone ===== */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 48px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
}

.upload-zone:hover, .upload-zone.dragover {
  border-color: var(--accent);
  background: rgba(88, 166, 255, 0.05);
}

.upload-icon {
  font-size: 3rem;
  display: block;
  margin-bottom: 16px;
}

.upload-hint {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 8px;
}

/* ===== Import Results ===== */
.import-result {
  margin-top: 24px;
  padding: 20px;
  background: var(--bg-card);
  border-radius: var(--radius);
}

.result-stats {
  display: flex;
  gap: 24px;
  margin-top: 12px;
}

.result-stat {
  font-size: 1.1rem;
}

.result-stat.success span { color: var(--success); font-weight: 700; }
.result-stat.warning span { color: var(--warning); font-weight: 700; }
.result-stat.error span { color: var(--error); font-weight: 700; }

/* ===== Processor ===== */
.processor-status {
  display: flex;
  align-items: center;
  gap: 24px;
  margin-bottom: 24px;
}

.processor-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
}

.indicator-dot {
  width: 12px;
  height: 12px;
  background: var(--success);
  border-radius: 50%;
  animation: pulse 2s infinite;
}

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

.processor-log {
  background: var(--bg-card);
  padding: 16px;
  border-radius: var(--radius);
  font-family: monospace;
  font-size: 0.85rem;
  max-height: 300px;
  overflow-y: auto;
}

.processor-log p {
  margin: 4px 0;
  color: var(--text-secondary);
}

/* ===== Modal ===== */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal.active {
  display: flex;
}

.modal-content {
  background: var(--bg-secondary);
  border-radius: var(--radius);
  width: 90%;
  max-width: 600px;
  max-height: 80vh;
  overflow: hidden;
}

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

.modal-header h2 {
  font-size: 1.1rem;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.5rem;
  cursor: pointer;
}

.modal-close:hover {
  color: var(--text-primary);
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  max-height: calc(80vh - 80px);
}

/* ===== Timeline ===== */
.timeline {
  position: relative;
  padding-left: 24px;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 6px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--border);
}

.timeline-item {
  position: relative;
  padding-bottom: 20px;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: -22px;
  top: 4px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg-secondary);
}

.timeline-action {
  font-weight: 600;
  margin-bottom: 4px;
}

.timeline-details {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.timeline-time {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* ===== Pagination ===== */
.pagination {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 20px;
}

.pagination button {
  padding: 8px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-radius: 4px;
  cursor: pointer;
}

.pagination button:hover {
  border-color: var(--accent);
}

.pagination button.active {
  background: var(--accent);
  border-color: var(--accent);
}

/* ===== User Actions ===== */
.action-buttons {
  display: flex;
  gap: 6px;
}
