/* EgyptMeds — additions on top of the design's tokens.css + web.css.
   The design used React <button> elements for navigation; the server-rendered build uses
   <a> for anything that navigates, so those selectors are extended here. Nothing in this
   file changes a value the design already set. */

/* The design's CSS sets display on these components, which defeats the hidden attribute. */
[hidden] { display: none !important; }

/* ── Links that reuse design components ─────────────────────── */
.brand { color: inherit; text-decoration: none; }
.brand:hover { color: inherit; }

a.nav-item { text-decoration: none; box-sizing: border-box; }
a.nav-item:hover { color: var(--on-surface-2); background: var(--surface-low); }
a.nav-item[data-active="true"]:hover { color: var(--on-primary-container); background: var(--primary-container); }

.seg a {
  flex: 1; height: 32px; border: none; border-radius: var(--r-pill);
  background: transparent; color: var(--on-surface-2);
  font-size: 12.5px; font-weight: 600; cursor: pointer; text-decoration: none;
  display: flex; align-items: center; justify-content: center; gap: 6px;
}
.seg a[data-on="true"] { background: var(--surface); color: var(--on-surface); box-shadow: var(--e1); }
.seg a:hover { color: var(--on-surface); }

.tabbar a {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
  background: transparent; border: none; cursor: pointer; padding: 4px 0;
  color: var(--on-surface-2); font-size: 11px; font-weight: 600; min-height: 52px;
  text-decoration: none;
}
.tabbar a i { width: 56px; height: 30px; border-radius: 15px; display: grid; place-items: center; }
.tabbar a[data-active="true"] { color: var(--on-surface); }
.tabbar a[data-active="true"] i { background: var(--primary-container); color: var(--on-primary-container); }

a.drug, a.cat, a.quick { text-decoration: none; color: inherit; }
a.chip { text-decoration: none; }
a.link-btn { text-decoration: none; display: inline-block; }

/* Icons keep their box inside flex rows. */
.ic { flex: none; }
.search-ic { color: var(--on-surface-3); }


/* Detail tabs are links in the server-rendered build. */
.tabs a.tab-link {
  border: none; background: transparent; padding: 12px 14px;
  font-size: 14px; font-weight: 700; color: var(--on-surface-3);
  cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap;
  text-decoration: none;
}
.tabs a.tab-link[data-on="true"] { color: var(--on-surface); border-bottom-color: var(--primary); }
.tabs a.tab-link:hover { color: var(--on-surface-2); }


/* The input is type=search for mobile keyboards, but Chrome's native clear button
   would sit next to our own; hide theirs and keep ours. */
.search input[type="search"]::-webkit-search-cancel-button,
.search input[type="search"]::-webkit-search-decoration { -webkit-appearance: none; appearance: none; }

/* ── Autocomplete ───────────────────────────────────────────── */
.search { position: relative; }
.ac-panel {
  position: absolute; inset-inline: 0; top: calc(100% + 6px); z-index: 40;
  background: var(--surface); border: 1px solid var(--outline);
  border-radius: var(--r-md); box-shadow: var(--e3);
  padding: 6px; max-height: 60vh; overflow-y: auto;
}
.ac-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 9px 10px; border-radius: var(--r-sm);
  color: var(--on-surface); text-decoration: none; cursor: pointer;
}
.ac-item:hover, .ac-item[aria-selected="true"] { background: var(--surface-low); color: var(--on-surface); }
.ac-name { flex: 1; min-width: 0; font-size: 14px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ac-sub { font-size: 12px; color: var(--on-surface-3); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ac-kind { font-size: 10.5px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; color: var(--on-surface-3); flex: none; }
.ac-empty { padding: 14px 10px; font-size: 13px; color: var(--on-surface-3); }

/* ── Pagination ─────────────────────────────────────────────── */
.pager { display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 28px; flex-wrap: wrap; }
.pager .btn { height: 40px; font-size: 13.5px; }
.pager .btn[aria-disabled="true"] { opacity: .45; pointer-events: none; }
.pager-info { font-size: 13px; color: var(--on-surface-3); font-weight: 600; font-variant-numeric: tabular-nums; }

/* ── Sourced clinical data ──────────────────────────────────── */
.src {
  display: inline-flex; align-items: center; gap: 5px; margin-top: 8px;
  font-size: 11.5px; font-weight: 600; color: var(--on-surface-3);
}
.src b { font-weight: 700; color: var(--on-surface-2); }
.review { display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: var(--r-pill); font-size: 10.5px; font-weight: 700; }
.review.unreviewed { background: var(--amber-50); color: var(--amber-800); }
.review.flagged { background: var(--red-50); color: var(--red-800); }
[data-theme="dark"] .review.unreviewed { background: #3D2E10; color: #FDE68A; }
[data-theme="dark"] .review.flagged { background: #3B1616; color: #FECACA; }

/* ── Small helpers ──────────────────────────────────────────── */
.stack { display: flex; flex-direction: column; gap: 14px; }
.muted { color: var(--on-surface-3); }
.nowrap { white-space: nowrap; }
.filters-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 18px; }
.filters-bar select {
  height: 36px; padding: 0 10px; border-radius: var(--r-pill);
  border: 1px solid var(--outline); background: var(--surface);
  color: var(--on-surface-2); font-size: 13px; font-weight: 600; cursor: pointer;
}
.price-hist { display: flex; flex-direction: column; gap: 0; font-size: 13.5px; }
.price-hist div { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-top: 1px solid var(--outline); font-weight: 600; }
.price-hist div:first-child { border-top: none; }
.price-hist span { color: var(--on-surface-3); font-weight: 600; }

.skip-link {
  position: absolute; inset-inline-start: -9999px; top: 0; z-index: 100;
  background: var(--surface); color: var(--on-surface); padding: 10px 16px; border-radius: 0 0 var(--r-sm) 0;
}
.skip-link:focus { inset-inline-start: 0; }

/* Visible keyboard focus for everything interactive. */
a:focus-visible, button:focus-visible, select:focus-visible, input:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
