/* ==========================================================================
   UniSUS CID-10 — Módulo de Doenças
   Mesma base visual do UniSUS, com acento roxo (#9B2FAE)
   ========================================================================== */

/* ==========================================================================
   1. FONT-FACE
   ========================================================================== */

@font-face {
  font-family: "Rawline";
  src: url("/assets/fonts/rawline-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Rawline";
  src: url("/assets/fonts/rawline-600.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Rawline";
  src: url("/assets/fonts/rawline-600.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* ==========================================================================
   2. CSS VARIABLES (light + dark)
   ========================================================================== */

:root {
  --white-pure: #F8F9FA;
  --light-gray: #D5D8DE;
  --low-opacity-gray: #EDEFF2;
  --highlight-gray: #E0E3E8;
  --gray: #71839B;
  --dark-gray: #71839B;

  --green: #059142;
  --warm-green: #168821;
  --light-blue: #E8F0FE;
  --blue-warm: #1351B4;
  --blue-warm-vivid-05: #EEF2FA;
  --dark-blue: #0C326F;
  --blue-light: #2670E8;
  --bright-red: #e52207;
  --bright-yellow: #fabd10;

  --text-color: #1A1A2E;
  --dark-200: #71839B;
  --dark-300: #1A1A2E;
  --dark-400: #555555;

  --on-dark: #ffffff;
  --dark-blue-bg: #0C326F;

  --shadow-sm: rgba(0, 0, 0, 0.04);
  --shadow-md: rgba(0, 0, 0, 0.08);
  --shadow-lg: rgba(0, 0, 0, 0.12);
  --shadow-xl: rgba(0, 0, 0, 0.15);

  --btn-primary-bg: #9B2FAE;
  --btn-primary-text: #ffffff;
  --shadow-blue-sm: rgba(155, 47, 174, 0.04);
  --shadow-blue-md: rgba(155, 47, 174, 0.08);
  --shadow-blue-lg: rgba(155, 47, 174, 0.15);
  --shadow-blue-xl: rgba(155, 47, 174, 0.3);

  /* Cores por módulo */
  --mod-sigtap: #1351B4;
  --mod-cnes: #059142;
  --mod-cid: #9B2FAE;
  --mod-tabnet: #E8590C;
  --mod-cns: #D63384;
  --mod-bpa: #0C8599;
  --mod-cbhpm: #C92A2A;
  --mod-ciap: #5C7CFA;

  /* Module accent */
  --accent: #9B2FAE;
  --accent-light: rgba(155, 47, 174, 0.08);
  --accent-vivid-05: #F5EAFA;
}

[data-theme="dark"] {
  --white-pure: #16162a;
  --light-gray: #3a3a4e;
  --low-opacity-gray: #20203a;
  --highlight-gray: #2a2a40;
  --gray: #9a9aae;
  --dark-gray: #8a8a9e;

  --green: #4ADE80;
  --warm-green: #34D399;
  --light-blue: #1e2d4a;
  --blue-warm: #6BA6FF;
  --blue-warm-vivid-05: #1c2540;
  --dark-blue: #8AC4FF;
  --blue-light: #5B9BF5;
  --bright-red: #ff6b6b;
  --bright-yellow: #ffd93d;

  --on-dark: #ffffff;
  --dark-blue-bg: #111128;

  --text-color: #e4e4ee;
  --dark-200: #b0b0c0;
  --dark-300: #e0e0ee;
  --dark-400: #c0c0d0;

  --shadow-sm: rgba(0, 0, 0, 0.15);
  --shadow-md: rgba(0, 0, 0, 0.25);
  --shadow-lg: rgba(0, 0, 0, 0.35);
  --shadow-xl: rgba(0, 0, 0, 0.45);

  --btn-primary-bg: #B44DCA;
  --btn-primary-text: #ffffff;
  --shadow-blue-sm: rgba(208, 140, 237, 0.06);
  --shadow-blue-md: rgba(208, 140, 237, 0.12);
  --shadow-blue-lg: rgba(208, 140, 237, 0.2);
  --shadow-blue-xl: rgba(208, 140, 237, 0.35);

  --mod-sigtap: #6BA6FF;
  --mod-cnes: #4ADE80;
  --mod-cid: #D08CED;
  --mod-tabnet: #FF9F5A;
  --mod-cns: #F06CAA;
  --mod-bpa: #3DC9D8;
  --mod-cbhpm: #FF7B7B;
  --mod-ciap: #8FA4FF;

  --accent: #D08CED;
  --accent-light: rgba(208, 140, 237, 0.1);
  --accent-vivid-05: #2a1e3a;
}

/* ==========================================================================
   3. GLOBAL RESET & BASE
   ========================================================================== */

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

html, body {
  font-family: "Rawline", system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background-color: var(--white-pure);
  color: var(--text-color);
  transition: background-color 0.2s ease, color 0.2s ease;
}

button, input, textarea, select { font-family: inherit; }
a { text-decoration: none; }
img { display: block; max-width: 100%; height: auto; }
ul { list-style: none; padding: 0; margin: 0; }

h1 { font-size: 2.2rem; font-weight: 400; color: var(--dark-300); }
h2 { font-size: 1.5rem; font-weight: 400; }

[id] {
  scroll-margin-top: 80px;
}

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* ==========================================================================
   4. LAYOUT
   ========================================================================== */

.main-content {
  display: flex;
  flex: 1;
  flex-direction: column;
  width: 100%;
  min-height: calc(100vh - 64px - 142px);
  position: relative;
}

/* ==========================================================================
   5. HEADER
   ========================================================================== */

.site-header {
  height: 64px;
  width: 100%;
  padding: 0 3rem;
  border-bottom: 1px solid var(--low-opacity-gray);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: var(--white-pure);
  transition: background-color 0.2s ease;
}

.header-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  width: 100%;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.logo-link {
  display: flex;
  align-items: center;
  text-decoration: none;
}
.logo-link:hover { opacity: 0.85; }
.logo { height: 28px; cursor: pointer; }

.header-pipe {
  height: 28px;
  width: 1.5px;
  background-color: var(--light-gray);
}

.brand-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--dark-300);
}
.brand-accent { color: var(--green); }

.module-label {
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-light);
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  letter-spacing: 0.02em;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Theme toggle */
.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--dark-300);
  cursor: pointer;
  transition: color 0.2s, background-color 0.2s;
}
.theme-toggle:hover {
  color: var(--accent);
  background-color: var(--accent-light);
}
.icon-moon { display: none; }
[data-theme="dark"] .icon-sun { display: none; }
[data-theme="dark"] .icon-moon { display: block; }

/* Nav button */
.nav-button {
  padding: 0.5rem 1.25rem;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--accent);
  background: transparent;
  border: 1px solid var(--light-gray);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: border-color 0.2s, background-color 0.2s;
}
.nav-button:hover {
  border-color: var(--accent);
  background-color: var(--accent-light);
}

@media (max-width: 767px) {
  .site-header { height: auto; padding: 0 1rem; }
  .header-pipe { display: none; }
  .nav-button span { display: none; }
  .nav-button { padding: 0.5rem; border: none; }
}

/* ==========================================================================
   6. HERO
   ========================================================================== */

.hero {
  padding: 3rem 2rem 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2rem;
}

.hero-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
  max-width: 700px;
  text-align: center;
}

.hero-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  background: var(--accent-light);
  padding: 0.35rem 1rem;
  border-radius: 20px;
}

.hero h1 {
  color: var(--dark-blue);
  font-weight: 700;
  text-align: center;
  max-width: 640px;
  font-size: 2rem;
}

.hero-subtitle {
  font-size: 1.0625rem;
  text-align: center;
  color: var(--dark-200);
  max-width: 540px;
  line-height: 1.6;
}

@media (max-width: 767px) {
  .hero { padding: 1.5rem 1rem; gap: 1.5rem; }
  .hero h1 { font-size: 1.5rem; }
  .hero-subtitle { font-size: 0.9375rem; }
}

/* ==========================================================================
   7. SEARCH BOX
   ========================================================================== */

.search-box {
  width: 100%;
  max-width: 560px;
  position: relative;
}

.search-input {
  width: 100%;
  height: 52px;
  padding: 0 1.25rem 0 3rem;
  border: 2px solid var(--light-gray);
  border-radius: 50px;
  font-size: 1rem;
  font-family: inherit;
  color: var(--text-color);
  background: var(--white-pure);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.search-input::placeholder { color: var(--gray); }
.search-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--shadow-blue-lg);
}

.search-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gray);
  pointer-events: none;
}

/* ==========================================================================
   8. STATS STRIP
   ========================================================================== */

.stats-strip {
  width: 100%;
  background-color: var(--accent);
  color: var(--on-dark);
  padding: 1.5rem 2rem;
}

.stats-inner {
  display: flex;
  justify-content: center;
  gap: 4rem;
  max-width: 700px;
  margin: 0 auto;
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--on-dark);
}

.stat-label {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.9);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  text-align: center;
}

@media (max-width: 767px) {
  .stats-inner { gap: 2rem; flex-wrap: wrap; }
  .stat-value { font-size: 1.35rem; }
}

/* ==========================================================================
   9. CHAPTERS SECTION
   ========================================================================== */

.chapters-section {
  width: 100%;
  padding: 3rem 2rem;
  background: var(--low-opacity-gray);
}

.chapters-inner {
  max-width: 960px;
  margin: 0 auto;
}

.chapters-title {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--dark-blue);
  text-align: center;
  margin-bottom: 2rem;
}

.chapters-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.chapter-card {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  background: var(--white-pure);
  border: 1px solid var(--light-gray);
  border-left: 4px solid var(--accent);
  border-radius: 8px;
  transition: box-shadow 0.2s, transform 0.2s;
  text-decoration: none;
  color: inherit;
}
.chapter-card:hover {
  box-shadow: 0 4px 12px var(--shadow-lg);
  transform: translateY(-1px);
}

.chapter-number {
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--on-dark);
  background: var(--accent);
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  flex-shrink: 0;
  min-width: 28px;
  text-align: center;
}

.chapter-info {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.chapter-range {
  font-size: 0.75rem;
  font-weight: 600;
  font-family: monospace;
  color: var(--accent);
}

.chapter-name {
  font-size: 0.8125rem;
  color: var(--dark-300);
  line-height: 1.4;
}

@media (max-width: 767px) {
  .chapters-section { padding: 2rem 1rem; }
  .chapters-grid { grid-template-columns: 1fr; }
}

/* ==========================================================================
   10. ABOUT / EXPLANATION SECTION
   ========================================================================== */

.about-section {
  width: 100%;
  padding: 3rem 2rem;
}

.about-inner {
  max-width: 760px;
  margin: 0 auto;
}

.about-section h2 {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--dark-blue);
  margin-bottom: 1.5rem;
  text-align: center;
}

.about-text {
  font-size: 0.9375rem;
  color: var(--dark-200);
  line-height: 1.8;
  margin-bottom: 1.25rem;
}

.about-text strong {
  color: var(--dark-300);
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  margin-top: 2rem;
}

.feature-card {
  padding: 1.25rem;
  border: 1px solid var(--light-gray);
  border-radius: 8px;
  background: var(--white-pure);
  text-align: center;
}

.feature-card svg {
  color: var(--accent);
  margin-bottom: 0.75rem;
}

.feature-card h3 {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--dark-300);
  margin-bottom: 0.35rem;
}

.feature-card p {
  font-size: 0.8125rem;
  color: var(--dark-200);
  line-height: 1.55;
}

@media (max-width: 767px) {
  .about-section { padding: 2rem 1rem; }
  .feature-grid { grid-template-columns: 1fr; }
}

/* ==========================================================================
   11. FOOTER
   ========================================================================== */

.site-footer {
  width: 100%;
  background-color: var(--dark-blue-bg);
  color: var(--on-dark);
}

.footer-logo-container {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 96px;
  width: 100%;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
}
.footer-logo-container a {
  display: flex;
  align-items: center;
  text-decoration: none;
}
.footer-logo-container a:hover { opacity: 0.85; }
.footer-logo {
  height: 36px;
  filter: brightness(1.6);
}

.footer-text-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding-block: 1.5rem;
  color: var(--on-dark);
}

.footer-text-container span,
.footer-text-container strong {
  font-size: 14px;
  width: fit-content;
}

.footer-text-container span:first-child {
  padding-inline: 1rem;
  text-align: center;
}

.footer-redirect-link {
  color: var(--on-dark);
  padding-top: 1rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: color 0.2s;
}
.footer-redirect-link:hover {
  color: var(--light-blue);
}

.footer-link-group {
  display: flex;
  gap: 2rem;
  padding-top: 0.5rem;
}

@media (max-width: 767px) {
  .footer-link-group { flex-direction: column; gap: 0; text-align: center; }
}

/* ==========================================================================
   12. SEARCH RESULTS (autocomplete dropdown)
   ========================================================================== */

.search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 0.5rem;
  background: var(--white-pure);
  border: 1px solid var(--light-gray);
  border-radius: 12px;
  box-shadow: 0 8px 24px var(--shadow-lg);
  max-height: 420px;
  overflow-y: auto;
  z-index: 200;
}

.search-result-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.25rem;
  text-decoration: none;
  color: var(--text-color);
  transition: background-color 0.15s;
  border-bottom: 1px solid var(--low-opacity-gray);
}
.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover { background-color: var(--accent-vivid-05); }

.search-result-code {
  font-family: monospace;
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-light);
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  flex-shrink: 0;
  min-width: 48px;
  text-align: center;
}

.search-result-name {
  font-size: 0.875rem;
  color: var(--dark-300);
  line-height: 1.4;
}

.search-empty {
  padding: 1.5rem;
  text-align: center;
  font-size: 0.875rem;
  color: var(--gray);
}

/* ==========================================================================
   13. BREADCRUMB
   ========================================================================== */

.breadcrumb {
  margin-bottom: 1rem;
}

.breadcrumb-list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8125rem;
  color: var(--gray);
}

.breadcrumb-item + .breadcrumb-item::before {
  content: "›";
  margin-right: 0.35rem;
  color: var(--light-gray);
}

.breadcrumb-item a {
  color: var(--accent);
  text-decoration: none;
}
.breadcrumb-item a:hover {
  text-decoration: underline;
}

.breadcrumb-item span[aria-current] {
  color: var(--dark-300);
  font-weight: 600;
}

/* ==========================================================================
   14. PAGE HEADER (inner pages)
   ========================================================================== */

.page-header {
  padding: 2rem 2rem 1.5rem;
  border-bottom: 1px solid var(--low-opacity-gray);
}

.page-header-inner {
  max-width: 960px;
  margin: 0 auto;
}

.page-header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--dark-blue);
  margin-bottom: 0.5rem;
}

.page-subtitle {
  font-size: 1rem;
  color: var(--dark-200);
  line-height: 1.6;
}

@media (max-width: 767px) {
  .page-header { padding: 1.25rem 1rem; }
  .page-header h1 { font-size: 1.35rem; }
}

/* ==========================================================================
   15. CONTENT SECTION (chapters listing, groups)
   ========================================================================== */

.content-section {
  padding: 2rem;
}

.content-inner {
  max-width: 960px;
  margin: 0 auto;
}

.chapter-block {
  margin-bottom: 2rem;
  border: 1px solid var(--light-gray);
  border-radius: 10px;
  overflow: hidden;
}

.chapter-block-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem 1.5rem;
  background: var(--accent-vivid-05);
  border-bottom: 1px solid var(--light-gray);
  text-decoration: none;
  color: inherit;
  transition: background-color 0.2s;
}
.chapter-block-header:hover { background-color: var(--accent-light); }

.chapter-block-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--dark-blue);
  margin: 0;
}

.chapter-groups {
  padding: 0.5rem 0;
}

.group-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 1.5rem;
  font-size: 0.875rem;
  border-bottom: 1px solid var(--low-opacity-gray);
}
.group-item:last-child { border-bottom: none; }

.group-range {
  font-family: monospace;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-light);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  flex-shrink: 0;
}

.group-name {
  color: var(--dark-300);
  flex: 1;
}

.group-count {
  font-size: 0.75rem;
  color: var(--gray);
  flex-shrink: 0;
}

@media (max-width: 767px) {
  .content-section { padding: 1rem; }
  .group-item { flex-wrap: wrap; padding: 0.6rem 1rem; }
}

/* ==========================================================================
   16. CHAPTER DETAIL PAGE
   ========================================================================== */

.chapter-hero {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  margin-top: 0.5rem;
}

.chapter-number-lg {
  font-size: 2rem;
  font-weight: 700;
  color: var(--on-dark);
  background: var(--accent);
  padding: 0.5rem 1rem;
  border-radius: 8px;
  flex-shrink: 0;
  min-width: 56px;
  text-align: center;
}

.chapter-range-lg {
  font-family: monospace;
  font-size: 0.9375rem;
  color: var(--accent);
  margin-top: 0.25rem;
}

.group-block {
  margin-bottom: 2rem;
}

.group-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 0;
  border-bottom: 2px solid var(--accent);
  margin-bottom: 0.5rem;
}

.group-block-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--dark-blue);
}

.group-block-range {
  font-family: monospace;
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-light);
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
}

.category-list {
  display: flex;
  flex-direction: column;
}

.category-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--low-opacity-gray);
  text-decoration: none;
  color: inherit;
  transition: background-color 0.15s;
  border-radius: 4px;
}
.category-item:hover { background-color: var(--accent-vivid-05); }
.category-item:last-child { border-bottom: none; }

.cat-code {
  font-family: monospace;
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--accent);
  min-width: 48px;
  flex-shrink: 0;
}

.cat-name {
  font-size: 0.875rem;
  color: var(--dark-300);
  flex: 1;
}

.cat-sub-count {
  font-size: 0.6875rem;
  color: var(--gray);
  background: var(--low-opacity-gray);
  padding: 0.15rem 0.4rem;
  border-radius: 10px;
  flex-shrink: 0;
}

/* ==========================================================================
   17. CID DETAIL PAGE
   ========================================================================== */

.cid-detail-section {
  padding: 0 2rem 3rem;
}

.cid-detail-inner {
  max-width: 760px;
  margin: 0 auto;
}

.cid-detail-card {
  padding: 2rem;
  background: var(--white-pure);
  border: 1px solid var(--light-gray);
  border-radius: 12px;
  margin-bottom: 2rem;
}

.cid-code-badge {
  display: inline-block;
  font-family: monospace;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--on-dark);
  background: var(--accent);
  padding: 0.5rem 1.25rem;
  border-radius: 8px;
  margin-bottom: 1rem;
}

.cid-detail-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--dark-blue);
  margin-bottom: 1.5rem;
  line-height: 1.4;
}

.cid-meta-grid {
  display: grid;
  gap: 1rem;
}

.cid-meta-item {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.cid-meta-label {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--gray);
}

.cid-meta-value {
  font-size: 0.9375rem;
  color: var(--dark-300);
}

.cid-subs-card,
.cid-related-card {
  padding: 1.5rem;
  background: var(--white-pure);
  border: 1px solid var(--light-gray);
  border-radius: 12px;
  margin-bottom: 2rem;
}

.cid-subs-card h2,
.cid-related-card h2 {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--dark-blue);
  margin-bottom: 1rem;
}

.cid-seo-text {
  padding: 2rem;
  background: var(--accent-vivid-05);
  border-radius: 12px;
  border: 1px solid var(--accent-light);
}

.cid-seo-text h2 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--dark-blue);
  margin-bottom: 1rem;
}

.cid-seo-text p {
  font-size: 0.9375rem;
  color: var(--dark-200);
  line-height: 1.7;
  margin-bottom: 0.75rem;
}
.cid-seo-text p:last-child { margin-bottom: 0; }
.cid-seo-text strong { color: var(--dark-300); }

@media (max-width: 767px) {
  .cid-detail-section { padding: 0 1rem 2rem; }
  .cid-detail-card { padding: 1.25rem; }
  .cid-code-badge { font-size: 1.25rem; }
  .cid-detail-title { font-size: 1.25rem; }
}

/* ==========================================================================
   18. FAQ PAGE
   ========================================================================== */

.faq-section {
  padding: 2rem;
}

.faq-inner {
  max-width: 760px;
  margin: 0 auto;
}

.faq-item {
  margin-bottom: 2rem;
  padding: 1.5rem;
  background: var(--white-pure);
  border: 1px solid var(--light-gray);
  border-radius: 10px;
}

.faq-question {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--dark-blue);
  margin-bottom: 1rem;
}

.faq-answer p {
  font-size: 0.9375rem;
  color: var(--dark-200);
  line-height: 1.7;
  margin-bottom: 0.75rem;
}
.faq-answer p:last-child { margin-bottom: 0; }
.faq-answer strong { color: var(--dark-300); }

.faq-answer ul {
  padding-left: 1.5rem;
  margin-bottom: 0.75rem;
}
.faq-answer li {
  font-size: 0.9375rem;
  color: var(--dark-200);
  line-height: 1.7;
  margin-bottom: 0.35rem;
  list-style: disc;
}
.faq-answer li strong { color: var(--dark-300); }

.faq-answer a {
  color: var(--accent);
  text-decoration: underline;
}

.faq-answer code {
  font-size: 0.8125rem;
  background: var(--accent-light);
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
  color: var(--accent);
}

@media (max-width: 767px) {
  .faq-section { padding: 1rem; }
  .faq-item { padding: 1rem; }
}

/* ==========================================================================
   19. LEGAL PAGES (Privacy, Terms)
   ========================================================================== */

.legal-page {
  padding: 2rem;
}

.legal-inner {
  max-width: 760px;
  margin: 0 auto;
}

.legal-page h1 {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--dark-blue);
  margin-bottom: 0.5rem;
}

.legal-updated {
  font-size: 0.8125rem;
  color: var(--gray);
  margin-bottom: 2rem;
}

.legal-content h2 {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--dark-blue);
  margin-top: 2rem;
  margin-bottom: 0.75rem;
}

.legal-content p {
  font-size: 0.9375rem;
  color: var(--dark-200);
  line-height: 1.7;
  margin-bottom: 0.75rem;
}

.legal-content ul {
  padding-left: 1.5rem;
  margin-bottom: 0.75rem;
}
.legal-content li {
  font-size: 0.9375rem;
  color: var(--dark-200);
  line-height: 1.7;
  margin-bottom: 0.35rem;
  list-style: disc;
}
.legal-content li strong { color: var(--dark-300); }

.legal-content a {
  color: var(--accent);
  text-decoration: underline;
}

@media (max-width: 767px) {
  .legal-page { padding: 1.25rem 1rem; }
}

/* ==========================================================================
   20. 404 ERROR PAGE
   ========================================================================== */

.error-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  padding: 2rem;
}

.error-inner {
  text-align: center;
}

.error-code {
  display: block;
  font-size: 5rem;
  font-weight: 700;
  color: var(--accent);
  opacity: 0.3;
  line-height: 1;
  margin-bottom: 1rem;
}

.error-page h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--dark-blue);
  margin-bottom: 0.5rem;
}

.error-page p {
  font-size: 1rem;
  color: var(--dark-200);
  margin-bottom: 1.5rem;
}

.error-link {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  background: var(--accent);
  color: var(--on-dark);
  border-radius: 8px;
  font-weight: 600;
  text-decoration: none;
  transition: opacity 0.2s;
}
.error-link:hover { opacity: 0.9; }

/* ==========================================================================
   21. SCROLL TO TOP
   ========================================================================== */

.scroll-top-btn {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--light-gray);
  background: var(--white-pure);
  color: var(--dark-300);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px var(--shadow-md);
  z-index: 50;
  transition: background-color 0.2s, color 0.2s;
}
.scroll-top-btn:hover {
  background: var(--accent);
  color: var(--on-dark);
  border-color: var(--accent);
}

/* ==========================================================================
   22. POPULAR CID SECTION (homepage)
   ========================================================================== */

.popular-section {
  width: 100%;
  padding: 3rem 2rem;
  background: var(--white-pure);
}

.popular-inner {
  max-width: 960px;
  margin: 0 auto;
}

.popular-title {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--dark-blue);
  text-align: center;
  margin-bottom: 0.5rem;
}

.popular-subtitle {
  font-size: 0.9375rem;
  color: var(--dark-200);
  text-align: center;
  margin-bottom: 2rem;
}

.popular-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 0.75rem;
}

.popular-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  background: var(--white-pure);
  border: 1px solid var(--light-gray);
  border-left: 4px solid var(--accent);
  border-radius: 8px;
  text-decoration: none;
  color: inherit;
  transition: box-shadow 0.2s, transform 0.2s;
}
.popular-card:hover {
  box-shadow: 0 4px 12px var(--shadow-lg);
  transform: translateY(-1px);
}

.popular-code {
  font-family: monospace;
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--on-dark);
  background: var(--accent);
  padding: 0.25rem 0.6rem;
  border-radius: 4px;
  flex-shrink: 0;
  min-width: 40px;
  text-align: center;
}

.popular-name {
  font-size: 0.8125rem;
  color: var(--dark-300);
  line-height: 1.4;
}

@media (max-width: 767px) {
  .popular-section { padding: 2rem 1rem; }
  .popular-grid { grid-template-columns: 1fr; }
}

/* ==========================================================================
   23. HOW-TO SECTION (homepage)
   ========================================================================== */

.howto-section {
  width: 100%;
  padding: 3rem 2rem;
  background: var(--low-opacity-gray);
}

.howto-inner {
  max-width: 760px;
  margin: 0 auto;
}

.howto-section h2 {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--dark-blue);
  text-align: center;
  margin-bottom: 2rem;
}

.howto-steps {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.howto-step {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  padding: 1.25rem;
  background: var(--white-pure);
  border: 1px solid var(--light-gray);
  border-radius: 10px;
}

.howto-number {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  min-width: 36px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--on-dark);
  font-weight: 700;
  font-size: 1rem;
  flex-shrink: 0;
}

.howto-step h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--dark-blue);
  margin-bottom: 0.35rem;
}

.howto-step p {
  font-size: 0.9375rem;
  color: var(--dark-200);
  line-height: 1.65;
}

.howto-step a {
  color: var(--accent);
  text-decoration: underline;
}

.howto-note {
  font-size: 0.875rem;
  color: var(--dark-200);
  text-align: center;
  line-height: 1.6;
  padding: 1rem;
  background: var(--accent-vivid-05);
  border: 1px solid var(--accent-light);
  border-radius: 8px;
}

.howto-note a {
  color: var(--accent);
  text-decoration: underline;
}

.chapters-subtitle {
  font-size: 0.9375rem;
  color: var(--dark-200);
  text-align: center;
  margin-bottom: 2rem;
  line-height: 1.6;
}

@media (max-width: 767px) {
  .howto-section { padding: 2rem 1rem; }
  .howto-step { flex-direction: column; align-items: center; text-align: center; }
}

/* ==========================================================================
   24. ARTICLE PAGE (CID-10 vs CID-11)
   ========================================================================== */

.article-section {
  padding: 2rem;
}

.article-inner {
  max-width: 760px;
  margin: 0 auto;
}

.article-block {
  margin-bottom: 2.5rem;
}

.article-block h2 {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--dark-blue);
  margin-bottom: 1rem;
}

.article-block p {
  font-size: 0.9375rem;
  color: var(--dark-200);
  line-height: 1.75;
  margin-bottom: 0.75rem;
}
.article-block p:last-child { margin-bottom: 0; }
.article-block strong { color: var(--dark-300); }

.article-block ul {
  padding-left: 1.5rem;
  margin-bottom: 0.75rem;
}
.article-block li {
  font-size: 0.9375rem;
  color: var(--dark-200);
  line-height: 1.75;
  margin-bottom: 0.5rem;
  list-style: disc;
}
.article-block li strong { color: var(--dark-300); }

.article-block a {
  color: var(--accent);
  text-decoration: underline;
}

.article-highlight {
  padding: 1.5rem;
  background: var(--accent-vivid-05);
  border: 1px solid var(--accent-light);
  border-radius: 12px;
}

.comparison-table-wrapper {
  overflow-x: auto;
  margin: 1rem 0;
}

.comparison-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.comparison-table th,
.comparison-table td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--light-gray);
  color: var(--dark-300);
}

.comparison-table th {
  background: var(--accent-vivid-05);
  font-weight: 700;
  color: var(--dark-blue);
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.comparison-table td {
  font-size: 0.875rem;
  line-height: 1.55;
  color: var(--dark-200);
}

.comparison-table td strong { color: var(--dark-300); }

.comparison-table tr:hover td {
  background: var(--accent-light);
}

@media (max-width: 767px) {
  .article-section { padding: 1rem; }
  .comparison-table { font-size: 0.8125rem; }
  .comparison-table th,
  .comparison-table td { padding: 0.5rem 0.6rem; }
}

/* ==========================================================================
   25. PRINT STYLES
   ========================================================================== */

@media print {
  *,
  *::before,
  *::after {
    background: transparent !important;
    color: #000 !important;
    box-shadow: none !important;
    text-shadow: none !important;
  }

  body {
    font-size: 11pt;
    line-height: 1.5;
  }

  .site-header,
  .site-footer,
  .scroll-top-btn,
  .theme-toggle,
  .nav-button,
  .search-box,
  .search-results,
  #scroll-top,
  #themeToggle {
    display: none !important;
  }

  .main-content {
    min-height: auto;
  }

  a {
    text-decoration: underline;
  }

  a[href^="http"]::after {
    content: " (" attr(href) ")";
    font-size: 0.8em;
    font-weight: normal;
  }

  a[href^="/"]::after {
    content: " (https://cid.unisus.info" attr(href) ")";
    font-size: 0.8em;
    font-weight: normal;
  }

  .hero {
    padding: 1rem 0;
  }

  .hero-badge {
    border: 1px solid #000;
  }

  .stats-strip {
    border: 1px solid #ccc;
    padding: 0.5rem;
  }

  .stats-inner {
    gap: 2rem;
  }

  .stat-value {
    font-size: 1.2rem;
  }

  .chapters-grid,
  .popular-grid,
  .feature-grid {
    gap: 0.5rem;
  }

  .chapter-card,
  .popular-card,
  .feature-card {
    border: 1px solid #ccc;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .cid-detail-card,
  .cid-subs-card,
  .cid-related-card,
  .cid-seo-text,
  .faq-item,
  .article-block {
    break-inside: avoid;
    page-break-inside: avoid;
    border: 1px solid #ccc;
    padding: 0.75rem;
    margin-bottom: 1rem;
  }

  .cid-code-badge {
    border: 2px solid #000;
    font-size: 1.2rem;
    padding: 0.3rem 0.75rem;
  }

  .comparison-table th {
    border-bottom: 2px solid #000;
  }

  .comparison-table td {
    border-bottom: 1px solid #ccc;
  }

  h1 { font-size: 1.5rem; }
  h2 { font-size: 1.2rem; }
  h3 { font-size: 1rem; }

  .page-header {
    border-bottom: 2px solid #000;
  }

  .breadcrumb-item + .breadcrumb-item::before {
    color: #666;
  }

  .howto-number {
    border: 2px solid #000;
    width: 24px;
    height: 24px;
    min-width: 24px;
    font-size: 0.8rem;
  }
}

/* ==========================================================================
   SYMPTOM GUIDE PAGE
   ========================================================================== */

.symptom-search-section {
  padding: 2rem;
  background: var(--highlight-gray);
}
.symptom-search-inner {
  max-width: 600px;
  margin: 0 auto;
}
.symptom-search-box {
  display: flex;
  align-items: center;
  background: var(--white-pure);
  border: 2px solid var(--mod-accent, #9B2FAE);
  border-radius: 12px;
  padding: 0.5rem 1rem;
  gap: 0.75rem;
}
.symptom-search-box .search-input {
  border: none;
  background: transparent;
  width: 100%;
  font-size: 1rem;
  color: var(--text-color);
  outline: none;
}

.symptom-guide-section {
  padding: 3rem 2rem;
  max-width: 960px;
  margin: 0 auto;
}
.symptom-guide-inner {
  width: 100%;
}
.symptom-guide-desc {
  color: var(--gray);
  margin-bottom: 2rem;
}

.symptom-category-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--mod-accent, #9B2FAE);
  margin: 2rem 0 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--highlight-gray);
}

.symptom-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.symptom-card {
  background: var(--white-pure);
  border: 1px solid var(--light-gray);
  border-radius: 10px;
  padding: 1rem 1.25rem;
  transition: box-shadow 0.15s, border-color 0.15s;
}
.symptom-card:hover {
  border-color: var(--mod-accent, #9B2FAE);
  box-shadow: 0 2px 8px var(--shadow-md);
}

.symptom-name {
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--text-color);
  margin-bottom: 0.5rem;
}

.symptom-codes {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.symptom-cid {
  display: inline-block;
  font-family: monospace;
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--mod-accent, #9B2FAE);
  background: var(--highlight-gray);
  padding: 0.2rem 0.6rem;
  border-radius: 6px;
  text-decoration: none;
  transition: background 0.15s;
}
.symptom-cid:hover {
  background: var(--mod-accent, #9B2FAE);
  color: #fff;
}

.symptom-cid-name {
  font-size: 0.8125rem;
  color: var(--gray);
}

.symptom-note-section {
  padding: 1.5rem 2rem 3rem;
  max-width: 960px;
  margin: 0 auto;
}
.symptom-note-inner {
  width: 100%;
}

/* Symptom CTA on homepage */
.symptom-cta-section {
  padding: 2rem;
}
.symptom-cta-inner {
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  background: var(--highlight-gray);
  border-radius: 12px;
  padding: 1.5rem 2rem;
  border-left: 4px solid var(--mod-accent, #9B2FAE);
}
.symptom-cta-inner svg {
  flex-shrink: 0;
  stroke: var(--mod-accent, #9B2FAE);
}
.symptom-cta-text h2 {
  font-size: 1.125rem;
  margin: 0 0 0.25rem;
  color: var(--text-color);
}
.symptom-cta-text p {
  font-size: 0.875rem;
  color: var(--gray);
  margin: 0;
}
.symptom-cta-button {
  flex-shrink: 0;
  display: inline-block;
  background: var(--mod-accent, #9B2FAE);
  color: #fff;
  padding: 0.6rem 1.25rem;
  border-radius: 8px;
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 600;
  transition: opacity 0.15s;
}
.symptom-cta-button:hover {
  opacity: 0.85;
}
@media (max-width: 640px) {
  .symptom-cta-inner {
    flex-direction: column;
    text-align: center;
  }
}

/* Cross-reference cards */
.cross-ref-card {
  margin-top: 2rem;
  padding: 1.5rem;
  border-radius: 0.75rem;
  background: var(--surface-2, #f8f9fa);
}
.cross-ref-card h2 {
  font-size: 1.15rem;
  margin: 0 0 0.5rem;
}
.cross-ref-card p {
  font-size: 0.92rem;
  color: var(--text-muted, #666);
  margin: 0 0 0.75rem;
}
.cross-ref-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 600;
  color: var(--accent, #9B2FAE);
  text-decoration: none;
  transition: opacity 0.15s;
}
.cross-ref-link:hover {
  opacity: 0.75;
  text-decoration: underline;
}

/* ==========================================================================
   CROSS-MODULE NAVIGATION BAR
   ========================================================================== */

.module-nav {
  background: var(--surface, #fff);
  border-bottom: 1px solid var(--border, #D5D8DE);
  height: 36px;
  display: flex;
  align-items: center;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.module-nav::-webkit-scrollbar { display: none; }

.module-nav-inner {
  display: flex;
  align-items: center;
  gap: 0;
  max-width: 900px;
  margin: 0 auto;
  padding: 0 16px;
  width: 100%;
}

.module-nav-link {
  font-family: "Rawline", system-ui, sans-serif;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary, var(--gray, #71839B));
  text-decoration: none;
  padding: 8px 14px;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
  line-height: 1;
}
.module-nav-link:hover {
  color: var(--text-primary, var(--text, #1A1A2E));
  text-decoration: none;
}
.module-nav-link.active {
  color: var(--accent, #9B2FAE);
  border-bottom-color: var(--accent, #9B2FAE);
}
.module-nav-portal {
  font-weight: 400;
  opacity: 0.7;
}
.module-nav-portal:hover {
  opacity: 1;
}

@media (max-width: 600px) {
  .module-nav-inner {
    padding: 0 8px;
  }
  .module-nav-link {
    padding: 8px 10px;
    font-size: 0.74rem;
  }
}
