:root {
  --gold: #d4af37;
  --bg: #ffffff;
  --bg-elevated: #ffffff;
  --bg-soft: #f9f7f0;
  --text: #121212;
  --muted: #616161;
  --border: #e9e9e9;
  --chip-border: #d0d0d0;
  --z-header: 200;
  --z-toolbar: 300;
  --z-overlay: 500;
  --z-modal: 1000;
  --z-fab: 1200;
}


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

body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}


a {
  color: var(--gold);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

/* Header */

header {
  position: sticky;
  top: 0;
  z-index: var(--z-header);
  background: #ffffff;
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.header-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 0.75rem 0.6rem 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.9rem;
}

.brand img {
  height: 28px;
}

.brand b {
  color: var(--gold);
}

.nav {
  display: flex;
  gap: 0.75rem;
  font-size: 0.8rem;
  margin-left: auto;
}

.nav a {
  color: var(--muted);
}

.nav a:hover {
  color: var(--gold);
}

/* Toolbar */

.toolbar {
  position: sticky;
  top: 60px;
  z-index: var(--z-toolbar);
  background: #ffffff;
  border-bottom: 1px solid var(--border);
  padding-top: 0.4rem;
  padding-bottom: 0.5rem;
}

.search-block {
  padding: 0.4rem 0 0.5rem;
}

.search-inline {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.search-field {
  flex: 1;
}

#searchInput {
  width: 100%;
  padding: 0.55rem 0.9rem;
  border-radius: 999px;
  border: 1px solid #000;
  background: #141414;
  color: #ffffff;
  font-size: 0.85rem;
}

#searchInput::placeholder {
  color: rgba(255, 255, 255, 0.65);
}

.filter-panel {
  padding-bottom: 0.35rem;
}

.filter-row-main {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.view-tabs {
  display: flex;
  gap: 0.55rem;
}

.tab-button {
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: transparent;
  color: var(--text);
  font-size: 0.78rem;
  padding: 0.3rem 0.85rem;
  cursor: pointer;
}

.tab-button.active {
  border-color: var(--gold);
  background: rgba(249, 225, 139, 0.18);
  color: var(--gold);
}

.btn,
#fabFilters {
  border-radius: 999px;
  border: 1px solid var(--gold);
  background: rgba(255, 250, 240, 0.9);
  color: #000;
  font-size: 0.78rem;
  padding: 0.3rem 0.85rem;
  cursor: pointer;
  box-shadow: 0 0 14px rgba(212, 175, 55, 0.55);
  transition: box-shadow 0.25s ease, background 0.25s ease, transform 0.08s ease;
}

.btn:hover,
#fabFilters:hover {
  box-shadow: 0 0 18px rgba(212, 175, 55, 0.8);
}

.btn.active,
#fabFilters.active {
  background: var(--gold);
  color: #000;
  border-color: var(--gold);
  box-shadow: 0 0 18px rgba(212, 175, 55, 0.9);
}

/* Filter overlay */

#filters {
  display: none;
  margin-top: 0.45rem;
}

#filters.active {
  display: block;
}

#filters .inner {
  background: var(--bg-elevated);
  border-radius: 1rem;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.9);
  padding: 0.6rem 0.75rem 0.75rem;
}

#filters .row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
}

.category-row {
  align-items: flex-start;
}

.category-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}


.topic-row {
  margin-top: 0.4rem;
  align-items: flex-start;
}

.filter-label {
  font-size: 0.75rem;
  opacity: 0.8;
  margin-right: 0.4rem;
  margin-top: 0.1rem;
}

.topic-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}



.related-row {
  margin-top: 0.35rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.filter-chip.related-chip {
  font-size: 0.7rem;
  border-color: var(--gold);
  background: transparent;
}
.filter-chip {
  border-radius: 999px;
  padding: 0.3rem 0.8rem;
  border: 1px solid var(--chip-border);
  background: var(--chip);
  font-size: 0.75rem;
  cursor: pointer;
  color: #000;
}

.filter-chip:hover {
  border-color: var(--gold);
}

.filter-chip.active {
  border-color: var(--gold);
  background: var(--gold);
  color: #121212;
}

/* Main layout */

main {
  padding-top: 0.6rem;
  padding-bottom: 2.5rem;
}

.iod-section {
  border-radius: 16px;
  border: 1px solid rgba(212, 175, 55, 0.5);
  padding: 0.9rem 1rem;
  margin-bottom: 1.2rem;
  background: linear-gradient(135deg, #fffaf0, #ffffff);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.06);
}

.iod-label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--gold);
  margin-bottom: 0.4rem;
  font-weight: 700;
}

.lists-wrapper {
  border-radius: 16px;
  border: 1px solid var(--border)6);
  padding: 0.9rem 1rem 1.1rem;
  background: var(--bg-elevated);
}

.results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.6rem;
}

#count {
  font-size: 0.8rem;
  color: var(--muted);
}

.results-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.results-right h2 {
  margin: 0;
  font-size: 0.95rem;
}

.list-actions {
  display: flex;
  gap: 0.55rem;
}

.btn-clear {
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-size: 0.72rem;
  padding: 0.25rem 0.65rem;
  cursor: pointer;
  display: none;
}

.btn-clear:hover {
  border-color: var(--gold);
  color: var(--gold);
}

/* Grid & cards */

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

.insight-card {
  position: relative;
  border-radius: 16px;
  border: 1px solid var(--border);
  padding: 0.75rem 0.9rem;
  padding-right: 3.2rem;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.06);
}

.insight-card:hover {
  border-color: var(--gold);
  box-shadow: 0 8px 20px rgba(212, 175, 55, 0.25);
}


.card-footer {
  display: flex;
  justify-content: flex-end;
  margin-top: 0.45rem;
}

.card-open-indicator {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--gold);
  background: #fffaf0;
  color: #000;
  font-size: 0.75rem;
  cursor: pointer;
}

.card-open-indicator .icon {
  font-size: 0.95rem;
  color: var(--gold);
}

.insight-card:hover .card-open-indicator {
  box-shadow: 0 0 0 1px rgba(212, 175, 55, 0.3);
}


.insight-question {
  font-size: 0.9rem;
  font-weight: 600;
}

.insight-preview {
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.4;
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-top: 0.25rem;
}

.badge {
  font-size: 0.65rem;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  border: 1px solid var(--chip-border);
  background: #f3f3f3;
}




.badge.featured {
  border-color: var(--gold);
  color: var(--gold);
}


.favorite-indicator {
  margin-left: auto;
  font-size: 0.9rem;
  color: var(--gold);
}

/* Modal */

.modal {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal.hidden {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(4px);
  z-index: var(--z-modal);
}

.modal-dialog {
  position: relative;
  max-width: 720px;
  width: 100%;
  margin: 1rem;
  max-height: calc(100vh - 2rem);
  overflow: hidden;
  border-radius: 1rem;
  border: 1px solid rgba(249, 225, 139, 0.7);
  background: var(--bg-soft);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.9);
  z-index: calc(var(--z-modal) + 1);
}

.modal-content {
  padding: 1rem 1.1rem 1.2rem;
  overflow-y: auto;
  max-height: calc(100vh - 2rem);
}

.modal-close {
  position: absolute;
  top: 0.55rem;
  right: 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--chip-border);
  width: 1.9rem;
  height: 1.9rem;
  background: #ffffff;
  color: var(--text);
  cursor: pointer;
  font-size: 1.1rem;
  box-shadow: 0 4px 14px rgba(0,0,0,0.25);
}

.modal h2 {
  margin-top: 0.2rem;
  margin-bottom: 0.3rem;
  font-size: 1.05rem;
}

.modal-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.6rem;
}

.favorite-btn {
  border-radius: 999px;
  border: 1px solid var(--chip-border);
  padding: 0.25rem 0.7rem;
  background: #ffffff;
  color: var(--text);
  font-size: 0.75rem;
  cursor: pointer;
  white-space: nowrap;
}

.favorite-btn.active {
  border-color: var(--gold);
  color: #000;
  background: var(--gold);
}

.modal-section {
  margin-top: 0.6rem;
}

.modal-section h3 {
  margin: 0 0 0.2rem;
  font-size: 0.85rem;
  color: var(--gold);
}

.modal-section p {
  margin: 0;
  font-size: 0.8rem;
  line-height: 1.45;
}


.modal-answer {
  margin-top: 0.8rem;
}

.modal-callout {
  margin-top: 0.7rem;
  border-radius: 12px;
  padding: 0.6rem 0.75rem;
  background: var(--bg-soft);
  border: 1px solid rgba(0, 0, 0, 0.03);
}

.modal-callout h3 {
  margin-bottom: 0.25rem;
}

.modal-praxis {
  border-left: 3px solid #3b82f6;
}

.modal-error {
  border-left: 3px solid #ef4444;
}

.modal-bestpractice {
  border-left: 3px solid var(--gold);
}

.active-search {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.4rem 0 0.5rem;
  font-size: 0.78rem;
}

.active-search.hidden {
  display: none;
}

.active-search .label {
  opacity: 0.8;
}

#activeSearchChip {
  border-radius: 999px;
  border: 1px solid var(--gold);
  background: #fffaf0;
  padding: 0.2rem 0.7rem;
  font-size: 0.78rem;
  cursor: pointer;
}

.btn-clear-search {
  border: none;
  background: transparent;
  font-size: 0.75rem;
  cursor: pointer;
  opacity: 0.8;
}
/* FAB */

.fab {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 70;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pill {
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(255, 250, 240, 0.9);
  border: 1px solid var(--gold);
  box-shadow: 0 0 14px rgba(212, 175, 55, 0.55);
  cursor: pointer;
  font-size: 0.75rem;
  color: #000;
}

.pill.active {
  background: var(--gold);
  color: #000;
  border-color: var(--gold);
  box-shadow: 0 0 14px rgba(212, 175, 55, 0.8);
}

.circle {
  width: 44px;
  height: 44px;
  border-radius: 999px;
  background: #050509;
  border: 1px solid rgba(249, 225, 139, 0.9);
  color: var(--gold);
display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 12px rgba(249, 225, 139, 0.6);
  cursor: pointer;
}

/* Footer */

footer {
  border-top: 1px solid var(--border);
  padding: 1.2rem 0 1.4rem;
  margin-top: 1.2rem;
  font-size: 0.78rem;
  color: var(--muted);
}

footer a {
  color: var(--muted);
}

footer a:hover {
  color: var(--gold);
}

/* Responsive */

@media (max-width: 720px) {
  .header-wrap {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.55rem;
  }

  .nav {
    font-size: 0.78rem;
  }

  .filter-row-main {
    flex-direction: column;
    align-items: flex-start;
  }

  .results-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .grid {
    grid-template-columns: 1fr;
  }

  .modal-dialog {
    margin: 0.6rem;
    max-height: calc(100vh - 1.2rem);
  }

  .modal-content {
    padding: 0.8rem 0.85rem 1rem;
  }
}

#backToTopBtn {
  position: fixed;
  right: 1.2rem;
  bottom: 1.2rem;
  z-index: var(--z-fab);
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 999px;
  border: 1px solid rgba(212, 175, 55, 0.9);
  background: radial-gradient(circle at 30% 0%, rgba(249,225,139,0.4), #ffffff);
  color: #000;
  cursor: pointer;
  font-size: 1.1rem;
  display: none;
  align-items: center;
  justify-content: center;
}
#backToTopBtn.visible {
  display: flex;
}
@media (max-width: 640px) {
  #backToTopBtn {
    bottom: 4.5rem;
  }
}

.iod-card .insight-question {
  font-size: 1rem;
  font-weight: 600;
}

.iod-card {
  border-width: 1px;
  border-color: var(--gold);
  box-shadow: 0 0 0 1px rgba(212,175,55,0.25);
}

mark.highlight { background: var(--gold); color: #000; padding: 0 0.05em; border-radius: 2px; }

.favorite-btn .star-icon,
.card-fav-button .star-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  margin-right: 0.3rem;
  background: #ffffff;
  color: #000;
  font-size: 0.9rem;
}

.favorite-btn.active .star-icon,
.card-fav-button.active .star-icon {
  border-color: var(--gold);
  background: var(--gold);
  color: #000;
  box-shadow: 0 0 10px rgba(212, 175, 55, 0.5);
}

.card-fav-button {
  border: none;
  background: transparent;
  padding: 0;
  cursor: pointer;
}

.card-fav-button .star-icon {
  margin-right: 0;
}

.card-actions {
  position: absolute;
  top: 0.4rem;
  right: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.25rem;
}

body.modal-open header { display: none; }

.modal-content > h2 {
  margin: 0;
  font-size: 1.3rem;
  font-weight: 600;
  line-height: 1.25;
  padding-right: 3.4rem;
  word-break: break-word;
}
