/* Category Products Shortcode Styling */
.novateplica-category-products-section {
    margin: 0;
}

.shortcode-category-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    margin-bottom: 20px;
    padding: 0 5px;
    position: relative;
}

.shortcode-category-title {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 24px;
    font-weight: 700;
    color: #1e293b;
    margin: 0;
    line-height: 1.2;
}

/* Stylish Toggle-style Button */
.shortcode-category-link {
    flex: 0 0 auto;
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: auto;
    padding: 6px 12px;
    background: transparent;
    border: 1.5px solid #e0e0e0;
    border-radius: 20px;
    color: var(--primary-color, #22c55e);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.product-actions.variable-actions .btn-small {
    padding: 6px 12px !important;
}

.var-trigger-wrapper {
    margin-top: 0 !important;
}

.shortcode-category-link:hover {
    background: rgba(34, 197, 94, 0.05);
    border-color: var(--primary-color, #22c55e);
}

.shortcode-category-link i {
    font-size: 12px;
    transition: transform 0.3s ease;
}

.shortcode-category-link:hover i {
    transform: translateX(2px);
}

.novateplica-category-products-section .novateplica-shortcode-wrapper {
    position: relative;
    display: block;
}

.novateplica-category-products-section .novateplica-shortcode-wrapper ul.novateplica-shortcode-products {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    -webkit-overflow-scrolling: touch !important;
    gap: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    list-style: none !important;
    scrollbar-width: thin !important;
    scrollbar-color: transparent transparent !important;
    scroll-snap-type: x mandatory;
    cursor: default;
    user-select: auto;
    touch-action: auto !important;
}

@media (min-width: 769px) {
    .novateplica-category-products-section .novateplica-shortcode-wrapper ul.novateplica-shortcode-products {
        overflow-x: hidden !important;
        padding-bottom: 0 !important;
        margin-bottom: 0 !important;
    }

    /* PC Variation Panel: Aligned with card as requested in the screenshot */
    .novateplica-category-products-section .product-card-variations {
        width: 100% !important;
        left: 0 !important;
        transform: none !important;
        border-radius: 0 0 12px 12px !important;
        margin-top: 0 !important;
        box-shadow: 0 15px 30px rgba(0, 0, 0, 0.1) !important;
        border: 1px solid #eee !important;
        border-top: none !important;
        padding: 15px !important;
    }

    .novateplica-category-products-section .product-card-variations.is-shortcode-overlay {
        position: fixed !important;
        top: var(--variation-panel-top) !important;
        left: var(--variation-panel-left) !important;
        width: var(--variation-panel-width) !important;
        z-index: 1000 !important;
    }

    /* Boost z-index for the active card container */
    .novateplica-category-products-section .product.variation-open {
        z-index: 100 !important;
    }

    .novateplica-category-products-section .product.variation-open .novateplica-product-card {
        border-bottom-left-radius: 0 !important;
        border-bottom-right-radius: 0 !important;
        box-shadow: 0 15px 30px rgba(0, 0, 0, 0.1) !important;
    }

    .novateplica-category-products-section .novateplica-slider-nav {
        margin-top: 0;
    }
}

/* Navigation Arrows - Minimalist Style */
.novateplica-slider-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 38px;
    height: 38px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 50%;
    color: #1e293b;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 50;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.2s ease;
}

.novateplica-slider-nav:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.novateplica-slider-nav.prev {
    left: -19px;
}

.novateplica-slider-nav.next {
    right: -19px;
}

/* --- Responsive Grid Engine --- */

/* 1. Ultra Wide Screens (Min 1400px) */
@media (min-width: 1400px) {
    .novateplica-category-products-section .novateplica-shortcode-wrapper ul.novateplica-shortcode-products li.product {
        flex: 0 0 16.666% !important;
        /* exactly 6 items */
        width: 16.666% !important;
    }
}

/* 2. Large Desktops & Notebooks (1200px - 1400px) */
@media (min-width: 1200px) and (max-width: 1399px) {
    .novateplica-category-products-section .novateplica-shortcode-wrapper ul.novateplica-shortcode-products li.product {
        flex: 0 0 20% !important;
        /* 5 items */
        width: 20% !important;
    }

    .novateplica-slider-nav.prev {
        left: -10px;
    }

    .novateplica-slider-nav.next {
        right: -10px;
    }
}

/* 3. Medium Desktops & Standard Laptops (992px - 1199px) */
@media (min-width: 992px) and (max-width: 1199px) {
    .novateplica-category-products-section .novateplica-shortcode-wrapper ul.novateplica-shortcode-products li.product {
        flex: 0 0 25% !important;
        /* 4 items */
        width: 25% !important;
    }

    .novateplica-slider-nav.prev {
        left: 5px;
    }

    .novateplica-slider-nav.next {
        right: 5px;
    }
}

/* 4. Tablets (Horizontal & Netbooks) (768px - 991px) */
@media (min-width: 768px) and (max-width: 991px) {
    .novateplica-category-products-section .novateplica-shortcode-wrapper ul.novateplica-shortcode-products li.product {
        flex: 0 0 33.333% !important;
        /* 3 items */
        width: 33.333% !important;
    }

    .novateplica-slider-nav.prev {
        left: 5px;
    }

    .novateplica-slider-nav.next {
        right: 5px;
    }

    .shortcode-category-title {
        font-size: 22px;
    }
}

/* 5. All Mobile Screens (Below 768px) - ALWAYS 2 PRODUCTS & FULL WIDTH */
@media (max-width: 767px) {
    .novateplica-category-products-section {
        /* margin: 30px 0; */
    }

    .shortcode-category-header {
        margin-bottom: 15px;
        padding: 0;
    }

    .novateplica-category-products-section .novateplica-shortcode-wrapper {
        margin-left: -15px !important;
        margin-right: -15px !important;
        width: calc(100% + 30px);
    }

    .novateplica-category-products-section .novateplica-shortcode-wrapper ul.novateplica-shortcode-products {
        padding-bottom: 0 !important;
        margin-bottom: 0 !important;
    }

    .novateplica-category-products-section .novateplica-shortcode-wrapper ul.novateplica-shortcode-products li.product {
        flex: 0 0 50% !important;
        width: 50% !important;
    }

    .novateplica-slider-nav {
        /* Arrows shown on mobile — visibility controlled by JS toggleArrows() */
        width: 32px;
        height: 32px;
        background: rgba(255, 255, 255, 0.85);
        backdrop-filter: blur(4px);
        -webkit-backdrop-filter: blur(4px);
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
        opacity: 0.9;
    }

    /* On mobile the wrapper extends to full width, so keep arrows inside */
    .novateplica-slider-nav.prev {
        left: 4px;
    }

    .novateplica-slider-nav.next {
        right: 4px;
    }

    .shortcode-category-title {
        font-size: 19px;
        overflow-wrap: anywhere;
    }
}

/* 6. Fix for very small phones */
@media (max-width: 400px) {
    .shortcode-category-title {
        font-size: 17px;
    }

    .shortcode-category-link {
        padding: 4px 10px;
        font-size: 12px;
    }
}

/* Shared Product Item Logic (No Gaps) */
.novateplica-category-products-section .novateplica-shortcode-wrapper ul.novateplica-shortcode-products li.product {
    margin: 0 !important;
    padding: 0 !important;
    float: none !important;
    scroll-snap-align: start;
    display: block !important;
    border-right: 0;
    box-sizing: border-box;
}

/* Dark Mode Support */
[data-theme="dark"] .shortcode-category-title {
    color: #f8fafc;
}

[data-theme="dark"] .shortcode-category-link {
    border-color: #374151;
    color: #f3f4f6;
}

[data-theme="dark"] .shortcode-category-link:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

[data-theme="dark"] .novateplica-slider-nav {
    background: #1e293b;
    color: #f8fafc;
    border-color: #334155;
}

[data-theme="dark"] .novateplica-category-products-section .novateplica-shortcode-wrapper ul.novateplica-shortcode-products li.product {
    border-color: transparent;
}

/* Scrollbar Customization */
.novateplica-category-products-section .novateplica-shortcode-wrapper ul.novateplica-shortcode-products::-webkit-scrollbar {
    height: 4px;
    display: block;
}

.novateplica-category-products-section .novateplica-shortcode-wrapper ul.novateplica-shortcode-products::-webkit-scrollbar-thumb {
    background: transparent;
    border-radius: 10px;
}

.novateplica-category-products-section .novateplica-shortcode-wrapper ul.novateplica-shortcode-products.is-scrolling::-webkit-scrollbar-thumb {
    background: var(--primary-color);
}
