/* =========================================================
   Next-gen Header & Navigation (wb-cio)
   Uses design tokens from defaults.css
   ========================================================= */

/* --- global overflow guard (header used to cause horizontal scroll) --- */
html, body { overflow-x: hidden; }

/* Header */
.wbc-header{
  position: sticky;
  top: 0;
  z-index: 70;

  /* Glassy but readable */
  backdrop-filter: saturate(160%) blur(10px);
  -webkit-backdrop-filter: saturate(160%) blur(10px);

  background: color-mix(in srgb, var(--bg) 85%, var(--surface));
  border-bottom: 1px solid var(--border);

  /* Prevent any child from creating horizontal overflow */
  width: 100%;
  overflow-x: clip;
}

.wbc-header--glass.is-compact .wbc-header__inner{
  padding-top: 10px;
  padding-bottom: 10px;
}

.wbc-header__inner{
  max-width: var(--container);
  margin: 0 auto;
  padding: 14px 24px;

  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 16px;

  box-sizing: border-box;    /* important for no overflow with padding */
}

/* ----- Brand / logo ----- */
.wbc-brand .custom-logo-link,
.wbc-brand .wbc-logo{
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--brand-brown);
  font-weight: 800;
  font-size: 20px;
}
.wbc-brand .custom-logo{
  height: 28px;
  width: auto;
  display: block;
  max-width: 100%;
}

/* ----- Primary nav (desktop) ----- */
.wbc-nav{
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.wbc-nav__list{
  display: flex;
  gap: 16px;
  list-style: none;
  margin: 0;
  padding: 0;
  flex-wrap: wrap;
}
.wbc-nav__list a{
  padding: 10px 12px;
  border-radius: 12px;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
}
.wbc-nav__list a:hover{
  background: color-mix(in srgb, var(--surface-2) 80%, #000 0%);
}
.wbc-nav__link{
  padding: 10px 12px;
  border-radius: 12px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.wbc-ico{ display:block; }

/* ----- Header actions ----- */
.wbc-actions{
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}
.wbc-iconbtn{
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
}
.wbc-iconbtn:hover{
  background: var(--surface-2);
}
.wbc-cart{ position: relative; }
.wbc-cart__count{
  position: absolute;
  top: -7px;
  right: -7px;
  font-size: 11px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--accent);
  color: var(--on-accent);
  display: grid;
  place-items: center;
}

/* ----- Search ----- */
.wbc-search{ position: relative; }

.wbc-search--inline{
  display: flex;
  align-items: center;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 12px;
  padding: 4px 6px 4px 10px;
  min-width: 280px;
  max-width: 100%;
}
.wbc-search--inline .wbc-search__input{
  border: 0;
  outline: 0;
  background: transparent;
  width: 100%;
  padding: 8px 8px;
  color: var(--text);
}
.wbc-search__btn{
  border: 0;
  background: transparent;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  color: var(--text);
}
.wbc-search__btn:hover{
  background: color-mix(in srgb, var(--surface-2) 85%, #000 0%);
}

.wbc-search-overlay[hidden]{ display:none; }
.wbc-search-overlay{
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.35);
  z-index: 90;
}
.wbc-search-overlay__panel{
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
}
.wbc-search--overlay{
  display: flex;
  align-items: center;
  gap: 12px;
  width: min(860px, 92vw);
  background: var(--surface);
  border-radius: 16px;
  padding: 12px 14px;
  border: 1px solid var(--border);
}
.wbc-search--overlay .wbc-search__input{
  border: 0;
  outline: none;
  flex: 1;
  font-size: 16px;
  background: transparent;
  color: var(--text);
}

/* ----- Mega menu ----- */
.wbc-mega[hidden]{ display:none; }
.wbc-mega{
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  z-index: 65;
  width: 100%;
  max-width: var(--container);
  padding: 8px 24px 24px;
}
.wbc-mega__inner{
  background: var(--surface);
  border-radius: 18px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  padding: 16px;
}
.wbc-mega__title{
  margin: 6px 6px 12px;
  font-size: 16px;
  color: var(--muted);
}
.wbc-mega__grid{
  display: grid;
  grid-template-columns: repeat(6, minmax(0,1fr));
  gap: 12px;
}
.wbc-mega__card{
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
}
.wbc-mega__img{
  width: 72px;
  height: 72px;
  border-radius: 14px;
  background: var(--surface-2);
  object-fit: cover;
  display: block;
}
.wbc-mega__img--ph{ display:grid; place-items:center; }
.wbc-mega__label{ font-weight:700; color: var(--text); }

/* ----- Drawers (shared) ----- */
.wbc-drawer{
  position: fixed;
  inset: 0;
  display: none;
  z-index: 100;
}
.wbc-drawer.is-open{
  display: block;
  background: rgba(0,0,0,.35);
}
.wbc-drawer__panel{
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: min(90vw, 360px);
  background: var(--surface);
  border-radius: 0 16px 16px 0;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
}
.wbc-drawer__panel--right{
  left: auto;
  right: 0;
  border-radius: 16px 0 0 16px;
  width: min(95vw, 420px);
  border-left: 1px solid var(--border);
  border-right: 0;
}
.wbc-drawer__close{
  margin: 10px;
  font-size: 28px;
  background: transparent;
  border: 0;
  color: var(--text);
}
.wbc-drawer__content{
  padding: 8px 14px 18px;
  overflow: auto;
  color: var(--text);
}

/* ----- Mobile bottom tab bar ----- */
.wbc-tabbar{
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 60;
  display: flex;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 4px 8px calc(4px + env(safe-area-inset-bottom));
}
.wbc-tabbar__item{
  flex: 1;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: center;
  justify-content: center;
  padding: 6px 4px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  position: relative;
}
.wbc-tabbar__item .wbc-ico{ width: 22px; height: 22px; }
.wbc-tabbar__badge{
  position: absolute;
  transform: translate(8px,-8px);
  background: var(--accent);
  color: var(--on-accent);
}

/* ===== WooCommerce Store Notice (Control IO Modern Accent) ===== */
.woocommerce-store-notice,
.woocommerce-store-notice.demo_store,
p.woocommerce-store-notice,
p.demo_store {
  background: linear-gradient(90deg, var(--accent) 0%, var(--accent-2) 100%) !important;
  color: var(--on-accent) !important;
  border: 0 !important;
  text-align: center;
  font-weight: 600;
  letter-spacing: 0.2px;
  z-index: 80;
  box-shadow: 0 6px 20px rgba(0,0,0,.08);
}
.woocommerce-store-notice__dismiss-link {
  background: var(--accent-3);
  color: var(--on-accent) !important;
  text-decoration: none;
}
.woocommerce-store-notice__dismiss-link:hover {
  background: color-mix(in srgb, var(--accent-3) 70%, #000 0%);
}
body.woocommerce-demo-store {
  --wp-admin--admin-bar--height: 0;
}

/* =========================================================
   Mobile compact layout
   ========================================================= */
@media (max-width: 768px){
  .wbc-header__inner{
    grid-template-columns: auto 1fr auto;
    padding: 10px 12px;
  }
  .wbc-nav__list{ gap: 10px; flex-wrap: wrap; }
  .wbc-nav__list a{ padding: 8px 10px; }
}
