/* =============================================================
   HOME TOP SELLING PRODUCTS SECTION
   Placed directly under Homepage Hero Banner
   Package: Clena Child Theme
   ============================================================= */

.home-top-selling {
    padding: 70px 24px 75px;
    background: #f8fafc;
    position: relative;
    border-bottom: 1px solid #eef2f6;
    overflow: hidden;
}

.top-selling-container {
    max-width: 1320px;
    margin: 0 auto;
    position: relative;
}

/* ─────────────────────────────────────────────────────────────
   SECTION HEADER (Title on Left, CTA in Right Corner)
   ───────────────────────────────────────────────────────────── */
.top-selling-header {
    display: flex;
    flex-direction: row;
    align-items: flex-end;
    justify-content: space-between;
    margin-bottom: 34px;
    gap: 20px;
    flex-wrap: wrap;
    text-align: left;
}

.top-selling-titles {
    max-width: 650px;
    margin: 0;
    text-align: left;
    flex: 1 1 320px;
}

.top-selling-title {
    color: var(--primary, #2b3890);
    font-size: clamp(24px, 3.2vw, 36px);
    font-weight: 700;
    line-height: 1.25;
    margin: 0 0 10px;
    letter-spacing: -0.3px;
    text-align: left;
}

.top-selling-subtitle {
    color: #555d7a;
    font-size: 15px;
    line-height: 1.6;
    margin: 0;
    max-width: 580px;
    text-align: left;
}

/* ─────────────────────────────────────────────────────────────
   HEADER ACTIONS (View All Button in Right Corner)
   ───────────────────────────────────────────────────────────── */
.top-selling-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-shrink: 0;
    margin-left: auto;
}

.btn-top-selling-all {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #ffffff;
    color: var(--primary, #2b3890);
    border: 1.5px solid #dbe2ea;
    border-radius: 30px;
    padding: 10px 20px;
    font-size: 13.5px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.25s ease;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
    white-space: nowrap;
}

.btn-top-selling-all:hover {
    background: var(--primary, #2b3890);
    color: #ffffff;
    border-color: var(--primary, #2b3890);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(43, 56, 144, 0.2);
}

.btn-top-selling-all svg {
    transition: transform 0.25s ease;
}

.btn-top-selling-all:hover svg {
    transform: translateX(4px);
}

/* ─────────────────────────────────────────────────────────────
   CAROUSEL NAVIGATION ARROWS (Placed on Left & Right Sides)
   ───────────────────────────────────────────────────────────── */
button.top-selling-nav-btn,
.top-selling-nav-btn {
    position: absolute;
    top: 42%;
    transform: translateY(-50%);
    z-index: 10;
    width: 44px;
    height: 44px;
    border-radius: 50% !important;
    background: #ffffff !important;
    border: 1.5px solid #dbe2ea !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer;
    transition: all 0.25s ease;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12) !important;
    padding: 0 !important;
    outline: none !important;
    -webkit-tap-highlight-color: transparent !important;
}

.top-selling-nav-btn.prev {
    left: -16px;
}

.top-selling-nav-btn.next {
    right: -16px;
}

.top-selling-nav-btn svg {
    width: 22px !important;
    height: 22px !important;
    display: block !important;
    flex-shrink: 0 !important;
    pointer-events: none;
}

.top-selling-nav-btn svg path,
.top-selling-nav-btn svg polyline {
    stroke: #2b3890 !important;
    stroke-width: 3px !important;
    fill: none !important;
    stroke-linecap: round !important;
    stroke-linejoin: round !important;
    transition: stroke 0.25s ease;
}

/* Prevent unwanted dark/charcoal background on click or focus from parent theme */
button.top-selling-nav-btn:focus,
button.top-selling-nav-btn:focus-visible,
button.top-selling-nav-btn:active,
.top-selling-nav-btn:focus,
.top-selling-nav-btn:focus-visible,
.top-selling-nav-btn:active {
    outline: none !important;
    background: #ffffff !important;
    border-color: #dbe2ea !important;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12) !important;
}

button.top-selling-nav-btn:focus svg path,
button.top-selling-nav-btn:focus svg polyline,
button.top-selling-nav-btn:focus-visible svg path,
button.top-selling-nav-btn:focus-visible svg polyline,
button.top-selling-nav-btn:active svg path,
button.top-selling-nav-btn:active svg polyline,
.top-selling-nav-btn:focus svg path,
.top-selling-nav-btn:focus svg polyline,
.top-selling-nav-btn:active svg path,
.top-selling-nav-btn:active svg polyline {
    stroke: #2b3890 !important;
}

button.top-selling-nav-btn:active,
.top-selling-nav-btn:active {
    transform: translateY(-50%) scale(0.92) !important;
}

/* Desktop hover state only — prevents sticky hover on mobile touch */
@media (hover: hover) and (pointer: fine) {
    button.top-selling-nav-btn:hover,
    .top-selling-nav-btn:hover {
        background: #2b3890 !important;
        border-color: #2b3890 !important;
        transform: translateY(-50%) scale(1.08) !important;
        box-shadow: 0 6px 18px rgba(43, 56, 144, 0.35) !important;
    }

    button.top-selling-nav-btn:hover svg path,
    button.top-selling-nav-btn:hover svg polyline,
    .top-selling-nav-btn:hover svg path,
    .top-selling-nav-btn:hover svg polyline {
        stroke: #ffffff !important;
    }
}

/* ─────────────────────────────────────────────────────────────
   CAROUSEL TRACK & PRODUCT CARDS
   ───────────────────────────────────────────────────────────── */
.top-selling-carousel-wrap {
    position: relative;
    margin: 0 -12px;
    padding: 8px 12px 24px;
}

.top-selling-grid {
    display: flex;
    gap: 20px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
    list-style: none;
    padding: 0;
    margin: 0;
}

.top-selling-grid::-webkit-scrollbar {
    display: none; /* Chrome, Safari */
}

/* Single card in slider track */
.top-selling-grid .top-selling-card {
    flex: 0 0 calc(25% - 15px);
    scroll-snap-align: start;
    box-sizing: border-box;
    margin: 0;
}

/* Card layout & typography */
.top-selling-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.03);
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

.top-selling-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.09);
    border-color: #cbd5e1;
}

/* Card image wrap */
.top-selling-card .card-img-wrap {
    position: relative;
    display: block;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background: #ffffff;
    flex-shrink: 0;
}

.top-selling-card .card-img-wrap img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    padding: 12px;
    transition: transform 0.4s ease;
}

.top-selling-card:hover .card-img-wrap img {
    transform: scale(1.06);
}

/* Badges */
.top-selling-card .card-badges {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 2;
    display: flex;
    flex-direction: column;
    gap: 5px;
    align-items: flex-start;
}

.top-selling-card .card-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.7px;
    padding: 4px 10px;
    border-radius: 20px;
    color: #fff;
    line-height: 1;
    white-space: nowrap;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.top-selling-card .bdg-sale {
    background: #e53e3e;
    font-size: 9.5px;
}

.top-selling-card .bdg-new {
    background: #22c55e;
    font-size: 9.5px;
}

.top-selling-card .bdg-bestseller {
    background: var(--primary, #2b3890);
    font-size: 9.5px;
}

.top-selling-card .bdg-out-of-stock {
    background: #dc2626;
    font-size: 9.5px;
}

/* Card body */
.top-selling-card .card-body {
    padding: 16px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.top-selling-card .card-meta-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    flex-wrap: wrap;
}

.top-selling-card .card-meta-wrap .card-cat {
    margin-bottom: 0;
}

.top-selling-card .card-stock-badge.out-of-stock {
    display: inline-flex;
    align-items: center;
    background: #fee2e2;
    color: #dc2626;
    font-size: 9.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 3px 8px;
    border-radius: 20px;
    line-height: 1.2;
    white-space: nowrap;
}

.top-selling-card .card-cat {
    display: block;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: #94a3b8;
    margin-bottom: 6px;
    line-height: 1.2;
}

.top-selling-card .card-title {
    font-size: 15px;
    font-weight: 600;
    line-height: 1.35;
    margin: 0 0 8px;
    color: #1e293b;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    height: 40px;
}

.top-selling-card .card-title a {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s;
}

.top-selling-card .card-title a:hover {
    color: var(--secondary, #00adef);
}

.top-selling-card .card-price {
    font-size: 15px;
    font-weight: 700;
    color: var(--primary, #2b3890);
    margin-bottom: 8px;
    display: flex;
    align-items: baseline;
    gap: 6px;
}

.top-selling-card .card-price del {
    color: #94a3b8;
    font-size: 13px;
    font-weight: 500;
}

.top-selling-card .card-price ins {
    text-decoration: none;
}

.top-selling-card .card-rating {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 14px;
    font-size: 12px;
}

.top-selling-card .star-rating {
    font-size: 11px;
}

.top-selling-card .rating-count {
    color: #94a3b8;
    font-size: 11px;
}

/* Card Add to Cart */
.top-selling-card .card-atc {
    margin-top: auto;
}

.top-selling-card .button.add_to_cart_button,
.top-selling-card .button {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary, #2b3890);
    color: #ffffff !important;
    border: none;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 13.5px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
    cursor: pointer;
    box-sizing: border-box;
}

.top-selling-card .button.add_to_cart_button:hover,
.top-selling-card .button:hover {
    background: var(--secondary, #00adef);
    color: #ffffff !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 173, 239, 0.25);
}

.top-selling-card .added_to_cart {
    display: block;
    text-align: center;
    font-size: 12px;
    font-weight: 600;
    color: var(--secondary, #00adef);
    margin-top: 6px;
    text-decoration: underline;
}

/* ─────────────────────────────────────────────────────────────
   CAROUSEL DOTS INDICATORS
   ───────────────────────────────────────────────────────────── */
.top-selling-dots {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 20px;
    padding: 4px 0;
}

.top-selling-dot {
    width: 8px;
    height: 8px;
    border-radius: 4px;
    background: #cbd5e1;
    border: none;
    padding: 0;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.top-selling-dot:hover {
    background: #94a3b8;
    transform: scale(1.15);
}

.top-selling-dot.active {
    width: 26px;
    background: var(--primary, #2b3890);
    border-radius: 13px;
    box-shadow: 0 2px 6px rgba(43, 56, 144, 0.3);
}

/* ─────────────────────────────────────────────────────────────
   RESPONSIVE BREAKPOINTS
   ───────────────────────────────────────────────────────────── */
@media (max-width: 1200px) {
    .top-selling-grid .top-selling-card {
        flex: 0 0 calc(33.333% - 14px);
    }
}

@media (max-width: 860px) {
    .home-top-selling {
        padding: 50px 16px 55px;
    }
    
    .top-selling-header {
        align-items: flex-end;
        justify-content: space-between;
        flex-direction: row;
        gap: 16px;
        margin-bottom: 24px;
        text-align: left;
    }

    .top-selling-titles {
        text-align: left;
    }

    .top-selling-actions {
        width: auto;
        justify-content: flex-end;
        margin-left: auto;
    }

    .top-selling-carousel-wrap {
        margin: 0 -8px;
        padding: 6px 8px 20px;
    }

    .top-selling-nav-btn {
        width: 38px;
        height: 38px;
        top: 40%;
    }

    .top-selling-nav-btn svg {
        width: 18px !important;
        height: 18px !important;
    }

    .top-selling-nav-btn.prev {
        left: 0px;
    }

    .top-selling-nav-btn.next {
        right: 0px;
    }

    .top-selling-grid {
        gap: 14px;
    }

    .top-selling-grid .top-selling-card {
        flex: 0 0 calc(50% - 7px);
    }
}

@media (max-width: 580px) {
    .home-top-selling {
        padding: 40px 12px 45px;
    }

    .top-selling-header {
        display: flex;
        flex-direction: row;
        align-items: flex-end;
        justify-content: space-between;
        margin-bottom: 20px;
        gap: 12px;
        text-align: left;
    }

    .top-selling-titles {
        text-align: left;
        flex: 1 1 190px;
    }

    .top-selling-title {
        font-size: 22px;
        margin-bottom: 6px;
        text-align: left;
    }

    .top-selling-subtitle {
        font-size: 13px;
        line-height: 1.45;
        padding: 0;
        text-align: left;
    }

    .top-selling-actions {
        justify-content: flex-end;
        margin-left: auto;
    }

    .btn-top-selling-all {
        padding: 7px 14px;
        font-size: 12px;
        border-radius: 20px;
        gap: 6px;
    }

    .btn-top-selling-all svg {
        width: 14px;
        height: 14px;
    }

    button.top-selling-nav-btn,
    .top-selling-nav-btn {
        width: 34px !important;
        height: 34px !important;
        top: 36%;
        background: #ffffff !important;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.16) !important;
    }

    button.top-selling-nav-btn:focus,
    button.top-selling-nav-btn:active,
    .top-selling-nav-btn:focus,
    .top-selling-nav-btn:active {
        background: #ffffff !important;
        border-color: #dbe2ea !important;
    }

    .top-selling-nav-btn svg {
        width: 16px !important;
        height: 16px !important;
    }

    .top-selling-nav-btn.prev {
        left: 2px;
    }

    .top-selling-nav-btn.next {
        right: 2px;
    }

    .top-selling-carousel-wrap {
        margin: 0 -6px;
        padding: 4px 6px 16px;
    }

    .top-selling-grid {
        gap: 10px;
    }

    /* Display 2 products side by side */
    .top-selling-grid .top-selling-card {
        flex: 0 0 calc(50% - 5px);
        border-radius: 12px;
    }

    .top-selling-card .card-img-wrap img {
        padding: 8px;
    }

    .top-selling-card .card-badges {
        top: 6px;
        left: 6px;
        gap: 3px;
    }

    .top-selling-card .card-badge {
        font-size: 8px;
        font-weight: 700;
        padding: 3px 6px;
        border-radius: 6px;
        letter-spacing: 0.4px;
    }

    .top-selling-card .card-body {
        padding: 10px;
    }

    .top-selling-card .card-cat {
        font-size: 10px;
        margin-bottom: 3px;
        letter-spacing: 0.5px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .top-selling-card .card-title {
        font-size: 13px;
        font-weight: 600;
        line-height: 1.25;
        margin: 0 0 6px;
        height: 34px;
        min-height: 34px;
    }

    .top-selling-card .card-price {
        font-size: 13.5px;
        margin-bottom: 6px;
        gap: 4px;
        flex-wrap: wrap;
    }

    .top-selling-card .card-price del {
        font-size: 11.5px;
    }

    .top-selling-card .card-rating {
        margin-bottom: 8px;
        gap: 3px;
        flex-wrap: wrap;
    }

    .top-selling-card .star-rating {
        font-size: 10px;
    }

    .top-selling-card .rating-count {
        font-size: 10px;
    }

    .top-selling-card .button.add_to_cart_button,
    .top-selling-card .button {
        padding: 7px 6px;
        font-size: 12px;
        border-radius: 6px;
        min-height: 32px;
    }
}

@media (max-width: 360px) {
    .home-top-selling {
        padding: 35px 8px 40px;
    }

    .top-selling-grid {
        gap: 8px;
    }

    .top-selling-grid .top-selling-card {
        flex: 0 0 calc(50% - 4px);
    }

    .top-selling-card .card-body {
        padding: 8px;
    }

    .top-selling-card .card-title {
        font-size: 12px;
        height: 30px;
        min-height: 30px;
    }

    .top-selling-card .button.add_to_cart_button,
    .top-selling-card .button {
        font-size: 11px;
        padding: 6px 4px;
    }
}
