@font-face {
  font-family: 'PF2Actions';
  src: url('/static/Pathfinder2eActions.ttf') format('truetype'),
       local('Pathfinder2eActions'),
       local('PF2Actions');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #f8fafc;             /* light background */
  --panel: #ffffff;           /* cards and bars */
  --border: #e5e7eb;          /* light gray border */
  --text: #111827;            /* near-black text */
  --muted: #6b7280;           /* gray-500 */
  --accent: #b91c1c;          /* red-700 */
  --accent-weak: #dc2626;     /* red-600 */
  --link: #1d4ed8;            /* blue-700 */
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.container { max-width: 1000px; margin: 0 auto; padding: 16px; }

header.appbar { background: var(--panel); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 1000; }
.appbar .container { display: flex; align-items: center; gap: 16px; position: relative; }
.brand { font-weight: 800; letter-spacing: .5px; color: var(--text); }
nav a { color: var(--link); text-decoration: none; }
nav a:hover { text-decoration: underline; }

h1.title { margin: 16px 0; font-size: 24px; color: var(--accent); display: flex; align-items: center; gap: 8px; }
h1.title .hint { color: var(--muted); font-size: 14px; font-weight: 500; }
h2 { font-size: 18px; }

.searchbar { display: flex; gap: 8px; margin-bottom: 16px; }
.searchbar input[type="text"] {
  flex: 1;
  background: #f9fafb;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--text);
}
.btn { background: var(--accent); color: white; border: 0; border-radius: 8px; padding: 10px 14px; cursor: pointer; }
.btn:hover { background: var(--accent-weak); }

.results, .grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
.card, .result-card { background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 0; overflow: hidden; }
.result-card header, .card header { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--border); background: #fff; }
.result-card header .right, .card header .right { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.result-card h3, .card h3 { margin: 0; font-size: 20px; font-weight: 800; color: #991b1b; display: flex; align-items: center; gap: 8px; }
.result-card a, .card a { color: var(--text); text-decoration: none; }
.result-card a:hover, .card a:hover { color: #000; }
.traits { padding: 10px 12px; display: flex; flex-wrap: wrap; gap: 8px; }
.text { font-size: 0.85em; }
.traits .item-trait, .traits .trait, .traits a.item-link--traits-output {
  display: inline-block;
  background: #5b0b0b;            /* dark burgundy */
  color: #fff;                     /* white text */
  border: 3px solid #e9d5a1;       /* sand/gold border (outer) */
  box-shadow: inset 0 0 0 3px #5b0b0b; /* inner fill border to create double border effect */
  padding: 4px 8px;
  font-weight: 800;
  letter-spacing: .5px;
  text-transform: uppercase;
}
.traits a { color: #fff; text-decoration: none; }
.traits a:hover { text-decoration: underline; }

/* Search page: container gets yellow border; labels smaller and without own border */
.result-card .traits { border: none; border-radius: 0; background: transparent; }
.result-card .traits .item-trait,
.result-card .traits .trait,
.result-card .traits a.item-link--traits-output {
  font-size: 70%;
  padding: 3px 6px;
  box-shadow: none;
  border: none;
}

/* Saved page: same appearance as search with larger size */
.card .traits { border: none; border-radius: 0; background: transparent; }
.card .traits .item-trait,
.card .traits .trait,
.card .traits a.item-link--traits-output {
  font-size: 91%;
  padding: 3px 6px;
  box-shadow: none;
  border: none;
}

/* Ensure PF2 action icons use the dedicated font everywhere */
.action-icon, span.action-icon, .item-output .action-icon, h1 .action-icon, h2 .action-icon, a .action-icon {
  font-family: 'PF2Actions' !important;
  font-weight: normal !important;
  font-style: normal !important;
  line-height: 1;
  display: inline-block;
}

/* Action buttons styling */
button.scrape { background: #14532d; color: #fff; border: 1px solid #064e3b; padding: 6px 10px; border-radius: 6px; }
button.scrape:hover { background: #166534; }
button.delete { background: #7f1d1d; color: #fff; border: 1px solid #991b1b; padding: 6px 10px; border-radius: 6px; }
button.delete:hover { background: #991b1b; }

/* Drag handle */
.handle { cursor: grab; color: var(--muted); }
.handle:active { cursor: grabbing; }

.chip { display: inline-flex; align-items: center; padding: 2px 6px; border-radius: 4px; background: #fff1f2; border: 1px solid #fecdd3; color: #9f1239; font-size: 12px; }
.badge { background: var(--accent); color: #fff; border-radius: 4px; font-size: 12px; font-weight: 700; padding: 4px 8px; letter-spacing: .3px; }
.actions button { background: transparent; color: var(--muted); border: 1px solid var(--border); padding: 6px 8px; border-radius: 6px; cursor: pointer; }
.actions button:hover { color: white; border-color: var(--accent); }

/* Link colors similar to screenshot */
a { color: var(--link); }
a:hover { color: #1e40af; }

/* Header search */
.header-search input[type="text"] {
  background: #f9fafb;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--text);
  min-width: 260px;
}
.search-dropdown {
  position: fixed;
  /* top is set dynamically from JS to be below header */
  left: 50%;
  transform: translateX(-50%);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 10px 20px rgba(0,0,0,.08);
  width: min(860px, 92vw);
  max-height: 70vh;
  overflow: auto;
  padding: 8px;
  z-index: 1100;
}
.search-dropdown .result-card { margin: 8px 0; }

/* List picker */
.list-picker { position: relative; }
.list-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 10px 20px rgba(0,0,0,.08);
  min-width: 260px;
  z-index: 1000;
}
.list-menu-body { max-height: 50vh; overflow: auto; }
.list-row { display: flex; align-items: center; gap: 8px; padding: 6px; border-bottom: 1px solid var(--border); }
.list-row:last-child { border-bottom: none; }
.list-row .list-select { flex: 1; text-align: left; background: transparent; border: 0; padding: 8px; cursor: pointer; }
.list-row .list-select:hover { background: #f3f4f6; }
.list-row .delete-list { background: #7f1d1d; color: #fff; border: 1px solid #991b1b; padding: 6px 8px; border-radius: 6px; cursor: pointer; }
.list-row .delete-list:hover { background: #991b1b; }
.list-menu-footer { padding: 8px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; }

/* Modal */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.35);
  display: flex; align-items: center; justify-content: center;
  z-index: 1200;
}
.modal { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; width: min(800px, 92vw); max-height: 85vh; overflow: hidden; box-shadow: 0 10px 30px rgba(0,0,0,.15); }
.modal-header { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.modal-body { padding: 12px 16px; }
.modal-footer { padding: 12px 16px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; }
.icon-btn { background: transparent; border: 0; color: var(--muted); cursor: pointer; font-size: 16px; }
.icon-btn:hover { color: var(--text); }
.input { width: 100%; background: #f9fafb; border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; color: var(--text); }
.textarea { width: 100%; height: 220px; resize: vertical; background: #f9fafb; border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; color: var(--text); font-family: inherit; }
.form-label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }

/* (Reverted) no overrides for h2 sizing/weight inside item-output */



/* Print: show only cards */
@media print {
  header.appbar,
  nav,
  h1.title,
  .searchbar,
  #globalListSelect,
  #globalNewList,
  #globalDeleteList,
  #printBtn,
  .actions,
  .handle,
  .pos-input,
  .card header .right .skill,
  .result-card header .right { display: none !important; }

  body { background: #fff; color: #000; }
  .container { max-width: none; padding: 0; }
  .grid, .results { padding: 0 10mm; }
  .card, .result-card { border: 1px solid #000; page-break-inside: avoid; margin: 0 0 10mm 0; border-radius: 0; }
  .card header, .result-card header { background: #fff; border-bottom: 1px solid #000; }
  .list-controls { display: none !important; }
  /* Traits readable in print: black text on light gray background */
  /* Override all trait styles for print with high specificity */
  .card .traits .item-trait,
  .card .traits .trait,
  .card .traits a.item-link--traits-output,
  .result-card .traits .item-trait,
  .result-card .traits .trait,
  .result-card .traits a.item-link--traits-output,
  .traits .item-trait,
  .traits .trait,
  .traits a.item-link--traits-output {
    background: #e5e7eb !important; /* light gray */
    color: #000 !important;         /* black text */
    border: 1px solid #9ca3af !important; /* gray-400 outer border */
    box-shadow: none !important;    /* remove inset shadow (inner border) */
    -webkit-print-color-adjust: exact !important; /* force background color in print */
    print-color-adjust: exact !important; /* force background color in print */
  }
}