.wb-app,
.wb-app * {
  box-sizing: border-box;
}

.wb-app {
  --gold: #d4a843;
  --gold-dark: #c09530;
  --gold-light: #f7f0df;
  --navy: #2b4c7e;
  --navy-dark: #1b3a66;
  --navy-light: #e8eef5;
  --ink: #333333;
  --ink2: #555555;
  --ink3: #888888;
  --bg: #ffffff;
  --bg-alt: #f9f9f7;
  --border: #ddd;
  --link: #2b4c7e;

  font-family: 'Source Sans 3', 'Segoe UI', Tahoma, sans-serif;
  color: var(--ink);
  line-height: 1.65;
  width: 100%;
  max-width: 1172px;
  margin: 0 auto;
  padding: 30px 34px 60px;
  background: var(--bg);
  border-radius: 5px;
  box-shadow: 0 12px 34px rgba(15, 30, 55, 0.12);
  border: 1px solid rgba(0, 0, 0, 0.06);
}

/* When embedded inside Divi post content, keep container fully fluid */
.et_pb_post_content .wb-app {
  max-width: 1172px;
}

/* Divi header template override for woordenboek view */
body.wb-app-active.et-db #et-boc .et-l .et_pb_row_0_tb_header.et_pb_row {
  padding-bottom: 0 !important;
}

/* Keep overlay/modal visible below WP admin bar */
body.admin-bar .wb-overlay {
  inset: 32px 0 0 0;
}
@media (max-width: 782px) {
  body.admin-bar .wb-overlay {
    inset: 46px 0 0 0;
  }
}

/* Better width scaling at common Divi breakpoints */
@media (max-width: 1280px) {
  .wb-app {
    width: calc(100% - 28px);
  }
}
@media (max-width: 980px) {
  .wb-app {
    width: calc(100% - 22px);
    padding: 24px 20px 46px;
  }
}

.wb-page-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 28px;
  font-weight: 700;
  color: var(--navy-dark);
  margin: 0 0 6px;
}

.wb-page-intro {
  margin: 0 0 28px;
  color: var(--ink2);
  font-size: 15px;
}

.wb-search-row {
  display: flex;
  gap: 0;
  margin-bottom: 24px;
  max-width: 480px;
}

.wb-search {
  flex: 1;
  min-width: 0;
  padding: 10px 14px;
  border: 1px solid var(--border);
  font-size: 15px;
  background: var(--bg);
  border-radius: 0;
  outline: none;
}

.wb-search:focus {
  border-color: var(--gold);
}

.wb-search-button {
  padding: 10px 20px;
  background: var(--gold);
  color: #fff;
  border: 1px solid var(--gold);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.wb-search-button:hover {
  background: var(--gold-dark);
}

.wb-search-info {
  font-size: 13px;
  color: var(--ink3);
  margin-top: -18px;
  margin-bottom: 20px;
  min-height: 20px;
}

.wb-filter-block {
  margin-bottom: 20px;
}

.wb-filter-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--ink3);
  font-weight: 600;
  margin-bottom: 8px;
  display: block;
}

.wb-letter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
}

.wb-letter-btn {
  width: 33px;
  height: 33px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--ink2);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.wb-letter-btn:hover {
  background: var(--navy-light);
  color: var(--navy);
  border-color: #b8cde0;
}

.wb-letter-btn.is-active {
  background: var(--navy);
  color: #fff;
  border-color: var(--navy);
}

.wb-letter-btn.is-empty {
  opacity: 0.3;
  cursor: default;
  pointer-events: none;
}

.wb-cat-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.wb-cat-tag {
  padding: 5px 13px;
  font-size: 13px;
  font-weight: 500;
  background: var(--bg-alt);
  color: var(--ink2);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.wb-cat-tag:hover {
  background: var(--navy-light);
  color: var(--navy);
  border-color: #b8cde0;
}

.wb-cat-tag.is-active {
  background: var(--navy);
  color: #fff;
  border-color: var(--navy);
}

.wb-cat-tag-count {
  font-size: 11px;
  opacity: 0.65;
  margin-left: 3px;
}

.wb-letter-group {
  margin-bottom: 28px;
}

.wb-letter-heading {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 26px;
  color: var(--navy);
  font-weight: 700;
  padding-bottom: 6px;
  border-bottom: 2px solid var(--gold);
  margin-bottom: 12px;
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.wb-group-count {
  font-family: 'Source Sans 3', sans-serif;
  font-size: 13px;
  color: var(--ink3);
  font-weight: 400;
}

.wb-terms-list {
  column-count: 3;
  column-gap: 24px;
}

.wb-term-item {
  break-inside: avoid;
  width: 100%;
  border: 0;
  border-bottom: 1px solid #f0eeea;
  background: transparent;
  text-align: left;
  cursor: pointer;
  transition: background 0.1s;
  padding: 5px 0;
}

.wb-term-item:hover {
  background: var(--gold-light);
}

.wb-term-item:hover .wb-term-name {
  color: var(--gold-dark);
}

.wb-term-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--link);
  display: block;
  line-height: 1.4;
  padding: 2px 4px;
}

.wb-term-category {
  font-size: 11px;
  color: #7a96b4;
  padding: 0 4px;
  display: block;
}

.wb-no-results {
  text-align: center;
  padding: 40px 20px;
  color: var(--ink3);
}

.wb-no-results strong {
  color: var(--ink2);
  font-size: 17px;
  display: block;
  margin-bottom: 6px;
}

.wb-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.wb-overlay.is-open {
  display: flex;
}

.wb-modal {
  background: var(--bg);
  max-width: 520px;
  width: 100%;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
  animation: wbModalIn 0.2s ease;
}

@keyframes wbModalIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
}

.wb-modal-top {
  padding: 22px 24px 14px;
  border-bottom: 2px solid var(--gold);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.wb-modal-top h2 {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 22px;
  color: var(--navy-dark);
  font-weight: 700;
  line-height: 1.3;
  margin: 0;
}

.wb-modal-close {
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  background: var(--bg);
  cursor: pointer;
  font-size: 18px;
  color: var(--ink3);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.wb-modal-close:hover {
  background: var(--navy-light);
  color: var(--navy);
}

.wb-modal-body {
  padding: 18px 24px 24px;
}

.wb-modal-cat {
  display: inline-block;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 600;
  background: var(--navy-light);
  color: var(--navy);
  border: 1px solid #b8cde0;
  margin-bottom: 14px;
}

.wb-modal-related {
  margin-top: 18px;
}

.wb-modal-related h4 {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--ink3);
  margin: 0 0 8px;
  font-weight: 600;
}

.wb-rel-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.wb-rel-tag {
  padding: 3px 9px;
  font-size: 12px;
  background: var(--bg-alt);
  color: var(--ink2);
  border: 1px solid var(--border);
  cursor: pointer;
}

.wb-rel-tag:hover {
  background: var(--navy-light);
  color: var(--navy);
  border-color: #b8cde0;
}

.wb-modal-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #fff;
  background: var(--gold);
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  padding: 10px 22px;
}

.wb-modal-btn:hover {
  background: var(--gold-dark);
}

.wb-totop {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 40px;
  height: 40px;
  background: var(--navy);
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: 18px;
  display: none;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
  z-index: 50;
}

.wb-totop:hover {
  background: var(--navy-dark);
}

.wb-totop.is-show {
  display: flex;
}

body.admin-bar .wb-totop {
  bottom: 20px;
}

mark.wb-mark {
  background: var(--gold-light);
  padding: 0 1px;
}

@media (max-width: 768px) {
  .wb-app {
    padding: 22px 18px 44px;
    border-radius: 5px;
  }

  .wb-terms-list {
    column-count: 2;
  }
}

@media (max-width: 480px) {
  .wb-app {
    width: calc(100% - 16px);
    padding: 18px 14px 36px;
  }

  .wb-terms-list {
    column-count: 1;
  }
}

.wb-term-page {
  padding-bottom: 36px;
  margin-bottom: 28px;
}

.wb-term-header {
  margin-bottom: 18px;
}

.wb-term-title {
  margin: 0 0 8px;
  font-family: 'Playfair Display', Georgia, serif;
  font-size: clamp(28px, 3.2vw, 40px);
  line-height: 1.15;
  color: var(--navy-dark);
  padding-bottom: 10px;
  border-bottom: 2px solid var(--gold);
}

.wb-term-badge {
  display: inline-block;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  background: var(--navy-light);
  color: var(--navy);
  border: 1px solid #b8cde0;
}

.wb-term-content {
  margin-top: 14px;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.65;
}

.wb-term-content p {
  margin: 0 0 14px;
  font-size: 15px;
  font-weight: 500;
}

.wb-legacy-bottom {
  margin-top: 26px;
  padding-top: 14px;
  border-top: 1px solid #e6e8ec;
  color: #1f1f1f;
  font-family: 'Source Sans 3', 'Segoe UI', Tahoma, sans-serif;
  font-size: 18px;
  font-weight: 400;
  line-height: 1.5;
}

.wb-legacy-line {
  margin: 0 0 20px;
}

.wb-legacy-line:last-child {
  margin-bottom: 0;
}

.wb-legacy-bullet {
  display: inline-block;
  margin-right: 8px;
  color: #111;
  font-size: 0.95em;
}

.wb-legacy-bottom a {
  color: #1f33cc;
  text-decoration: none;
}

.wb-legacy-bottom a:hover,
.wb-legacy-bottom a:focus {
  text-decoration: underline;
}

.wb-term-back {
  margin: 18px 0 0;
}

@media (max-width: 640px) {
  .wb-legacy-bottom {
    font-size: 16px;
  }

  .wb-legacy-line {
    margin-bottom: 16px;
  }
}

/* Keep footer pinned to viewport bottom on woordenboek pages with little content */
body.post-type-archive-woordenboek_term #et-main-area,
body.single-woordenboek_term #et-main-area {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

body.post-type-archive-woordenboek_term #main-content,
body.single-woordenboek_term #main-content {
  flex: 1 0 auto;
}

body.post-type-archive-woordenboek_term #main-footer,
body.single-woordenboek_term #main-footer {
  margin-top: auto;
}

/* Compensate admin bar height for logged-in users */
body.admin-bar.post-type-archive-woordenboek_term #et-main-area,
body.admin-bar.single-woordenboek_term #et-main-area {
  min-height: calc(100vh - 32px);
}

@media (max-width: 782px) {
  body.admin-bar.post-type-archive-woordenboek_term #et-main-area,
  body.admin-bar.single-woordenboek_term #et-main-area {
    min-height: calc(100vh - 46px);
  }
}

body.post-type-archive-woordenboek_term .wb-app {
  margin-bottom: 28px;
}
