/* Dashboard-specific styles */

.time-selector {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  flex-wrap: wrap;
  justify-content: center;
}

.time-btn {
  padding: 8px 16px;
  font-size: 0.85rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  background: transparent;
  color: #888;
  cursor: pointer;
  transition: all 0.2s;
}

.time-btn:hover {
  border-color: rgba(255, 255, 255, 0.4);
  color: #ccc;
}

.time-btn.active {
  background: rgba(47, 156, 178, 0.2);
  border-color: #2f9cb2;
  color: #2f9cb2;
}

.loading-indicator {
  color: #2f9cb2;
  font-style: italic;
  margin-bottom: 20px;
}

.loading-indicator.hidden {
  display: none;
}

/* Hero: Search vs Voice Latency Cards */
.latency-hero {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 30px;
  max-width: 900px;
  width: 100%;
}

.latency-hero.hidden {
  display: none;
}

.latency-card {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  padding: 24px;
  text-align: center;
  border: 1px solid transparent;
}

.latency-card h2 {
  font-size: 0.85rem;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 8px;
  font-weight: 500;
}

.latency-card.search-latency {
  border-color: rgba(47, 156, 178, 0.3);
}

.latency-card.voice-latency {
  border-color: rgba(155, 89, 182, 0.3);
}

.latency-value {
  font-size: 3rem;
  font-weight: 700;
  margin: 10px 0;
}

.search-latency .latency-value {
  color: #2f9cb2;
}

.voice-latency .latency-value {
  color: #9b59b6;
}

.latency-label {
  font-size: 0.8rem;
  color: #666;
  text-transform: uppercase;
}

/* Distribution chart: mini histogram with avg line */
.latency-distribution {
  margin-top: 16px;
  width: 100%;
  max-width: 200px;
  margin-left: auto;
  margin-right: auto;
}

.dist-chart {
  width: 100%;
  height: 40px;
  display: block;
}

.dist-area {
  transition: d 0.4s ease;
}

.dist-avg-line {
  opacity: 0.9;
}

.dist-labels {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.7rem;
  color: #666;
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}

.dist-avg-label {
  font-size: 0.6rem;
  text-transform: uppercase;
  color: #555;
  letter-spacing: 0.5px;
}

.latency-count {
  margin-top: 12px;
  font-size: 0.8rem;
  color: #555;
}

/* Country columns within latency cards */
.country-columns {
  display: flex;
  gap: 16px;
  justify-content: center;
}

.country-section {
  flex: 1;
  max-width: 220px;
  text-align: center;
}

.country-label {
  font-size: 0.75rem;
  color: #999;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
  font-weight: 500;
}

.country-section .latency-value {
  font-size: 2rem;
  margin: 6px 0;
}

.country-section .latency-label {
  font-size: 0.7rem;
}

.country-section .latency-distribution {
  margin-top: 10px;
  max-width: 180px;
  margin-left: auto;
  margin-right: auto;
}

.country-section .dist-chart {
  height: 32px;
}

.country-section .dist-labels {
  font-size: 0.65rem;
}

.country-section .latency-count {
  margin-top: 8px;
  font-size: 0.75rem;
}

/* Metrics Sections */
.metrics-section {
  width: 100%;
  max-width: 900px;
  margin-bottom: 24px;
}

.metrics-section.hidden {
  display: none;
}

.section-title {
  font-size: 0.8rem;
  text-transform: uppercase;
  color: #666;
  margin-bottom: 12px;
  letter-spacing: 0.05em;
  font-weight: 500;
}

/* Fixed 2-column grid */
.metrics-grid {
  display: grid;
  gap: 20px;
  width: 100%;
}

.metrics-grid.two-column {
  grid-template-columns: 1fr 1fr;
}

.metrics-grid.single-column {
  grid-template-columns: 1fr;
}

.metric-card.full-width {
  max-width: 600px;
  margin: 0 auto;
}

.metric-card {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  padding: 20px;
}

.metric-card h3 {
  font-size: 0.85rem;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
  font-weight: 500;
}

/* Tables with dual latency columns */
.table-container table {
  width: 100%;
  border-collapse: collapse;
}

.table-container th,
.table-container td {
  padding: 8px 6px;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.table-container th {
  font-size: 0.7rem;
  color: #555;
  text-transform: uppercase;
  font-weight: 500;
}

.table-container td {
  font-size: 0.85rem;
  color: #bbb;
}

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

/* Color-coded latency columns */
.col-search {
  color: #2f9cb2 !important;
}

.col-voice {
  color: #9b59b6 !important;
}

.no-data {
  color: #555;
  font-style: italic;
  font-size: 0.85rem;
  padding: 8px 0;
}

/* Voice engine comparison table */
.engine-table {
  width: 100%;
  border-collapse: collapse;
}

.engine-table th,
.engine-table td {
  padding: 10px 8px;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.engine-table th {
  font-size: 0.7rem;
  color: #555;
  text-transform: uppercase;
  font-weight: 500;
}

.engine-table td {
  font-size: 0.9rem;
  color: #bbb;
}

.engine-table .engine-name {
  font-weight: 500;
  color: #ddd;
}

.engine-table .latency-value {
  font-size: 1rem;
  font-weight: 600;
  color: #9b59b6;
}

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

/* Daily City Chart */
.daily-city-chart {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  padding: 20px;
  border: 1px solid rgba(47, 156, 178, 0.2);
}

.chart-container {
  width: 100%;
  overflow-x: auto;
  margin-bottom: 16px;
}

.city-bars-svg {
  width: 100%;
  min-width: 300px;
  height: 200px;
  display: block;
}

.city-bar-segment {
  transition: opacity 0.2s;
}

.city-bar-segment:hover {
  opacity: 0.8;
}

.bar-label {
  fill: #888;
  font-size: 11px;
  font-family: inherit;
}

.bar-count {
  fill: #aaa;
  font-size: 10px;
  font-family: inherit;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: #888;
}

.legend-color {
  width: 12px;
  height: 12px;
  border-radius: 3px;
}

.legend-city {
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Total records */
.total-records {
  margin-top: 8px;
  margin-bottom: 16px;
  font-size: 0.8rem;
  color: #555;
  text-align: center;
}

/* Mobile responsive */
@media (max-width: 700px) {
  /* Time selector: bigger touch targets */
  .time-selector {
    gap: 8px;
    margin-bottom: 16px;
  }

  .time-btn {
    padding: 12px 16px;
    font-size: 0.85rem;
    min-height: 44px; /* iOS recommended touch target */
  }

  /* Hero: tighter stacked cards */
  .latency-hero {
    grid-template-columns: 1fr;
    gap: 12px;
    margin-bottom: 20px;
    max-width: 100%;
  }

  .latency-card {
    padding: 16px 12px;
    border-radius: 10px;
  }

  .latency-card h2 {
    font-size: 0.75rem;
    margin-bottom: 4px;
    letter-spacing: 0.5px;
  }

  .latency-value {
    font-size: 2.2rem;
    margin: 6px 0;
  }

  .latency-label {
    font-size: 0.75rem;
  }

  .latency-distribution {
    margin-top: 12px;
    max-width: 180px;
  }

  .dist-chart {
    height: 36px;
  }

  .dist-labels {
    font-size: 0.75rem;
  }

  .latency-count {
    margin-top: 10px;
    font-size: 0.8rem;
  }

  /* Country columns mobile: keep side-by-side but tighter */
  .country-columns {
    gap: 8px;
  }

  .country-section {
    max-width: 140px;
  }

  .country-label {
    font-size: 0.7rem;
    margin-bottom: 4px;
  }

  .country-section .latency-value {
    font-size: 1.6rem;
    margin: 4px 0;
  }

  .country-section .latency-label {
    font-size: 0.65rem;
  }

  .country-section .latency-distribution {
    margin-top: 8px;
    max-width: 110px;
  }

  .country-section .dist-chart {
    height: 28px;
  }

  .country-section .dist-labels {
    font-size: 0.6rem;
  }

  .country-section .latency-count {
    margin-top: 6px;
    font-size: 0.7rem;
  }

  /* Metrics sections: tighter */
  .metrics-section {
    margin-bottom: 16px;
  }

  .section-title {
    font-size: 0.75rem;
    margin-bottom: 8px;
  }

  .metrics-grid.two-column {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .metric-card {
    padding: 14px;
    border-radius: 10px;
  }

  .metric-card h3 {
    font-size: 0.8rem;
    margin-bottom: 10px;
  }

  /* Tables: bigger fonts for readability */
  .table-container th,
  .table-container td {
    padding: 8px 6px;
    font-size: 0.9rem;
  }

  .table-container th {
    font-size: 0.75rem;
  }

  .total-records {
    margin-top: 6px;
    margin-bottom: 10px;
    font-size: 0.8rem;
  }

  /* Daily city chart mobile */
  .daily-city-chart {
    padding: 14px;
  }

  .city-bars-svg {
    height: 160px;
  }

  .chart-legend {
    gap: 8px;
  }

  .legend-item {
    font-size: 0.75rem;
  }

  .legend-color {
    width: 10px;
    height: 10px;
  }
}
