/* ==============================
   Gstore Mobile Header
============================== */

#gstore-mobile-header {
  display: none;
  transition: transform 0.3s ease-in-out;
}

@media (max-width: 1024px) {
  #gstore-mobile-header {
    display: block;
  }

  .whb-header:not(#gstore-mobile-header) {
    display: none !important;
  }
}

#gstore-mobile-header.header-hidden {
  transform: translateY(-200%);
}

.gstore-header-row {
  display: grid;
  grid-template-columns: 44px 44px minmax(0, 1fr) 44px 44px 44px;
  gap: 6px;
  align-items: center;
}

/* ==============================
   Logo (left)
============================== */
#gstore-mobile-header .gstore-header-logo {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  box-shadow: none;
}

#gstore-mobile-header .gstore-header-logo .site-logo {
  display: flex !important;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  margin: 0;
}

#gstore-mobile-header .gstore-header-logo a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  text-decoration: none;
}

#gstore-mobile-header .gstore-header-logo img,
#gstore-mobile-header .gstore-header-logo svg {
  width: 44px;
  height: 44px;
  max-width: 44px;
  max-height: 44px;
  display: block;
  border-radius: 8px;
  box-shadow: 0 6px 14px rgba(0,0,0,.08);
}

#gstore-mobile-header .gstore-header-logo .wd-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

#gstore-mobile-header .gstore-header-logo .wd-logo img,
#gstore-mobile-header .gstore-header-logo .wd-logo svg {
  max-height: 28px;
  max-width: 100%;
  width: auto;
  height: auto;
  display: block;
}

/* ==============================
   Inherited Icons Wrapper
============================== */
.gstore-header-icon {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 14px rgba(0,0,0,.08);
}

.gstore-header-menu-trigger {
  touch-action: manipulation;
  pointer-events: auto;
  z-index: 2;
}

.gstore-header-menu-trigger,
.gstore-header-menu-trigger:visited,
.gstore-header-menu-trigger:hover,
.gstore-header-menu-trigger:focus,
.gstore-header-menu-trigger:active,
.gstore-header-menu-trigger.is-active {
  color: #1b1b1b !important;
}

.gstore-header-menu-trigger svg {
  stroke: currentColor;
}

/* Reset Woodmart internal styles */
.gstore-header-icon .wd-tools-element {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gstore-header-icon a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  color: #1b1b1b;
  text-decoration: none;
}

.gstore-header-icon .wd-tools-icon,
.gstore-header-icon img,
.gstore-header-icon svg {
  width: 22px;
  height: 22px;
  max-width: 22px;
  max-height: 22px;
  display: block;
}

.gstore-header-icon .wd-tools-icon {
  background-position: center;
  background-repeat: no-repeat;
  background-size: 18px 18px;
}

.gstore-header-icon .wd-tools-icon::before {
  font-size: 18px;
  line-height: 1;
}

.gstore-header-icon .wd-tools-text {
  display: none;
}

.gstore-header-btn {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  border: none;
  background: #fff;
  box-shadow: 0 6px 14px rgba(0,0,0,.08);
}

.gstore-header-btn--primary {
  background: #3A6FF8;
  color: #fff;
}

.gstore-header-search {
  position: relative;
  min-width: 0;
}

.gstore-header-search .searchform {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
}

.gstore-header-search .searchform .s {
  width: 100%;
  height: 44px;
  border-radius: 8px;
  min-width: 0;
  box-sizing: border-box;
  font-size: 16px;
}

.gstore-header-search .searchform .searchsubmit {
  height: 44px;
  border-radius: 8px;
  padding: 0 10px;
  white-space: nowrap;
  box-sizing: border-box;
}

.gstore-header-search form {
  height: 44px;
}

/* ==============================
   Woodmart Search → Glass Tiles
   Mobile & Tablet only
============================== */

@media (max-width: 1024px) {

  .gstore-header-search .wd-search-results-wrapper {
    position: fixed;
    left: 12px;
    right: 12px;
    top: calc(var(--gstore-header-height, 64px) + 8px);
    z-index: 10001;
  }

  .gstore-header-search .wd-search-results {
    position: static !important;
    display: block !important;
    background: rgba(255,255,255,.65) !important;
    backdrop-filter: blur(14px) saturate(160%);
    border: 1px solid rgba(255,255,255,.4);
    border-radius: 8px;
    padding: 10px;
    box-shadow: 0 12px 28px rgba(0,0,0,.12);
    overflow: visible !important;
    max-height: none !important;
    width: 100%;
  }

  .gstore-header-search .wd-scroll {
    overflow-y: auto !important;
    max-height: min(60vh, 260px);
    -webkit-overflow-scrolling: touch;
  }

  .gstore-header-search .wd-scroll-content {
    overflow: visible !important;
  }

  .gstore-header-search .wd-search-suggestions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  .gstore-header-search .wd-suggestions-group {
    display: contents;
  }

  .wd-suggestion {
    background: rgba(255,255,255,.7);
    backdrop-filter: blur(10px);
    border-radius: 8px;
    padding: 6px;
    display: flex;
    gap: 6px;
    box-shadow: 0 10px 22px rgba(0,0,0,.12);
    border: 1px solid rgba(255,255,255,.35);
    align-items: flex-start;
    min-height: 78px;
    position: relative;
    overflow: hidden;
  }

  .wd-suggestion-thumb {
    width: 44px;
    height: 44px;
    border-radius: 8px;
    overflow: hidden;
    flex: 0 0 auto;
  }

  .wd-suggestion-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
  }

  .gstore-header-search .wd-entities-title {
    display: -webkit-box !important;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: 12px;
    line-height: 1.2;
    margin: 0 0 2px;
  }

  .wd-suggestion-content {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
    max-width: 100%;
  }

  .gstore-header-search .wd-suggestion-content * {
    max-width: 100%;
  }

  .gstore-header-search .wd-suggestion-content,
  .gstore-header-search .wd-suggestion .price {
    position: static;
  }

  .wd-suggestion .price {
    font-size: 13px;
    color: #3A6FF8;
    margin: 0;
  }

  .gstore-header-search .wd-fill {
    position: absolute;
    inset: 0;
  }

  .wd-all-results {
    grid-column: span 2;
    text-align: center;
    padding: 14px;
    border-radius: 8px;
    background: rgba(255,255,255,.6);
    backdrop-filter: blur(10px);
  }
}

/* ==============================
   Mobile Language Switcher
============================== */
.gstore-mobile-lang-switcher {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 14px rgba(0,0,0,.08);
  gap: 2px;
  padding: 4px;
}

.gstore-lang-btn-mobile {
  width: 50%;
  height: 100%;
  border: none;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.2s ease;
  padding: 0;
}

.gstore-lang-btn-mobile .gstore-flag-mobile {
  font-size: 16px;
  line-height: 1;
  opacity: 0.5;
  transition: opacity 0.2s ease;
}

.gstore-lang-btn-mobile.is-active {
  background: rgba(58, 111, 248, 0.1);
}

.gstore-lang-btn-mobile.is-active .gstore-flag-mobile {
  opacity: 1;
}

.gstore-lang-btn-mobile:hover .gstore-flag-mobile {
  opacity: 0.8;
}

/* ==============================
   Mobile Theme Toggle
============================== */
.gstore-mobile-theme-toggle {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 14px rgba(0,0,0,.08);
}

.gstore-theme-toggle-mobile {
  width: 100%;
  height: 100%;
  border: none;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: default;
  border-radius: 8px;
  transition: all 0.2s ease;
  padding: 0;
  color: #1b1b1b;
  pointer-events: none;
  opacity: 0.5;
}

.gstore-theme-toggle-mobile:hover {
  background: rgba(0, 0, 0, 0.05);
}

.gstore-theme-toggle-mobile .gstore-theme-icon {
  width: 20px;
  height: 20px;
}

/* Dark mode styling for mobile theme toggle */
[data-theme="dark"] .gstore-mobile-theme-toggle {
  background: rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .gstore-theme-toggle-mobile {
  color: #f0f0f0;
}

[data-theme="dark"] .gstore-theme-toggle-mobile:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* ==============================
   Mobile Content Offset
   Prevent first section/header from sliding under fixed app header.
============================== */
@media (max-width: 767px), (max-width: 1024px) and (orientation: portrait) {
  body.gstore-mobile-header-offset:not(.home):not(.front-page):not(.single-product) {
    padding-top: var(--gstore-mobile-header-offset, 68px) !important;
  }

  /* Fallback in case JS class is missing/delayed on first paint. */
  body:not(.gstore-mobile-header-offset):not(.home):not(.front-page):not(.single-product) #gstore-mobile-header.gstore-header-app ~ .app-shell,
  body:not(.gstore-mobile-header-offset):not(.home):not(.front-page):not(.single-product) #gstore-mobile-header.gstore-header-app ~ #primary,
  body:not(.gstore-mobile-header-offset):not(.home):not(.front-page):not(.single-product) #gstore-mobile-header.gstore-header-app ~ .main-page-wrapper {
    margin-top: var(--gstore-mobile-header-offset, 68px) !important;
  }
}
