/*
Theme Name: Lapa
Theme URI: https://shaytechsolutions.com
Description: Storefront theme for Lapa, a child of Hello Elementor. Built and maintained by Shay Tech Solutions.
Author: Shay Tech Solutions
Author URI: https://shaytechsolutions.com
Template: hello-elementor
Version: 1.2.0
Text Domain: lapa
License: GNU General Public License v3 or later.
License URI: https://www.gnu.org/licenses/gpl-3.0.html
Tags: rtl-language-support, translation-ready, custom-colors, custom-menu, custom-logo, featured-images, e-commerce
*/

/*
  Colours, radii and font sizes come from the tokens in css/base.css.
  This file is loaded after Hello and Elementor (see functions.php), so plain
  class selectors are enough; avoid !important.
*/

/* Hello page titles are hidden: each template prints its own heading */
.entry-title,
h1.entry-title {
  display: none;
}

.in-stock {
  display: none;
}

.soldout {
  padding: 3px 8px;
  text-align: center;
  background: var(--color-sold-out);
  color: var(--color-on-brand);
  font-weight: bold;
  position: absolute;
  top: 6px;
  right: 6px;
  font-size: 12px;
}

/*
  Elementor's WooCommerce widgets colour their links cyan (#5bc0de) unless told otherwise.
  The theme used to force every link brown with !important; set the colour here instead.
  The cart and account widgets read CSS variables; the checkout widget needs the colour set directly.
*/
.elementor-widget-woocommerce-cart,
.elementor-widget-woocommerce-my-account {
  --links-normal-color: var(--color-brand);
  --product-link-normal-color: var(--color-brand);
  --checkout-button-normal-text-color: var(--color-brand);
}

.elementor-widget-woocommerce-checkout-page a {
  color: var(--color-brand);
}

.woocommerce .quantity .qty {
  width: 4.631em;
}

.yith-wcbm-badge.yith-wcbm-badge-text.yith-wcbm-badge-1938 {
  border: 5px solid var(--color-accent);
}

/* Explanation under "Shipping" for the local free-shipping rate (see assets/js/checkout.js) */
.custom-shipping-text {
  font-size: 0.85em;
  font-weight: normal;
  margin-top: 5px;
}

/******************** Product Category Carousel Styles ********************/

.base-section-container {
  max-width: 1280px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
  padding: 1rem 0.5rem;
  box-sizing: border-box;
}

/******************** Product Flex Container (Carousel) ********************/
.product-flex-container {
  display: flex;
  flex-direction: column;
  align-content: center;
  justify-content: center;
  position: relative;
  width: calc(100% - var(--arrow-button-wrapper));
  gap: 1rem;
  margin: 0 var(--arrow-button-wrapper);
  box-sizing: border-box;
  touch-action: pan-y pinch-zoom;
  pointer-events: auto;
}

/* Dragging state */
.product-flex-container.dragging {
  cursor: grabbing;
  -webkit-user-select: none;
  user-select: none;
}

.product-flex-container.dragging * {
  pointer-events: none;
  -webkit-user-select: none;
  user-select: none;
}

/******************** Product Container ********************/
.product-container {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: calc(25% - 0.375rem);
  gap: 0.5rem;
  width: 100%;
  will-change: transform;
  pointer-events: auto;
  overflow-x: scroll;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  -ms-overflow-style: none;
  /* Force LTR so scrollLeft is always a simple positive number,
     even on this RTL (Hebrew) site. Product cards restore RTL below. */
  direction: ltr;
}

.product-container::-webkit-scrollbar {
  display: none;
}

/* Snap each product card and restore RTL layout inside it */
.product-container > * {
  scroll-snap-align: start;
  direction: rtl;
}

@media (max-width: 767px) {
  .product-container {
    grid-auto-columns: calc(50% - 0.25rem);
  }
}

.product-container .product-card {
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  width: 100%;
  overflow: hidden;
  transition: transform 0.3s ease;
  position: relative;
}

/* Everything fits on one screen (view.js sets the class): the arrows have nothing to do */
.product-flex-container.carousel-static [data-carousel-prev],
.product-flex-container.carousel-static [data-carousel-next] {
  display: none;
}

/******************** Arrow Buttons ********************/
.product-flex-container .arrow-button {
  --arrow-translate-x: 0;
  --arrow-translate-y: -50%;
  color: var(--color-icon-muted);
  position: absolute;
  cursor: pointer;
  top: 50%;
  width: var(--arrow-button-size);
  height: var(--arrow-button-size);
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 9999px;
  transition:
    transform 0.3s ease,
    background-color 0.3s ease;
  transform: translate(var(--arrow-translate-x), var(--arrow-translate-y));
  z-index: 2;
}

[data-carousel-prev] {
  border: 0.5px solid #00000070;
  left: 0;
  --arrow-translate-x: calc(-50% - var(--arrow-button-size));
  --arrow-translate-y: -50%;
}

[data-carousel-next] {
  border: 0.5px solid #00000070;
  right: 0;
  --arrow-translate-x: calc(50% + var(--arrow-button-size));
  --arrow-translate-y: -50%;
}

.product-flex-container .arrow-button svg {
  width: var(--arrow-button-size);
  height: var(--arrow-button-size);
}

/******************** Product Card ********************/
.product-card {
  display: flex;
  justify-content: space-between;
  width: 100%;
  flex-direction: column;
  max-width: 330px;
  overflow: hidden;
  transition: transform var(--product-card-hover-duration, 0.3s) ease;
  position: relative;
  z-index: 1;
  pointer-events: auto;
}

.product-card:hover {
  transform: translateY(var(--product-card-hover-y, -4px));
  box-shadow: var(--product-card-hover-shadow, none);
}

.product-card-link {
  text-decoration: none;
  cursor: pointer;
  position: relative;
  z-index: 2;
  pointer-events: auto;
  display: block;
  width: 100%;
}

.product-card-image-wrapper {
  width: 100%;
  height: 280px;
  aspect-ratio: 285 / 360;
  line-height: 0;
  cursor: pointer;
  position: relative;
}

/* Sale / discount badge (WooCommerce + Discount Rules for WooCommerce) */
.product-card-image-wrapper .onsale {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  left: auto;
  margin: 0;
  padding: 0.35em 0.6em;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.2;
  background: var(--wp--preset--color--primary, #000);
  color: var(--color-on-brand);
  z-index: 2;
  border-radius: 2px;
}

@media (max-width: 767px) {
  .product-card-image-wrapper {
    height: 200px;
  }
}

.product-card-image-wrapper img,
.product-card-image {
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: cover;
  object-position: center;
}

.product-card-info {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.product-card-header {
  align-items: end;
  width: 100%;
  margin-bottom: 0.2rem;
}

.product-card-text-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  text-decoration: none;
  position: relative;
  z-index: 2;
  pointer-events: auto;
}

.product-card-title {
  margin: 0.25rem 0 0 0;
}

.product-card-title:hover {
  color: var(--color-muted);
}

.product-card-price {
  font-size: 1rem;
}

/******************** Product Variation Dropdown ********************/
.product-card-variation-wrapper {
  width: 100%;
  padding: 0.5rem;
  margin: 0.5rem 0;
  display: flex;
  justify-content: center;
}

.product-card-variation-select {
  width: 100%;
  max-width: 100%;
  padding: 0.5rem 2.5rem 0.5rem 0.75rem;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-sm);
  font-family: var(--font-family-alef, "Alef", sans-serif);
  font-size: 0.9rem;
  font-weight: 400;
  color: var(--color-brand);
  background-color: #fff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23603813' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 12px;
  cursor: pointer;
  direction: rtl;
  text-align: right;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  transition: border-color 0.2s ease;
}

.product-card-variation-select:hover {
  border-color: var(--color-brand);
}

.product-card-variation-select:focus {
  outline: none;
  border-color: var(--color-brand);
  box-shadow: 0 0 0 2px rgba(96, 56, 19, 0.1);
}

.product-card-variation-select option {
  direction: rtl;
  text-align: right;
}

@media (max-width: 767px) {
  .product-card-variation-wrapper {
    padding: 0.4rem;
    margin: 0.4rem 0;
  }

  .product-card-variation-select {
    font-size: 0.85rem;
    padding: 0.4rem 2.25rem 0.4rem 0.65rem;
  }
}

/******************** Button Styles ********************/
.btn {
  padding: 0.5rem 1rem;
  border: none;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
  display: inline-block;
  text-align: center;
}

.btn-primary {
  background: var(--button-bg-color, var(--color-accent));
  color: var(--color-brand);
  border: 1px solid var(--color-brand);
  border-radius: var(--radius-pill);
}

.btn-primary:hover {
  background: var(--button-hover-bg, var(--color-background));
  color: var(--button-hover-text, var(--color-brand));
}

.btn-secondary {
  color: var(--color-brand);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
}

.btn-secondary:hover {
  background: var(--color-surface);
  border: 1px solid #000;
}

/******************** Add to Cart Button ********************/
.product-card-add-to-cart-wrapper {
  padding: 0 0.5rem;
  display: flex;
  justify-content: center;
}

.product-card .product-card-add-to-cart-btn {
  display: inline-block;
  width: auto;
  min-width: auto;
  font-size: 0.9rem;
  white-space: nowrap;
  text-align: center;
  text-decoration: none;
  font-weight: 600;
}

@media (max-width: 767px) {
  .product-card .product-card-add-to-cart-btn {
    padding: 0.25rem 0.5rem;
  }
}

/* Keep cart buttons clickable and on top */
.cart-icon-button,
.add_to_cart_button,
.ajax_add_to_cart,
.product-card-add-to-cart-btn {
  position: relative;
  z-index: 10;
  pointer-events: auto;
}

/* WooCommerce adds a "View cart" link after an AJAX add-to-cart; the toast replaces it */
.added_to_cart {
  display: none !important;
}

/******************** Product category page ********************/
.custom-product-category-page,
.custom-shop-page {
  margin: 0;
  padding: 0;
  width: 100%;
  display: block;
  clear: both;
}

.woocommerce img,
.woocommerce-page img {
  height: 100%;
}

.category-navigation-links {
  display: flex;
  flex-wrap: wrap;
  margin-bottom: 1rem;
  gap: 0.5rem;
  justify-content: center;
  max-width: 800px;
}

.subcategory-link svg {
  flex-shrink: 0;
  display: inline;
}

.subcategory-link {
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  min-width: 8rem;
  transition: none;
  white-space: nowrap;
}

.subcategory-link:hover {
  background: var(--color-accent);
}

@media (max-width: 767px) {
  .category-navigation-links {
    gap: 0.125rem;
  }
  .subcategory-link {
    font-size: 1rem;
    padding: 0.125rem 0.25rem;
    max-width: 6rem;
  }
}

/******************** Products Grid ********************/
.products-grid-wrapper {
  width: 100%;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(min(200px, 100%), 1fr));
  gap: 2rem;
  justify-items: center;
  width: 100%;
}

.product-grid .product-card:hover {
  transform: translateY(-4px);
}

/* Tablet (3 columns) */
@media (max-width: 1200px) {
  .product-grid {
    grid-template-columns: repeat(3, minmax(min(200px, 100%), 1fr));
    gap: 1.5rem;
  }
}

/* Mobile (2 columns) */
@media (max-width: 767px) {
  .product-grid {
    grid-template-columns: repeat(2, minmax(min(120px, 100%), 1fr));
    gap: 0.5rem;
  }

  .product-grid .product-card {
    min-width: 120px;
  }
}

/* With JavaScript the grid loads more products by itself (assets/js/infinite-scroll.js):
   the numbered links are only for visitors without it, and for search engines. */
.lapa-infinite .lapa-pagination {
  display: none;
}

.lapa-more {
  width: 100%;
  margin: 2rem 0 1rem;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.lapa-more:not([hidden]) {
  display: flex;
}

.lapa-more[aria-busy="true"] .lapa-more-button {
  opacity: 0.6;
  cursor: progress;
}

.lapa-more-status {
  min-height: 1.25rem;
  font-size: var(--font-size-extra-small);
  color: var(--color-muted);
}

/******************** Pagination ********************/
.lapa-pagination {
  width: 100%;
  margin: 2rem 0 1rem;
}

.lapa-pagination ul.page-numbers {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.lapa-pagination li > .page-numbers {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.5rem;
  height: 2.5rem;
  padding: 0 0.75rem;
  box-sizing: border-box;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  font-family: var(--font-family-text-sts, var(--font-family-bona-nova-sc));
  font-size: var(--font-size-small);
  line-height: 1;
  color: var(--color-brand);
  text-decoration: none;
}

.lapa-pagination a.page-numbers:hover {
  background: var(--color-surface);
  border-color: var(--color-brand);
}

.lapa-pagination li > .page-numbers.current {
  background: var(--color-accent);
  border-color: var(--color-brand);
  font-weight: 600;
}

.lapa-pagination li > .page-numbers.dots {
  border-color: transparent;
}

@media (max-width: 767px) {
  .lapa-pagination ul.page-numbers {
    gap: 0.25rem;
  }

  .lapa-pagination li > .page-numbers {
    min-width: 2.25rem;
    height: 2.25rem;
    padding: 0 0.5rem;
  }
}

.no-products-message {
  text-align: center;
  padding: 4rem 2rem;
  font-family: var(--font-family-rubik, serif);
  font-size: 20px;
  color: var(--color-muted);
}
