/* LatencyLens Styles - Sleek, minimal, network engineer-friendly */

:root {
  /* Light theme */
  --bg-primary: #ffffff;
  --bg-secondary: #f5f7fa;
  --bg-card: #ffffff;
  --text-primary: #1a1a1a;
  --text-secondary: #6b7280;
  --accent: #0066cc;
  --accent-hover: #0052a3;
  --border: #e5e7eb;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --shadow: rgba(0, 0, 0, 0.1);
  --chart-grid: rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] {
  /* Dark theme */
  --bg-primary: #0a0a0a;
  --bg-secondary: #1a1a1a;
  --bg-card: #151515;
  --text-primary: #f5f5f5;
  --text-secondary: #9ca3af;
  --accent: #00d4aa;
  --accent-hover: #00b890;
  --border: #2a2a2a;
  --success: #10b981;
  --warning: #fbbf24;
  --danger: #f87171;
  --shadow: rgba(0, 0, 0, 0.3);
  --chart-grid: rgba(255, 255, 255, 0.1);
}

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

body {
  font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Fira Code', monospace;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  transition: background-color 0.3s ease, color 0.3s ease;
}

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

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

.header-content {
  flex: 1;
}

.title {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.logo {
  font-size: 2rem;
}

.subtitle {
  font-size: 1rem;
  color: var(--text-secondary);
  margin-top: 0.5rem;
}

.theme-toggle {
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  cursor: pointer;
  font-size: 1.5rem;
  transition: all 0.3s ease;
}

.theme-toggle:hover {
  border-color: var(--accent);
  transform: scale(1.05);
}

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

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

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

.stat-card {
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  transition: all 0.3s ease;
}

.stat-card:hover {
  border-color: var(--accent);
  box-shadow: 0 4px 12px var(--shadow);
  transform: translateY(-2px);
}

.stat-label {
  font-size: 0.875rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 0.25rem;
}

.stat-sublabel {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

/* Controls */
.controls {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 2rem;
  padding: 1rem;
  background: var(--bg-secondary);
  border-radius: 8px;
  flex-wrap: wrap;
}

.controls label {
  font-size: 0.875rem;
  color: var(--text-secondary);
  font-weight: 600;
}

.time-range-select {
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: 6px;
  padding: 0.5rem 1rem;
  font-family: inherit;
  font-size: 0.875rem;
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.2s ease;
}

.time-range-select:hover {
  border-color: var(--accent);
}

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

.refresh-btn {
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 6px;
  padding: 0.5rem 1rem;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.refresh-btn:hover {
  background: var(--accent-hover);
  transform: scale(1.05);
}

.last-update {
  margin-left: auto;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

/* Chart Container */
.chart-container {
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 2rem;
  margin-bottom: 2rem;
}

.section-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  color: var(--text-primary);
}

#latencyChart {
  max-height: 400px;
}

/* Table */
.table-container {
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 2rem;
  margin-bottom: 2rem;
  overflow-x: auto;
}

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

.stats-table thead {
  background: var(--bg-secondary);
}

.stats-table th {
  padding: 1rem;
  text-align: left;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 2px solid var(--border);
}

.stats-table td {
  padding: 1rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.875rem;
}

.stats-table tbody tr:hover {
  background: var(--bg-secondary);
}

.stats-table tbody tr:last-child td {
  border-bottom: none;
}

.loading {
  text-align: center;
  color: var(--text-secondary);
  padding: 2rem !important;
}

/* Location badge */
.location-badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  background: var(--accent);
  color: white;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
}

/* Latency indicators */
.latency-good {
  color: var(--success);
  font-weight: 600;
}

.latency-medium {
  color: var(--warning);
  font-weight: 600;
}

.latency-bad {
  color: var(--danger);
  font-weight: 600;
}

/* Uptime indicators */
.uptime-excellent {
  color: var(--success);
  font-weight: 600;
}

.uptime-good {
  color: var(--warning);
  font-weight: 600;
}

.uptime-poor {
  color: var(--danger);
  font-weight: 600;
}

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

.footer a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.2s ease;
}

.footer a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

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

/* Responsive */
@media (max-width: 768px) {
  .container {
    padding: 1rem;
  }

  .header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }

  .title {
    font-size: 2rem;
  }

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

  .controls {
    flex-direction: column;
    align-items: flex-start;
  }

  .last-update {
    margin-left: 0;
  }

  .chart-container,
  .table-container {
    padding: 1rem;
  }
}
