/**
 * Header system — topbar, main header, product-category mega menu and the mobile
 * off-canvas drawer. Lifted 1:1 from the design; colors reference tokens.css.
 */

/* ============================ Topbar ============================ */
.topbar { background: var(--teal); color: #dff0ee; font-size: 12px; }
.topbar .wrap { display: flex; align-items: center; justify-content: space-between; height: 32px; }
.topbar a { color: #fff; }
.topbar .free { font-weight: 600; }
.topbar .tphone { font-weight: 600; }

/* ============================ Header bar ============================ */
.header { background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 50; }
/* Pin below the admin bar instead of underneath it (--admin-h is 0 whenever the
 * bar scrolls away, so this is a no-op for visitors). */
.admin-bar .header { top: var(--admin-h); }
.header .wrap { display: flex; align-items: center; gap: 18px; height: 88px; position: relative; }
.logo { font-size: 21px; font-weight: 800; letter-spacing: -.02em; color: var(--teal); white-space: nowrap; display: inline-flex; align-items: center; }
.logo:hover { text-decoration: none; }
.logo span { color: var(--green); }
.logo img { display: block; width: auto; height: 74px; }
.header .custom-logo-link { display: inline-flex; align-items: center; }
.header .custom-logo { max-height: 44px; width: auto; }

/* Search slot (FiboSearch renders here; fallback input styled to match). */
.header .search { flex: 1; max-width: 560px; position: relative; }
.header .search .dgwt-wcas-search-wrapp { max-width: 100%; }
.search-fallback input {
  width: 100%; height: 40px; border: 1.5px solid var(--line); border-radius: 9px;
  padding: 0 42px 0 14px; font-size: 14px; color: var(--ink); background: var(--page-bg);
}
.search-fallback input:focus { outline: none; border-color: var(--teal); background: #fff; }
.search-fallback .s-btn {
  position: absolute; right: 4px; top: 4px; width: 32px; height: 32px; border: none; border-radius: 7px;
  background: var(--teal); color: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.search-fallback .s-btn svg { width: 16px; height: 16px; }

/* FiboSearch markup (dgwt-wcas-*) restyled to match the mockup's .search
 * input/.s-btn — the plugin's own CSS is dequeued, so this is the only styling
 * the rendered [fibosearch] shortcode gets. */
.header .search .dgwt-wcas-search-wrapp,
.header .search .dgwt-wcas-search-form,
.header .search .dgwt-wcas-sf-wrapp { width: 100%; position: relative; box-sizing: border-box; }
.header .search .dgwt-wcas-search-input {
  width: 100%; height: 40px; border: 1.5px solid var(--line); border-radius: 9px;
  padding: 0 42px 0 14px; font-size: 14px; color: var(--ink); background: var(--page-bg);
  box-sizing: border-box;
}
.header .search .dgwt-wcas-search-input:focus,
.header .search .dgwt-wcas-search-input.dgwt-wcas-search-focused { outline: none; border-color: var(--teal); background: #fff; }
.header .search .dgwt-wcas-ico-magnifier,
.header .search .dgwt-wcas-search-submit {
  position: absolute !important; right: 4px !important; top: 4px !important; left: auto !important;
  width: 32px !important; height: 32px !important; max-width: none !important; max-height: none !important;
  margin: 0 !important; opacity: 1 !important; border: none; border-radius: 7px; background: var(--teal);
  display: flex !important; align-items: center; justify-content: center;
}
/* The rule above styles the magnifier and the submit button as alternatives —
   which is how FiboSearch renders them in some layouts. In this one the icon is
   NESTED inside the button and carries .dgwt-wcas-ico-magnifier itself, so it
   was handed the button's own box: 32px, teal, absolutely positioned, filling
   the button edge to edge. Here it is the glyph, not the box.
   (`.header .header .search …` used to guard these — a typo that matched nothing,
   so the svg was never sized at all.) */
.header .search .dgwt-wcas-search-submit .dgwt-wcas-ico-magnifier {
  position: static !important;
  width: 16px !important; height: 16px !important;
  background: none; border-radius: 0;
}
.header .search .dgwt-wcas-ico-magnifier svg, .header .search .dgwt-wcas-ico-magnifier path,
.header .search .dgwt-wcas-search-submit svg, .header .search .dgwt-wcas-search-submit path { fill: #fff !important; width: 16px; height: 16px; }
.header .search .dgwt-wcas-preloader, .header .search .dgwt-wcas-voice-search { display: none !important; }

/* Account + cart actions */
.h-actions { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.h-link {
  display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 9px;
  color: var(--ink); font-size: 13px; font-weight: 550; cursor: pointer;
}
.h-link:hover { background: var(--teal-50); text-decoration: none; }
.h-link svg { width: 20px; height: 20px; stroke: var(--teal); }
.h-link .ico-wrap { position: relative; display: flex; }
.h-link .count {
  position: absolute; top: -7px; right: -8px; background: var(--accent); color: #fff;
  font-size: 10px; font-weight: 700; border-radius: var(--radius-pill); min-width: 16px; height: 16px;
  display: flex; align-items: center; justify-content: center; padding: 0 4px;
}
.h-link .count:empty, .h-link .count.is-zero { display: none; }
.h-link .stk { display: flex; flex-direction: column; line-height: 1.15; }
.h-link .stk small { font-size: 11px; color: var(--muted); font-weight: 450; }
.bionela-cart-fragment { display: inline-flex; }

/* The cart is the one action in this header that ends a purchase, but as a plain
   .h-link it was indistinguishable from "Môj účet" next to it. Inverted, it
   mirrors the "Obchod" button at the other end of the row — the two read as
   bookends rather than rivals, because they sit at opposite edges and the
   account link stays quiet between them, which is what makes the hierarchy
   legible: one primary action per side. */
.h-link.cart-contents {
  background: var(--teal); color: #fff; font-weight: 650;
  padding: 6px 14px; transition: background .12s;
}
.h-link.cart-contents:hover { background: var(--teal-600); }
.h-link.cart-contents svg { stroke: #fff; }
/* Subtotal stays legible but subordinate to the label above it. */
.h-link.cart-contents .stk small { color: rgba(255, 255, 255, .78); }
/* Amber on teal keeps the badge readable; on the old white pill it sat on
   nothing, so this is the first time it needs a border to separate it. */
.h-link.cart-contents .count { box-shadow: 0 0 0 2px var(--teal); }

/* Shop / category button */
.shop-menu {
  display: flex; align-items: center; gap: 8px; flex: none;
  background: var(--teal); color: #fff; border: none; border-radius: 9px;
  font-size: 14px; font-weight: 650; padding: 0 15px; height: 40px; cursor: pointer;
  font-family: inherit; transition: background .12s;
}
.shop-menu:hover { background: var(--teal-600); }
.shop-menu svg { width: 17px; height: 17px; }
.shop-menu .chev { width: 14px; height: 14px; opacity: .85; margin-left: 1px; transition: transform .18s; }
.shop-menu.open .chev { transform: rotate(180deg); }

/* ============================ Mega menu (desktop) ============================ */
.mega {
  position: absolute; top: 100%; left: 0; right: 0;
  background: #f4f8f4; border-bottom: 1px solid var(--line);
  box-shadow: var(--shadow-pop); z-index: 60; overflow: hidden;
  opacity: 0; visibility: hidden; transform: translateY(-8px);
  transition: opacity .18s, transform .18s, visibility .18s;
}
.mega-inner {
  position: relative; z-index: 1; max-width: var(--maxw); margin: 0 auto; padding: 26px 5px 28px;
  /* On short laptop screens the panel used to run past the fold, so the footer
   * strip ("Moje produkty" / "Odporúčanie") was cut mid-list. Cap it to the room
   * under the header and scroll inside instead. The 32px is the topbar, which is
   * still above the header until the page scrolls. */
  max-height: calc(100vh - var(--admin-h) - var(--hdr-h) - 32px);
  max-height: calc(100dvh - var(--admin-h) - var(--hdr-h) - 32px);
  overflow-y: auto; overscroll-behavior: contain;
}
.mega::before {
  content: ""; position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background: var(--leaf-green) repeat; background-size: 58px 58px; opacity: .05;
}
.mega.open { opacity: 1; visibility: visible; transform: translateY(0); }
.mega-grid { position: relative; z-index: 1; display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px 26px; }
.mega-cat { margin-bottom: 22px; }
.mega-cat:last-child { margin-bottom: 0; }
.mega-tag {
  display: inline-block; font-size: 9px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  border-radius: 5px; padding: 2px 7px; margin-bottom: 6px; color: #fff;
}
.mega-tag.hot { background: var(--tag-amber); }
.mega-tag.rec { background: var(--tag-green); }
/* Colours pickable per menu item in Appearance → Menus. */
.mega-tag.tag-green { background: var(--tag-green); }
.mega-tag.tag-amber { background: var(--tag-amber); }
.mega-tag.tag-teal  { background: var(--tag-teal); }
.mega-tag.tag-red   { background: var(--tag-red); }
.mega-h {
  display: block; font-size: 13px; font-weight: 800; letter-spacing: .02em; text-transform: uppercase;
  color: var(--teal); line-height: 1.25; margin-bottom: 8px;
}
.mega-h:hover { color: var(--teal-600); text-decoration: none; }
.mega-sub { list-style: none; margin: 0; padding: 0; }
.mega-sub a { display: flex; align-items: flex-start; gap: 8px; padding: 4px 0; font-size: 13.5px; font-weight: 500; color: #33403d; }
.mega-sub a::before { content: ""; width: 13px; height: 13px; flex: none; margin-top: 3px; background: var(--leaf-green) no-repeat center/contain; }
.mega-sub a:hover { color: var(--teal); text-decoration: none; }
@media (max-width: 1180px) { .mega-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 860px) { .mega { display: none !important; } }

/* ---- Mega menu footer: my products + recommendations ---- */
.mega-foot {
  position: relative; z-index: 1; margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line);
  display: grid; grid-template-columns: 1fr 1fr; gap: 30px;
}
.mega-foot-h {
  font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted);
  margin: 0 0 10px; display: flex; align-items: center; gap: 8px;
}
.mega-foot-h svg { width: 15px; height: 15px; color: var(--teal); }
.mega-foot-h .muted { color: #9fb0ac; font-weight: 600; letter-spacing: 0; text-transform: none; font-size: 11.5px; }
.mega-mini { display: flex; align-items: center; gap: 11px; padding: 7px 8px; border-radius: 9px; }
.mega-mini:hover { background: #fff; }
.mega-mini-link { display: flex; align-items: center; gap: 11px; flex: 1; min-width: 0; }
.mega-mini-link:hover { text-decoration: none; }
.mega-miniadd {
  flex: none; width: 30px; height: 30px; border-radius: 7px; border: 1.5px solid var(--line); cursor: pointer;
  background: #fff; color: var(--teal); display: flex; align-items: center; justify-content: center; padding: 0;
}
.mega-miniadd:hover { background: var(--teal); color: #fff; border-color: var(--teal); }
.mega-miniadd svg { width: 15px; height: 15px; }
.mthumb {
  width: 38px; height: 38px; border-radius: 8px; flex: none; background: #fff; border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center; color: var(--teal); overflow: hidden;
}
.mthumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.minfo { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.mname { font-size: 13px; font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mprice { font-size: 12px; color: var(--teal); font-weight: 700; }
.mprice .amount { font-size: inherit; color: inherit; }
.mega-login {
  display: flex; align-items: center; gap: 14px; background: #fff;
  border: 1px solid var(--line); border-radius: 11px; padding: 14px 16px;
}
.mega-login .li-ico {
  width: 42px; height: 42px; flex: none; border-radius: 50%; background: var(--teal-50); color: var(--teal);
  display: flex; align-items: center; justify-content: center;
}
.mega-login .li-ico svg { width: 22px; height: 22px; }
.mega-login .li-txt { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.mega-login .li-t { font-size: 14px; font-weight: 700; color: var(--ink); }
.mega-login .li-p { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.mega-login .li-btn {
  flex: none; background: var(--teal); color: #fff; font-size: 13px; font-weight: 700;
  padding: 9px 15px; border-radius: 8px;
}
.mega-login .li-btn:hover { background: var(--teal-600); text-decoration: none; }
/* Shared out-of-stock pill (mega menu footer + My Account → Produkty). */
.bio-unavailable {
  display: inline-block; flex: none; font-size: 10.5px; font-weight: 700;
  letter-spacing: .03em; padding: 2px 7px; border-radius: 5px; white-space: nowrap;
  background: #f2f4f4; color: #8a9895; border: 1px solid var(--line);
}
.mline { display: flex; align-items: center; gap: 7px; min-width: 0; }
.mline .mprice { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mega-mini.is-unavailable .mthumb img,
.mega-mini.is-unavailable .mname { opacity: .6; }
.mega-foot-empty { font-size: 12.5px; color: var(--muted); margin: 0; padding: 7px 8px; }
.mega-foot-all {
  display: inline-block; margin: 8px 0 0 8px; font-size: 12.5px; font-weight: 700;
  color: var(--teal); border-bottom: 1px solid currentColor;
}
.mega-foot-all:hover { color: var(--teal-600); text-decoration: none; }

/* ============================ Off-canvas drawer (mobile) ============================ */
.oc-overlay {
  position: fixed; inset: 0; background: rgba(10, 32, 30, .5);
  opacity: 0; visibility: hidden; transition: opacity .25s, visibility .25s; z-index: 90;
}
.oc-overlay.open { opacity: 1; visibility: visible; }
.offcanvas {
  position: fixed; top: 0; left: 0; height: 100%; width: 330px; max-width: 88vw;
  background: #fff; z-index: 100; display: flex; flex-direction: column;
  transform: translateX(-100%); transition: transform .3s cubic-bezier(.4, 0, .2, 1);
  box-shadow: 0 0 50px rgba(0, 0, 0, .25);
}
.offcanvas.open { transform: translateX(0); }
.oc-head { display: flex; align-items: center; justify-content: space-between; padding: 15px 18px; background: var(--teal); color: #fff; flex: none; }
.oc-head .logo { font-size: 20px; color: #fff; }
.oc-head .logo span { color: var(--green); }
.oc-head .logo img { height: 46px; filter: brightness(0) invert(1); }
.oc-close {
  width: 38px; height: 38px; border: none; border-radius: 9px; cursor: pointer;
  background: rgba(255, 255, 255, .14); color: #fff; display: flex; align-items: center; justify-content: center; transition: background .12s;
}
.oc-close:hover { background: rgba(255, 255, 255, .26); }
.oc-close svg { width: 20px; height: 20px; }
.oc-body { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.oc-tabs { display: flex; gap: 3px; padding: 8px; border-bottom: 1px solid var(--line); background: #fff; flex: none; }
.oc-tab {
  flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 4px;
  border: none; background: none; cursor: pointer; font-family: inherit; font-size: 11px; font-weight: 650; color: var(--muted);
  padding: 9px 4px; border-radius: 9px; min-height: 54px; justify-content: center; line-height: 1.15; text-align: center;
}
.oc-tab svg { width: 18px; height: 18px; }
.oc-tab.active { background: var(--teal); color: #fff; }
.oc-panel { display: none; }
.oc-panel.active { display: block; }
.oc-catwrap { padding: 8px 10px; }
.oc-foot { display: flex; gap: 10px; padding: 14px 18px; border-top: 1px solid var(--line); flex: none; }
.oc-foot a {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 10px; border-radius: 9px; border: 1.5px solid var(--line); font-size: 13.5px; font-weight: 650; color: var(--teal);
}
.oc-foot a:hover { background: var(--teal-50); text-decoration: none; }
.oc-foot svg { width: 18px; height: 18px; }
body.oc-lock { overflow: hidden; }

/* Category tree (drawer) */
.cat-tree { list-style: none; margin: 0; padding: 0; font-size: 14px; }
.cat-tree .row { display: flex; align-items: center; gap: 9px; padding: 9px 10px; border-radius: 8px; color: var(--ink); font-weight: 500; cursor: pointer; }
/* A childless category renders its .row AS the <a>, so the global
   `a:hover { text-decoration: underline }` hit it — branch rows were already
   covered because their link is the inner .label. Both shapes listed here so
   the tree never underlines, in the drawer and in the sidebar alike. */
.cat-tree .row:hover,
.cat-tree .row:hover .label { background: var(--teal-50); text-decoration: none; }
.cat-tree .row:hover .label { background: none; }
.cat-tree .row .ic { width: 18px; height: 18px; flex: none; color: var(--teal); opacity: .8; }
.cat-tree .row .label { flex: 1; }
.cat-tree .row .chev { width: 15px; height: 15px; color: var(--muted); transition: transform .18s; }
.cat-tree li.open > .row .chev { transform: rotate(180deg); }
.cat-tree li.open > .row { color: var(--teal); font-weight: 700; }
.cat-tree .sub { list-style: none; margin: 2px 0 6px; padding: 0 0 0 28px; display: none; }
.cat-tree li.open > .sub { display: block; }
.cat-tree .sub a { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 8px; font-size: 13.5px; font-weight: 500; color: #3a4744; }
.cat-tree .sub a::before { content: ""; width: 13px; height: 13px; flex: none; background: var(--leaf-green) no-repeat center/contain; }
.cat-tree .sub a:hover { background: var(--teal-50); text-decoration: none; }

/* Drawer "Stránky" list */
.oc-list a { display: flex; align-items: center; gap: 11px; padding: 12px 20px; font-size: 14.5px; font-weight: 550; color: var(--ink); border-bottom: 1px solid var(--line-soft); }
.oc-list a:hover { background: var(--teal-50); text-decoration: none; }
.oc-list a .ic { width: 18px; height: 18px; flex: none; color: var(--teal); opacity: .8; }

/* ============================ Header responsive ============================ */
@media (max-width: 1000px) {
  .topbar { display: none; }
  .shop-menu { padding: 0 12px; }
  .h-link .stk { display: none; }
  .h-link.account span.txt { display: none; }
  .h-link { padding: 6px 8px; }
  /* Label and subtotal are hidden here, so the filled pill collapses to a square
     around the icon — keep it square rather than letting the old wide padding
     leave a lopsided box. */
  .h-link.cart-contents { padding: 8px; }
}
@media (max-width: 860px) {
  .header .wrap { height: auto; flex-wrap: wrap; gap: 10px; padding-top: 10px; padding-bottom: 10px; }
  .shop-menu { order: 0; flex: none; gap: 0; width: 44px; height: 44px; padding: 0; justify-content: center; }
  .shop-menu .sm-label, .shop-menu .chev { display: none; }
  .logo { order: 1; font-size: 20px; }
  .h-actions { order: 2; margin-left: auto; gap: 2px; }
  .header .search { order: 3; flex: 1 0 100%; max-width: none; }
  .header .search .dgwt-wcas-search-input { height: 44px; }
  .header .search .dgwt-wcas-ico-magnifier, .header .search .dgwt-wcas-search-submit { top: 6px; height: 32px; }
}
