/* Minnesota Myeloma Trials — styled to match the Mac app. */

:root {
  --bg: #ffffff;
  --sidebar: #f5f5f7;
  --card: #ffffff;
  --text: #1d1d1f;
  --text-2: #6e6e73;
  --text-3: #a1a1a6;
  --border: rgba(0, 0, 0, 0.11);
  --fill: rgba(0, 0, 0, 0.05);
  --fill-hover: rgba(0, 0, 0, 0.09);
  --panel-fill: rgba(0, 0, 0, 0.035);
  --accent: #007aff;
  --accent-soft: rgba(0, 122, 255, 0.12);
  --accent-text: #0066d6;
  --exclusion: #c25400;
  --success: #248a3d;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.14), 0 0 0 1px rgba(0, 0, 0, 0.06);
  --tone-green: rgba(52, 199, 89, 0.2);
  --tone-orange: rgba(255, 149, 0, 0.2);
  --tone-purple: rgba(175, 82, 222, 0.2);
  --tone-blue: rgba(0, 122, 255, 0.17);
  --tone-gray: rgba(142, 142, 147, 0.2);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1e1e1e;
    --sidebar: #262628;
    --card: #2a2a2c;
    --text: #f5f5f7;
    --text-2: #a1a1a6;
    --text-3: #6e6e73;
    --border: rgba(255, 255, 255, 0.13);
    --fill: rgba(255, 255, 255, 0.07);
    --fill-hover: rgba(255, 255, 255, 0.12);
    --panel-fill: rgba(255, 255, 255, 0.045);
    --accent: #0a84ff;
    --accent-soft: rgba(10, 132, 255, 0.2);
    --accent-text: #4aa3ff;
    --exclusion: #ff9f0a;
    --success: #30d158;
    --shadow: 0 12px 34px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.1);
    --tone-green: rgba(48, 209, 88, 0.24);
    --tone-orange: rgba(255, 159, 10, 0.24);
    --tone-purple: rgba(191, 90, 242, 0.26);
    --tone-blue: rgba(10, 132, 255, 0.26);
    --tone-gray: rgba(142, 142, 147, 0.26);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #1e1e1e;
  --sidebar: #262628;
  --card: #2a2a2c;
  --text: #f5f5f7;
  --text-2: #a1a1a6;
  --text-3: #6e6e73;
  --border: rgba(255, 255, 255, 0.13);
  --fill: rgba(255, 255, 255, 0.07);
  --fill-hover: rgba(255, 255, 255, 0.12);
  --panel-fill: rgba(255, 255, 255, 0.045);
  --accent: #0a84ff;
  --accent-soft: rgba(10, 132, 255, 0.2);
  --accent-text: #4aa3ff;
  --exclusion: #ff9f0a;
  --success: #30d158;
  --shadow: 0 12px 34px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.1);
  --tone-green: rgba(48, 209, 88, 0.24);
  --tone-orange: rgba(255, 159, 10, 0.24);
  --tone-purple: rgba(191, 90, 242, 0.26);
  --tone-blue: rgba(10, 132, 255, 0.26);
  --tone-gray: rgba(142, 142, 147, 0.26);
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body { margin: 0; height: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, p { margin: 0; }
button { font: inherit; color: inherit; }
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }
hr { border: 0; border-top: 1px solid var(--border); margin: 0; width: 100%; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.icon { width: 15px; height: 15px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.chevron { width: 10px; height: 10px; stroke-width: 2.6; transition: transform 0.2s ease; }

/* Layout */

.layout {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  height: 100vh;
  height: 100dvh;
}

.sidebar {
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  padding: 22px 22px 18px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.results {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}

/* Search panel */

.brand h1 { font-size: 22px; font-weight: 650; letter-spacing: -0.01em; }
.brand p { color: var(--text-2); margin-top: 4px; }

.group { display: flex; flex-direction: column; gap: 9px; }
.group-header { display: flex; align-items: baseline; justify-content: space-between; }
.group-header h2 { font-size: 14px; font-weight: 650; }
.quick-actions { display: inline-flex; align-items: baseline; gap: 6px; }
.dot { color: var(--text-3); font-size: 12px; }

.quick-action {
  background: none; border: 0; padding: 0; cursor: pointer;
  font-size: 12px; font-weight: 550; color: var(--accent-text);
}
.quick-action:disabled { color: var(--text-3); cursor: default; }

.check-row {
  display: flex; align-items: center; gap: 9px;
  cursor: pointer; user-select: none; min-height: 22px;
}
.check-row input { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); flex: none; cursor: pointer; }
.check-label { flex: 1; }
.count { color: var(--text-2); font-variant-numeric: tabular-nums; }

.search-button {
  width: 100%; height: 36px; border: 0; border-radius: 18px;
  background: var(--accent); color: #fff; font-weight: 600; cursor: pointer;
  transition: filter 0.12s ease;
}
.search-button:hover:not(:disabled) { filter: brightness(1.07); }
.search-button:disabled { opacity: 0.45; cursor: default; }

.hint { color: var(--text-2); font-size: 13px; }

.sidebar-footer { margin-top: auto; display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--text-2); }
.version { color: var(--text-3); }

/* Results header */

.results-header {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 22px; border-bottom: 1px solid var(--border);
  background: var(--bg);
}
.result-heading { flex: 1; min-width: 0; }
.result-count { font-size: 19px; font-weight: 650; }
.result-subtitle { color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.header-actions { display: flex; gap: 10px; align-items: center; }
.popover-anchor { position: relative; }

.header-button {
  display: inline-flex; align-items: center; gap: 6px;
  height: 32px; padding: 0 13px; border-radius: 16px;
  border: 1px solid var(--border); background: transparent;
  font-weight: 550; cursor: pointer; transition: background 0.12s ease;
}
.header-button:hover:not(:disabled) { background: var(--fill); }
.header-button:disabled { opacity: 0.45; cursor: default; }
.header-button.active { background: var(--accent-soft); color: var(--accent-text); }

.badge {
  min-width: 17px; height: 17px; padding: 0 5px; border-radius: 9px;
  background: var(--accent); color: #fff; font-size: 11px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
}
.badge[hidden] { display: none; }

/* Filters popover */

.popover {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 20;
  width: min(340px, calc(100vw - 32px));
  max-height: min(620px, calc(100dvh - 120px)); overflow-y: auto;
  background: var(--card); border-radius: 12px; box-shadow: var(--shadow);
  padding: 18px; display: flex; flex-direction: column; gap: 10px;
  animation: drop 0.18s ease-out;
}
.popover[hidden] { display: none; }
.pop-header { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 4px; }
.pop-header h2 { font-size: 18px; font-weight: 650; }
.popover h3 { font-size: 14px; font-weight: 650; }
.pop-rows { display: flex; flex-direction: column; gap: 8px; }
.pop-relapsed { display: flex; flex-direction: column; gap: 10px; }
.pop-relapsed[hidden] { display: none; }
.pop-relapsed hr { margin: 6px 0 2px; }
.pop-caption { color: var(--text-2); font-size: 12px; margin-top: -6px; }
.drug-title { margin-top: 6px; }

.search-field {
  display: flex; align-items: center; gap: 7px; height: 34px; padding: 0 11px;
  background: var(--fill); border-radius: 9px; color: var(--text-2);
}
.drug-input {
  flex: 1; min-width: 0; border: 0; outline: 0; background: transparent;
  font: inherit; color: var(--text);
}
.drug-input::placeholder { color: var(--text-3); }
.search-field:focus-within { box-shadow: 0 0 0 2px var(--accent); }

/* Cards */

.results-scroll { flex: 1; overflow-y: auto; padding: 20px 22px 28px; }
.card-list { display: flex; flex-direction: column; gap: 12px; }
.results-note { color: var(--text-3); font-size: 12px; margin-top: 22px; }

.card {
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  padding: 15px 16px; display: flex; flex-direction: column; gap: 10px;
}
.card-title { font-size: 15px; font-weight: 650; line-height: 1.35; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-size: 12px; font-weight: 550; padding: 2px 9px; border-radius: 999px; }
.tone-green { background: var(--tone-green); }
.tone-orange { background: var(--tone-orange); }
.tone-purple { background: var(--tone-purple); }
.tone-blue { background: var(--tone-blue); }
.tone-gray { background: var(--tone-gray); }
.chip.outline { border: 1px solid var(--border); color: var(--text-2); font-weight: 500; }

.meta { color: var(--text-2); white-space: pre-wrap; }
.site-lines { display: flex; flex-direction: column; gap: 3px; }
.site-line strong { font-weight: 600; }
.site-line span { color: var(--text-2); }

.card-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: 2px; }
.trial-link { display: inline-flex; align-items: center; gap: 6px; min-width: 0; overflow-wrap: anywhere; }
.card-buttons { display: flex; gap: 8px; align-items: center; }

.panel-button {
  display: inline-flex; align-items: center; gap: 6px;
  height: 30px; padding: 0 12px; border: 0; border-radius: 15px;
  background: var(--fill); font-weight: 550; cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}
.panel-button:hover { background: var(--fill-hover); }
.panel-button.open { background: var(--accent-soft); color: var(--accent-text); }
.panel-button.open .chevron, .text-button.open .chevron { transform: rotate(180deg); }

.copy-button {
  width: 30px; height: 30px; border: 0; border-radius: 50%;
  background: var(--fill); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.copy-button:hover { background: var(--fill-hover); }
.copy-button.copied { color: var(--success); }

/* Pop-down panels */

.detail-panel {
  background: var(--panel-fill); border-radius: 10px; padding: 15px 16px;
  display: flex; flex-direction: column; gap: 13px;
  animation: drop 0.2s ease-out;
}

@keyframes drop {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: none; }
}

.elig-grid { margin: 0; display: flex; flex-direction: column; gap: 11px; }
.elig-row { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 16px; }
.elig-row dt { color: var(--text-2); }
.elig-row dd { margin: 0; display: flex; flex-direction: column; gap: 8px; }
.criterion { display: flex; flex-direction: column; gap: 2px; }
.exclusion-tag { font-size: 10px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--exclusion); }

.panel-footer {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  border-top: 1px solid var(--border); padding-top: 11px;
}
.text-button {
  display: inline-flex; align-items: center; gap: 5px; padding: 0; border: 0; background: none;
  color: var(--accent-text); font-weight: 550; cursor: pointer;
}
.quiet { color: var(--text-2); font-size: 12px; }
.full-criteria { white-space: pre-wrap; overflow-wrap: anywhere; animation: drop 0.2s ease-out; }

.contact-block { display: flex; flex-direction: column; gap: 6px; }
.contact-block h4 { font-size: 14px; font-weight: 650; }
.contact-row { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.contact-name { display: flex; flex-direction: column; }
.contact-name small { color: var(--text-2); font-size: 12px; }
.contact-links { display: flex; gap: 16px; flex-wrap: wrap; }
.contact-links a { display: inline-flex; align-items: center; gap: 6px; overflow-wrap: anywhere; }

/* Empty, loading and error views */

.center-view {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; padding: 40px 24px; text-align: center; color: var(--text-2);
}
.center-view h2 { font-size: 24px; font-weight: 650; color: var(--text-2); }
.empty-icon { width: 40px; height: 40px; stroke-width: 1.6; color: var(--text-3); margin-bottom: 6px; }
.no-match { display: flex; flex-direction: column; gap: 12px; align-items: flex-start; color: var(--text-2); padding: 16px 0; }

.secondary-button {
  height: 32px; padding: 0 16px; border-radius: 16px; border: 1px solid var(--border);
  background: var(--card); font-weight: 550; cursor: pointer; margin-top: 6px;
}
.secondary-button:hover { background: var(--fill); }

.spinner {
  width: 28px; height: 28px; border-radius: 50%;
  border: 3px solid var(--fill-hover); border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Disclaimer */

.disclaimer {
  width: min(520px, calc(100vw - 32px)); border: 0; border-radius: 14px; padding: 24px;
  background: var(--card); color: var(--text); box-shadow: var(--shadow);
}
.disclaimer::backdrop { background: rgba(0, 0, 0, 0.35); }
.disclaimer h2 { font-size: 19px; font-weight: 650; margin-bottom: 12px; }
.disclaimer ul { margin: 0 0 20px; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; }

.copy-buffer { position: fixed; top: -1000px; opacity: 0; }
.noscript { padding: 24px; }
.print-only { display: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Phones and narrow windows */

@media (max-width: 820px) {
  html, body { height: auto; }
  .layout { display: block; height: auto; }
  .sidebar { border-right: 0; border-bottom: 1px solid var(--border); padding: 18px 16px; }
  .sidebar-footer { margin-top: 0; }
  .results-header { position: sticky; top: 0; z-index: 10; padding: 12px 16px; flex-wrap: wrap; }
  .results-scroll { overflow: visible; padding: 16px 16px 28px; }
  .center-view { min-height: 280px; }
  .header-button { padding: 0 11px; }
  .elig-row { grid-template-columns: minmax(0, 1fr); gap: 3px; }
  .card-actions { flex-direction: column; align-items: flex-start; }
}

/* Printing */

@media print {
  .layout, .disclaimer, .noscript { display: none !important; }
  .print-only { display: block; color: #000; font-size: 10pt; }
  .print-only h1 { font-size: 18pt; font-weight: 600; margin-bottom: 4pt; }
  .print-only h2 { font-size: 11pt; font-weight: 600; margin-bottom: 3pt; }
  .print-meta { color: #555; }
  .print-trial { margin-top: 14pt; break-inside: avoid; }
  .print-link { color: #0645ad; }
  .print-note { margin-top: 18pt; color: #555; font-size: 9pt; }
  @page { margin: 0.6in 0.7in; }
}
