/* Overlay for mobile nav and cart */
.wd-close-side {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.wd-close-side.wd-close-side-opened,
body.ps-mobile-nav-open .wd-close-side {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* Mobile navigation drawer */
.ps-mobile-nav {
  position: fixed;
  top: 0;
  left: 0;
  width: min(88vw, 320px);
  height: 100%;
  z-index: 400;
  background: #fff;
  box-shadow: 2px 0 24px rgba(0, 0, 0, 0.15);
  transform: translateX(-105%);
  transition: transform 0.28s ease;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.ps-mobile-nav.ps-mobile-nav--open {
  transform: translateX(0);
}

.ps-mobile-nav-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid #eee;
  font-weight: 700;
  font-size: 16px;
}

.ps-mobile-nav-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: #f3f3f3;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

.ps-mobile-nav-body {
  overflow-y: auto;
  padding: 12px 0 24px;
  -webkit-overflow-scrolling: touch;
}

.ps-mobile-nav-links {
  display: flex;
  flex-direction: column;
}

.ps-mobile-nav-links a {
  display: block;
  padding: 14px 20px;
  color: #1d1d22;
  text-decoration: none;
  font-weight: 600;
  border-bottom: 1px solid #f2f2f2;
}

.ps-mobile-nav-links a:hover,
.ps-mobile-nav-links a:focus {
  background: #f7f7f7;
  color: #0693e3;
}

body.ps-mobile-nav-open {
  overflow: hidden;
}

body.ps-mobile-nav-open .wd-close-side {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.ps-shop-mobile-search {
  display: none;
}

/* Global mobile layout */
@media (max-width: 1024px) {
  html,
  body {
    overflow-x: hidden;
  }

  .container {
    padding-left: 16px;
    padding-right: 16px;
  }

  .ps-store-page,
  .ps-store-main.container,
  .wd-page-content.main-page-wrapper {
    padding-left: 16px;
    padding-right: 16px;
  }

  .ps-page-title {
    padding: 0 16px;
    font-size: clamp(1.35rem, 4vw, 1.75rem);
  }

  .ps-checkout-grid,
  .ps-form-row-grid,
  .product-detail-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .ps-checkout-panel,
  .ps-cart-totals,
  .ps-compare-root,
  .order-card,
  .product-detail-grid {
    padding: 18px 16px;
  }

  .ps-store-page {
    padding-top: 24px;
    padding-bottom: 24px;
  }

  /* Header: simplify mobile cart */
  .whb-mobile-right .wd-header-cart .wd-tools-text,
  .whb-mobile-right .wd-cart-number > span {
    display: none !important;
  }

  .whb-mobile-right .wd-header-cart > a {
    padding-inline: 8px;
  }

  .whb-general-header .site-logo img {
    max-width: 150px !important;
    height: auto;
  }

  .whb-general-header-inner {
    min-height: 56px;
  }

  /* Shop page mobile search bar */
  .ps-shop-mobile-search {
    display: block;
    margin: 0 0 16px;
    position: relative;
    z-index: 30;
  }

  .ps-shop-mobile-search .wd-search-form {
    width: 100%;
  }

  .ps-shop-mobile-search form.searchform {
    display: flex;
    align-items: stretch;
    width: 100%;
    margin: 0;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
  }

  .ps-shop-mobile-search form.searchform input.s {
    flex: 1 1 auto;
    min-width: 0;
    border: 0;
    padding: 12px 14px;
    font-size: 16px;
    background: transparent;
  }

  .ps-shop-mobile-search form.searchform .searchsubmit {
    flex: 0 0 auto;
    border: 0;
    padding: 0 16px;
    background: #0693e3;
    color: #fff;
    font-weight: 600;
    cursor: pointer;
  }

  .ps-shop-mobile-search .wd-search-results-wrapper {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 4px);
  }

  .ps-shop-mobile-search .wd-search-results.wd-opened {
    display: block;
  }

  /* Product grid (shop pages only — homepage uses theme/laptop layout) */
  body:not(.home) #firebase-shop-grid.wd-products,
  body:not(.home) .products.wd-products.wd-grid-g {
    --wd-col-lg: 2 !important;
    --wd-col-md: 2 !important;
    --wd-col-sm: 2 !important;
    --wd-col: 2 !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 12px !important;
  }

  body:not(.home) .wd-product .product_title,
  body:not(.home) .wd-entities-title {
    font-size: 14px;
    line-height: 1.35;
  }

  body:not(.home) .wd-product .wrap-price {
    font-size: 14px;
  }

  /* Cart sidebar full width on phones */
  .cart-widget-side {
    width: min(100vw, 360px);
  }

  /* Footer widgets stack */
  .footer-column,
  .wd-footer .elementor-column {
    width: 100% !important;
    max-width: 100% !important;
  }

  .scrollToTop {
    right: 12px;
    bottom: 68px;
    width: 42px;
    height: 42px;
  }

  .button,
  .ps-checkout-auth-actions .button,
  .ps-cart-totals .button {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .ps-cart-totals {
    max-width: none;
    margin-left: 0;
  }

  .ps-cart-totals .button {
    width: 100%;
    margin-bottom: 10px;
    text-align: center;
  }

  .order-card-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .order-card-body {
    grid-template-columns: 1fr;
  }

  .product_title {
    font-size: clamp(1.35rem, 5vw, 1.75rem);
  }

  .product-price-wrap {
    font-size: 1.25rem;
  }

  .wishlist-card {
    display: grid;
    gap: 12px;
    padding: 16px;
    background: #fff;
    border-radius: 8px;
  }

  .wishlist-card img {
    max-width: 120px;
    height: auto;
  }

  .ps-wishlist-grid {
    grid-template-columns: 1fr;
  }

  /* Home hero slideshow — same images as laptop, mobile-friendly carousel */
  body.home .elementor-element-7622938 {
    display: none !important;
  }

  body.home .elementor-element-7622938.ps-hide-on-mobile-hero {
    display: none !important;
  }

  body.home .ps-mobile-hero-mount {
    display: block;
    width: 100%;
    margin: 0 0 12px;
    position: relative;
    z-index: 3;
  }

  body.home #slider-70,
  body.home #slide-151,
  body.home .wd-slide-inner,
  body.home .elementor-151 .e-con-inner {
    overflow: visible !important;
  }

  body.home .ps-mobile-hero-slider {
    position: relative;
    width: 100%;
    background: #e45a2d;
    overflow: hidden;
  }

  body.home .ps-mobile-hero-viewport {
    position: relative;
    width: 100%;
    min-height: clamp(220px, 52vw, 420px);
  }

  body.home .ps-mobile-hero-slide {
    display: none;
    width: 100%;
    min-height: clamp(220px, 52vw, 420px);
    padding: 16px 44px;
    background-color: #e45a2d;
    background-repeat: no-repeat;
    background-position: center center;
    background-size: contain;
  }

  body.home .ps-mobile-hero-slide[data-slide="1"] {
    background-image: url("../images/hero/slide-1.png");
  }

  body.home .ps-mobile-hero-slide[data-slide="2"] {
    background-image: url("../images/hero/slide-2.png");
  }

  body.home .ps-mobile-hero-slide[data-slide="3"] {
    background-image: url("../images/hero/slide-3.png");
  }

  body.home .ps-mobile-hero-slide[data-slide="4"] {
    background-image: url("../images/hero/slide-4.png");
  }

  body.home .ps-mobile-hero-slide.is-active {
    display: block;
  }

  body.home .ps-mobile-hero-link {
    display: block;
    width: 100%;
    min-height: clamp(188px, 48vw, 388px);
    text-decoration: none;
  }

  body.home .ps-mobile-hero-slide img {
    display: block;
    width: 100%;
    max-width: 100%;
    height: auto;
    min-height: clamp(160px, 42vw, 360px);
    max-height: clamp(190px, 48vw, 388px);
    margin: 0 auto;
    object-fit: contain;
    object-position: center;
    opacity: 1;
    visibility: visible;
  }

  body.home .ps-mobile-hero-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
    width: 34px;
    height: 34px;
    border: 0;
    padding: 0;
    background: transparent;
    color: rgba(255, 255, 255, 0.92);
    cursor: pointer;
  }

  body.home .ps-mobile-hero-prev {
    left: 8px;
  }

  body.home .ps-mobile-hero-next {
    right: 8px;
  }

  body.home .ps-mobile-hero-arrow::before {
    font-size: 28px;
    font-weight: 300;
    line-height: 1;
  }

  body.home .ps-mobile-hero-prev::before {
    content: "‹";
  }

  body.home .ps-mobile-hero-next::before {
    content: "›";
  }

  body.home .ps-mobile-hero-dots {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 8px;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
  }

  body.home .ps-mobile-hero-dot {
    width: 5px;
    height: 5px;
    min-width: 5px;
    min-height: 5px;
    border: 0;
    border-radius: 50%;
    padding: 0;
    margin: 0;
    background: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    flex: 0 0 auto;
    -webkit-appearance: none;
    appearance: none;
  }

  body.home .ps-mobile-hero-dot.is-active {
    width: 6px;
    height: 6px;
    min-width: 6px;
    min-height: 6px;
    background: #1d1d22;
  }

  body.home #slider-70 .wd-carousel-wrap {
    height: auto !important;
  }

  body.home #slider-70 .wd-carousel-item,
  body.home #slider-70 .wd-slide {
    width: 100% !important;
    max-width: 100% !important;
  }

  /* Hide Google reviews on home page mobile */
  body.home .elementor-element-25beb40 {
    display: none !important;
  }
}

@media (min-width: 1025px) {
  body.home .ps-mobile-hero-mount {
    display: none !important;
  }

  body.home .elementor-element-7622938 {
    display: block !important;
  }
}

@media (max-width: 767px) {
  .ps-checkout-auth-actions {
    flex-direction: column;
  }

  .ps-checkout-auth-actions .button {
    width: 100%;
  }

  /* Responsive cart table */
  .woocommerce-cart-form__contents.shop_table_responsive thead {
    display: none;
  }

  .woocommerce-cart-form__contents.shop_table_responsive tbody tr {
    display: block;
    margin-bottom: 16px;
    padding: 16px;
    background: #fff;
    border: 1px solid #eee;
    border-radius: 8px;
  }

  .woocommerce-cart-form__contents.shop_table_responsive tbody td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 0;
    border: 0;
    text-align: right;
  }

  .woocommerce-cart-form__contents.shop_table_responsive tbody td::before {
    content: attr(data-title);
    font-weight: 600;
    text-align: left;
    color: #666;
    flex: 1 1 auto;
  }

  .woocommerce-cart-form__contents.shop_table_responsive .product-remove {
    justify-content: flex-end;
    padding-bottom: 0;
  }

  .woocommerce-cart-form__contents.shop_table_responsive .product-remove::before {
    display: none;
  }

  .woocommerce-cart-form__contents.shop_table_responsive .product-thumbnail {
    justify-content: center;
  }

  .woocommerce-cart-form__contents.shop_table_responsive .product-thumbnail::before {
    display: none;
  }

  .woocommerce-cart-form__contents.shop_table_responsive .product-name {
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
  }

  .woocommerce-cart-form__contents.shop_table_responsive .product-name::before {
    margin-bottom: 4px;
  }

  .woocommerce-cart-form__contents.shop_table_responsive .ps-cart-qty-stepper {
    margin-left: auto;
  }

  .woocommerce-cart-form__contents.shop_table_responsive .ps-cart-qty-stepper .firebase-cart-qty {
    width: 40px;
    flex-basis: 40px;
    min-height: 40px;
    pointer-events: auto;
    touch-action: manipulation;
  }

  .woocommerce-cart-form__contents.shop_table_responsive .ps-cart-qty-btn {
    flex-basis: 36px;
    width: 36px;
    min-height: 40px;
    font-size: 20px;
  }

  .woocommerce-cart-form__contents.shop_table_responsive .firebase-cart-qty {
    width: 72px;
    min-height: 40px;
    pointer-events: auto;
    touch-action: manipulation;
  }

  .firebase-cart-qty {
    width: 80px;
    min-height: 40px;
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 16px;
    pointer-events: auto;
    touch-action: manipulation;
    background: #fff;
    color: #222;
  }

  .product-quantity .firebase-cart-qty {
    position: relative;
    z-index: 2;
  }

  .shop_table:not(.shop_table_responsive) {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .ps-compare-table {
    min-width: 520px;
  }

  .ps-compare-table img {
    max-width: 80px;
  }

  .ps-bitcoin-panel code {
    font-size: 12px;
  }

  .ps-modal {
    padding: 12px;
  }

  .ps-modal-card {
    padding: 20px 18px;
  }
}

@media (max-width: 480px) {
  body:not(.home) #firebase-shop-grid.wd-products,
  body:not(.home) .products.wd-products.wd-grid-g {
    --wd-col: 1 !important;
    grid-template-columns: 1fr !important;
  }

  .whb-general-header .site-logo img {
    max-width: 130px !important;
  }

  .wd-toolbar-label {
    font-size: 10px;
  }
}

/* Admin mobile tweaks */
@media (max-width: 900px) {
  .admin-sidebar {
    width: 100%;
    border-right: 0;
    border-bottom: 1px solid #2a3444;
  }

  .admin-layout {
    flex-direction: column;
  }

  .admin-main {
    padding: 20px 16px;
  }

  .admin-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .admin-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-form-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .admin-stats {
    grid-template-columns: 1fr;
  }

  .admin-login-card {
    padding: 28px 20px;
  }
}
