:root {
  --background: 222.2 84% 4.9%;
  --foreground: 210 40% 98%;
  --card: 222.2 84% 4.9%;
  --card-foreground: 210 40% 98%;
  --popover: 222.2 84% 4.9%;
  --popover-foreground: 210 40% 98%;
  --primary: 210 40% 98%;
  --primary-foreground: 222.2 47.4% 11.2%;
  --secondary: 217.2 32.6% 17.5%;
  --secondary-foreground: 210 40% 98%;
  --muted: 217.2 32.6% 17.5%;
  --muted-foreground: 215 20.2% 65.1%;
  --accent: 217.2 32.6% 17.5%;
  --accent-foreground: 210 40% 98%;
  --destructive: 0 62.8% 30.6%;
  --destructive-foreground: 210 40% 98%;
  --border: 217.2 32.6% 17.5%;
  --input: 217.2 32.6% 17.5%;
  --ring: 212.7 26.8% 83.9%;
  --radius: 0.5rem;
  
  --green: 142.1 76.2% 36.3%;
  --yellow: 47.9 95.8% 53.1%;
  --red: 0 84.2% 60.2%;
  --purple: 262.1 83.3% 57.8%;
  --teal: 173.4 80.4% 40%;
}

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

html {
  scroll-behavior: smooth;
}

body {
  background-color: hsl(var(--background));
  background-image: 
    radial-gradient(circle at 15% 50%, hsl(var(--primary) / 0.08), transparent 25%),
    radial-gradient(circle at 85% 30%, hsl(var(--primary) / 0.08), transparent 25%);
  background-attachment: fixed;
  color: hsl(var(--foreground));
  font-family: 'Geist', sans-serif;
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ─── NAV ─── */
.navbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 2rem;
  height: 4.5rem;
  background: hsl(var(--background) / 0.4);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid hsl(var(--foreground) / 0.08);
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
  border-radius: 0 0 1.5rem 1.5rem;
  margin: 0 auto;
  max-width: 1400px;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  font-size: 1rem;
}

.nav-links {
  display: flex;
  gap: 1.5rem;
}

.nav-links a {
  color: hsl(var(--muted-foreground));
  text-decoration: none;
  font-weight: 500;
  font-size: 0.875rem;
  transition: color 0.15s ease;
}

.nav-links a:hover {
  color: hsl(var(--foreground));
}

/* ─── DASHBOARD CONTAINER ─── */
.dashboard-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.dashboard-header {
  margin-bottom: 1rem;
}

.dashboard-title {
  font-size: 1.875rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  margin-bottom: 0.5rem;
}

.dashboard-subtitle {
  color: hsl(var(--muted-foreground));
  font-size: 1rem;
}

/* ─── KPI GRID ─── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.5rem;
}

.kpi-card {
  background-color: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
}

.kpi-title {
  font-size: 0.875rem;
  font-weight: 500;
  color: hsl(var(--muted-foreground));
  margin-bottom: 0.25rem;
}

.kpi-val {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.25rem;
}

.kpi-sub {
  font-size: 0.75rem;
  color: hsl(var(--muted-foreground));
}

/* ─── SECTIONS ─── */
.dashboard-section {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.section-header h2 {
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.025em;
  margin-bottom: 0.25rem;
}

.section-header p {
  font-size: 0.875rem;
  color: hsl(var(--muted-foreground));
}

/* ─── CHARTS ─── */
.charts-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
}

.chart-card {
  background-color: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
}

.chart-span {
  grid-column: span 2;
}

@media (max-width: 1024px) {
  .charts-grid {
    grid-template-columns: 1fr;
  }
  .chart-span {
    grid-column: span 1;
  }
}

.chart-header h3 {
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.025em;
}

.chart-sub {
  font-size: 0.875rem;
  color: hsl(var(--muted-foreground));
  margin-bottom: 1.5rem;
}

.chart-body {
  position: relative;
  flex: 1;
  min-height: 250px;
}
.chart-donut {
  display: flex;
  justify-content: center;
  align-items: center;
}

/* ─── EXPLORE FILTER & SEARCH ─── */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
}

.search-wrap {
  display: flex;
  align-items: center;
  border: 1px solid hsl(var(--foreground) / 0.1);
  border-radius: 9999px; /* Pill shape for liquid look */
  padding: 0 1rem;
  background: hsl(var(--card) / 0.1);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
  height: 2.5rem;
  width: 100%;
  max-width: 300px;
}

.search-wrap svg {
  color: hsl(var(--muted-foreground));
  margin-right: 0.5rem;
}

.search-wrap input {
  border: none;
  background: transparent;
  width: 100%;
  font-family: inherit;
  font-size: 0.875rem;
  color: hsl(var(--foreground));
  outline: none;
}

.search-wrap input::placeholder {
  color: hsl(var(--muted-foreground));
}

.filter-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.filter-btn {
  height: 2.5rem;
  padding: 0 1.25rem;
  font-size: 0.875rem;
  font-family: inherit;
  font-weight: 500;
  background: hsl(var(--card) / 0.1);
  border: 1px solid hsl(var(--foreground) / 0.1);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-radius: 9999px;
  color: hsl(var(--foreground));
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

.filter-btn:hover {
  background: hsl(var(--card) / 0.2);
  border-color: hsl(var(--foreground) / 0.3);
  transform: translateY(-1px);
}

.filter-btn.active {
  background-color: hsl(var(--foreground));
  color: hsl(var(--background));
  border-color: hsl(var(--foreground));
}

.results-count {
  font-size: 0.875rem;
  color: hsl(var(--muted-foreground));
}

.results-count strong {
  color: hsl(var(--foreground));
  font-weight: 600;
}

/* ─── GRID / CARDS ─── */
.degree-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.5rem;
}

.degree-card {
  background: hsl(var(--card) / 0.15);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid hsl(var(--foreground) / 0.1);
  border-radius: 1.25rem;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.15);
}

.degree-card:hover {
  border-color: hsl(var(--foreground) / 0.25);
  box-shadow: 0 12px 40px 0 rgba(0, 0, 0, 0.25);
  background: hsl(var(--card) / 0.2);
  transform: translateY(-4px);
}

.card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.card-category {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.625rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 9999px;
  text-transform: capitalize;
}

.cat-best { background-color: hsl(var(--green) / 0.15); color: hsl(var(--green)); }
.cat-strong { background-color: hsl(var(--yellow) / 0.2); color: hsl(var(--yellow) / 1); }
.cat-access { background-color: hsl(var(--red) / 0.1); color: hsl(var(--red)); }
.cat-niche { background-color: hsl(var(--purple) / 0.1); color: hsl(var(--purple)); }
.cat-general { background-color: hsl(var(--muted)); color: hsl(var(--muted-foreground)); }

.card-emoji {
  font-size: 1.5rem;
  line-height: 1;
}

.card-title {
  font-size: 1.125rem;
  font-weight: 600;
  line-height: 1.25;
  margin-bottom: 0.25rem;
}

.card-institute {
  font-size: 0.875rem;
  color: hsl(var(--muted-foreground));
}

.card-metrics {
  display: flex;
  gap: 1rem;
}

.metric {
  flex: 1;
  background: hsl(var(--muted) / 0.1);
  border: 1px solid hsl(var(--foreground) / 0.05);
  border-radius: calc(var(--radius) - 2px);
  padding: 0.75rem;
}

.metric-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: hsl(var(--muted-foreground));
  margin-bottom: 0.25rem;
}

.metric-bar {
  height: 4px;
  background-color: hsl(var(--border));
  border-radius: 9999px;
  overflow: hidden;
  margin-bottom: 0.35rem;
}

.metric-fill {
  height: 100%;
  border-radius: 9999px;
}

.fill-high { background-color: hsl(var(--green)); }
.fill-medium-high { background-color: hsl(var(--teal)); }
.fill-medium { background-color: hsl(var(--yellow)); }
.fill-low { background-color: hsl(var(--red)); }
.fill-very-high { background-color: hsl(var(--primary)); }

.metric-val {
  font-size: 0.875rem;
  font-weight: 600;
}

.card-fee {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: hsl(var(--muted) / 0.1);
  border: 1px solid hsl(var(--foreground) / 0.05);
  border-radius: calc(var(--radius) - 2px);
  padding: 0.75rem 1rem;
}

.fee-label {
  font-size: 0.75rem;
  color: hsl(var(--muted-foreground));
}

.fee-amount {
  font-size: 1rem;
  font-weight: 600;
}

.fee-note {
  font-size: 0.65rem;
  color: hsl(var(--muted-foreground));
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
}

.tag {
  background-color: hsl(var(--secondary));
  color: hsl(var(--secondary-foreground));
  border-radius: 9999px;
  padding: 0.125rem 0.625rem;
  font-size: 0.75rem;
  font-weight: 500;
}

.no-results {
  text-align: center;
  padding: 4rem 1rem;
  color: hsl(var(--muted-foreground));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  background: hsl(var(--muted)/0.3);
  border-radius: var(--radius);
  border: 1px dashed hsl(var(--border));
}

.no-results.hidden {
  display: none;
}

/* ─── SPLIT SECTION (COMPARE & SUMMARY) ─── */
.dashboard-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
}

@media (max-width: 1024px) {
  .dashboard-split {
    grid-template-columns: 1fr;
  }
}

.fee-bars {
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
  background: hsl(var(--card) / 0.15);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid hsl(var(--foreground) / 0.1);
  padding: 1.5rem;
  border-radius: 1.25rem;
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.15);
}

.fee-bar-row {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.fee-bar-label {
  font-size: 0.875rem;
  width: 160px;
  flex-shrink: 0;
  line-height: 1.3;
}

.fee-bar-track {
  flex: 1;
  height: 8px;
  background-color: hsl(var(--secondary));
  border-radius: 9999px;
  overflow: hidden;
}

.fee-bar-fill {
  height: 100%;
  border-radius: 9999px;
  transition: width 1s ease;
}

.fee-bar-amount {
  font-size: 0.875rem;
  font-weight: 600;
  width: 80px;
  text-align: right;
  flex-shrink: 0;
}

.summary-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.summary-card {
  background-color: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
}

.sc-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.sc-icon {
  font-size: 1.5rem;
}

.sc-title {
  font-size: 1.125rem;
  font-weight: 600;
}

.sc-desc {
  font-size: 0.875rem;
  color: hsl(var(--muted-foreground));
}

/* ─── FOOTER ─── */
footer {
  text-align: center;
  padding: 3rem 1.5rem;
  font-size: 0.875rem;
  border-top: 1px solid hsl(var(--border));
  margin-top: 2rem;
}

.footer-muted {
  color: hsl(var(--muted-foreground));
}

/* ─── MODAL ─── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background-color: hsl(var(--background) / 0.8);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-overlay.hidden {
  display: none;
}

.modal {
  background: hsl(var(--card) / 0.25);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  border: 1px solid hsl(var(--foreground) / 0.15);
  border-radius: 1.5rem;
  padding: 2rem;
  max-width: 500px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 12px 40px 0 rgba(0, 0, 0, 0.3);
}

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: transparent;
  border: none;
  cursor: pointer;
  color: hsl(var(--muted-foreground));
  padding: 0.5rem;
  border-radius: var(--radius);
  transition: background-color 0.2s, color 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close:hover {
  background-color: hsl(var(--secondary));
  color: hsl(var(--foreground));
}

.modal-emoji {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.modal-title {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 0.25rem;
}

.modal-institute {
  font-weight: 500;
  color: hsl(var(--muted-foreground));
  margin-bottom: 1.5rem;
}

.modal-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.modal-metric {
  background: hsl(var(--muted) / 0.1);
  border: 1px solid hsl(var(--foreground) / 0.05);
  border-radius: var(--radius);
  padding: 1rem;
}

.modal-metric-label {
  font-size: 0.75rem;
  color: hsl(var(--muted-foreground));
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.25rem;
}

.modal-metric-value {
  font-size: 1.25rem;
  font-weight: 600;
}

.modal-desc {
  font-size: 0.875rem;
  line-height: 1.6;
  color: hsl(var(--foreground));
  margin-bottom: 1.5rem;
}

.modal-highlights h4 {
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.highlight-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.highlight-item {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: hsl(var(--muted-foreground));
}

.highlight-item .hi {
  color: hsl(var(--primary));
  font-weight: bold;
}

.modal-fee-box {
  margin-top: 2rem;
  background: hsl(var(--secondary) / 0.25);
  border: 1px solid hsl(var(--foreground) / 0.05);
  border-radius: var(--radius);
  padding: 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.mfb-left .mfb-label {
  font-size: 0.75rem;
  color: hsl(var(--muted-foreground));
  text-transform: uppercase;
  margin-bottom: 0.25rem;
}

.mfb-left .mfb-amt {
  font-size: 1.5rem;
  font-weight: 700;
}

.mfb-left .mfb-note {
  font-size: 0.75rem;
  color: hsl(var(--muted-foreground));
}

.mfb-right .mfb-dur {
  font-size: 0.875rem;
  text-align: right;
  color: hsl(var(--muted-foreground));
}

.mfb-right .mfb-dur strong {
  color: hsl(var(--foreground));
}

/* ─── MOBILE RESPONSIVENESS ─── */
@media (max-width: 768px) {
  .dashboard-container {
    padding: 1rem;
    gap: 1.5rem;
  }

  .navbar {
    padding: 0 1rem;
    height: 3.5rem;
  }

  .nav-logo {
    font-size: 0.875rem;
  }

  .nav-logo svg {
    width: 20px;
    height: 20px;
  }

  .nav-links {
    gap: 0.75rem;
  }
  
  .nav-links a {
    font-size: 0.8rem;
  }

  .degree-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .search-wrap {
    max-width: 100%;
  }

  .filter-bar {
    gap: 0.75rem;
  }

  .filter-buttons {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
  }

  .filter-btn {
    width: 100%;
    padding: 0 0.25rem;
    font-size: 0.75rem;
  }

  .dashboard-split {
    gap: 1.5rem;
  }

  .fee-bars {
    padding: 1rem;
  }

  .fee-bar-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid hsl(var(--border));
  }

  .fee-bar-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
  }

  .fee-bar-label {
    width: 100%;
  }

  .fee-bar-track {
    width: 100%;
    height: 6px;
  }

  .fee-bar-amount {
    width: 100%;
    text-align: left;
    font-size: 0.875rem;
  }

  .modal {
    padding: 1.25rem;
  }

  .modal-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .modal-fee-box {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
    padding: 1.25rem;
  }

  .mfb-right .mfb-dur {
    text-align: left;
  }
}

@media (max-width: 480px) {
  .filter-buttons {
    grid-template-columns: repeat(2, 1fr);
  }
}