/* ───────────────────────────────────────────────────────────────────────────
   icd10-search-widget.css — shared styles for the WHO ICD-10 search widget
   ─────────────────────────────────────────────────────────────────────────── */

.icd10-widget {
  border: 1px solid rgba(26, 107, 114, .28);
  border-radius: 14px;
  background:
    linear-gradient(180deg, #eef6f7 0%, #ffffff 90px),
    #ffffff;
  padding: 0;
  margin: 24px 0;
  font-family: 'Manrope', system-ui, sans-serif;
  color: var(--text, #1e2a38);
  box-shadow:
    0 1px 2px rgba(15, 30, 46, .04),
    0 6px 24px rgba(26, 107, 114, .10);
  overflow: hidden;
}

/* ── Header banner ──────────────────────────────────────────────────────── */
.icd10-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  background: linear-gradient(135deg, #1a6b72 0%, #14545c 100%);
  color: #fff;
  border-bottom: 1px solid rgba(0, 0, 0, .14);
}
.icd10-header-icon {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: rgba(255, 255, 255, .14);
  border: 1px solid rgba(255, 255, 255, .22);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
}
.icd10-header-icon svg { width: 20px; height: 20px; }
.icd10-header-text { flex: 1; min-width: 0; }
.icd10-header-eyebrow {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .10em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, .82);
  margin-bottom: 2px;
}
.icd10-header-title {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 17px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -.005em;
  line-height: 1.25;
}
.icd10-header-cta {
  flex: 0 0 auto;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .04em;
  color: #fff;
  background: rgba(255, 255, 255, .14);
  border: 1px solid rgba(255, 255, 255, .28);
  border-radius: 999px;
  padding: 5px 12px;
  white-space: nowrap;
}

/* Body padding now applied to all inner panes since widget itself is padding-0 */
.icd10-pane,
.icd10-mode-tabs,
.icd10-footnote {
  padding-left: 18px;
  padding-right: 18px;
}
.icd10-mode-tabs { margin-top: 14px; }
.icd10-pane { padding-bottom: 4px; }
.icd10-footnote { padding-bottom: 16px; }

/* ── Mode tabs ───────────────────────────────────────────────────────────── */
.icd10-mode-tabs {
  display: flex;
  gap: 4px;
  background: #f3f4f6;
  border-radius: 10px;
  padding: 4px;
  margin-bottom: 14px;
  max-width: 360px;
}
.icd10-tab {
  flex: 1;
  font-family: 'Manrope', system-ui, sans-serif;
  font-size: 13px;
  font-weight: 600;
  padding: 7px 12px;
  border-radius: 7px;
  border: none;
  background: transparent;
  color: var(--text-muted, #4a5568);
  cursor: pointer;
  transition: background .15s, color .15s, box-shadow .15s;
}
.icd10-tab:hover { color: var(--text, #1e2a38); }
.icd10-tab-active {
  background: #fff;
  color: var(--navy, #1f3864);
  box-shadow: 0 1px 3px rgba(15, 30, 46, .08);
}

.icd10-pane[hidden] { display: none; }

/* ── Single-mode bar ─────────────────────────────────────────────────────── */
.icd10-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.icd10-input {
  flex: 1;
  min-width: 0;
  font-family: 'Manrope', system-ui, sans-serif;
  font-size: 15px;
  font-weight: 500;
  padding: 11px 14px;
  border: 1px solid var(--border, #e2e6eb);
  border-radius: 10px;
  background: #f9fafb;
  color: var(--text, #1e2a38);
  outline: none;
  transition: border-color .15s, box-shadow .15s, background .15s;
  -webkit-appearance: none;
}
.icd10-input:focus {
  border-color: var(--teal, #1a6b72);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(26, 107, 114, .12);
}

.icd10-count {
  font-size: 13px;
  color: var(--text-muted, #4a5568);
  font-weight: 500;
  white-space: nowrap;
}

.icd10-hint {
  font-size: 12.5px;
  color: var(--text-faint, #5c6a7e);
  margin: 6px 2px 10px;
  line-height: 1.55;
}
.icd10-hint em {
  font-style: normal;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 12px;
  background: #f3f4f6;
  padding: 1px 5px;
  border-radius: 4px;
  color: var(--navy, #1f3864);
}

.icd10-status {
  font-size: 13px;
  color: var(--text-muted, #4a5568);
  background: #f9fafb;
  border: 1px dashed var(--border, #e2e6eb);
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 10px;
}
.icd10-status-err {
  color: #b91c1c;
  background: #fff0f0;
  border-color: rgba(185, 28, 28, .35);
  border-style: solid;
}

.icd10-results { margin: 8px 0; }

.icd10-empty {
  padding: 24px 12px;
  text-align: center;
  color: var(--text-muted, #4a5568);
  font-size: 14px;
}
.icd10-empty code,
.icd10-batch-no code {
  background: #f3f4f6;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 13px;
  color: var(--navy, #1f3864);
}

/* ── Results table ───────────────────────────────────────────────────────── */
.icd10-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border, #e2e6eb);
  border-radius: 10px;
}
.icd10-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.icd10-table thead th {
  background: #f9fafb;
  text-align: left;
  padding: 10px 14px;
  font-weight: 700;
  font-size: 12.5px;
  color: var(--text-muted, #4a5568);
  text-transform: uppercase;
  letter-spacing: .04em;
  border-bottom: 1px solid var(--border, #e2e6eb);
}
.icd10-table tbody td {
  padding: 10px 14px;
  border-bottom: 1px solid #eef0f2;
  vertical-align: top;
}
.icd10-table tbody tr:last-child td { border-bottom: none; }
.icd10-table tbody tr:hover { background: #f9fafb; }

.icd10-code-col { width: 110px; }
.icd10-code {
  font-family: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', monospace;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--navy, #1f3864);
  white-space: nowrap;
}
.icd10-title {
  color: var(--text, #1e2a38);
  line-height: 1.45;
}
.icd10-chapter {
  font-size: 12.5px;
  color: var(--text-muted, #4a5568);
  white-space: nowrap;
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.icd10-hl {
  background: rgba(184, 150, 46, .35);
  color: inherit;
  padding: 0 2px;
  border-radius: 3px;
  font-weight: 700;
}

/* ── Pager ───────────────────────────────────────────────────────────────── */
.icd10-pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-top: 12px;
  flex-wrap: wrap;
}
.icd10-page-btn,
.icd10-btn {
  font-family: 'Manrope', system-ui, sans-serif;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 8px;
  border: 1px solid var(--border, #e2e6eb);
  background: #fff;
  color: var(--navy, #1f3864);
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.icd10-page-btn:hover:not(:disabled),
.icd10-btn:hover:not(:disabled) {
  background: #f9fafb;
  border-color: var(--teal, #1a6b72);
}
.icd10-page-btn:disabled {
  color: var(--text-faint, #5c6a7e);
  cursor: not-allowed;
  opacity: .55;
}
.icd10-page-info {
  font-size: 13px;
  color: var(--text-muted, #4a5568);
  white-space: nowrap;
}

.icd10-btn-primary {
  background: var(--teal, #1a6b72);
  border-color: var(--teal, #1a6b72);
  color: #fff;
}
.icd10-btn-primary:hover:not(:disabled) {
  background: #15555b;
  border-color: #15555b;
  color: #fff;
}
.icd10-btn-ghost {
  background: transparent;
  color: var(--text-muted, #4a5568);
}
.icd10-btn-reset {
  flex: 0 0 auto;
  padding: 8px 14px;
  font-size: 12.5px;
}
.icd10-btn-reset:disabled {
  cursor: not-allowed;
  opacity: .45;
}

/* ── Batch mode ──────────────────────────────────────────────────────────── */
.icd10-batch-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted, #4a5568);
  margin-bottom: 8px;
}
.icd10-batch-input {
  width: 100%;
  font-family: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', 'Manrope', system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.55;
  padding: 12px 14px;
  border: 1px solid var(--border, #e2e6eb);
  border-radius: 10px;
  background: #f9fafb;
  color: var(--text, #1e2a38);
  resize: vertical;
  min-height: 120px;
  outline: none;
  transition: border-color .15s, box-shadow .15s, background .15s;
  -webkit-appearance: none;
}
.icd10-batch-input:focus {
  border-color: var(--teal, #1a6b72);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(26, 107, 114, .12);
}
.icd10-batch-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  flex-wrap: wrap;
}
.icd10-batch-hint {
  font-size: 12.5px;
  color: var(--text-faint, #5c6a7e);
}
.icd10-batch-status {
  margin-top: 10px;
  min-height: 18px;
}
.icd10-status-msg {
  font-size: 13px;
  color: var(--text-muted, #4a5568);
}
.icd10-status-warn {
  color: #92400e;
  font-weight: 600;
}

.icd10-batch-results {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.icd10-batch-group {
  border: 1px solid var(--border, #e2e6eb);
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
}
.icd10-batch-q {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: #f9fafb;
  border-bottom: 1px solid var(--border, #e2e6eb);
  font-size: 13.5px;
  flex-wrap: wrap;
}
.icd10-batch-q-num {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  background: var(--navy, #1f3864);
  padding: 2px 8px;
  border-radius: 6px;
}
.icd10-batch-q-text {
  flex: 1;
  font-weight: 600;
  color: var(--text, #1e2a38);
  min-width: 0;
  word-break: break-word;
}
.icd10-batch-q-count {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted, #4a5568);
  white-space: nowrap;
}
.icd10-batch-group .icd10-table-wrap {
  border: none;
  border-radius: 0;
}
.icd10-batch-group .icd10-table thead th {
  background: #fff;
  font-size: 11.5px;
  padding: 8px 14px;
}
.icd10-batch-no {
  text-align: center;
  padding: 16px 12px !important;
  color: var(--text-muted, #4a5568);
  font-size: 13px;
}

.icd10-footnote {
  margin: 14px 0 0;
  font-size: 12.5px;
  color: var(--text-muted, #4a5568);
  line-height: 1.6;
}

@media (max-width: 640px) {
  .icd10-header { padding: 12px 14px; gap: 10px; }
  .icd10-header-icon { width: 32px; height: 32px; }
  .icd10-header-icon svg { width: 18px; height: 18px; }
  .icd10-header-title { font-size: 15.5px; }
  .icd10-header-cta { display: none; }
  .icd10-pane, .icd10-mode-tabs, .icd10-footnote { padding-left: 14px; padding-right: 14px; }
  .icd10-bar { flex-wrap: wrap; }
  .icd10-count { width: 100%; }
  .icd10-table-wrap { font-size: 13px; }
  .icd10-chapter { display: none; }
  .icd10-code-col { width: auto; }
  .icd10-mode-tabs { max-width: 100%; }
  .icd10-batch-actions { gap: 8px; }
  .icd10-batch-hint { width: 100%; }
  .icd10-batch-q { font-size: 12.5px; padding: 8px 12px; }
}

/* ── Dark mode ───────────────────────────────────────────────────────────── */
/* Two selectors so the same overrides apply whether the host page uses
   html[data-theme="dark"] (guide pages) or body.dark-mode (legacy pages). */
html[data-theme="dark"] .icd10-widget,
body.dark-mode .icd10-widget {
  background:
    linear-gradient(180deg, rgba(26,107,114,.22) 0%, #16243f 96px),
    #16243f;
  border-color: rgba(78,195,202,.40);
  color: #e6ebf2;
  box-shadow:
    0 1px 2px rgba(0,0,0,.30),
    0 8px 28px rgba(0,0,0,.40);
}
/* Header banner reads the same teal gradient in both modes — keep it that
   way; just darken its border slightly so it doesn't visually clip. */
html[data-theme="dark"] .icd10-header,
body.dark-mode .icd10-header {
  border-bottom-color: rgba(0,0,0,.40);
}
html[data-theme="dark"] .icd10-mode-tabs,
body.dark-mode .icd10-mode-tabs {
  background: rgba(255,255,255,.06);
}
html[data-theme="dark"] .icd10-tab,
body.dark-mode .icd10-tab {
  color: rgba(230,235,242,.70);
}
html[data-theme="dark"] .icd10-tab:hover,
body.dark-mode .icd10-tab:hover {
  color: #fff;
}
html[data-theme="dark"] .icd10-tab-active,
body.dark-mode .icd10-tab-active {
  background: rgba(26,107,114,.35);
  color: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.25);
}

html[data-theme="dark"] .icd10-input,
html[data-theme="dark"] .icd10-batch-input,
body.dark-mode .icd10-input,
body.dark-mode .icd10-batch-input {
  background: rgba(15,30,46,.55);
  border-color: rgba(255,255,255,.14);
  color: #f0f3f8;
}
html[data-theme="dark"] .icd10-input::placeholder,
html[data-theme="dark"] .icd10-batch-input::placeholder,
body.dark-mode .icd10-input::placeholder,
body.dark-mode .icd10-batch-input::placeholder {
  color: rgba(230,235,242,.40);
}
html[data-theme="dark"] .icd10-input:focus,
html[data-theme="dark"] .icd10-batch-input:focus,
body.dark-mode .icd10-input:focus,
body.dark-mode .icd10-batch-input:focus {
  background: rgba(15,30,46,.85);
  border-color: #4ec3ca;
  box-shadow: 0 0 0 3px rgba(78,195,202,.18);
}

html[data-theme="dark"] .icd10-count,
html[data-theme="dark"] .icd10-batch-label,
html[data-theme="dark"] .icd10-batch-hint,
html[data-theme="dark"] .icd10-status-msg,
html[data-theme="dark"] .icd10-footnote,
html[data-theme="dark"] .icd10-page-info,
html[data-theme="dark"] .icd10-hint,
body.dark-mode .icd10-count,
body.dark-mode .icd10-batch-label,
body.dark-mode .icd10-batch-hint,
body.dark-mode .icd10-status-msg,
body.dark-mode .icd10-footnote,
body.dark-mode .icd10-page-info,
body.dark-mode .icd10-hint {
  color: rgba(230,235,242,.72);
}
html[data-theme="dark"] .icd10-footnote strong,
body.dark-mode .icd10-footnote strong {
  color: #fff;
}
html[data-theme="dark"] .icd10-hint em,
body.dark-mode .icd10-hint em {
  background: rgba(255,255,255,.08);
  color: #aac0e6;
}

html[data-theme="dark"] .icd10-status,
body.dark-mode .icd10-status {
  background: rgba(255,255,255,.04);
  border-color: rgba(255,255,255,.14);
  color: rgba(230,235,242,.78);
}
html[data-theme="dark"] .icd10-status-err,
body.dark-mode .icd10-status-err {
  background: rgba(185,28,28,.18);
  border-color: rgba(185,28,28,.55);
  color: #fca5a5;
}
html[data-theme="dark"] .icd10-status-warn,
body.dark-mode .icd10-status-warn {
  color: #fbbf24;
}

html[data-theme="dark"] .icd10-table-wrap,
body.dark-mode .icd10-table-wrap {
  border-color: rgba(255,255,255,.10);
}
html[data-theme="dark"] .icd10-table thead th,
body.dark-mode .icd10-table thead th {
  background: rgba(255,255,255,.04);
  color: rgba(230,235,242,.65);
  border-bottom-color: rgba(255,255,255,.10);
}
html[data-theme="dark"] .icd10-table tbody td,
body.dark-mode .icd10-table tbody td {
  border-bottom-color: rgba(255,255,255,.06);
}
html[data-theme="dark"] .icd10-table tbody tr:hover,
body.dark-mode .icd10-table tbody tr:hover {
  background: rgba(255,255,255,.04);
}
html[data-theme="dark"] .icd10-code,
body.dark-mode .icd10-code {
  color: #8fb4e6;
}
html[data-theme="dark"] .icd10-title,
body.dark-mode .icd10-title {
  color: #f0f3f8;
}
html[data-theme="dark"] .icd10-chapter,
body.dark-mode .icd10-chapter {
  color: rgba(230,235,242,.55);
}
html[data-theme="dark"] .icd10-empty,
body.dark-mode .icd10-empty {
  color: rgba(230,235,242,.70);
}
html[data-theme="dark"] .icd10-empty code,
html[data-theme="dark"] .icd10-batch-no code,
body.dark-mode .icd10-empty code,
body.dark-mode .icd10-batch-no code {
  background: rgba(255,255,255,.08);
  color: #aac0e6;
}
html[data-theme="dark"] .icd10-batch-no,
body.dark-mode .icd10-batch-no {
  color: rgba(230,235,242,.70);
}

html[data-theme="dark"] .icd10-hl,
body.dark-mode .icd10-hl {
  background: rgba(212,175,79,.40);
  color: #fff;
}

html[data-theme="dark"] .icd10-page-btn,
html[data-theme="dark"] .icd10-btn,
body.dark-mode .icd10-page-btn,
body.dark-mode .icd10-btn {
  background: rgba(255,255,255,.06);
  border-color: rgba(255,255,255,.16);
  color: #e6ebf2;
}
html[data-theme="dark"] .icd10-page-btn:hover:not(:disabled),
html[data-theme="dark"] .icd10-btn:hover:not(:disabled),
body.dark-mode .icd10-page-btn:hover:not(:disabled),
body.dark-mode .icd10-btn:hover:not(:disabled) {
  background: rgba(255,255,255,.12);
  border-color: #4ec3ca;
}
html[data-theme="dark"] .icd10-btn-primary,
body.dark-mode .icd10-btn-primary {
  background: #1a6b72;
  border-color: #1a6b72;
  color: #fff;
}
html[data-theme="dark"] .icd10-btn-primary:hover:not(:disabled),
body.dark-mode .icd10-btn-primary:hover:not(:disabled) {
  background: #208088;
  border-color: #208088;
}
html[data-theme="dark"] .icd10-btn-ghost,
body.dark-mode .icd10-btn-ghost {
  background: transparent;
  color: rgba(230,235,242,.70);
}

html[data-theme="dark"] .icd10-batch-group,
body.dark-mode .icd10-batch-group {
  background: #16243f;
  border-color: rgba(255,255,255,.10);
}
html[data-theme="dark"] .icd10-batch-q,
body.dark-mode .icd10-batch-q {
  background: rgba(255,255,255,.04);
  border-bottom-color: rgba(255,255,255,.10);
}
html[data-theme="dark"] .icd10-batch-q-text,
body.dark-mode .icd10-batch-q-text {
  color: #f0f3f8;
}
html[data-theme="dark"] .icd10-batch-q-count,
body.dark-mode .icd10-batch-q-count {
  color: rgba(230,235,242,.62);
}
html[data-theme="dark"] .icd10-batch-q-num,
body.dark-mode .icd10-batch-q-num {
  background: #1a6b72;
  color: #fff;
}
html[data-theme="dark"] .icd10-batch-group .icd10-table thead th,
body.dark-mode .icd10-batch-group .icd10-table thead th {
  background: transparent;
}
