@import url('https://fonts.googleapis.com/css2?family=Bai+Jamjuree:wght@400;500;600;700&display=swap');

:root {
  --accent: #44c9c6;
  --accent-dark: #0d9488;
  --accent-light: rgba(68, 201, 198, 0.12);
  --bg: #F4F8FA;
  --surface: #ffffff;
  --text: #07293D;
  --ink: #04202F;
  --muted: #5A788A;
  --border: #DFE9EF;
  --shadow: 0 12px 36px rgba(4, 32, 47, 0.06);
  --radius: 16px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', monospace;
  --sans: "Bai Jamjuree", system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

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

body {
  font-family: var(--sans);
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  line-height: 1.6;
}

.container {
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  background: #ffffff;
  border-bottom: 1px solid var(--border);
  z-index: 50;
  box-shadow: 0 2px 10px rgba(4, 32, 47, 0.03);
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--ink);
  font-weight: 700;
  font-size: 1.05rem;
}

.brand-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 5px var(--accent-light);
}

.nav a {
  color: var(--muted);
  text-decoration: none;
  margin-left: 18px;
  font-size: 14px;
  font-weight: 600;
  transition: color 0.2s;
}

.nav a:hover {
  color: var(--accent-dark);
}

/* Hero & Search */
.hero {
  padding: 40px 0 24px;
}

.hero h1 {
  font-size: clamp(1.8rem, 3.2vw, 2.4rem);
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 8px;
}

.muted { color: var(--muted); }
.small { font-size: 13px; }

.search-card {
  margin-top: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}

.label {
  display: block;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.search-input {
  width: 100%;
  padding: 16px 18px;
  border-radius: 12px;
  border: 2px solid var(--border);
  outline: none;
  font-size: 16.5px;
  font-family: inherit;
  color: var(--ink);
  background: #FCFDFE;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-light);
  background: #ffffff;
}

.filters {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  padding: 18px 0 10px;
}

.filter-group {
  display: flex;
  gap: 12px;
  align-items: center;
  background: #F8FBFC;
  border: 1px solid var(--border);
  padding: 10px 16px;
  border-radius: 12px;
}

.filter-title {
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.filter-group label {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.filter-group input[type="checkbox"] {
  accent-color: var(--accent-dark);
  cursor: pointer;
  width: 16px;
  height: 16px;
}

.select {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  background: #fff;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  cursor: pointer;
  outline: none;
}

.select:focus {
  border-color: var(--accent);
}

.status {
  padding: 12px 0 0;
  font-size: 13.5px;
}

/* Results */
.results {
  margin: 18px 0 40px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.result {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 22px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  cursor: pointer;
  transition: all 0.25s ease;
  text-decoration: none;
  color: inherit;
}

.result:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(4, 32, 47, 0.08);
}

.result.active {
  border-color: var(--accent-dark);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.result-left {
  min-width: 0;
  flex: 1;
}

.badges {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.badge {
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
  background: #F8FBFC;
}

.badge-primary {
  border-color: rgba(13, 148, 136, 0.35);
  color: var(--accent-dark);
  background: var(--accent-light);
  font-weight: 700;
}

.badge-cpt {
  border-color: rgba(13, 148, 136, 0.4);
  color: #0d9488;
  background: rgba(68, 201, 198, 0.15);
  font-weight: 700;
}

.badge-icd10 {
  border-color: rgba(56, 189, 248, 0.4);
  color: #0284c7;
  background: rgba(56, 189, 248, 0.12);
  font-weight: 700;
}

.badge-hcpcs {
  border-color: rgba(244, 183, 64, 0.5);
  color: #b45309;
  background: rgba(244, 183, 64, 0.12);
  font-weight: 700;
}

.badge-mod {
  border-color: rgba(168, 85, 247, 0.4);
  color: #7e22ce;
  background: rgba(168, 85, 247, 0.12);
  font-weight: 700;
}

.code {
  font-family: var(--mono);
  font-weight: 700;
  letter-spacing: 0.03em;
  font-size: 13px;
}

.desc {
  font-size: 15px;
  line-height: 1.45;
  color: var(--ink);
  font-weight: 500;
}

.meta {
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 6px;
}

.actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-end;
  justify-content: center;
  flex-shrink: 0;
}

.btn {
  border: 1px solid var(--border);
  background: #fff;
  color: var(--ink);
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn:hover {
  border-color: var(--accent);
  color: var(--accent-dark);
  background: #F8FBFC;
}

/* Detail page styles */
.code-hero {
  padding: 36px 0 20px;
}

.code-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  box-shadow: var(--shadow);
  margin-top: 20px;
}

.code-card h2 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--ink);
  margin: 22px 0 8px;
}

.code-card h2:first-of-type {
  margin-top: 14px;
}

.code-card p {
  color: #334E68;
  font-size: 15.5px;
  line-height: 1.7;
}

.code-card ul {
  list-style: none;
  padding-left: 0;
}

.code-card ul li {
  position: relative;
  padding-left: 24px;
  margin-bottom: 8px;
  color: #334E68;
  font-size: 15px;
}

.code-card ul li::before {
  content: "✓";
  position: absolute;
  left: 0;
  color: var(--accent-dark);
  font-weight: 700;
}

.related-grid {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.related-grid a {
  text-decoration: none;
  font-family: var(--mono);
  font-size: 13px;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #F8FBFC;
  color: var(--ink);
  font-weight: 600;
  transition: all 0.2s;
}

.related-grid a:hover {
  border-color: var(--accent);
  background: var(--accent-light);
  color: var(--accent-dark);
}

@media (max-width: 768px) {
  .nav { display: none; }
  .result { flex-direction: column; align-items: flex-start; }
  .actions { align-items: flex-start; flex-direction: row; margin-top: 6px; }
  .code-card { padding: 20px; }
}
