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

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #f1f5f9;
  color: #1e293b;
}

body {
  min-height: 100vh;
}

.container {
  max-width: 1200px;
  width: 95%;
  margin: 0 auto;
  padding: 20px;
}

/* ── Landing Page ──────────────────────────────────── */
#landing {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 60px 20px;
}

header h1 {
  font-size: 2.8rem;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 6px;
}

.tagline {
  font-size: 0.9rem;
  color: #94a3b8;
  margin-bottom: 14px;
  letter-spacing: 0.5px;
}

.description {
  font-size: 1.05rem;
  color: #64748b;
  margin-bottom: 36px;
  line-height: 1.7;
  max-width: 500px;
}

.search-container {
  display: flex;
  width: 100%;
  max-width: 520px;
  border: 1.5px solid #cbd5e1;
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 32px;
  background: white;
}

.search-container:focus-within {
  border-color: #4f46e5;
}

.search-input {
  flex: 1;
  padding: 13px 16px;
  border: none;
  outline: none;
  font-size: 0.95rem;
  color: #1e293b;
  background: transparent;
}

.search-input::placeholder {
  color: #94a3b8;
}

.search-btn {
  padding: 13px 24px;
  background: #4f46e5;
  color: white;
  border: none;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
}

.search-btn:hover {
  background: #4338ca;
}

.quick-picks {
  width: 100%;
  max-width: 520px;
  margin-bottom: 32px;
}

.quick-picks h2 {
  font-size: 0.78rem;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 500;
  margin-bottom: 12px;
}

.quick-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.quick-btn {
  padding: 8px 18px;
  font-size: 0.9rem;
  background: white;
  color: #475569;
  border: 1.5px solid #cbd5e1;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.2s;
}

.quick-btn:hover {
  border-color: #4f46e5;
  color: #4f46e5;
}

.credit {
  font-size: 0.8rem;
  color: #94a3b8;
}

/* ── Dashboard ─────────────────────────────────────── */
#dashboard {
  background: #f1f5f9;
  min-height: 100vh;
}

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

#dashboard {
  animation: fadeIn 0.3s ease;
}

/* Navbar */
.db-navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px;
  background: white;
  border-bottom: 1px solid #e2e8f0;
  position: sticky;
  top: 0;
  z-index: 10;
  margin-bottom: 24px;
}

.nav-left h1 {
  font-size: 1.3rem;
  font-weight: 600;
  color: #1e293b;
}

.nav-right .db-search {
  padding: 9px 16px;
  border: 1.5px solid #e2e8f0;
  border-radius: 6px;
  width: 240px;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s;
}

.nav-right .db-search:focus {
  border-color: #4f46e5;
}

/* Country Header */
.country-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  padding: 20px 24px;
  background: white;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
}

.country-left h2 {
  font-size: 1.8rem;
  font-weight: 700;
  color: #1e293b;
  margin: 0 0 4px 0;
}

.country-region {
  color: #64748b;
  font-size: 0.95rem;
}

.country-right {
  display: flex;
  gap: 12px;
  align-items: center;
}

.status-badge {
  padding: 5px 14px;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 500;
  color: white;
}

.badge-high       { background: #16a34a; }
.badge-upper-mid  { background: #2563eb; }
.badge-lower-mid  { background: #d97706; }
.badge-low        { background: #dc2626; }
.badge-unknown    { background: #94a3b8; }

.compare-btn {
  padding: 9px 20px;
  background: #4f46e5;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  transition: background 0.2s;
}

.compare-btn:hover {
  background: #4338ca;
}

/* Metrics Cards */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.metric-card {
  padding: 20px;
  background: white;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  transition: border-color 0.2s;
}

.metric-card:hover {
  border-color: #4f46e5;
}

.metric-title {
  font-size: 0.8rem;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
  font-weight: 500;
}

.metric-value {
  font-size: 1.6rem;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 4px;
}

.metric-unit {
  color: #94a3b8;
  font-size: 0.8rem;
}

/* Dashboard Main Layout */
.dashboard-main {
  display: flex;
  gap: 20px;
  margin-top: 4px;
}

/* Indicators Sidebar */
.indicators-sidebar {
  flex: 0 0 290px;
  background: white;
  padding: 20px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  height: fit-content;
}

.indicators-sidebar h3 {
  font-size: 0.95rem;
  font-weight: 600;
  color: #1e293b;
  margin-bottom: 16px;
}

.category-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}

.tab-btn {
  padding: 6px 12px;
  border: 1.5px solid #e2e8f0;
  background: white;
  border-radius: 5px;
  cursor: pointer;
  font-size: 0.82rem;
  color: #475569;
  transition: all 0.2s;
}

.tab-btn:hover {
  border-color: #4f46e5;
  color: #4f46e5;
}

.tab-btn.active {
  background: #4f46e5;
  color: white;
  border-color: #4f46e5;
}

.sort-select {
  width: 100%;
  padding: 9px 32px 9px 12px;
  border: 1.5px solid #e2e8f0;
  border-radius: 6px;
  margin-bottom: 16px;
  font-size: 0.88rem;
  color: #475569;
  background: white;
  cursor: pointer;
  outline: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}

.indicator-list {
  max-height: 420px;
  overflow-y: auto;
}

.indicator-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid #f1f5f9;
}

.indicator-item:last-child {
  border-bottom: none;
}

.indicator-name {
  flex: 1;
  font-size: 0.85rem;
  color: #475569;
  font-weight: 500;
}

.progress-container {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
}

.progress-bar {
  flex: 1;
  height: 6px;
  background: #f1f5f9;
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: #4f46e5;
  border-radius: 3px;
  transition: width 0.4s ease;
}

.indicator-value {
  font-size: 0.82rem;
  font-weight: 600;
  color: #1e293b;
  min-width: 60px;
  text-align: right;
}

/* Chart Spinner */
.chart-spinner {
  display: none;
  justify-content: center;
  align-items: center;
  height: 300px;
}

.chart-spinner::after {
  content: '';
  width: 40px;
  height: 40px;
  border: 3px solid #e2e8f0;
  border-top-color: #4f46e5;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

/* Chart */
.chart-section {
  flex: 1;
  background: white;
  padding: 24px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
}

.chart-section h3 {
  font-size: 0.95rem;
  font-weight: 600;
  color: #1e293b;
  margin-bottom: 20px;
}

#dataChart {
  max-height: 400px;
}

/* ── Responsive ────────────────────────────────────── */
@media (max-width: 1024px) {
  .indicators-sidebar {
    flex: 0 0 250px;
  }
}

@media (max-width: 768px) {
  .dashboard-main {
    flex-direction: column;
  }

  .indicators-sidebar {
    flex: none;
    width: 100%;
  }

  .country-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
  }

  .country-right {
    width: 100%;
    justify-content: space-between;
  }

  .db-navbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .nav-right .db-search {
    width: 100%;
  }

  header h1 {
    font-size: 2.2rem;
  }
}

@media (max-width: 480px) {
  header h1 {
    font-size: 1.8rem;
  }

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

  .search-container {
    flex-direction: column;
    border-radius: 8px;
  }

  .search-btn {
    border-radius: 0 0 6px 6px;
  }
}
