/* Flash Sale Badge Animation */
@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

/* Size button enhancements */
.size-btn {
    transition: all 0.2s ease !important;
    background: #ffffff !important;
    border: 1.5px solid #dee2e6 !important;
    color: #212529 !important;
    border-radius: 999px !important;
    box-shadow: none !important;
    -webkit-tap-highlight-color: transparent;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    text-decoration: none;
    appearance: none;
    -webkit-appearance: none;
}

.size-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: none !important;
    border-color: #cfd4da !important;
}

.size-btn.active {
    background: #111418 !important;
    color: #ffffff !important;
    border-color: #111418 !important;
    box-shadow: none !important;
}

.size-btn:focus,
.size-btn:focus-visible,
.size-btn.active:focus,
.size-btn:active {
    outline: none !important;
    box-shadow: none !important;
}

/* Out-of-stock: same look/size as normal, just add a diagonal line */
.size-btn.out-of-stock {
    position: relative;           /* anchor the ::after line */
}
.size-btn.out-of-stock:disabled {
    opacity: 0.5;                 /* dimmed */
    color: inherit;               /* ensure text color stays the same */
}
.size-btn.out-of-stock::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 6px;                    /* keep within button padding */
    right: 6px;
    border-top: 2px solid #000000;/* black diagonal slash */
    transform: rotate(-20deg);
    pointer-events: none;         /* do not block clicks/focus */
}

.size-btn.out-of-stock.active::after {
    border-top-color: #ffffff;
}

/* Add to Cart button hover */
.add-to-cart-btn:hover:not(:disabled) {
    background: #333 !important;
    border-color: #333 !important;
    box-shadow: none !important;
}

.add-to-cart-btn:active:not(:disabled) {
    transform: translateY(0);
}

/* Wishlist icon enhancements */
.wishlist-icon:hover {
    transform: scale(1.1);
    box-shadow: none !important;
}

.wishlist-icon:active {
    transform: scale(0.95);
}

.wishlist-btn {
    transition: all 0.3s ease;
}

/* Hide scrollbar for size variants */
.size-variants-container::-webkit-scrollbar {
    display: none;
}

.size-variants-container {
    scrollbar-width: none;
    -ms-overflow-style: none;
}

/* Size rail: inline arrow siblings flanking the scrollable container */
.size-variants-wrapper {
    display: flex;
    align-items: stretch;
    gap: 0.3rem;
}

.size-variants-container {
    flex: 1 1 0;
    min-width: 0;
}

.card-size-arrow {
    flex: 0 0 auto;
    align-self: stretch;
    width: 24px;
    border: 1px solid #d7dce3;
    border-radius: 5px;
    background: #f9fafb;
    color: #374151;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 0.62rem;
    cursor: pointer;
    padding: 0;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.card-size-arrow.is-visible {
    display: flex;
}

.card-size-arrow:hover:not(:disabled) {
    background: #f3f4f6;
    border-color: #9ca3af;
}

.card-size-arrow:disabled {
    opacity: 0.28;
    cursor: not-allowed;
}

[dir="rtl"] .card-size-arrow i {
    transform: scaleX(-1);
    display: inline-block;
}

.scroll-indicator {
    position: absolute;
    top: 50%;
    right: 3px;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    background: rgba(255, 255, 255, 0.78);
    border: 1px solid rgba(0, 0, 0, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    color: rgba(17, 24, 39, 0.82);
    font-weight: 600;
    pointer-events: none;
    z-index: 10;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
    backdrop-filter: blur(1px);
}

.scroll-indicator::before {
    content: '→';
}

/* Show scroll indicator only when content overflows */
.size-variants-wrapper:not(.no-scroll) .scroll-indicator,
.size-variants-wrapper.no-scroll .scroll-indicator {
    display: none;
}

/* Responsive reviews section for all small screens */
@media (max-width: 576px) {
    .reviews-info {
        font-size: 0.75rem !important;
    }
    
    .reviews-info .rating-text {
        font-size: 0.75rem !important;
        margin-right: 0.25rem !important;
    }
    
    .reviews-info .stars {
        font-size: 0.7rem !important;
        margin-right: 0.25rem !important;
    }
    
.reviews-info .stars i {
        margin-right: 1px !important;
    }
    
    .reviews-info a,
    .reviews-info span {
        font-size: 0.75rem !important;
    }
    
    /* Responsive price section for all small screens */
    .price-section h6 {
        font-size: 0.85rem !important;
    }

    .price-section {
        white-space: normal !important;
        overflow: visible !important;
    }
    
    /* Responsive image container for small screens */
    .image-container {
        height: 230px !important;
    }

    .size-variants-container {
        overflow-x: auto !important;
        overflow-y: hidden !important;
        white-space: normal !important;
    }

    .size-variants-list {
        display: grid !important;
        grid-auto-flow: column !important;
        grid-auto-columns: max-content !important;
        grid-template-rows: repeat(2, auto) !important;
        column-gap: 0.5rem !important;
        row-gap: 0.5rem !important;
        min-width: 0 !important;
        padding-right: 0 !important;
    }

    .scroll-indicator {
        display: none !important;
    }
}

[dir="rtl"] .product-card .reviews-info .stars,
[dir="rtl"] .product-card-list .reviews-info .stars {
    direction: rtl;
    unicode-bidi: isolate;
    display: inline-flex;
    gap: 0.08rem;
}

[dir="rtl"] .product-card .reviews-info .stars .fa-star-half-alt,
[dir="rtl"] .product-card-list .reviews-info .stars .fa-star-half-alt {
    transform: scaleX(-1);
}

/* Ensure reviews always stay on one line */
.reviews-info {
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
}

.reviews-info > * {
    flex-shrink: 0;
    display: inline-block;
}


.reviews-info .review-count-inline {
    margin-inline-start: 0.35rem;
    color: #aaa !important;
    text-decoration: none !important;
}

.reviews-info .review-count-inline:hover,
.reviews-info .review-count-inline:focus {
    color: #111 !important;
    text-decoration: none !important;
}

/* Ensure consistent card layout */
.product-card {
    display: flex;
    flex-direction: column;
    border-radius: 2px;
    border: 1px solid #e8e8e8;
    overflow: hidden;
    transition: all 0.3s ease;
}

.product-card:hover {
    box-shadow: 0 6px 28px rgba(0, 0, 0, 0.07);
    border-color: #dee2e6;
}

.image-container {
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
}

.image-container img {
    transition: transform 0.4s ease;
}

.product-card:hover .image-container img {
    transform: scale(1.05);
}

/* Image overlay on hover */
.image-container::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0);
    transition: background 0.3s ease;
    pointer-events: none;
}

.product-card:hover .image-container::after {
    background: rgba(0, 0, 0, 0.03);
}

.details-container {
    flex-grow: 1;
    justify-content: space-between;
}

/* Flash Sale Badge Animation */
@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

/* Out-of-stock: same look/size as normal, just add a diagonal line */
.size-btn {
    padding: 0.4rem 0.9rem;
    font-size: 0.85rem;
    border-radius: 999px;
    background: #ffffff !important;
    border: 1.5px solid #dee2e6 !important;
    color: #212529 !important;
  box-shadow: none !important;
  transition: all 0.2s ease !important;
  -webkit-tap-highlight-color: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  text-decoration: none;
  appearance: none;
  -webkit-appearance: none;
}

.size-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    border-color: #cfd4da !important;
}

.size-btn.out-of-stock {
    position: relative;           /* anchor the ::after line */
}
.size-btn.out-of-stock:disabled {
    opacity: 1;                   /* keep original colors (override Bootstrap) */
    color: inherit;               /* ensure text color stays the same */
}
.size-btn.out-of-stock::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 6px;                    /* keep within button padding */
  right: 6px;
  border-top: 2px solid #000000;/* black diagonal slash */
  transform: rotate(-20deg);
  pointer-events: none;         /* do not block clicks/focus */
}

.size-btn.out-of-stock.active::after {
  border-top-color: #ffffff;
}

.product-card-list .size-btn.active {
    background: #111418 !important;
    color: #ffffff !important;
    border-color: #111418 !important;
    box-shadow: none !important;
}

.product-card-list .size-variants-container {
    margin-top: 0.15rem !important;
}

.product-card-list .size-btn:focus,
.product-card-list .size-btn:focus-visible,
.product-card-list .size-btn.active:focus,
.product-card-list .size-btn:active {
    outline: none !important;
    box-shadow: none !important;
}

/* Wishlist icon styling to match grid */
.wishlist-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: none;
    transition: all 0.3s ease;
    border: 1px solid #e8e8e8;
}
.wishlist-icon:hover {
    transform: scale(1.05);
    box-shadow: none;
}
.wishlist-icon:active {
    transform: scale(0.97);
}

.wishlist-remove-btn:hover {
    color: #dc3545;
    border-color: #dc3545;
}

.wishlist-move-select:focus,
.wishlist-move-select:hover {
    border-bottom-color: #111;
    color: #111;
}


/* Hide scrollbar for size variants */
.size-variants-container::-webkit-scrollbar {
    display: none;
}

.size-variants-container {
    scrollbar-width: none;
    -ms-overflow-style: none;
}

/* Swipe indicators for variants — layout now handled by flex rules above */

.scroll-indicator {
    position: absolute;
    top: 50%;
    right: 3px;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    background: rgba(255, 255, 255, 0.78);
    border: 1px solid rgba(0, 0, 0, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    color: rgba(17, 24, 39, 0.82);
    font-weight: 600;
    pointer-events: none;
    z-index: 10;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
    backdrop-filter: blur(1px);
}

.scroll-indicator::before {
    content: '→';
}

/* Show scroll indicator only when content overflows */
.size-variants-wrapper:not(.no-scroll) .scroll-indicator {
    display: flex;
}

.size-variants-wrapper.no-scroll .scroll-indicator {
    display: none;
}

.product-card-list {
    border-bottom: 1px solid #e5e5e5;
    padding-bottom: 0.5rem;
    margin-bottom: 0.5rem;
}

/* Constrain the info panel so the size rail cannot expand the card */
.product-card-list .product-info-list {
    min-width: 0;
    flex: 1 1 auto;
    overflow: hidden;
}

.product-card .product-title,
.products-list .product-title-list {
  margin-bottom: 0.35rem;
  text-align: start;
}

.product-card .product-title a,
.products-list .product-title-list a {
  display: block;
  text-align: inherit;
  text-decoration-line: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
  text-decoration-skip-ink: none;
}

.product-card .product-title .product-title-text,
.products-list .product-title-list .product-title-text {
  display: block;
  line-height: 1.35;
  white-space: normal;
  overflow-wrap: break-word;
  word-break: normal;
  unicode-bidi: plaintext;
  text-decoration: inherit;
  text-transform: none !important;
  letter-spacing: normal !important;
}

.product-card .product-title a .product-title-text *,
.products-list .product-title-list a .product-title-text * {
  text-decoration: inherit;
  text-transform: none !important;
  letter-spacing: normal !important;
}

.product-card .product-title .product-title-text bdi,
.products-list .product-title-list .product-title-text bdi {
  unicode-bidi: isolate;
}

.product-card .product-title .product-title-text .product-sep,
.products-list .product-title-list .product-title-text .product-sep {
  white-space: pre;
}

.product-card .price-section h5,
.products-list .product-price-list h6 {
  text-transform: none !important;
  letter-spacing: normal !important;
}

/* Desktop detail compaction: keep image area unchanged, tighten info panel only */
@media (min-width: 992px) {
  .product-card .details-container {
    padding: 0.75rem 0.8rem !important;
  }

  .product-card .product-brand {
    font-size: 0.74rem !important;
    letter-spacing: 0.03em !important;
  }

  .product-card .product-title {
    margin-bottom: 0.28rem !important;
  }

  .product-card .product-title .product-title-text {
    line-height: 1.24 !important;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    /* line-clamp only caps height at 2 lines — it doesn't reserve space for
       a second line that isn't there. A 1-line title then leaves everything
       below it (rating, price, size selector, CTA button) sitting higher
       than in a sibling card whose title actually wrapped to 2 lines,
       misaligning same-row cards even though the outer .card is equal
       height. Reserve 2 lines' worth of height always. */
    min-height: calc(1.24em * 2);
  }

  .product-card .reviews-info {
    margin-top: 0.2rem !important;
    margin-bottom: 0.45rem !important;
  }

  .product-card .reviews-info .rating-text {
    font-size: 0.82rem !important;
  }

  .product-card .reviews-info .stars {
    font-size: 0.76rem !important;
  }

  .product-card .reviews-info .review-count-inline {
    font-size: 0.74rem !important;
  }

  .product-card .price-section {
    margin-bottom: 0.45rem !important;
  }

  .product-card .price-section h5 {
    font-size: 1rem !important;
  }

  .product-card .seller-meta {
    font-size: 0.74rem !important;
    margin-bottom: 0.4rem !important;
    line-height: 1.28;
  }

  .product-card .size-selection {
    margin-bottom: 0.45rem !important;
  }

  .product-card .size-selection small {
    font-size: 0.74rem !important;
  }

  .product-card .size-btn {
    padding: 0.3rem 0.7rem !important;
    font-size: 0.78rem !important;
    min-width: 40px !important;
  }

  .product-card .add-to-cart-btn {
    padding: 0.56rem 0.7rem !important;
    font-size: 0.82rem !important;
  }
}

.size-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.size-scroll-hint {
  display: none;
}

.seller-fulfillment-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  margin-inline-start: 0.4rem;
  padding: 0.12rem 0.42rem;
  border-radius: 2px;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1;
  color: #555;
  background: #f4f4f4;
  border: 1px solid #e8e8e8;
  white-space: nowrap;
}

.seller-fulfillment-badge i {
  font-size: 0.6rem;
}

@media (max-width: 576px) {
  .product-card .image-container {
    height: 304px !important;
  }

  .product-card .details-container {
    padding: 0.58rem 0.58rem 0.5rem !important;
    gap: 0.12rem;
  }

  .product-card .product-brand {
    font-size: 0.7rem !important;
    opacity: 0.74;
    letter-spacing: 0.04em;
  }

  .product-card .product-title {
    margin-bottom: 0.2rem !important;
  }

  .product-card .product-title .product-title-text {
    line-height: 1.2 !important;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .product-card .reviews-info {
    margin-top: 0.1rem !important;
    margin-bottom: 0.35rem !important;
  }

  .product-card .price-section {
    margin-bottom: 0.3rem !important;
  }

  .product-card .seller-meta {
    margin-bottom: 0.22rem !important;
    font-size: 0.69rem !important;
    opacity: 0.88;
  }

  .product-card .size-selection {
    margin-bottom: 0.34rem !important;
  }

  .product-card .size-label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
  }

  .product-card .size-scroll-hint {
    display: none;
    font-size: 0.94rem;
    line-height: 1;
    color: rgba(17, 24, 39, 0.72);
    font-weight: 600;
    align-items: center;
    gap: 0.18rem;
    direction: ltr;
    unicode-bidi: isolate;
  }

  .product-card .size-scroll-hint.is-visible {
    display: inline-flex;
  }

  .product-card .size-scroll-hint .hint-left,
  .product-card .size-scroll-hint .hint-right {
    display: none;
  }

  .product-card .size-scroll-hint.show-left .hint-left {
    display: inline;
  }

  .product-card .size-scroll-hint.show-right .hint-right {
    display: inline;
  }

  .product-card .quick-add-section {
    margin-top: auto;
    padding-top: 0.2rem;
  }

  .product-card .mobile-cta-sticky {
    position: relative;
    background: #fff;
    padding-top: 0.28rem;
  }

  .product-card .seller-meta-hidden-mobile {
    display: none;
  }

  .product-card .seller-meta-visible {
    display: block;
  }

  .product-card .size-selection small {
    font-size: 0.7rem !important;
    letter-spacing: 0.02em;
    opacity: 0.9;
  }

  .product-card .size-variants-wrapper .scroll-indicator {
    display: none !important;
  }

  .product-card .size-btn {
    padding: 0.22rem 0.56rem;
    font-size: 0.68rem;
    border: 1px solid #d7dce3 !important;
    background: #ffffff !important;
    border-radius: 999px !important;
    min-height: 1.72rem;
    transition: transform 0.16s ease, background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
  }

  .product-card .size-btn.active {
    transform: translateY(-1px);
    border-color: #111418 !important;
    background: #111418 !important;
    color: #fff !important;
  }

  .product-card .add-to-cart-btn {
    padding: 0.48rem 0.62rem !important;
    font-size: 0.76rem !important;
    border-radius: 2px !important;
    transition: transform 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
  }

  .product-card .add-to-cart-btn.cta-ready {
    box-shadow: none !important;
  }

  .product-card .add-to-cart-btn.cta-notify {
    box-shadow: none !important;
  }

  .product-card .seller-meta-visible {
    animation: sellerMetaReveal 0.2s ease-out;
  }

  .product-card.size-selected .size-scroll-hint {
    opacity: 0.72;
  }

  .product-card:not(.size-selected) .reviews-info {
    opacity: 0.82;
  }

  .product-card:not(.size-selected) .add-to-cart-btn {
    opacity: 0.94;
  }

  .product-card-list {
    padding: 0.15rem;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
  }

  .products-list {
    overflow-x: hidden;
  }

  .products-list .product-image-list {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }

  .products-list .product-image-container {
    width: 120px;
    height: 140px;
  }

  .products-list .product-info-list {
    padding: 0.35rem;
    min-width: 0;
    flex: 1 1 auto;
    overflow: hidden;
  }

  .products-list .product-title-list {
    font-size: 0.8rem;
    line-height: 1.15;
  }

  .products-list .product-title-list .product-title-text {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .products-list .size-label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
  }

  .products-list .size-scroll-hint {
    display: none;
    font-size: 0.86rem;
    line-height: 1;
    color: rgba(17, 24, 39, 0.72);
    font-weight: 600;
    align-items: center;
    gap: 0.16rem;
    direction: ltr;
    unicode-bidi: isolate;
  }

  .products-list .size-scroll-hint.is-visible {
    display: inline-flex;
  }

  .products-list .size-scroll-hint .hint-left,
  .products-list .size-scroll-hint .hint-right {
    display: none;
  }

  .products-list .size-scroll-hint.show-left .hint-left {
    display: inline;
  }

  .products-list .size-scroll-hint.show-right .hint-right {
    display: inline;
  }

  .products-list .product-price-list h6 {
    font-size: 0.8rem;
  }

  .product-description-list {
    display: none;
  }

  .product-actions-list {
    gap: 0.3rem;
  }

  .product-actions-list .btn {
    padding: 0.25rem 0.4rem;
    font-size: 0.7rem;
    border-radius: 8px;
  }

  .products-list .quick-add-section {
    display: block;
    margin-top: 0.3rem !important;
  }

  .products-list .seller-meta-hidden-mobile {
    display: none;
  }

  .products-list .seller-meta-visible {
    display: block;
    animation: sellerMetaReveal 0.2s ease-out;
  }

  .products-list .size-variants-wrapper .scroll-indicator {
    display: none !important;
  }

  .products-list .size-btn {
    padding: 0.2rem 0.52rem !important;
    font-size: 0.67rem !important;
    min-height: 1.64rem;
    border-radius: 999px !important;
  }

  .products-list .add-to-cart-btn.cta-ready {
    box-shadow: 0 3px 10px rgba(13, 110, 253, 0.22) !important;
    transform: translateY(-1px);
  }

  .products-list .add-to-cart-btn.cta-notify {
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.2) !important;
  }

  .products-list .product-card-list.size-selected .size-scroll-hint {
    opacity: 0.72;
  }

  .wishlist-btn-product-detail {
    border-radius: 2px !important;
    border-width: 1.5px !important;
    box-shadow: none;
  }

  .wishlist-btn-product-detail i {
    font-size: 0.95rem;
  }

  .size-selection small {
    font-size: 0.7rem;
  }

}

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

/* ── Scraped-product card: hover image swap ── */
.card-img-primary,
.card-img-hover {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 0.45s ease;
}
.card-img-primary { opacity: 1; z-index: 1; }
.card-img-hover   { opacity: 0; z-index: 2; }

.product-card.has-hover-img:hover .card-img-primary { opacity: 0; }
.product-card.has-hover-img:hover .card-img-hover   { opacity: 1; }
/* Suppress zoom during a fade swap — the image change is the effect */
.product-card.has-hover-img:hover .image-container img { transform: none; }

/* List-view card: same .card-img-hover second photo, different wrapper class.
   The primary .product-image-list doesn't need to fade out here — it already
   sizes the container in normal flow, and .card-img-hover sits at the same
   position/size on top of it (its own width/height lose to
   .products-list .product-image-list's higher-specificity 200px rule, but
   position:absolute + inset:0 still apply), so simply fading it in fully
   covers the primary. */
.product-card-list.has-hover-img:hover .card-img-hover { opacity: 1; }

/* Recommendation-row card: same .card-img-hover second photo again, this
   time hovering the whole 200px .rec-card tile (its <a> wrapper has no
   hover state of its own to key off, and the card itself has no fixed
   class name we can reuse from the grid/list cards). */
.rec-card:hover .has-hover-img .card-img-primary { opacity: 0; }
.rec-card:hover .has-hover-img .card-img-hover   { opacity: 1; }

/* ── Color swatches ── */
.color-swatch {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1.5px solid rgba(0, 0, 0, 0.12);
  flex-shrink: 0;
  cursor: default;
}
.color-swatch-more {
  font-size: .65rem;
  color: #999;
  align-self: center;
}
