/* ==========================================================================
   Big Pharmacy Child — Site chrome (header + footer)
   Emulates bigpharmacy.com.my
   ========================================================================== */

:root {
  --bp-red:        #cb321e;
  --bp-red-dark:   #a82817;
  --bp-ink:        #1a1a1a;
  --bp-muted:      #5c5c5c;
  --bp-line:       #e4e4e4;
  --bp-bg:         #ffffff;
  --bp-bg-soft:    #f6f6f6;
  --bp-bg-soft-2:  #f0f0f0;
  --bp-nav-fg:     #0a0a0a;
  --bp-red-nav:    #ed1c24;
  --bp-footer-bg:  #000000;
  --bp-footer-fg:  #cccccc;
  --bp-footer-line:rgb(255 255 255 / 0.15);
  --bp-font:       "Roboto", -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;

  --bp-container:  1620px;  /* matches the live header's content width */
  --bp-gutter:     16px;
  --bp-header-h:   64px;
}

/* --- Reset-ish scoping ---------------------------------------------------- */

body {
  font-family: var(--bp-font);
  color: var(--bp-ink);
  background: var(--bp-bg);
}

.bp-container {
  width: 100%;
  max-width: var(--bp-container);
  margin-inline: auto;
  /* 16px on phones, growing to the live site's 50px gutter on wide screens. */
  padding-inline: clamp(16px, 3.5vw, 50px);
}

.bp-skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 200;
  padding: 10px 16px;
  background: var(--bp-red);
  color: #fff;
  font-weight: 700;
}
.bp-skip-link:focus { left: 8px; top: 8px; }

.bp-icon { width: 22px; height: 22px; flex: none; }

/* The parent theme does not define this WordPress-standard utility. */
.screen-reader-text {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
.screen-reader-text:focus {
  position: static !important;
  width: auto;
  height: auto;
  margin: 0;
  overflow: visible;
  clip: auto;
  clip-path: none;
  white-space: normal;
}

/* --- Announcement bar ----------------------------------------------------- */

.bp-announcement {
  background: var(--bp-red);
  color: #fff;
}
.bp-announcement__text {
  margin: 0;
  padding: 7px 0;
  text-align: center;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
}

/* --- Header --------------------------------------------------------------- */

.bp-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bp-bg);
  border-bottom: 1px solid var(--bp-line);
}

.bp-header__main-inner {
  display: flex;
  align-items: center;
  gap: 20px;
  min-height: var(--bp-header-h);
}

/* Branding */
.bp-branding__link { display: inline-flex; align-items: center; }
.bp-branding__logo {
  display: block;
  width: auto;
  height: 39px; /* matches the live site's 260x39 logo */
  max-width: 100%;
}

/* Search — sampled from the live header: #f0f0f0 pill, 48px tall, ~635px wide,
   "All Categories" separated by a hairline, and no visible submit button. */
.bp-search {
  display: flex;
  align-items: center;
  flex: 1 1 auto;
  min-width: 0;
  max-width: 635px;
  height: 48px;
  border: 0;
  border-radius: 999px;
  background: var(--bp-bg-soft-2);
  /* not `overflow: hidden` — the All Categories panel must escape the pill */
}
.bp-search__cats {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: none;
  height: 24px;
  padding: 0 18px 0 22px;
  border-right: 1px solid #d9d9d9;
  font-size: 15px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  color: var(--bp-ink);
  cursor: pointer;
  list-style: none;
}
.bp-search__cats .bp-icon { transition: transform .18s ease; }
.bp-search__cats .bp-icon { width: 14px; height: 14px; }
.bp-search__input {
  flex: 1 1 auto;
  min-width: 0;
  height: 100%;
  padding: 0 24px;
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 15px;
  color: var(--bp-ink);
}
.bp-search__input::placeholder { color: #6f6f6f; opacity: 1; }
.bp-search__input:focus { outline: none; }

/* Utilities — labels sit on one line beside their icon; wishlist and cart are
   48px #ececec circles, both sampled from the live header. */
.bp-utils {
  display: flex;
  align-items: center;
  gap: 22px;
  flex: none;
  margin-left: auto;
}
.bp-utils__item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--bp-ink);
  text-decoration: none;
  font-size: 15px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
}
.bp-utils__item:hover { color: var(--bp-red-nav); }
.bp-utils__item--circle {
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #ececec;
  gap: 0;
}
.bp-utils__item--circle:hover { background: #e0e0e0; }

/* --- Category nav ----------------------------------------------------------
   Values measured from bigpharmacy.com.my: the visible label is a 15px/600
   #0a0a0a span. Flat links only — no mega menu, no chevrons.
   -------------------------------------------------------------------------- */

.bp-header__nav {
  position: relative;
  border-top: 1px solid var(--bp-line);
}

.bp-nav__list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 24px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.bp-nav__item { position: relative; }

.bp-nav__link {
  display: inline-flex;
  align-items: center;
  padding: 12px 0;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0;
  white-space: nowrap;
  color: var(--bp-nav-fg);
  text-decoration: none;
}
.bp-nav__link:hover { color: var(--bp-red-nav); }

/* --- "All Categories" dropdown --------------------------------------------
   The one dropdown the header keeps. <details>/<summary> so it opens without
   JavaScript; chrome.js adds click-outside and Escape.
   -------------------------------------------------------------------------- */

.bp-cats {
  position: relative;
  flex: none;
  height: 100%;
  display: flex;
  align-items: center;
}
.bp-cats__list {
  position: absolute;
  top: calc(100% + 10px);
  left: 8px;
  z-index: 120;
  min-width: 260px;
  margin: 0;
  padding: 12px 0;
  list-style: none;
  background: var(--bp-bg);
  border-radius: 14px;
  box-shadow: 0 8px 24px rgb(18 18 18 / 0.18);
}
.bp-cats__list a {
  display: block;
  padding: 12px 24px;
  font-size: 17px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--bp-ink);
  text-decoration: none;
  white-space: nowrap;
}
.bp-cats__list a:hover { color: var(--bp-red-nav); background: var(--bp-bg-soft-2); }

.bp-search__cats::-webkit-details-marker { display: none; }
.bp-search__cats::marker { content: ""; }
.bp-cats[open] > .bp-search__cats .bp-icon { transform: rotate(180deg); }

/* --- Burger ---------------------------------------------------------------
   Hidden on desktop; shown by the 1299px breakpoint below.
   -------------------------------------------------------------------------- */

.bp-burger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  padding: 0 8px;
  border: 0;
  background: transparent;
  cursor: pointer;
}
.bp-burger__bar {
  display: block;
  width: 100%;
  height: 2px;
  border-radius: 2px;
  background: var(--bp-ink);
}

/* --- Mobile drawer -------------------------------------------------------- */

.bp-drawer {
  position: fixed;
  inset: 0;
  z-index: 200;
}
.bp-drawer[hidden] { display: none; }
.bp-drawer__scrim {
  position: absolute;
  inset: 0;
  background: rgb(0 0 0 / 0.45);
}
.bp-drawer__panel {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(86vw, 340px);
  height: 100%;
  padding: 20px 20px 32px;
  background: var(--bp-bg);
  overflow-y: auto;
}
.bp-drawer__close {
  align-self: flex-end;
  width: 40px;
  height: 40px;
  border: 0;
  background: transparent;
  font-size: 30px;
  line-height: 1;
  color: var(--bp-ink);
  cursor: pointer;
}
.bp-drawer__menu {
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  overflow: visible;
}
.bp-drawer__menu > li > a {
  display: block;
  padding: 13px 0;
  border-bottom: 1px solid var(--bp-line);
  font-size: 15px;
  font-weight: 500;
  color: var(--bp-ink);
  text-decoration: none;
}
.bp-drawer__utils {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 20px;
}
.bp-drawer__utils a {
  font-size: 14px;
  font-weight: 700;
  color: var(--bp-red);
  text-decoration: none;
}

/* --- Footer --------------------------------------------------------------- */

.bp-footer {
  margin-top: 0;
  padding: 56px 0 28px;
  background: var(--bp-footer-bg);
  color: var(--bp-footer-fg);
  font-size: 14px;
}

.bp-footer__top {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 2.4fr);
  gap: 48px;
}

.bp-footer__logo {
  display: block;
  width: auto;
  height: 30px;
  margin-bottom: 16px;
}
.bp-footer__blurb {
  margin: 0 0 20px;
  max-width: 46ch;
  color: var(--bp-footer-fg);
  font-size: 13px;
  line-height: 1.7;
}

.bp-social {
  display: flex;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.bp-social a {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #282828;
  color: #fff;
}
.bp-social a:hover { background: var(--bp-red); }

.bp-footer__cols {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 32px;
}
.bp-footer__col-title {
  margin: 0 0 14px;
  font-size: 14px;
  font-weight: 700;
  color: #ffffff;
}
.bp-footer__list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.bp-footer__list a {
  color: var(--bp-footer-fg);
  text-decoration: none;
  font-size: 13px;
  line-height: 1.5;
}
.bp-footer__list a:hover { color: #ffffff; text-decoration: underline; }

.bp-footer__bottom {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid var(--bp-footer-line);
}
.bp-footer__copy {
  margin: 0;
  color: var(--bp-footer-fg);
  font-size: 12px;
  line-height: 1.6;
}
.bp-footer__legal {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.bp-footer__legal a {
  color: var(--bp-footer-fg);
  font-size: 12px;
  text-decoration: none;
}
.bp-footer__legal a:hover { color: #ffffff; text-decoration: underline; }

/* --- Responsive ----------------------------------------------------------- */

@media (max-width: 1024px) {
  .bp-utils__item--text span { display: none; }
  .bp-utils { gap: 14px; }
}

/* The 11 top-level labels need ~1300px to sit on one line; below that the
   drawer takes over rather than letting the row wrap to two lines. */
/* The 11 top-level labels need ~1300px to sit on one line, so the drawer takes
   over below that — but only the nav swaps here. The header's own layout and
   the footer keep their desktop arrangement down to 860px. */
@media (max-width: 1299px) {
  .bp-burger { display: flex; }
  .bp-header__nav { display: none; }
}

@media (max-width: 860px) {
  .bp-header__main-inner {
    flex-wrap: wrap;
    gap: 10px;
    padding-block: 10px;
  }
  .bp-search {
    order: 3;
    flex-basis: 100%;
    max-width: none;
    height: 42px;
  }
  .bp-search__cats { display: none; }
  .bp-search__input { padding: 0 18px; }
  /* 26px keeps burger + logo + both circles on a single row at 375px. */
  .bp-branding__logo { height: 26px; }

  /* Keep burger, logo and the two circled actions on one row; "Find a store"
     and "Sign in" move into the drawer at this width. */
  .bp-utils { gap: 10px; }
  .bp-utils__item--text { display: none; }
  .bp-utils__item--circle { width: 40px; height: 40px; }
  .bp-utils__item--circle .bp-icon { width: 20px; height: 20px; }

  .bp-footer__top { grid-template-columns: 1fr; gap: 32px; }
  .bp-footer__cols { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px; }
}

@media (max-width: 480px) {
  .bp-footer__cols { grid-template-columns: 1fr; }
  .bp-footer__bottom { flex-direction: column; align-items: flex-start; }
}

/* --- WordPress admin bar ---------------------------------------------------
   The admin bar is fixed at the top for logged-in users, so a header stuck at
   top:0 slides underneath it. Only affects logged-in views, never visitors.
   -------------------------------------------------------------------------- */

.admin-bar .bp-header { top: 32px; }

@media screen and (max-width: 782px) {
  /* Below 783px WordPress makes the admin bar position:fixed at 46px tall. */
  .admin-bar .bp-header { top: 46px; }
  .admin-bar .bp-drawer { top: 46px; }
}

/* --- Mobile drawer menu --------------------------------------------------- */

.bp-drawer__menu {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}
.bp-drawer__menu > li { border-bottom: 1px solid var(--bp-line); }
.bp-drawer__menu .bp-nav__link {
  display: block;
  width: 100%;
  padding: 13px 0;
  font-size: 15px;
  font-weight: 500;
  color: var(--bp-ink);
}

/* Keep the category row on one line as the viewport narrows. */
@media (max-width: 1560px) {
  .bp-nav__list { gap: 0 18px; }
  .bp-nav__link { font-size: 14px; }
  .bp-nav__link .bp-icon { width: 13px; height: 13px; }
}
