/* Clinical Codes Index Page — Recovery TLV Design System */

.codes-hero {
  padding: 50px 20px 30px;
  text-align: center;
  border-bottom: 1px solid var(--border);
  background: radial-gradient(ellipse at 50% 0%, rgba(25, 90, 254, 0.15), transparent 70%);
}

.codes-title {
  font-family: var(--fh);
  font-size: clamp(1.75rem, 3.5vw, 2.5rem);
  font-weight: 700;
  margin-bottom: 10px;
  color: var(--t1);
}

.codes-sub {
  color: var(--t2);
  max-width: 680px;
  margin: 0 auto 24px;
  font-size: 0.95rem;
  line-height: 1.6;
}

/* Controls & Filter Bar */
.codes-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 12px;
  max-width: 900px;
  margin: 0 auto;
}

.search-wrap {
  position: relative;
  flex: 1 1 300px;
  min-width: 260px;
}

.search-box {
  width: 100%;
  height: 48px;
  padding: 0 16px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
  font-family: inherit;
  font-size: 0.95rem;
  outline: none;
  box-sizing: border-box;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.search-box:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(0, 217, 255, 0.2);
}

.filter-select {
  height: 48px;
  padding: 0 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #0b1526;
  color: var(--t1);
  font-family: inherit;
  font-size: 0.9rem;
  outline: none;
  cursor: pointer;
  min-width: 160px;
}

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

/* Status & Counter Bar */
.results-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1280px;
  margin: 24px auto 16px;
  padding: 0 20px;
  font-size: 0.88rem;
  color: var(--t2);
}

.results-count {
  font-weight: 600;
  color: var(--cyan);
}

/* Table Container */
.codes-container {
  max-width: 1280px;
  margin: 0 auto 60px;
  padding: 0 20px;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--card);
  -webkit-overflow-scrolling: touch;
}

.codes-table {
  width: 100%;
  border-collapse: collapse;
  text-align: right;
  font-size: 0.9rem;
}

.codes-table th, .codes-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.codes-table th {
  background: rgba(255, 255, 255, 0.04);
  color: var(--cyan);
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  position: sticky;
  top: 0;
  z-index: 2;
}

.codes-table tr:hover {
  background: rgba(255, 255, 255, 0.025);
}

/* Badges & External Links */
.cond-link {
  color: var(--t1);
  text-decoration: none;
  font-weight: 600;
  transition: color 0.2s;
  display: inline-block;
  min-height: 44px;
  line-height: 44px;
}

.cond-link:hover {
  color: var(--cyan);
}

.entity-type-tag {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 6px;
  vertical-align: middle;
}
.type-condition { background: rgba(25, 90, 254, 0.18); color: #60a5fa; border: 1px solid rgba(96, 165, 250, 0.3); }
.type-anatomy { background: rgba(16, 185, 129, 0.18); color: #34d399; border: 1px solid rgba(52, 211, 153, 0.3); }
.type-intervention { background: rgba(168, 85, 247, 0.18); color: #c084fc; border: 1px solid rgba(192, 132, 252, 0.3); }
.type-assessment { background: rgba(245, 158, 11, 0.18); color: #fbbf24; border: 1px solid rgba(251, 191, 36, 0.3); }
.type-activity { background: rgba(236, 72, 153, 0.18); color: #f472b6; border: 1px solid rgba(244, 114, 182, 0.3); }

.code-badge {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 4px 10px;
  border-radius: 6px;
  font-family: monospace;
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
  margin-bottom: 4px;
  transition: transform 0.15s, opacity 0.15s;
}

.code-badge:hover {
  transform: translateY(-1px);
  opacity: 0.88;
}

.icd10 { background: rgba(0, 217, 255, 0.12); color: #38bdf8; border: 1px solid rgba(56, 189, 248, 0.25); }
.icd11 { background: rgba(168, 85, 247, 0.12); color: #c084fc; border: 1px solid rgba(192, 132, 252, 0.25); }
.snomed { background: rgba(245, 158, 11, 0.12); color: #fbbf24; border: 1px solid rgba(251, 191, 36, 0.25); }
.icf { background: rgba(16, 185, 129, 0.12); color: #34d399; border: 1px solid rgba(52, 211, 153, 0.25); font-size: 0.76rem; }
.unverified-text { font-size: 0.78rem; color: var(--t3); font-style: italic; }

.mesh-link, .wiki-link {
  color: var(--cyan);
  text-decoration: underline;
  font-size: 0.85rem;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

/* Pagination Bar */
.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 24px;
}

.page-btn {
  min-width: 44px;
  height: 44px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--t1);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

.page-btn:hover:not(:disabled) {
  background: rgba(0, 217, 255, 0.15);
  border-color: var(--cyan);
}

.page-btn.active {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}

.page-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Empty State */
.empty-state {
  padding: 48px 20px;
  text-align: center;
  color: var(--t2);
  font-size: 1.05rem;
}

/* Responsive Mobile Rules */
@media (max-width: 768px) {
  .codes-hero { padding: 36px 16px 20px; }
  .codes-controls { flex-direction: column; align-items: stretch; }
  .filter-select { width: 100%; }
  .results-bar { flex-direction: column; align-items: flex-start; gap: 8px; }
}
