/* Layout-only support for the original cp-buttons.css design. */

html[data-theme="dark"] {
  --cp-surface: #1b1c1e;
  --cp-light: rgba(255, 255, 255, 0.055);
  --cp-shade: rgba(0, 0, 0, 0.62);
  --cp-ink: #f2f2f3;
  --cp-ink-2: #8b8f95;
  --cp-dot-off: #2c2e31;
  --cp-on-ink: #0d0d0e;
}

/* Keep legacy cards from painting over a CP surface. */
.card.cp-surface { background: var(--cp-surface); color: var(--cp-ink); }
.product-options-shell.cp-surface { background: var(--cp-surface); }
.product-options-footer.cp-surface { background: var(--cp-surface); }

/* Restore the pill's own colors after the light-theme reveal inheritance rule. */
html[data-theme="light"] .reveal .cp-pill { color: var(--cp-ink); }
html[data-theme="light"] .reveal .cp-pill__label { color: var(--cp-ink); }
html[data-theme="light"] .reveal .cp-pill__toggle { color: var(--cp-ink); }
html[data-theme="light"] .reveal .cp-pill[data-open="true"] .cp-pill__toggle { color: var(--cp-on-ink); }
html[data-theme="light"] .reveal .cp-pill .cp-act { color: var(--cp-ink); }

/* Keep primary CTA text legible over the black fill inside light surfaces. */
html[data-theme="light"] .cp-surface .cp-btn--primary {
  color: var(--cp-on-ink) !important;
  -webkit-text-fill-color: var(--cp-on-ink);
}

/* Header controls share the exact gray surface used by secondary cp-btns. */
.page-home .topbar,
.page-home .topbar.scrolled { background: var(--cp-surface); }
.page-home .search.cp-surface { background: var(--cp-surface); }
.home-glass.contact-band.cp-surface { background: var(--cp-surface); color: var(--cp-ink); }
.orders-heading.cp-surface { padding: 1rem; border-radius: 16px; }
html[data-theme="light"] .card-body .badge-subcategory {
  background: rgba(17, 18, 20, .07);
  border-color: rgba(17, 18, 20, .12);
  color: #17181a;
}

/* Compact share pills live on their own matching surface inside product cards. */
.cp-card-share-surface {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-height: 68px;
  margin: 0 .9rem .9rem;
  padding: 8px;
  border-radius: 999px;
}
.cp-card-share-surface > .cp-pill {
  flex: 0 0 auto;
  max-width: 100%;
  background: var(--cp-surface);
  color: var(--cp-ink);
}

/* The player pill sits on the same solid gray as its own background. */
.producto-video-player.cp-surface {
  display: flex;
  align-items: center;
  min-height: 76px;
  padding: 6px 10px;
  border-radius: 16px;
}
.producto-video-player > .cp-pill { flex: 0 0 auto; max-width: 100%; }

.cp-card-action { width: calc(100% - 2rem); margin: 0 1rem 1rem; }
.home-shell .cp-card-action,
.page-product-block .cp-card-action,
.technology-catalog .products-section .cp-card-action { width: calc(100% - 1.8rem); margin: .5rem .9rem 0; }
.products-section .cp-card-action { width: calc(100% - 1.6rem); margin: .6rem .8rem 0; }

.mobile-bottom-nav { display: none; }

/* Keep the floating WhatsApp action comfortably larger than compact icon buttons. */
.whatsapp-float.cp-btn {
  --cp-d: 3px;
  --cp-blur: 8px;
  --cp-light: rgba(255, 255, 255, .28);
  --cp-shade: rgba(0, 0, 0, .32);
  --cp-bh: 64px;
  --cp-bpad: 0;
  flex: 0 0 64px;
  width: 64px;
  min-width: 64px;
  height: 64px;
  padding: 0;
}
.whatsapp-float.cp-btn:hover {
  --cp-d: 4px;
  --cp-blur: 10px;
}
.whatsapp-float.cp-btn img.whatsapp-icon {
  width: 36px;
  height: 36px;
}

.search button.cp-btn {
  display: grid;
  flex: 0 0 var(--cp-bh);
  width: var(--cp-bh);
  height: var(--cp-bh);
  margin-right: 2px;
  padding: 0;
}

@media (min-width: 781px) {
  .page-home .topbar-inner {
    grid-template-columns: minmax(180px, max-content) minmax(220px, 1fr) max-content;
    gap: clamp(.5rem, 1vw, 1rem);
  }
  .page-home .topbar-inner > .search { width: 100%; min-width: 0; }
  .page-home .topbar .search input { min-width: 0; }
  .page-home .top-actions {
    display: flex;
    flex-wrap: nowrap;
    gap: clamp(.35rem, .6vw, .7rem);
    min-width: max-content;
    white-space: nowrap;
  }
  .page-home .top-actions > *,
  .page-home .account-menu { flex: 0 0 auto; }
  .page-home .top-actions .cp-btn {
    flex: 0 0 auto;
  }
}

@media (min-width: 781px) and (max-width: 1100px) {
  .page-home .topbar-inner {
    grid-template-columns: minmax(145px, max-content) minmax(160px, 1fr) max-content;
  }
  .page-home .home-favorites,
  .page-home .home-cart,
  .page-home .home-account {
    width: 42px;
    min-width: 42px;
    padding: 0;
  }
  .page-home .home-favorites span,
  .page-home .home-cart > span,
  .page-home .home-account span { display: none; }
}

/* Preserve standard 42px cp-btn sizing while the mobile header compacts. */
@media (max-width: 780px) {
  .page-home .mobile-menu-toggle.cp-btn { display: inline-flex; --cp-bh: 42px; width: 42px; min-width: 42px; height: 42px; }
  .page-home .home-cart.cp-btn { --cp-bh: 42px; width: 42px; min-width: 42px; height: 42px; padding: 0; }
  .page-home .topbar.scrolled .mobile-menu-toggle.cp-btn,
  .page-home .topbar.scrolled .home-cart.cp-btn { --cp-bh: 42px; width: 42px; min-width: 42px; height: 42px; }
  .page-home .topbar.scrolled .search button.cp-btn { --cp-bh: 42px; width: 42px; min-width: 42px; height: 42px; }
}
.mobile-menu-toggle.cp-btn { display: none; }
.mobile-menu-close.cp-btn { display: grid; }

/* Product-image buttons keep their image fit and size; cp-buttons owns their look. */
.product-options-thumb.cp-btn {
  flex: 0 0 64px;
  width: 64px;
  min-width: 64px;
  height: 64px;
  --cp-bh: 64px;
  padding: 4px;
  border-radius: 12px;
  overflow: hidden;
}
.product-options-thumb.cp-btn img { width: 100%; height: 100%; object-fit: contain; }
.product-thumb.cp-btn img { width: 60px; height: 60px; object-fit: contain; }
.product-options-thumb.cp-btn[aria-pressed="true"] {
  outline: 0;
  box-shadow: inset 3px 3px 8px var(--cp-shade), inset -3px -3px 8px var(--cp-light);
}
.product-options-submit.cp-btn { min-width: min(18rem, 52%); }

.product-options-variant.cp-btn[aria-pressed="true"] {
  --cp-bg: var(--cp-surface);
  --cp-fg: var(--cp-ink);
  box-shadow: inset 3px 3px 8px var(--cp-shade), inset -3px -3px 8px var(--cp-light);
}
.product-options-thumb[aria-pressed="true"],
.cv-swatch.cp-btn.cv-swatch--active { outline: 2px solid var(--cp-ink); outline-offset: 2px; }
.cv-swatch.cp-btn.cv-swatch--active { transform: scale(1.04); }

.product-description-link.cp-btn { gap: .5rem; }
.qty-display.cp-btn { min-height: 42px; height: auto; padding-inline: 18px; }
.product-detail-page .qty-selector-wrap {
  display: flex;
  width: max-content;
  max-width: 100%;
  flex-direction: column;
  align-items: flex-start;
}
.product-detail-page .qty-dropdown {
  position: static;
  width: max-content;
  min-width: min(13rem, 100%);
  max-width: 100%;
  max-height: min(42vh, 16rem);
  margin: .5rem 0 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.product-share-pill.cp-pill { flex: 0 0 auto; max-width: 100%; }
.product-detail-page .qty-nostock + .product-share-pill { margin-top: .5rem; }

.pagination .pagination-btn.cp-btn { width: auto; min-width: 5.5rem; height: 42px; padding-inline: 14px; }
.pagination .page-num.cp-btn { min-width: 40px; height: 42px; padding-inline: 12px; }

@media (max-width: 760px) {
  .product-options-submit.cp-btn { min-width: 58%; }
}

.hero-carousel .carousel-btn.cp-btn {
  --cp-d: 1px;
  --cp-blur: 4px;
}
.hero-carousel .carousel-btn.cp-btn:hover {
  --cp-d: 2px;
  --cp-blur: 5px;
  transform: translateY(-50%);
}
.hero-carousel .carousel-btn.cp-btn:active {
  --cp-d: 1px;
  transform: translateY(-50%) scale(.98);
}
.carousel-dot.cp-btn--round {
  --cp-d: 1px;
  --cp-blur: 4px;
  width: 10px;
  min-width: 10px;
  height: 10px;
  padding: 0;
}
.carousel-dot.active.cp-btn--round { width: 24px; }
.hero-carousel .carousel-dot.cp-btn--round:hover {
  --cp-d: 1px;
  --cp-blur: 4px;
}

@media (prefers-reduced-motion: reduce) {
  .product-thumb.cp-btn { transition-duration: 1ms !important; }
}

@media (max-width: 780px) {
  body.has-mobile-app-nav { padding-bottom: calc(88px + env(safe-area-inset-bottom)); }

  .page-home .mobile-menu-toggle { display: none !important; }
  .page-home .topbar-inner {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "brand" "search";
    gap: .55rem;
    padding: .65rem 3vw;
  }
  .page-home .topbar.scrolled .topbar-inner { padding: .5rem 3vw; }
  .page-home .brand-home { grid-area: brand; justify-self: center; }
  .page-home .top-actions { display: none !important; }

  .mobile-bottom-nav {
    position: fixed;
    z-index: 90;
    inset: auto 0 0;
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    align-items: stretch;
    gap: 2px;
    padding: 8px max(6px, env(safe-area-inset-left)) calc(8px + env(safe-area-inset-bottom));
    border: 1px solid rgba(255, 255, 255, .8);
    border-bottom: 0;
    border-radius: 20px 20px 0 0;
    background: rgba(244, 245, 247, .84);
    box-shadow: 0 -10px 32px rgba(14, 18, 24, .12), inset 0 1px 0 rgba(255, 255, 255, .9);
    -webkit-backdrop-filter: blur(22px) saturate(1.35);
    backdrop-filter: blur(22px) saturate(1.35);
  }

  .mobile-bottom-nav a {
    display: flex;
    min-width: 0;
    min-height: 54px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    border-radius: 13px;
    color: #60646c;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
  }
  .mobile-bottom-nav__icon {
    position: relative;
    display: grid;
    place-items: center;
    width: 34px;
    height: 28px;
    border-radius: 999px;
    color: currentColor;
    font-size: 17px;
    transition: color .18s ease, background-color .18s ease, transform .18s ease;
  }
  .mobile-bottom-nav__label {
    max-width: 100%;
    overflow: hidden;
    font-size: 9px;
    font-weight: 550;
    line-height: 1.1;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .mobile-bottom-nav a[aria-current="page"] {
    color: #111214;
    font-weight: 700;
  }
  .mobile-bottom-nav a[aria-current="page"] .mobile-bottom-nav__icon {
    background: #111214;
    color: #fff;
  }
  .mobile-bottom-nav a:active .mobile-bottom-nav__icon { transform: scale(.94); }
  .mobile-bottom-nav a:focus-visible { outline: 2px solid #111214; outline-offset: -2px; }
  .mobile-bottom-nav__count {
    position: absolute;
    top: -3px;
    right: -5px;
    display: grid;
    min-width: 15px;
    height: 15px;
    place-items: center;
    padding: 0 3px;
    border: 1px solid rgba(255, 255, 255, .95);
    border-radius: 999px;
    background: #111214;
    color: #fff;
    font-size: 8px;
    font-weight: 700;
    line-height: 1;
  }
  .mobile-bottom-nav a[aria-current="page"] .mobile-bottom-nav__count {
    border-color: #111214;
    background: #fff;
    color: #111214;
  }

  .whatsapp-float.cp-btn {
    right: 14px;
    bottom: calc(84px + env(safe-area-inset-bottom));
  }
}

@supports not (backdrop-filter: blur(1px)) {
  @media (max-width: 780px) {
    .mobile-bottom-nav { background: rgba(244, 245, 247, .98); }
  }
}
