/**
 * Enhanced Cross Listing / Home Product Cards
 * Global Load More system with responsive grid layout.
 *
 * Sections covered: ALL homepage product sections
 * Excluded: Flash Sale & Boost (kept as Swiper sliders)
 */

/* ══════════════════════════════════════════════════
   SECTION WRAPPER
══════════════════════════════════════════════════ */
#dvProductHomePageContainer .product-home-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 4px 4px;
    margin-bottom: 0;
    border-bottom: none;
}

#dvProductHomePageContainer .product-home-heading .h3,
#dvProductHomePageContainer .product-home-heading h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 800;
    color: #0f172a;
    letter-spacing: -0.02em;
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
}

#dvProductHomePageContainer .product-home-heading .h3::before,
#dvProductHomePageContainer .product-home-heading h3::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 22px;
    border-radius: 4px;
    background: var(--theme-color, #362a89);
    flex-shrink: 0;
}

/* Section "View All" link */
#dvProductHomePageContainer .product-home-heading .cl-view-all {
    font-size: 13px;
    font-weight: 600;
    color: var(--theme-color, #362a89);
    text-decoration: none;
    opacity: 0.85;
    transition: opacity 0.15s ease;
    white-space: nowrap;
}

#dvProductHomePageContainer .product-home-heading .cl-view-all:hover {
    opacity: 1;
    text-decoration: underline;
}

/* ══════════════════════════════════════════════════
   OUTER SECTION CARD
══════════════════════════════════════════════════ */
#dvProductHomePageContainer>.container>#dvproducthome>div {
    margin-bottom: 28px;
}

#dvProductHomePageContainer .cl-section-card {
    background: #fff;
    border-radius: 18px;
    border: 1px solid #e8edf4;
    padding: 18px 16px 16px;
    box-shadow: 0 2px 12px rgba(15, 23, 42, 0.06);
    margin-bottom: 28px;
    overflow: hidden;
}

/* ══════════════════════════════════════════════════
   RESPONSIVE PRODUCT GRID — 4 / 3 / 2 / 1 columns
══════════════════════════════════════════════════ */
.cl-grid-wrap {
    position: relative;
}

.cl-product-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    padding: 6px 2px 10px;
}

/* ── Hidden items (not yet revealed) ── */
.cl-grid-item.cl-grid-hidden {
    display: none;
}

/* ── Fade-in animation for newly loaded items ── */
@keyframes clGridFadeIn {
    from {
        opacity: 0;
        transform: translateY(18px) scale(0.97);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.cl-grid-item.cl-grid-fadein {
    animation: clGridFadeIn 0.4s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

/* ══════════════════════════════════════════════════
   PRODUCT CARD — hover enhancement (scale + shadow)
══════════════════════════════════════════════════ */
.cl-grid-item .product-card,
.cl-grid-item .product-box.product-card {
    border-radius: 14px !important;
    border: 1px solid #eef0f5 !important;
    background: #fff !important;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06) !important;
    transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1),
        box-shadow 0.25s cubic-bezier(0.22, 1, 0.36, 1),
        border-color 0.25s ease !important;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    max-width: none !important;
}

.cl-grid-item .product-card:hover {
    transform: scale(1.03) !important;
    box-shadow: 0 14px 32px rgba(15, 23, 42, 0.13),
        0 4px 10px rgba(15, 23, 42, 0.06) !important;
    border-color: #dce3ef !important;
}

/* Image */
.cl-grid-item .pc-img-wrap,
.cl-grid-item .product-image,
.cl-grid-item .p-img.product-image {
    aspect-ratio: 1 !important;
    border-radius: 14px 14px 0 0 !important;
    background: #f4f6f9 !important;
    overflow: hidden !important;
    flex-shrink: 0 !important;
}

.cl-grid-item .pc-img-wrap img,
.cl-grid-item .product-image img,
.cl-grid-item .p-img.product-image img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    transition: transform 0.38s ease !important;
}

.cl-grid-item .product-card:hover .pc-img-wrap img,
.cl-grid-item .product-card:hover .product-image img {
    transform: scale(1.06) !important;
}

/* Wishlist heart icon */
.cl-grid-item .product-wishlist {
    width: 30px !important;
    height: 30px !important;
}

/* Badges */
.cl-grid-item .p-badges {
    margin-bottom: 4px !important;
    gap: 3px !important;
}

.cl-grid-item .pc-badge {
    font-size: 9.5px !important;
    padding: 2px 6px !important;
    border-radius: 5px !important;
}

/* Title */
.cl-grid-item .product-title,
.cl-grid-item .p-title.product-title {
    font-size: 12.5px !important;
    font-weight: 600 !important;
    -webkit-line-clamp: 2 !important;
    line-clamp: 2 !important;
    min-height: 2.8em;
    margin: 2px 0 6px !important;
}

/* Price */
.cl-grid-item .pc-price-main {
    font-size: 14px !important;
    font-weight: 800 !important;
    color: var(--theme-color, #362a89) !important;
}

.cl-grid-item .p-old-p {
    font-size: 11px !important;
}

/* Body area */
.cl-grid-item .product-body,
.cl-grid-item .p-data.product-body {
    padding: 9px 10px 4px !important;
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Footer with add to cart — hide qty for compact cards */
.cl-grid-item .p-conditional_div {
    padding: 4px 10px 10px !important;
}

.cl-grid-item .qty-control {
    display: none !important;
}

.cl-grid-item .pc-atc-btn {
    width: 100% !important;
    height: 34px !important;
    font-size: 12px !important;
    border-radius: 9px !important;
    padding: 0 10px !important;
    gap: 5px !important;
}

.cl-grid-item .pc-atc-btn svg {
    width: 13px !important;
    height: 13px !important;
}

/* Hide hover actions (side buttons) in grid cards */
.cl-grid-item .pc-hover-actions {
    display: none !important;
}

/* Sale badge — smaller */
.cl-grid-item .pc-sale-tag {
    font-size: 9px !important;
    padding: 2px 6px !important;
}

/* ══════════════════════════════════════════════════
   LOAD MORE BUTTON — Default (centered, min-width)
══════════════════════════════════════════════════ */
.cl-loadmore-wrap {
    display: flex;
    justify-content: center;
    padding: 20px 0 8px;
}

.cl-loadmore-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-width: 220px;
    height: 52px;
    padding: 0 36px;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.01em;
    color: #fff;
    background: linear-gradient(135deg, var(--theme-color, #362a89) 0%, #5b4bc4 100%);
    border: none;
    border-radius: 14px;
    cursor: pointer;
    transition: transform 0.22s cubic-bezier(0.22, 1, 0.36, 1),
        box-shadow 0.22s cubic-bezier(0.22, 1, 0.36, 1),
        opacity 0.22s ease;
    box-shadow: 0 4px 18px rgba(54, 42, 137, 0.22);
    position: relative;
    overflow: hidden;
}

/* Shimmer overlay on hover */
.cl-loadmore-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, transparent 38%, rgba(255, 255, 255, 0.15) 50%, transparent 62%);
    background-size: 300% 100%;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.cl-loadmore-btn:hover {
    transform: scale(1.04);
    box-shadow: 0 8px 30px rgba(54, 42, 137, 0.34);
}

.cl-loadmore-btn:hover::before {
    opacity: 1;
    animation: clShimmer 1.6s ease infinite;
}

@keyframes clShimmer {
    0% {
        background-position: 100% 50%;
    }

    100% {
        background-position: -100% 50%;
    }
}

.cl-loadmore-btn:active {
    transform: scale(0.97);
}

/* Disabled state */
.cl-loadmore-btn:disabled {
    cursor: not-allowed;
    opacity: 0.65;
    transform: none !important;
    box-shadow: 0 2px 10px rgba(54, 42, 137, 0.12);
}

/* Hidden (no more products) */
.cl-loadmore-btn.is-hidden {
    display: none !important;
}

/* ── Loading spinner inside button ── */
.cl-loadmore-spinner {
    display: none;
    width: 18px;
    height: 18px;
    border: 2.5px solid rgba(255, 255, 255, 0.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: clSpinnerRotate 0.6s linear infinite;
    flex-shrink: 0;
}

.cl-loadmore-btn.is-loading .cl-loadmore-text {
    opacity: 0.55;
}

.cl-loadmore-btn.is-loading .cl-loadmore-spinner {
    display: inline-block;
}

@keyframes clSpinnerRotate {
    to {
        transform: rotate(360deg);
    }
}

/* ══════════════════════════════════════════════════
   LOAD MORE — Full-width variant (Section 2+)
   Gradient, rounded, full-width, hover animation
══════════════════════════════════════════════════ */
.cl-loadmore-wrap.cl-loadmore-fullwidth {
    padding: 16px 0 4px;
}

.cl-loadmore-wrap.cl-loadmore-fullwidth .cl-loadmore-btn {
    width: 100%;
    min-width: unset;
    height: 54px;
    border-radius: 14px;
    font-size: 15px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--theme-color, #362a89) 0%, #5b4bc4 100%);
    box-shadow: 0 4px 20px rgba(54, 42, 137, 0.22);
}

.cl-loadmore-wrap.cl-loadmore-fullwidth .cl-loadmore-btn:hover {
    transform: scale(1.015);
    box-shadow: 0 8px 32px rgba(54, 42, 137, 0.36);
}

/* ══════════════════════════════════════════════════
   SECTION HEADING — standalone mobile style
══════════════════════════════════════════════════ */
#dvProductHomePageContainer .mobile-heading {
    font-size: 1.15rem;
    font-weight: 800;
    color: #0f172a;
    letter-spacing: -0.018em;
    margin: 0 0 12px;
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ══════════════════════════════════════════════════
   RESPONSIVE BREAKPOINTS
══════════════════════════════════════════════════ */

/* 3 columns — small desktop / large tablet */
@media (max-width: 1024px) {
    .cl-product-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 14px;
    }
}

/* 2 columns — tablet */
@media (max-width: 768px) {
    .cl-product-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .cl-loadmore-btn {
        min-width: 160px;
        height: 48px;
        font-size: 14px;
        padding: 0 24px;
        border-radius: 12px;
    }

    .cl-loadmore-wrap.cl-loadmore-fullwidth .cl-loadmore-btn {
        height: 50px;
    }

    .cl-grid-item .product-title,
    .cl-grid-item .p-title.product-title {
        font-size: 12px !important;
    }

    .cl-grid-item .pc-price-main {
        font-size: 13px !important;
    }
}

/* 2 columns stays — small mobile */
@media (max-width: 480px) {
    .cl-product-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .cl-loadmore-btn {
        min-width: 140px;
        height: 46px;
        font-size: 13px;
        border-radius: 11px;
    }

    #dvProductHomePageContainer .cl-section-card {
        padding: 14px 10px 12px;
        border-radius: 14px;
    }
}

/* 1 column — very narrow screens */
@media (max-width: 360px) {
    .cl-product-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
}

/* ══════════════════════════════════════════════════
   FALLBACK: plain grid (when JS doesn't enhance)
══════════════════════════════════════════════════ */
#dvProductHomePageContainer .product-box-wrapper.product-card-grid.home-ui-clean {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    padding: 4px 0;
}

#dvProductHomePageContainer .product-box-wrapper.product-card-grid.home-ui-clean .block-item {
    flex: 0 0 16.666%;
    max-width: 16.666%;
    padding: 6px;
}

@media (max-width: 1280px) {
    #dvProductHomePageContainer .product-box-wrapper.product-card-grid.home-ui-clean .block-item {
        flex: 0 0 20%;
        max-width: 20%;
    }
}

@media (max-width: 1024px) {
    #dvProductHomePageContainer .product-box-wrapper.product-card-grid.home-ui-clean .block-item {
        flex: 0 0 25%;
        max-width: 25%;
    }
}

@media (max-width: 768px) {
    #dvProductHomePageContainer .product-box-wrapper.product-card-grid.home-ui-clean .block-item {
        flex: 0 0 33.333%;
        max-width: 33.333%;
    }
}

/* ══════════════════════════════════════════════════
   SECTION DIVIDER (between sections)
══════════════════════════════════════════════════ */
#dvProductHomePageContainer .cl-section-divider {
    height: 1px;
    background: linear-gradient(to right, transparent, #e2e8f0 20%, #e2e8f0 80%, transparent);
    margin: 8px 0 28px;
}