/*
 * db.css — styles for the database pages: site/items/index.html, site/npcs/index.html and
 * site/quests/index.html (logic in site/db.js, data in site/db/*.json). Colours come from the
 * variables in site.css. Tables scroll inside their own .db-wrap, never the page.
 */
.db-page header { margin: 0 0 8px; }
.db-page .page { overflow-x: hidden; }
#db-app { min-width: 0; }

/* Tab row: Items · NPCs · Quests · Full wiki. */
.db-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 14px 0 6px; }
.db-tabs a { display: inline-flex; align-items: center; padding: 6px 14px; border: 1px solid var(--edge); border-radius: 4px; background: var(--panel); color: var(--text); text-decoration: none; }
.db-tabs a:hover { background: var(--panel-2); border-color: var(--edge-hi); }
.db-tabs a[aria-current="page"] { background: var(--primary); border-color: var(--primary-hi); color: #fff; }

.db-note { color: var(--muted); }
.db-back { display: inline-block; margin: 0 0 10px; }

/* Search box. */
.db-search { display: flex; gap: 10px 16px; flex-wrap: wrap; align-items: flex-end; margin: 4px 0 12px; }
.db-search label { display: flex; flex-direction: column; gap: 4px; color: var(--muted); font-size: .85rem; min-width: 0; }
.db-search input { background: var(--panel); color: var(--text); border: 1px solid var(--edge); border-radius: 4px; padding: 8px 10px; font: inherit; width: 280px; max-width: 100%; }
.db-search input:focus { border-color: var(--primary-hi); }

/* Result list under the search box. */
.db-results { list-style: none; margin: 0 0 8px; padding: 0; border: 1px solid var(--edge); border-radius: 4px; background: var(--panel); }
.db-results li { border-bottom: 1px solid var(--edge); }
.db-results li:last-child { border-bottom: none; }
.db-results a { display: flex; align-items: center; gap: 10px; padding: 6px 12px; color: var(--text); text-decoration: none; min-width: 0; }
.db-results a:hover { background: var(--panel-2); }
.db-results .db-name { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.db-results .db-meta { color: var(--muted); font-size: .85rem; white-space: nowrap; }

/* Icons: hidden by db.js when the image is missing. */
.db-icon { width: 32px; height: 32px; object-fit: contain; flex: none; }
.db-icon.big { width: 48px; height: 48px; }

/* Tables. */
.db-wrap { overflow-x: auto; margin: 0 0 14px; }
.db-table { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--edge); font-variant-numeric: tabular-nums; }
.db-table th, .db-table td { padding: 6px 10px; text-align: left; border-bottom: 1px solid var(--edge); vertical-align: top; }
.db-table th { color: var(--muted); font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; white-space: nowrap; }
.db-table tr:last-child td { border-bottom: none; }
.db-table .num { text-align: right; }

/* Detail card. */
.db-card { background: var(--panel); border: 1px solid var(--edge); border-radius: 3px; padding: 14px 16px; margin: 0 0 16px; }
.db-title { display: flex; align-items: center; gap: 12px; margin: 0 0 10px; font-size: 1.4rem; min-width: 0; overflow-wrap: anywhere; }
.db-card h3, .db-detail h3 { margin: 18px 0 8px; }
.db-facts { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; margin: 0; }
.db-facts dt { color: var(--muted); }
.db-facts dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

/* Equipment bonus grid: three groups of label/value cells. */
.db-bonus-groups { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.db-bonus-group h4 { margin: 0 0 6px; font-size: .8rem; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.db-bonus { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; margin: 0; padding: 8px 10px; border: 1px solid var(--edge); border-radius: 3px; background: var(--panel-2); }
.db-bonus dt { color: var(--muted); }
.db-bonus dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.db-pos { color: #6fcf7f; }
.db-neg { color: #e5736b; }

.db-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.db-chips li { padding: 2px 10px; border: 1px solid var(--edge); border-radius: 10px; background: var(--panel-2); }

/* Quests. */
.db-section-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin: 18px 0 8px; }
.db-section-head h2 { margin: 0; }
.db-check { list-style: none; margin: 0 0 12px; padding: 0; }
.db-check li { border-bottom: 1px solid var(--edge); }
.db-check li:last-child { border-bottom: none; }
.db-check label { display: flex; align-items: flex-start; gap: 10px; padding: 8px 4px; cursor: pointer; }
.db-check input { margin-top: 5px; flex: none; width: 16px; height: 16px; }
.db-check input:checked + span { color: var(--muted); text-decoration: line-through; }
.db-list { margin: 0 0 12px; padding-left: 22px; }
.db-pager { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin: 16px 0 0; }
.db-btn { background: var(--panel); color: var(--text); border: 1px solid var(--edge-hi); border-radius: 3px; padding: 6px 14px; font: inherit; cursor: pointer; }
.db-btn:hover { background: var(--panel-2); }

@media (max-width: 600px) {
  .db-page .page { padding-left: 16px; padding-right: 16px; }
  .db-search input { width: 100%; }
  .db-search label { flex: 1 1 100%; }
  .db-bonus-groups { grid-template-columns: 1fr; }
  .db-title { font-size: 1.2rem; }
}

/* Side-panel embed (225px panel, about 210px of content): see the matching block at the end of
   site.css. Every rule is under `.embed`, so the normal database pages are untouched. Wide tables
   keep scrolling inside their own .db-wrap. */
.embed .db-page header { margin: 0 0 4px; }
.embed .db-page .tagline { font-size: 12px; margin: 2px 0 0; }
.embed .db-tabs { gap: 4px; margin: 8px 0 6px; }
.embed .db-tabs a { flex: 1 1 auto; justify-content: center; padding: 4px 8px; font-size: 13px; }
.embed .db-search { margin: 4px 0 8px; }
.embed .db-wrap { max-width: 100%; }
.embed .db-table th, .embed .db-table td { padding: 4px 6px; font-size: 12px; }
.embed .db-table th { font-size: 10px; letter-spacing: .04em; }
.embed .db-results a { padding: 4px 8px; gap: 6px; }
.embed .db-card { padding: 10px; }
/* Labels give way to values: a value column of at least 6em keeps numbers such as 25,600 gp whole. */
.embed .db-facts { gap: 4px 10px; font-size: 13px; grid-template-columns: minmax(0, max-content) minmax(6em, 1fr); }
