/**
 * Aptotema Responsive & Mobile Luxury UX
 */

/* Mobile Navigation Drawer */
.apt-mobile-nav-drawer {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  max-width: 360px;
  height: 100vh;
  height: 100dvh;
  background-color: var(--apt-color-bg, #FFFFFF);
  box-shadow: 10px 0 40px rgba(0,0,0,0.12);
  z-index: var(--apt-z-drawer, 400);
  display: flex;
  flex-direction: column;
  transform: translateX(-100%);
  transition: transform var(--apt-ease-editorial, cubic-bezier(0.16, 1, 0.3, 1));
  padding: 24px 20px;
  box-sizing: border-box;
}

.apt-mobile-nav-drawer.is-active {
  transform: translateX(0);
}

.apt-mobile-nav-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--apt-color-border-subtle, #F2F2F0);
  flex-shrink: 0;
}

.apt-mobile-nav-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--apt-color-text, #111111);
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.apt-mobile-nav-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0 0 16px;
  padding-right: 4px;
}

.apt-mobile-menu-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0;
  padding: 0;
}

.apt-mobile-menu-list > li {
  list-style: none;
  position: relative;
  border-bottom: 1px solid var(--apt-color-border-subtle, #F5F5F3);
  padding-bottom: 6px;
}

.apt-mobile-menu-list > li.menu-item-has-children,
.apt-mobile-menu-list > li.has-mega-menu,
.apt-mobile-menu-list > li.mega-menu {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
}

.apt-mobile-menu-link {
  font-family: var(--apt-font-sans);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: var(--apt-tracking-widest, 0.12em);
  text-transform: uppercase;
  color: var(--apt-color-text, #111111);
  display: block;
  text-decoration: none;
  padding: 10px 0;
  transition: color var(--apt-ease-fast);
}

.apt-mobile-menu-link.has-submenu-toggle {
  flex: 1;
}

.apt-mobile-menu-link:hover {
  color: var(--apt-color-text-muted, #777777);
}

/* Accordion Toggle Button */
.apt-mobile-submenu-toggle {
  background: transparent;
  border: none;
  padding: 10px;
  cursor: pointer;
  color: var(--apt-color-text, #111111);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.25s ease;
  margin-right: -6px;
}

.apt-mobile-submenu-toggle .apt-submenu-arrow {
  transition: transform 0.25s ease;
}

.apt-mobile-menu-list > li.is-open > .apt-mobile-submenu-toggle .apt-submenu-arrow {
  transform: rotate(180deg);
}

/* Mobile Submenu Accordion Dropdown List (Collapsed by default) */
.apt-mobile-menu-list .sub-menu {
  display: none;
  list-style: none;
  width: 100%;
  padding: 6px 0 10px 14px;
  margin: 0;
  flex-direction: column;
  gap: 10px;
  border-left: 2px solid var(--apt-color-border, #E8E8E6);
  box-sizing: border-box;
}

.apt-mobile-menu-list > li.is-open > .sub-menu {
  display: flex;
  animation: aptSubMenuFade 0.25s ease-out;
}

@keyframes aptSubMenuFade {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.apt-mobile-menu-list .sub-menu li {
  list-style: none;
}

.apt-mobile-menu-list .sub-menu .apt-mobile-menu-link,
.apt-mobile-menu-list .sub-menu a {
  font-family: var(--apt-font-sans);
  font-size: 11.5px;
  font-weight: 400;
  letter-spacing: var(--apt-tracking-wider, 0.08em);
  text-transform: uppercase;
  color: var(--apt-color-text-muted, #666666);
  text-decoration: none;
  display: block;
  padding: 4px 0;
}

.apt-mobile-menu-list .sub-menu a:hover {
  color: var(--apt-color-text, #111111);
}

/* Mobile Drawer Utilities (Mi Cuenta & Favoritos) */
.apt-mobile-nav-utilities {
  display: flex;
  gap: 8px;
  padding: 14px 0;
  border-top: 1px solid var(--apt-color-border-subtle, #ECECE8);
  border-bottom: 1px solid var(--apt-color-border-subtle, #ECECE8);
  margin-bottom: 16px;
  flex-shrink: 0;
}

.apt-mobile-utility-item {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 8px;
  background-color: var(--apt-color-bg-secondary, #F8F8F7);
  border: 1px solid var(--apt-color-border, #E8E8E6);
  font-family: var(--apt-font-sans);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--apt-color-text, #111111);
  text-decoration: none;
  transition: all var(--apt-ease-fast);
}

.apt-mobile-utility-item:hover {
  background-color: var(--apt-color-text, #111111);
  color: #FFFFFF;
}

.apt-mobile-utility-item svg {
  flex-shrink: 0;
}

.apt-mobile-nav-footer {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  font-size: 11px;
  color: var(--apt-color-text-muted, #777777);
  flex-shrink: 0;
}

.apt-mobile-nav-footer a {
  color: inherit;
  text-decoration: none;
  transition: color var(--apt-ease-fast);
}

.apt-mobile-nav-footer a:hover {
  color: var(--apt-color-text, #111111);
}

/* Mobile Sticky Bottom Add to Bag Bar */
.apt-mobile-sticky-buy {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  background-color: var(--apt-color-bg);
  border-top: 1px solid var(--apt-color-border);
  padding: 12px 16px;
  z-index: var(--apt-z-sticky);
  display: none;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.06);
  transform: translateY(100%);
  transition: transform var(--apt-ease-fast);
}

.apt-mobile-sticky-buy.is-visible {
  display: block;
  transform: translateY(0);
}

.apt-mobile-sticky-buy__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.apt-mobile-sticky-buy__info {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.apt-mobile-sticky-buy__title {
  font-size: var(--apt-text-xs);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.apt-mobile-sticky-buy__price {
  font-size: var(--apt-text-xs);
  color: var(--apt-color-text-muted);
}

/* Breakpoint Queries */
@media (max-width: 1024px) {
  :root {
    --apt-header-height: 64px;
    --apt-gutter: 20px;
  }

  .apt-header__row--nav,
  .apt-header__left .apt-nav-menu {
    display: none !important;
  }

  .apt-header__row--main {
    height: var(--apt-header-height, 64px) !important;
  }

  .apt-mobile-toggle {
    display: inline-flex !important;
  }

  .apt-products-grid:not(.grid-cols-2):not(.grid-cols-mobile-1),
  ul.products:not(.columns-2):not(.grid-cols-mobile-1),
  .woocommerce ul.products:not(.columns-2):not(.grid-cols-mobile-1),
  .woocommerce-page ul.products:not(.columns-2):not(.grid-cols-mobile-1) {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 16px 12px !important;
  }

  .apt-single-product__layout {
    grid-template-columns: 1fr 1fr;
    gap: 36px;
  }

  .apt-editorial-split__grid {
    gap: 40px;
  }

  .apt-collections-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0;
  }

  .apt-checkout-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  :root {
    --apt-header-height: 56px;
    --apt-topbar-height: 32px;
    --apt-gutter: 14px;
  }

  .apt-topbar {
    font-size: 10px;
    letter-spacing: var(--apt-tracking-wide);
    padding: 0 10px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* 1. Refined Mobile Header (Perfect Centered Logo & Only Search + Cart on Right) */
  .apt-header__row--main .apt-header__container,
  .apt-header__inner {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    position: relative !important;
    padding-left: var(--apt-gutter, 14px) !important;
    padding-right: var(--apt-gutter, 14px) !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .apt-header__left {
    display: flex !important;
    align-items: center !important;
    flex: 0 0 auto !important;
    z-index: 3 !important;
    gap: 8px !important;
  }

  .apt-header-currency {
    display: none !important;
  }

  .apt-mobile-toggle {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 6px !important;
    margin-left: -4px !important;
    background: transparent !important;
    border: none !important;
    cursor: pointer !important;
    color: inherit !important;
  }

  .apt-header__center {
    position: absolute !important;
    left: 50% !important;
    top: 50% !important;
    transform: translate(-50%, -50%) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
    max-width: calc(100% - 130px) !important;
    z-index: 2 !important;
    pointer-events: auto !important;
  }

  .apt-site-logo,
  .custom-logo-link {
    font-size: clamp(1.05rem, 4vw, 1.35rem) !important;
    letter-spacing: 0.14em !important;
    line-height: 1 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    display: inline-block !important;
    color: inherit !important;
  }

  .apt-site-logo-img,
  .custom-logo,
  .apt-site-logo img,
  .apt-site-logo-svg svg {
    height: 18px !important;
    max-height: 20px !important;
    width: auto !important;
    max-width: 160px !important;
    min-width: 0 !important;
  }

  /* Hide Account & Wishlist on Mobile Header Right (Moved to Mobile Drawer) */
  .apt-header-action--account,
  .apt-header-action--wishlist,
  .apt-header__right a.apt-header-action[aria-label="Account"],
  .apt-header__right a.apt-header-action[aria-label="Wishlist"] {
    display: none !important;
  }

  .apt-header__right {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-end !important;
    gap: 8px !important;
    flex: 0 0 auto !important;
    z-index: 3 !important;
    margin-left: auto !important;
  }

  .apt-header-action {
    padding: 6px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: transparent !important;
    border: none !important;
    color: inherit !important;
    position: relative !important;
  }

  .apt-header-cart-count {
    top: 0 !important;
    right: -2px !important;
    width: 15px !important;
    height: 15px !important;
    font-size: 9px !important;
  }

  /* 2. Homepage & Editorial Sections */
  .apt-hero {
    height: calc(100dvh - var(--apt-site-header-total-height, 96px));
    min-height: 520px;
  }

  .apt-hero__content {
    margin-bottom: 32px;
  }

  .apt-editorial-split {
    padding: 60px 0;
  }

  .apt-editorial-split__grid {
    grid-template-columns: 1fr;
    gap: 30px;
  }

  .apt-editorial-split--reverse .apt-editorial-split__grid {
    direction: ltr;
  }

  .apt-collections-grid {
    grid-template-columns: 1fr;
    gap: 0;
  }

  /* 3. Catalog Header & Products Grid (Responsive Switcher & Proportional Cards) */
  .apt-catalog-container {
    padding-left: var(--apt-gutter, 14px) !important;
    padding-right: var(--apt-gutter, 14px) !important;
    overflow-x: clip !important;
  }

  .apt-catalog-header {
    padding: 24px 0 14px !important;
    text-align: left !important;
  }

  .apt-catalog-header__title {
    font-size: 1.5rem !important;
    margin-bottom: 6px !important;
  }

  .apt-catalog-breadcrumb {
    margin-bottom: 10px !important;
  }


  .apt-products-grid,
  .apt-products-grid.grid-cols-mobile-2,
  .apt-products-grid:not(.grid-cols-mobile-1),
  ul.products,
  ul.products.grid-cols-mobile-2,
  ul.products:not(.grid-cols-mobile-1),
  .woocommerce ul.products,
  .woocommerce-page ul.products,
  .wc-block-grid__products {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 16px 10px !important;
    margin-bottom: 40px !important;
  }

  .apt-products-grid.grid-cols-mobile-1,
  ul.products.grid-cols-mobile-1,
  .woocommerce ul.products.grid-cols-mobile-1,
  .woocommerce-page ul.products.grid-cols-mobile-1 {
    grid-template-columns: 1fr !important;
    gap: 28px 0 !important;
    margin-bottom: 50px !important;
    max-width: 520px !important;
    margin-left: auto !important;
    margin-right: auto !important;
  }

  /* Product Card Mobile Proportions */
  .apt-product-card,
  li.product {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  .apt-product-card__media-wrap,
  li.product .apt-product-card__media-wrap {
    aspect-ratio: 4 / 5 !important;
    margin-bottom: 8px !important;
    border-radius: 0 !important;
  }

  /* Badges on mobile */
  .apt-product-card__badge-wrap {
    top: 8px !important;
    left: 8px !important;
    gap: 3px !important;
  }

  .apt-product-card__badge-wrap .apt-badge {
    font-size: 8px !important;
    padding: 2px 5px !important;
    letter-spacing: 0.06em !important;
  }

  /* Wishlist button on mobile */
  .apt-card-wishlist-btn {
    top: 6px !important;
    right: 6px !important;
    padding: 6px !important;
  }

  .apt-card-wishlist-btn svg {
    width: 14px !important;
    height: 14px !important;
  }

  /* Card info typography */
  .apt-product-card__title {
    font-size: 11px !important;
    line-height: 1.35 !important;
    font-weight: 500 !important;
    margin-bottom: 3px !important;
  }

  .grid-cols-mobile-2 .apt-product-card__title {
    display: -webkit-box !important;
    -webkit-line-clamp: 2 !important;
    -webkit-box-orient: vertical !important;
    overflow: hidden !important;
  }

  .grid-cols-mobile-1 .apt-product-card__title {
    font-size: 13px !important;
  }

  .apt-product-card__subtitle {
    font-size: 9.5px !important;
    margin-bottom: 3px !important;
    letter-spacing: 0.04em !important;
  }

  .grid-cols-mobile-1 .apt-product-card__subtitle {
    font-size: 10.5px !important;
  }

  .apt-product-card__price {
    font-size: 11px !important;
    font-weight: 500 !important;
  }

  .grid-cols-mobile-1 .apt-product-card__price {
    font-size: 12.5px !important;
  }

  /* 4. Filter Bar & View Switcher (Zero Horizontal Overflow) */
  .apt-filter-bar {
    display: flex !important;
    flex-direction: row !important;
    justify-content: space-between !important;
    align-items: center !important;
    padding: 8px 0 !important;
    gap: 6px !important;
    margin-bottom: 24px !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .apt-filter-dropdowns {
    display: none !important;
  }

  .apt-filter-bar__left {
    display: flex !important;
    align-items: center !important;
    flex: 0 0 auto !important;
    gap: 6px !important;
  }

  .apt-filter-drawer-toggle {
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
    padding: 6px 10px !important;
    font-size: 10px !important;
    letter-spacing: 0.08em !important;
    height: 32px !important;
    box-sizing: border-box !important;
  }

  .apt-filter-bar__right {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-end !important;
    gap: 6px !important;
    flex: 0 1 auto !important;
    max-width: calc(100% - 90px) !important;
  }

  .apt-sort-dropdown {
    position: relative !important;
    flex: 0 1 auto !important;
  }

  .apt-sort-btn {
    padding: 6px 8px !important;
    font-size: 10px !important;
    height: 32px !important;
    max-width: 135px !important;
    gap: 4px !important;
    box-sizing: border-box !important;
  }

  .apt-sort-btn .js-sort-label {
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    max-width: 95px !important;
    display: inline-block !important;
  }

  .apt-sort-panel {
    position: absolute !important;
    top: calc(100% + 4px) !important;
    right: 0 !important;
    left: auto !important;
    max-width: calc(100vw - 28px) !important;
    min-width: 180px !important;
    z-index: 1000 !important;
  }

  /* View Switcher: Show mobile 1-col/2-col, hide desktop 2-col/4-col */
  .apt-view-switcher {
    display: flex !important;
    align-items: center !important;
    gap: 2px !important;
    margin-left: 2px !important;
    flex: 0 0 auto !important;
  }

  .apt-view-btn--desktop {
    display: none !important;
  }

  .apt-view-btn--mobile {
    display: inline-flex !important;
    padding: 5px !important;
    width: 28px !important;
    height: 28px !important;
    align-items: center !important;
    justify-content: center !important;
  }

  .apt-view-btn--mobile svg {
    width: 14px !important;
    height: 14px !important;
  }

  .apt-single-product__layout {
    grid-template-columns: 1fr;
    gap: 30px;
  }

  .apt-product-summary {
    position: static;
    padding-left: 0;
  }

  .apt-lookbook-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ==========================================================================
   Responsive Floating WhatsApp Widget
   ========================================================================== */
@media (max-width: 768px) {
  .apt-whatsapp-float {
    gap: 8px;
  }

  .apt-whatsapp-float--bottom-right {
    bottom: calc(20px + env(safe-area-inset-bottom, 0px));
    right: 18px;
  }

  .apt-whatsapp-float--bottom-left {
    bottom: calc(20px + env(safe-area-inset-bottom, 0px));
    left: 18px;
  }

  .apt-whatsapp-float__btn {
    width: 48px;
    height: 48px;
  }

  .apt-whatsapp-float__icon svg {
    width: 22px;
    height: 22px;
  }

  .apt-whatsapp-float__tooltip {
    display: none;
  }
}


