/* MedCheck: simple, light, readable. */

:root {
  --bg: #ffffff;
  --text: #18181b;
  --body: #3f3f46;
  --muted: #6b6b73;
  --faint: #a1a1aa;
  --line: #ececee;
  --soft: #f6f6f7;
  --red: #b91c1c;
  --red-soft: #fef2f2;
  --green: #15803d;
  --green-soft: #f0fdf4;
  --radius: 12px;
  --font: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
}

/* Logo + name side by side */
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size:  18px;
  text-decoration: none;
  letter-spacing: -0.01em;
}

/* The + logo; its colour follows the text colour */
.logo {
  width: 28px;
  height: 28px;
  color: var(--text);
  flex-shrink: 0;
}

a { color: inherit; }

button, input, select { font: inherit; color: inherit; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* ------------------------------------------------------------ layout */

.topbar,
main,
.footer {
  max-width: 640px;
  margin: 0 auto;
  padding-left: 20px;
  padding-right: 20px;
}

.topbar { padding-top: 20px; padding-bottom: 8px; }


main { padding-top: 32px; padding-bottom: 48px; min-height: 60vh; }

h1 {
  font-size: 30px;
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin: 0 0 8px;
}

h2 {
  font-size: 16px;
  margin: 0 0 6px;
}

.lead { color: var(--muted); margin: 0 0 24px; }

.footer {
  border-top: 1px solid var(--line);
  padding-top: 20px;
  padding-bottom: 32px;
  font-size: 13px;
  color: var(--faint);
}
.footer p { margin: 0 0 4px; }

/* ------------------------------------------------------------ search */

#search-form { display: flex; gap: 8px; }

#search-form input {
  flex: 1;
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
  outline: none;
}
#search-form input:focus { border-color: var(--text); }

#search-form button {
  padding: 12px 18px;
  border: 0;
  border-radius: var(--radius);
  background: var(--text);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}
#search-form button:hover { opacity: 0.9; }

.form-error { color: var(--red); font-size: 14px; margin: 8px 0 0; }

.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 16px;
}

.chips { display: flex; flex-wrap: wrap; gap: 6px; }

.chip, .toggle button {
  padding: 5px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg);
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
}
.chip[aria-pressed="true"], .toggle button[aria-pressed="true"] {
  background: var(--text);
  border-color: var(--text);
  color: #fff;
}

.sort { font-size: 14px; color: var(--muted); }
select {
  margin-left: 4px;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  font-size: 14px;
}

.status { margin-top: 20px; color: var(--muted); font-size: 14px; }

.results { list-style: none; margin: 8px 0 0; padding: 0; }

.results a {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 4px;
  border-top: 1px solid var(--line);
  text-decoration: none;
}
.results li:last-child a { border-bottom: 1px solid var(--line); }
.results a:hover { background: var(--soft); }
.results .name { display: block; }
.results .sub { display: block; color: var(--muted); font-size: 14px; }
.results .arrow { color: var(--faint); }

.suggestions { margin-top: 20px; font-size: 14px; color: var(--muted); }
.suggestions button, .link-button {
  border: 0;
  background: none;
  padding: 0;
  margin: 0 8px 0 0;
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
  font-size: inherit;
}

/* ---------------------------------------------------- messages/errors */

.message {
  margin-top: 20px;
  padding: 14px 16px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 15px;
}
.message strong { display: block; color: var(--text); }
.message.error { border-style: solid; border-color: #fecaca; background: var(--red-soft); }
.message .link-button { margin-top: 6px; }

.spinner {
  display: inline-block;
  width: 14px; height: 14px;
  margin-right: 8px;
  vertical-align: -2px;
  border: 2px solid var(--line);
  border-top-color: var(--text);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ----------------------------------------------------------- medicine */

.back {
  display: inline-block;
  margin-bottom: 20px;
  color: var(--muted);
  font-size: 14px;
  text-decoration: none;
}
.back:hover { color: var(--text); }

#drug-view .lead { margin-bottom: 0; }

.recall-status {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 20px 0 28px;
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--soft);
  font-size: 15px;
}
.recall-status .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--faint); flex: none; }
.recall-status.ok .dot { background: var(--green); }
.recall-status.bad { background: var(--red-soft); color: var(--red); }
.recall-status.bad .dot { background: var(--red); }

.boxed {
  margin: 0 0 28px;
  padding: 14px 16px;
  border: 1px solid #fecaca;
  border-radius: var(--radius);
  background: var(--red-soft);
}
.boxed h2 { color: var(--red); }

.block { margin-bottom: 26px; }
.block p { margin: 0; color: var(--body); }
.block .link-button { margin-top: 4px; font-size: 14px; color: var(--muted); }

.block ul { margin: 0; padding-left: 20px; color: var(--body); }
.note { color: var(--faint); font-size: 13px; margin: 6px 0 0; }

.more-toggle {
  display: flex;
  justify-content: space-between;
  width: 100%;
  padding: 16px 0;
  border: 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: none;
  color: var(--muted);
  font-size: 15px;
  text-align: left;
  cursor: pointer;
}
.more-toggle:hover { color: var(--text); }

.more { padding-top: 28px; }

.row-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.row-head h2 { margin: 0; }
.toggle { display: flex; gap: 6px; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; font-size: 14px; color: var(--muted); }

/* side effects chart */
.bar-row {
  display: grid;
  grid-template-columns: 150px 1fr 64px;
  align-items: center;
  gap: 12px;
  margin: 8px 0;
  font-size: 14px;
}
.bar-track { height: 8px; border-radius: 4px; background: var(--soft); overflow: hidden; }
.bar-fill { display: block; height: 100%; border-radius: 4px; background: var(--text); }
.bar-value { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }

/* recall list */
.block .recalls { list-style: none; margin: 0 0 8px; padding: 0; }
.recalls li { padding: 12px 0; border-top: 1px solid var(--line); font-size: 14px; }
.recalls .meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; color: var(--muted); }
.recalls p { margin: 4px 0 0; color: var(--body); }

.badge {
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--body);
  font-size: 12px;
}
.badge.class-1 { background: var(--red-soft); color: var(--red); }
.badge.ongoing { background: #fff7ed; color: #c2410c; }

.source { margin-top: 32px; color: var(--faint); font-size: 13px; }

/* --------------------------------------------------------------- phone */

@media (max-width: 520px) {
  h1 { font-size: 26px; }
  main { padding-top: 20px; }
  #search-form button { padding: 12px 14px; }
  .bar-row { grid-template-columns: 110px 1fr 52px; gap: 8px; }
}
