/* Từ điển Pāli — Vibudra (frontend, khớp tam_giao / pali-canon) */
.pd-module {
  --pd-bg: #f7f9fb;
  --pd-card: #fff;
  --pd-border: #e2e8f0;
  --pd-text: #1e293b;
  --pd-muted: #64748b;
  /* Nâu đỏ trầm, trang nghiêm (thay tông xanh lá / teal) */
  --pd-accent: #6b3e2e;
  --pd-accent-soft: #f3e8e0;
  --pd-accent-on-soft: #5c2e24;
  font-family: "Inter", "Source Serif 4", system-ui, sans-serif;
  color: var(--pd-text);
  max-width: 1100px;
  margin: 0 auto;
  padding: 1rem 1rem 3rem;
}

.pd-module .pd-bc,
.pd-module .pd-subnav {
  font-size: 0.9rem;
  margin-bottom: 0.75rem;
}

.pd-module .pd-bc a,
.pd-module .pd-subnav a {
  color: var(--pd-accent);
  text-decoration: none;
}

.pd-module .pd-bc a:hover,
.pd-module .pd-subnav a:hover {
  text-decoration: underline;
}

.pd-module .pd-bc .sep,
.pd-module .pd-subnav-sep {
  color: var(--pd-muted);
  margin: 0 0.35rem;
}

.pd-page-hero {
  margin-bottom: 1.75rem;
}

.pd-kicker {
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--pd-muted);
  margin: 0 0 0.35rem;
}

.pd-h1 {
  font-family: "Source Serif 4", Georgia, serif;
  font-size: clamp(1.65rem, 3vw, 2.1rem);
  font-weight: 600;
  margin: 0 0 0.5rem;
  color: #0f172a;
}

.pd-lead {
  font-size: 1rem;
  line-height: 1.55;
  color: var(--pd-muted);
  margin: 0;
  max-width: 52em;
}

.pd-search-hub {
  background: var(--pd-card);
  border: 1px solid var(--pd-border);
  border-radius: 12px;
  padding: 1.25rem 1.35rem;
  margin-bottom: 2rem;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.pd-search-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
  margin-bottom: 1rem;
}

.pd-search-row input[type="search"] {
  flex: 1 1 220px;
  min-width: 180px;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--pd-border);
  border-radius: 8px;
  font-size: 1rem;
}

.pd-btn-solid {
  background: var(--pd-accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 0.65rem 1.25rem;
  font-weight: 600;
  cursor: pointer;
}

.pd-btn-solid:hover {
  filter: brightness(1.05);
}

.pd-btn-ghost {
  display: inline-block;
  background: transparent;
  color: var(--pd-accent);
  border: 1px solid var(--pd-border);
  border-radius: 8px;
  padding: 0.45rem 0.85rem;
  font-size: 0.9rem;
  text-decoration: none;
}

.pd-btn-ghost:hover {
  background: var(--pd-accent-soft);
}

.pd-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1.25rem;
  align-items: flex-start;
  border-top: 1px solid var(--pd-border);
  padding-top: 1rem;
}

.pd-filters legend {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--pd-muted);
  margin-bottom: 0.5rem;
  padding: 0;
  border: none;
  width: 100%;
}

.pd-check-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 0.35rem 0.75rem;
}

.pd-check-grid label {
  display: flex;
  align-items: flex-start;
  gap: 0.4rem;
  font-size: 0.88rem;
  line-height: 1.35;
  cursor: pointer;
  font-weight: 400;
}

.pd-check-grid input {
  margin-top: 0.2rem;
}

.pd-muted {
  color: var(--pd-muted);
  font-size: 0.95rem;
}

.pd-result-section {
  margin-bottom: 2rem;
}

.pd-result-section h2 {
  font-family: "Source Serif 4", Georgia, serif;
  font-size: 1.15rem;
  margin: 0 0 0.75rem;
  color: #0f172a;
}

.pd-lemma-group {
  background: var(--pd-card);
  border: 1px solid var(--pd-border);
  border-radius: 12px;
  padding: 1rem 1.15rem;
  margin-bottom: 1rem;
}

.pd-lemma-group-h {
  font-family: "Gentium Book Plus", Georgia, serif;
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0 0 0.75rem;
  color: #0f172a;
}

.pd-source-row {
  margin-bottom: 0.85rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px dashed var(--pd-border);
}

.pd-source-row:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.pd-source-meta {
  font-size: 0.8rem;
  color: var(--pd-muted);
  margin-bottom: 0.35rem;
}

.pd-source-meta strong {
  color: var(--pd-accent);
  font-weight: 600;
}

.pd-snippet {
  font-size: 0.92rem;
  line-height: 1.5;
  color: #334155;
  max-height: 6.5em;
  overflow: hidden;
}

.pd-entry-page {
  background: var(--pd-card);
  border: 1px solid var(--pd-border);
  border-radius: 12px;
  padding: 1.35rem 1.5rem;
  margin-bottom: 1.5rem;
}

.pd-entry-header .pd-lemma {
  font-family: "Gentium Book Plus", Georgia, serif;
  font-size: 1.75rem;
  font-weight: 700;
  margin: 0 0 0.25rem;
}

.pd-entry-header .pd-lemma-sub {
  font-size: 0.95rem;
  color: var(--pd-muted);
  margin: 0 0 0.75rem;
}

.pd-entry-header .pd-dict-badge {
  display: inline-block;
  font-size: 0.8rem;
  background: var(--pd-accent-soft);
  color: var(--pd-accent-on-soft);
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
  font-weight: 600;
}

.pd-entry-body {
  font-family: "Gentium Book Plus", Georgia, serif;
  font-size: 1.05rem;
  line-height: 1.65;
  margin-top: 1.25rem;
  white-space: pre-wrap;
  word-break: break-word;
}

/* HTML đã sanitize (normalizeDictionaryEntry): hiển thị học thuật */
.pd-entry-body.pd-entry-html {
  white-space: normal;
}

.pd-entry-html {
  word-break: break-word;
}

.pd-entry-html i,
.pd-entry-html em {
  font-style: italic;
  font-family: inherit;
  color: #334155;
}

.pd-entry-html b,
.pd-entry-html strong {
  font-weight: 600;
  color: #0f172a;
}

.pd-entry-html sup {
  font-size: 0.68em;
  line-height: 0;
  vertical-align: super;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.pd-entry-html sub {
  font-size: 0.68em;
  line-height: 0;
  vertical-align: sub;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.pd-vibudra {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 2px solid var(--pd-accent-soft);
}

.pd-vibudra h2 {
  font-family: "Source Serif 4", Georgia, serif;
  font-size: 1.2rem;
  margin: 0 0 1rem;
  color: #0f172a;
}

.pd-vibudra-block {
  margin-bottom: 1.25rem;
}

.pd-vibudra-block h3 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--pd-muted);
  margin: 0 0 0.35rem;
}

.pd-vibudra-block .pd-body {
  font-size: 0.98rem;
  line-height: 1.6;
  white-space: pre-wrap;
}

.pd-vibudra-block .pd-body.pd-entry-html {
  white-space: normal;
}

.pd-empty {
  color: var(--pd-muted);
  padding: 1rem 0;
}

.pd-hidden {
  display: none !important;
}

/* --- Tra cứu: ô lớn + gợi ý --- */
.pd-search-row-xl {
  align-items: stretch;
}

.pd-search-field-wrap {
  position: relative;
  flex: 1 1 280px;
  min-width: 200px;
}

.pd-input-search-lg {
  width: 100%;
  padding: 0.85rem 1rem;
  border: 1px solid var(--pd-border);
  border-radius: 10px;
  font-size: 1.12rem;
  line-height: 1.4;
}

.pd-btn-search-xl {
  padding: 0.85rem 1.35rem;
  font-size: 1rem;
  align-self: stretch;
}

.pd-suggestions {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  z-index: 40;
  background: #fff;
  border: 1px solid var(--pd-border);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
  max-height: min(320px, 50vh);
  overflow-y: auto;
}

.pd-suggestion-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.55rem 0.85rem;
  border: none;
  border-bottom: 1px solid #f1f5f9;
  background: transparent;
  cursor: pointer;
  font-size: 0.95rem;
}

.pd-suggestion-item:last-child {
  border-bottom: none;
}

.pd-suggestion-item:hover,
.pd-suggestion-item:focus {
  background: var(--pd-accent-soft);
  outline: none;
}

.pd-sug-main {
  display: block;
  font-family: "Gentium Book Plus", Georgia, serif;
  font-weight: 600;
  color: #0f172a;
}

.pd-sug-meta {
  display: block;
  font-size: 0.8rem;
  color: var(--pd-muted);
  margin-top: 0.15rem;
}

.pd-lemma-group-link {
  color: inherit;
  text-decoration: none;
}

.pd-lemma-group-link:hover {
  color: var(--pd-accent);
  text-decoration: underline;
}

/* --- Trang lemma (4 tầng) --- */
.pd-lemma-shell {
  margin-bottom: 2rem;
}

.pd-lemma-loading {
  padding: 2rem;
  text-align: center;
  color: var(--pd-muted);
}

.pd-lemma-error {
  background: #fff7ed;
  border: 1px solid #fed7aa;
  color: #9a3412;
  padding: 1rem 1.15rem;
  border-radius: 10px;
  margin-bottom: 1rem;
}

.pd-tier {
  background: var(--pd-card);
  border: 1px solid var(--pd-border);
  border-radius: 12px;
  padding: 1.25rem 1.35rem;
  margin-bottom: 1.25rem;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

/* Vibudra — nổi bật hơn các tầng khác */
#pd-tier-2.pd-tier {
  border-left: 4px solid var(--pd-accent);
  background: linear-gradient(90deg, rgba(107, 62, 46, 0.07) 0%, var(--pd-card) 48%);
}

.pd-tier-h {
  font-family: "Source Serif 4", Georgia, serif;
  font-size: 1.85rem;
  font-weight: 600;
  margin: 0 0 1rem;
  color: #0f172a;
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}

.pd-tier-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.75rem;
  height: 1.75rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  background: var(--pd-accent-soft);
  color: var(--pd-accent);
  border-radius: 6px;
}

.pd-lemma-display {
  font-family: "Gentium Book Plus", Georgia, serif;
  font-size: clamp(1.75rem, 3.5vw, 2.25rem);
  font-weight: 700;
  color: #0f172a;
  margin: 0 0 0.75rem;
  line-height: 1.2;
}

.pd-lemma-dl {
  margin: 0;
  display: grid;
  gap: 0.5rem 1.5rem;
}

.pd-lemma-dl > div {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 0.5rem;
  align-items: baseline;
}

.pd-lemma-dl dt {
  margin: 0;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--pd-muted);
  font-weight: 600;
}

.pd-lemma-dl dd {
  margin: 0;
  font-size: 0.98rem;
}

.pd-pali {
  font-family: "Gentium Book Plus", Georgia, serif;
}

.pd-vibudra-field {
  margin-bottom: 1.1rem;
}

.pd-vibudra-field:last-child {
  margin-bottom: 0;
}

.pd-field-label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--pd-muted);
  margin: 0 0 0.35rem;
  font-weight: 600;
}

.pd-field-body {
  font-size: 0.98rem;
  line-height: 1.65;
  color: #334155;
}

.pd-field-body.pd-entry-html {
  white-space: normal;
}

.pd-source-card {
  border: 1px solid var(--pd-border);
  border-radius: 10px;
  padding: 1rem 1.1rem;
  margin-bottom: 0.85rem;
  background: #fafbfc;
}

.pd-source-card:last-child {
  margin-bottom: 0;
}

.pd-source-card-h {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.65rem;
  margin-bottom: 0.65rem;
}

.pd-source-lemma-block {
  margin: 0 0 0.75rem;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid var(--pd-border);
}

.pd-source-lemma-display {
  font-family: "Gentium Book Plus", Georgia, serif;
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1.35;
  margin: 0 0 0.25rem;
  color: #0f172a;
}

.pd-source-lemma-iast {
  font-size: 0.88rem;
  margin: 0;
}

.pd-source-title {
  font-family: "Source Serif 4", Georgia, serif;
  font-weight: 600;
  font-size: 1.5rem;
  color: var(--pd-accent);
}

.pd-source-code {
  font-size: 0.78rem;
  background: #e2e8f0;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
}

.pd-source-body {
  font-size: 1.98rem;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
}

.pd-source-body.pd-entry-html {
  white-space: normal;
}

.pd-source-preview {
  font-size: 0.92rem;
  line-height: 1.55;
  color: #334155;
  margin: 0 0 0.65rem;
}

.pd-source-preview-empty {
  font-size: 0.88rem;
  margin: 0 0 0.65rem;
}

.pd-source-actions {
  margin: 0 0 0.5rem;
}

.pd-btn-source-expand {
  display: inline-block;
  background: var(--pd-accent-soft);
  color: var(--pd-accent-on-soft);
  border: 1px solid var(--pd-border);
  border-radius: 8px;
  padding: 0.35rem 0.75rem;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}

.pd-btn-source-expand:hover:not(:disabled) {
  filter: brightness(0.97);
}

.pd-btn-source-expand:disabled {
  opacity: 0.75;
  cursor: default;
}

.pd-source-error {
  color: #b91c1c;
  font-size: 0.9rem;
  margin: 0.35rem 0 0;
}

.pd-source-skeleton {
  font-size: 0.88rem;
  color: var(--pd-muted);
  margin: 0.35rem 0 0;
  font-style: italic;
}

.pd-loading-inline {
  margin: 0.35rem 0 0;
}

/* --- Danh sách thuật ngữ (chữ cái + lưới 2 cột) --- */
.pd-browse-section {
  margin-top: 2rem;
  margin-bottom: 2rem;
}

.pd-browse-h2 {
  font-family: "Source Serif 4", Georgia, serif;
  font-size: 1.2rem;
  font-weight: 600;
  margin: 0 0 0.5rem;
  color: #0f172a;
}

.pd-alpha-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.5rem;
  margin-bottom: 1.25rem;
  padding: 0.65rem 0.75rem;
  background: var(--pd-card);
  border: 1px solid var(--pd-border);
  border-radius: 10px;
}

.pd-alpha-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.75rem;
  padding: 0.28rem 0.45rem;
  border-radius: 6px;
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 500;
  color: #334155;
  border: 1px solid transparent;
}

.pd-alpha-link:hover {
  background: var(--pd-accent-soft);
  color: var(--pd-accent);
}

.pd-alpha-link.is-active {
  background: var(--pd-accent);
  color: #fff;
  border-color: var(--pd-accent);
}

.pd-browse-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

@media (max-width: 700px) {
  .pd-browse-grid {
    grid-template-columns: 1fr;
  }
}

.pd-browse-card {
  background: var(--pd-card);
  border: 1px solid var(--pd-border);
  border-radius: 12px;
  padding: 1rem 1.15rem;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.pd-browse-card--compact {
  padding: 0.65rem 0.95rem;
}

.pd-browse-card--compact .pd-browse-lemma {
  margin: 0;
}

.pd-browse-source-hint {
  font-size: 0.78rem;
  color: var(--pd-muted);
  margin: 0.35rem 0 0;
  line-height: 1.35;
}

.pd-browse-lemma {
  font-family: "Gentium Book Plus", Georgia, serif;
  font-size: 1.18rem;
  font-weight: 700;
  margin: 0 0 0.45rem;
  line-height: 1.25;
}

.pd-browse-lemma a {
  color: #0f172a;
  text-decoration: none;
}

.pd-browse-lemma a:hover {
  color: var(--pd-accent);
  text-decoration: underline;
}

.pd-browse-meta {
  font-size: 0.82rem;
  color: var(--pd-accent);
  font-weight: 500;
  margin-bottom: 0.45rem;
  line-height: 1.4;
}

.pd-browse-dot {
  color: var(--pd-muted);
  margin: 0 0.25rem;
}

.pd-browse-more {
  color: var(--pd-muted);
  font-weight: 400;
  text-decoration: none;
}

.pd-browse-more:hover {
  color: var(--pd-accent);
  text-decoration: underline;
}

.pd-browse-snippet {
  font-size: 0.9rem;
  line-height: 1.55;
  color: #334155;
  margin: 0;
}

.pd-browse-pagination {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  list-style: none;
  padding: 0;
}

.pd-browse-pagination li a,
.pd-browse-pagination li span {
  display: inline-block;
  padding: 0.35rem 0.55rem;
  border-radius: 6px;
  border: 1px solid var(--pd-border);
  text-decoration: none;
  color: #334155;
  font-size: 0.88rem;
}

.pd-browse-pagination li a:hover {
  background: var(--pd-accent-soft);
  border-color: #d4b8a8;
}

.pd-browse-pagination li.active a {
  background: var(--pd-accent);
  color: #fff;
  border-color: var(--pd-accent);
}

.pd-browse-pagination li.disabled span {
  opacity: 0.45;
  cursor: default;
}

@media (max-width: 576px) {
  .pd-search-row {
    flex-direction: column;
    align-items: stretch;
  }

  .pd-btn-solid {
    width: 100%;
  }

  .pd-lemma-dl > div {
    grid-template-columns: 1fr;
  }
}
