/* =======================================================
   Breakthrough Tracker Styles
   Matching LIFT design system
   ======================================================= */

/* Container */
.bt-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem;
}

/* KPI Grid */
.bt-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.bt-kpi-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem;
  background: var(--card, #FAFBFD);
  border: 1px solid var(--border, #D5DDE8);
  border-radius: var(--radius-lg, 0.8rem);
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.bt-kpi-card:hover {
  box-shadow: var(--shadow, 0 10px 30px rgba(14, 42, 71, 0.08));
  transform: translateY(-2px);
}

.bt-kpi-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  background: var(--navy, #0E2A47);
  border-radius: var(--radius-md, 0.6rem);
  color: #fff;
  flex-shrink: 0;
}

.bt-kpi-content {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.bt-kpi-label {
  font-family: 'Merriweather', Georgia, serif;
  font-size: 0.8rem;
  color: var(--muted, #55657D);
  margin-bottom: 0.25rem;
}

.bt-kpi-value {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--navy, #0E2A47);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Controls bar */
.bt-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  margin-bottom: 1.5rem;
  padding: 1rem;
  background: var(--card, #FAFBFD);
  border: 1px solid var(--border, #D5DDE8);
  border-radius: var(--radius-lg, 0.8rem);
}

.bt-controls-left,
.bt-controls-center {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.bt-controls-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
}

/* Labels and selects */
.bt-controls label {
  font-family: 'Merriweather', Georgia, serif;
  font-weight: 600;
  color: var(--ink, #0E1320);
  font-size: 0.95rem;
}

.bt-controls select {
  font-family: 'Merriweather', Georgia, serif;
  padding: 0.5rem 2rem 0.5rem 0.75rem;
  font-size: 0.95rem;
  border: 1px solid var(--border, #D5DDE8);
  border-radius: var(--radius-md, 0.6rem);
  background: #fff url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%230E2A47' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e") no-repeat right 0.75rem center/12px 12px;
  appearance: none;
  cursor: pointer;
  color: var(--navy, #0E2A47);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  min-width: 180px;
}

.bt-controls select:hover {
  border-color: var(--cornflower, #5F84E8);
}

.bt-controls select:focus {
  outline: none;
  border-color: var(--cornflower, #5F84E8);
  box-shadow: 0 0 0 3px rgba(95, 132, 232, 0.2);
}

/* Period controls (within comparison charts) */
.bt-period-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.bt-period-controls label {
  font-family: 'Merriweather', Georgia, serif;
  font-weight: 600;
  color: var(--ink, #0E1320);
  font-size: 0.85rem;
}

.bt-period-controls select {
  font-family: 'Merriweather', Georgia, serif;
  padding: 0.35rem 1.8rem 0.35rem 0.6rem;
  font-size: 0.85rem;
  border: 1px solid var(--border, #D5DDE8);
  border-radius: var(--radius-md, 0.6rem);
  background: #fff url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%230E2A47' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e") no-repeat right 0.5rem center/10px 10px;
  appearance: none;
  cursor: pointer;
  color: var(--navy, #0E2A47);
}

.bt-period-controls select:focus {
  outline: none;
  border-color: var(--cornflower, #5F84E8);
  box-shadow: 0 0 0 2px rgba(95, 132, 232, 0.2);
}

/* Action buttons */
.bt-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.9rem;
  font-family: 'Merriweather', Georgia, serif;
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: var(--radius-md, 0.6rem);
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
}

.bt-btn-primary {
  background: var(--navy, #0E2A47);
  color: #fff;
  border: 1px solid var(--navy, #0E2A47);
}

.bt-btn-primary:hover {
  background: var(--navy-700, #0A1E33);
  border-color: var(--navy-700, #0A1E33);
}

.bt-btn-secondary {
  background: #fff;
  color: var(--navy, #0E2A47);
  border: 1px solid var(--border, #D5DDE8);
}

.bt-btn-secondary:hover {
  background: var(--bg-alt, #E6EBF2);
  border-color: var(--cornflower, #5F84E8);
}

/* Country selector */
.bt-country-wrap {
  margin-bottom: 1.5rem;
}

.bt-country-label {
  font-family: 'Merriweather', Georgia, serif;
  font-weight: 600;
  color: var(--ink, #0E1320);
  font-size: 0.95rem;
  margin-bottom: 0.75rem;
  display: block;
}

#country-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* Country chips */
.bt-country-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.75rem;
  font-family: 'Merriweather', Georgia, serif;
  font-size: 0.85rem;
  font-weight: 500;
  background: #fff;
  border: 1px solid var(--border, #D5DDE8);
  border-radius: var(--radius-pill, 999px);
  cursor: pointer;
  transition: all 0.15s ease;
  color: var(--ink, #0E1320);
}

.bt-country-chip:hover {
  background: var(--bg-alt, #E6EBF2);
  border-color: var(--cornflower, #5F84E8);
}

.bt-country-chip.active {
  background: var(--navy, #0E2A47);
  color: #fff;
  border-color: var(--navy, #0E2A47);
}

.bt-country-chip.active:hover {
  background: var(--navy-700, #0A1E33);
  border-color: var(--navy-700, #0A1E33);
}

/* Section styling */
.bt-section {
  margin-bottom: 2rem;
}

.bt-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0;
}

.bt-section-header .bt-section-title {
  margin-bottom: 0.5rem;
}

.bt-section-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--navy, #0E2A47);
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--cornflower, #5F84E8);
}

.bt-btn-sm {
  padding: 0.3rem 0.6rem;
  font-size: 0.75rem;
}

/* Chart containers */
.bt-chart {
  width: 100%;
  height: 450px;
  background: var(--card, #FAFBFD);
  border: 1px solid var(--border, #D5DDE8);
  border-radius: var(--radius-lg, 0.8rem);
  box-shadow: var(--shadow, 0 10px 30px rgba(14, 42, 71, 0.08));
}

.bt-chart-half {
  min-height: 350px;
}

.bt-chart-map {
  height: 500px;
}

/* Map controls */
.bt-map-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.bt-map-controls label {
  font-family: 'Merriweather', Georgia, serif;
  font-weight: 600;
  color: var(--ink, #0E1320);
  font-size: 0.95rem;
}

.bt-map-controls select {
  font-family: 'Merriweather', Georgia, serif;
  padding: 0.5rem 2rem 0.5rem 0.75rem;
  font-size: 0.95rem;
  border: 1px solid var(--border, #D5DDE8);
  border-radius: var(--radius-md, 0.6rem);
  background: #fff url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%230E2A47' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e") no-repeat right 0.75rem center/12px 12px;
  appearance: none;
  cursor: pointer;
  color: var(--navy, #0E2A47);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  min-width: 180px;
}

.bt-map-controls select:hover {
  border-color: var(--cornflower, #5F84E8);
}

.bt-map-controls select:focus {
  outline: none;
  border-color: var(--cornflower, #5F84E8);
  box-shadow: 0 0 0 3px rgba(95, 132, 232, 0.2);
}

/* Comparison row */
.bt-comparison-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.bt-comparison-col {
  min-width: 0;
}

/* Loading state */
.bt-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  font-family: 'Merriweather', Georgia, serif;
  font-size: 1rem;
  color: var(--muted, #55657D);
}

.bt-loading::before {
  content: '';
  width: 24px;
  height: 24px;
  margin-right: 0.75rem;
  border: 3px solid var(--border, #D5DDE8);
  border-top-color: var(--cornflower, #5F84E8);
  border-radius: 50%;
  animation: bt-spin 0.8s linear infinite;
}

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

/* Error state */
.bt-error {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  font-family: 'Merriweather', Georgia, serif;
  font-size: 1rem;
  color: var(--accent, #E46A4E);
  text-align: center;
  padding: 2rem;
}

/* Data source note */
.bt-source {
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  background: var(--bg-alt, #E6EBF2);
  border-radius: var(--radius-md, 0.6rem);
  font-family: 'Merriweather', Georgia, serif;
  font-size: 0.85rem;
  color: var(--muted, #55657D);
}

.bt-source strong {
  color: var(--ink, #0E1320);
}

/* Mobile responsiveness */
@media (max-width: 1024px) {
  .bt-kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .bt-comparison-row {
    grid-template-columns: 1fr;
  }
}

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

  .bt-kpi-grid {
    grid-template-columns: 1fr;
  }

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

  .bt-controls-left,
  .bt-controls-center,
  .bt-controls-right {
    justify-content: center;
    margin-left: 0;
    flex-wrap: wrap;
  }

  .bt-controls select {
    width: 100%;
    min-width: auto;
  }

  .bt-chart {
    height: 350px;
  }

  .bt-chart-half {
    min-height: 300px;
  }

  .bt-country-chip {
    font-size: 0.8rem;
    padding: 0.35rem 0.6rem;
  }
}

@media (max-width: 480px) {
  .bt-chart {
    height: 300px;
  }

  .bt-chart-half {
    min-height: 250px;
  }

  .bt-btn {
    padding: 0.45rem 0.7rem;
    font-size: 0.85rem;
  }

  .bt-kpi-value {
    font-size: 1.25rem;
  }
}

/* Print styles */
@media print {
  .bt-controls,
  .bt-country-wrap,
  .bt-btn {
    display: none;
  }

  .bt-chart {
    height: 500px;
    border: none;
    box-shadow: none;
  }

  .bt-comparison-row {
    grid-template-columns: 1fr;
  }
}
