/* ==========================================================================
   Header Content Row — Figma-exact styling
   Task: 86ex0kxbn
   ========================================================================== */

/* ==========================================================================
   1. MIDDLE ROW — Layout & Padding
   ========================================================================== */

/* Desktop: no horizontal padding */
@media (min-width: 1025px) {
  #header [data-row="middle"] > .ct-container {
    padding-left: 0;
    padding-right: 0;
    gap: 24px;
    align-items: center;
  }

  /* Override Blocksy's fixed-width grid columns so logo & icons size to content,
     search fills remaining space (Blocksy defaults to equal-width 1fr 1fr 1fr) */
  [data-device="desktop"] [data-row="middle"] .ct-container {
    grid-template-columns: auto 1fr auto !important;
  }
}

/* Tablet/Mobile: no horizontal padding + auto grid columns */
@media (max-width: 1024px) {
  #header [data-row="middle"] > .ct-container {
    padding-left: 16px;
    padding-right: 16px;
    margin-inline: 0;
    width: 100%;
    align-items: center !important;
  }

  [data-device="mobile"] [data-row="middle"] .ct-container {
    grid-template-columns: minmax(0, auto) auto !important;
    justify-content: space-between !important;
  }
}

/* --- Tablet & Mobile: 60px row height per Figma (8px top/bottom padding + 44px content) --- */
@media (max-width: 1024px) {
  #header [data-row="middle"] {
    --height: 60px !important;
  }
}

/* ==========================================================================
   2. LOGO — Responsive sizing
   ========================================================================== */

/* Logo container + anchor — vertical centering */
#header [data-row="middle"] [data-id="logo"] {
  display: flex;
  align-items: center;
  align-self: center;
}

#header [data-row="middle"] [data-id="logo"] .site-logo-container {
  display: flex !important;
  align-items: center !important;
  line-height: 0;
}

/* Desktop: 220x54 */
@media (min-width: 1025px) {
  #header [data-id="logo"] img {
    max-height: 54px !important;
    width: auto;
  }
}

/* Tablet: 160x40 */
@media (min-width: 690px) and (max-width: 1024px) {
  #header [data-id="logo"] img {
    max-height: 40px !important;
    width: auto;
  }
}

/* Mobile: 142x35 */
@media (max-width: 689px) {
  #header [data-id="logo"] img {
    max-height: 35px !important;
    width: auto;
  }
}

/* ==========================================================================
   3. PIN + ADDRESS — Custom text element
   ========================================================================== */

/* Pin address link container */
.header-pin-address {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: #59402E;
  white-space: nowrap;
  height: 44px;
}

.header-pin-address:hover {
  color: var(--theme-palette-color-1);
}

/* Pin icon */
.header-pin-address .pin-icon-svg {
  width: 21px;
  height: auto;
  flex-shrink: 0;
}

/* Address text — desktop only */
.header-pin-address .pin-address-text {
  font-family: 'Barlow', sans-serif;
  font-weight: 600;
  font-size: 16px;
  line-height: 32px;
  color: #59402E;
  text-transform: capitalize;
}

/* Hide "Address" label at all viewports (QA follow-up 90180214199089) */
[data-row="middle"] .ct-contact-info[data-id="addres"] .contact-title {
  display: none;
}

/* Hide address text at ≤1299px — icon-only at tablet/mobile */
@media (max-width: 1299px) {
  .header-pin-address .pin-address-text,
  [data-row="middle"] .ct-contact-info[data-id="addres"] .contact-text {
    display: none;
  }
}

/* Hide pin icon at ≤390px — icon overlaps logo at ~375–385px viewport */
@media (max-width: 390px) {
  .header-pin-address,
  [data-row="middle"] .ct-contact-info[data-id="addres"],
  [data-row="middle"] .ct-header-divider {
    display: none !important;
  }
}

/* Pin text element container — ensure proper alignment */
[data-id="text~pin_address"] .ct-header-text,
[data-id="text~pin_address"] .ct-header-text .entry-content,
[data-id="text~pin_address"] .ct-header-text .entry-content p {
  display: flex;
  align-items: center;
  margin: 0;
  line-height: 1;
}

/* ==========================================================================
   4. PHONE (contacts) — Icon only, no text
   ========================================================================== */

/* Hide phone text content, show icon only */
[data-id="contacts"] li .contact-info {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* Make the tel: link a full clickable overlay */
[data-id="contacts"] li {
  position: relative;
  cursor: pointer;
}

[data-id="contacts"] li .contact-text a[href^="tel:"] {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  font-size: 0;
  z-index: 1;
  clip: auto;
  overflow: visible;
}

/* Phone icon container sizing */
[data-id="contacts"] {
  --icon-size: 24px;
}

[data-id="contacts"] li {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
}

[data-id="contacts"] li a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  color: #59402E;
}

[data-id="contacts"] li a:hover {
  color: var(--theme-palette-color-1);
}

[data-id="contacts"] li svg {
  width: 20px;
  height: 20px;
}

/* ==========================================================================
   5. INFO ICON — Custom text element (desktop only via Blocksy visibility)
   ========================================================================== */

/* Info icon wrapper */
.header-icon-info-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
}

.header-icon-info {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  color: #59402E;
  text-decoration: none;
}

.header-icon-info:hover {
  color: var(--theme-palette-color-1);
}

.header-icon-info .info-icon-svg {
  width: 24px;
  height: 24px;
}

/* Info text element container alignment */
[data-id="text~info_icon"] .ct-header-text,
[data-id="text~info_icon"] .ct-header-text .entry-content,
[data-id="text~info_icon"] .ct-header-text .entry-content p {
  display: flex;
  align-items: center;
  margin: 0;
  line-height: 1;
}

/* Info dropdown panel — Figma: 410px, white, radius 8, shadow 0 4px 4px rgba(0,0,0,0.09), p 24px 32px */
.info-dropdown-panel {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  width: 410px;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0px 4px 4px 0px rgba(0, 0, 0, 0.09);
  padding: 24px 32px;
  z-index: 100;
}

.header-icon-info-wrap.info-open .info-dropdown-panel {
  display: block;
}

/* Menu container — Figma: flex column, gap 10px */
.info-dropdown-menu {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Each top-level item */
.info-dropdown-item {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Divider between items — Figma: 1px #e4e5e7, border-radius 2px */
.info-dropdown-item + .info-dropdown-item::before {
  content: '';
  display: block;
  width: 100%;
  height: 1px;
  background: #e4e5e7;
  border-radius: 2px;
  /* Pull divider above the item's own gap to sit between items */
  margin-top: -10px;
  margin-bottom: 0;
}

/* Top-level link (no children) — Figma: Barlow Medium 16/24, #59402e, py 6px px 0 */
.info-dropdown-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  font-family: 'Barlow', sans-serif;
  font-size: 16px;
  font-weight: 500;
  line-height: 24px;
  color: #59402E;
  text-decoration: none;
  border-radius: 6px;
}

.info-dropdown-link:hover {
  color: var(--theme-palette-color-1);
}

/* Accordion toggle row — Figma: flex, justify-between, items-start, full width */
.info-dropdown-toggle {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  width: 100%;
  padding: 0;
  font-family: 'Barlow', sans-serif;
  font-size: 16px;
  font-weight: 500;
  line-height: 24px;
  color: #59402E;
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
}

.info-dropdown-toggle:hover {
  color: var(--theme-palette-color-1);
}

/* Toggle text span — Figma: py 6px px 0, rounded 6px */
.info-dropdown-toggle > span {
  padding: 6px 0;
  border-radius: 6px;
}

/* Chevron button area — Figma: padding 4px, 24x24 icon, color #4a4a4a */
.info-chevron {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  margin-top: 4px;
  padding: 0;
  color: #4a4a4a;
  transition: transform 0.2s ease;
  /* Default: points down (collapsed) */
  transform: rotate(0deg);
}

/* Open state: chevron points up (Figma shows ^ when expanded) */
.info-dropdown-item.is-open .info-chevron {
  transform: rotate(180deg);
}

/* Submenu — Figma: pl 16px, flex column, no gap (children have their own py) */
.info-dropdown-submenu {
  display: none;
  flex-direction: column;
  padding-left: 16px;
}

.info-dropdown-item.is-open .info-dropdown-submenu {
  display: flex;
}

/* Child links — Figma: Barlow Medium 16/24, #59402e, py 6px px 0, rounded 6px */
.info-dropdown-child-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  font-family: 'Barlow', sans-serif;
  font-size: 16px;
  font-weight: 500;
  line-height: 24px;
  color: #59402E;
  text-decoration: none;
  border-radius: 6px;
}

.info-dropdown-child-link:hover {
  color: var(--theme-palette-color-1);
}

/* ==========================================================================
   6. ACCOUNT ICON — 44px container
   ========================================================================== */

[data-id="account"] .ct-account-item {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

[data-id="account"] svg {
  color: #59402E;
  fill: none !important;
}

[data-id="account"]:hover svg {
  color: var(--theme-palette-color-1);
}

/* ==========================================================================
   7. CART ICON — 44px container
   ========================================================================== */

[data-id="cart"] .ct-cart-item {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

[data-id="cart"] .ct-icon-container svg {
  color: #59402E;
  fill: none !important;
}

[data-id="cart"]:hover .ct-icon-container svg {
  color: var(--theme-palette-color-1);
}

/* ==========================================================================
   8. DIVIDERS — Brown, 21px height
   ========================================================================== */

#header [data-row="middle"] .ct-header-divider {
  height: 21px;
  --divider-size: 21px !important;
  border-left-color: rgba(89, 64, 46, 0.3);
}

#header [data-row="middle"] .ct-header-divider::before {
  height: 21px !important;
}

/* ==========================================================================
   9. MOBILE/TABLET — Search row below main row
   ========================================================================== */

/* Search row injected by PHP (custom.php blocksy:header:rows-render filter) */
.header-search-row {
  background: #FFFFFF;
  width: 100%;
}

.header-search-row .dgwt-wcas-search-wrapp {
  margin: 0;
}

/* Force full-width search on tablet & mobile (overrides FiboSearch inline 600px max-width) */
@media (max-width: 1024px) {
  .dgwt-wcas-search-wrapp {
    max-width: 100% !important;
  }
}

/* Tablet search input */
@media (min-width: 690px) and (max-width: 1024px) {
  .header-search-row .dgwt-wcas-search-wrapp input[type="search"].dgwt-wcas-search-input {
    height: 48px;
    min-height: 48px;
    border-radius: 8px;
    border: 1px solid #2b9947;
    font-family: 'Barlow', sans-serif;
    font-size: 14px;
    background: #fff;
  }
}

/* Mobile search input */
@media (max-width: 689px) {
  .header-search-row .dgwt-wcas-search-wrapp input[type="search"].dgwt-wcas-search-input {
    height: 40px;
    min-height: 40px;
    border-radius: 8px;
    border: 1px solid #2b9947;
    font-family: 'Barlow', sans-serif;
    font-size: 14px;
    background: #fff;
  }
}

/* ==========================================================================
   10. TABLET/MOBILE — Icon spacing adjustments (Figma-exact)
   ========================================================================== */

/* --- Shared tablet + mobile --- */
@media (max-width: 1024px) {
  /* Override Blocksy 10px default margins on all items */
  #header [data-row="middle"] [data-column="end"] [data-items] > * {
    margin-left: 0 !important;
    margin-right: 0 !important;
  }

  /* All icon containers: 44×44 per Figma */
  #header [data-row="middle"] .header-pin-address {
    width: 44px;
    height: 44px;
    justify-content: center;
  }


  /* Dividers: 21px height, no extra margins (gap handles spacing) */
  #header [data-row="middle"] [data-column="end"] .ct-header-divider {
    height: 21px !important;
    --divider-size: 21px;
    align-self: center;
  }

  #header [data-row="middle"] [data-column="end"] .ct-header-divider::before {
    height: 21px !important;
  }

  /* Logo next to hamburger — allow shrink so icons get full space */
  #header [data-row="middle"] [data-column="start"] {
    gap: 8px;
    min-width: 0;
  }

  #header [data-row="middle"] [data-column="start"] [data-items] {
    min-width: 0;
  }

  #header [data-row="middle"] [data-id="logo"] {
    min-width: 0;
    flex-shrink: 1;
  }

  #header [data-row="middle"] [data-id="logo"] img {
    width: auto;
    max-width: 100%;
  }
}

/* --- Tablet (690–1024px): 24px gap, 44px icons --- */
@media (min-width: 690px) and (max-width: 1024px) {
  #header [data-row="middle"] [data-column="end"] [data-items] {
    gap: 24px;
    align-items: center;
  }
}

/* --- Mobile (≤689px): 1px gap, 44px icons, visible dividers --- */
@media (max-width: 689px) {
  #header [data-row="middle"] [data-column="end"] [data-items] {
    gap: 1px;
    align-items: center;
  }

  /* Phone icon: extra horizontal padding per Figma mobile */
  [data-id="contacts"] li {
    padding-left: 12px;
    padding-right: 12px;
  }
}

/* Hamburger trigger button — horizontal margin */
#header [data-row="middle"] .ct-header-trigger {
  margin-left: 10px;
  margin-right: 10px;
}

/* ==========================================================================
   11. DESKTOP SEARCH — Middle placement (FiboSearch via search-override.php)
   ========================================================================== */

@media (min-width: 1025px) {
  #header [data-row="middle"] [data-id="search"] {
    flex: 1;
    max-width: none;
  }

  #header [data-row="middle"] [data-id="search"] .dgwt-wcas-search-wrapp {
    width: 100%;
  }
}

/* ==========================================================================
   12. DESKTOP SEARCH POPUP — "Search Product" Header Bar
   Task: 86ew4y0vd
   Moved to header-search.css (authoritative source with correct Figma values)
   ========================================================================== */

/* ==========================================================================
   13. ICONS — Remove fill from contacts phone icon SVG (stroke-only per Figma)
   ========================================================================== */

[data-id="contacts"] .ct-icon-container svg {
  fill: none !important;
}

/* ==========================================================================
   14. INFO DROPDOWN — Z-INDEX FIX (Task: 86exdzrn9)
   Middle row must stack above bottom-row nav. Parent theme sets middle=z-index:2,
   bottom=z-index:1 per row — but nav submenu descendants escape the bottom context
   and render above the middle row. Raising middle to z-index:100 ensures the
   info panel clears the nav.
   ========================================================================== */

#header [data-row*='middle'] { z-index: 100 !important; }

/* ==========================================================================
   15. ACCOUNT ICON — CLICK-ONLY DROPDOWN (Task: 86exdzrn9)
   Parent theme opens .ct-header-account > ul via CSS :hover / :focus-within.
   Override suppresses hover; .is-open (toggled by JS below) gates visibility.
   ========================================================================== */

.ct-header-account:hover > ul,
.ct-header-account:focus-within > ul {
  opacity: 0 !important;
  visibility: hidden !important;
  transform: translate3d(0, 10px, 0) !important;
  pointer-events: none !important;
}

.ct-header-account.is-open > ul {
  opacity: 1 !important;
  visibility: visible !important;
  transform: translate3d(0, 0, 0) !important;
  pointer-events: auto !important;
}
