/* --- Category Tab Products Showcase Stylings (Avansas Style) --- */

/* 1. Main Section Container with thick theme purple border */
.category-tab-products-section {
    background-color: #ffffff;
    border: 4px solid #542580; /* Theme brand purple thick border */
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
}

/* 2. Header Banner block */
.ctp-header {
    background-color: #542580; /* Unified theme brand purple */
    border-bottom: 2px solid rgba(0, 0, 0, 0.08);
    padding: 16px 24px;
}

.ctp-title {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.4px;
}

.ctp-subtitle {
    font-size: 13px;
    font-weight: 400;
    opacity: 0.85;
    letter-spacing: -0.1px;
}

.ctp-view-all {
    color: #ffffff !important;
    text-decoration: underline !important;
    background-color: transparent !important;
    border: none !important;
    padding: 0 !important;
    transition: opacity 0.2s ease-in-out;
}

.ctp-view-all:hover {
    opacity: 0.85;
}

/* 3. Category Tabs Strip */
.ctp-tabs-wrapper {
    background-color: #ffffff;
    border-bottom: 1px solid #e2e8f0;
}

.ctp-tabs-container {
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
    padding-bottom: 4px;
}

/* Hide scrollbars */
.ctp-tabs-container::-webkit-scrollbar {
    display: none;
}
.ctp-tabs-container {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.ctp-tab-item {
    cursor: pointer;
    flex-shrink: 0;
    min-width: 120px;
    text-align: center;
    padding: 14px 10px;
    border-radius: 12px;
    border: 2px solid #e2e8f0; /* Set to 2px solid transparent or light grey to match active border width */
    background-color: #f8fafc;
    margin-right: 12px;
    transition: all 0.25s ease-in-out;
    position: relative;
}

.ctp-tab-item:hover {
    border-color: #cbd5e1;
    background-color: #f1f5f9;
}

.ctp-tab-item.active {
    border: 2px solid #542580; /* Same width, no height jump! */
    background-color: #ffffff;
    box-shadow: 0 4px 12px rgba(84, 37, 128, 0.05);
}

.ctp-tab-name {
    font-size: 13px;
    color: #1e293b;
    font-weight: 600;
    display: block;
    transition: color 0.2s ease;
}

.ctp-tab-item.active .ctp-tab-name {
    color: #542580;
    font-weight: 600; /* Keep weight identical to prevent layout stretch or wrap */
}

/* Tab image wrapper without circle */
.ctp-tab-image-wrap {
    width: 100%;
    height: 60px;
    margin: 0 auto 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
}

.ctp-tab-item.active .ctp-tab-image-wrap {
    background: transparent;
}

.ctp-tab-img {
    max-width: 100%;
    max-height: 52px;
    object-fit: contain;
}

/* Active Down Arrow Caret - positioned to overlay bottom border */
.ctp-tab-arrow {
    display: none;
    position: absolute;
    bottom: -13px;
    left: 50%;
    transform: translateX(-50%);
    color: #542580;
    font-size: 20px;
    line-height: 1;
    z-index: 10;
}

.ctp-tab-item.active .ctp-tab-arrow {
    display: block;
}

/* 4. Products Container & Cards Grid (White Area) */
.ctp-grids-wrapper {
    background-color: #ffffff !important;
    position: relative;
    padding: 16px;
    height: 444px !important; /* Fixed height on all devices to prevent page height shifts */
    overflow: hidden !important;
}

.ctp-products-container {
    position: absolute;
    top: 16px;
    left: 16px;
    width: calc(100% - 32px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.25s ease-in-out, visibility 0.25s ease-in-out;
}

.ctp-products-container.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.ctp-product-card {
    border: 1px solid #e2e8f0;
    border-radius: 12px !important;
    transition: all 0.25s ease-in-out;
}

.ctp-product-card:hover {
    border-color: #542580;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
    transform: translateY(-2px);
}

/* Top Left Badge */
.ctp-product-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    background-color: #eff6ff;
    color: #1d4ed8;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 4px;
    z-index: 2;
    border: 1px solid #dbeafe;
}

/* Image wrapper */
.ctp-product-img-link {
    height: 160px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ctp-product-img {
    max-height: 140px;
    object-fit: contain;
    mix-blend-mode: multiply;
    transition: transform 0.3s ease;
}

.ctp-product-card:hover .ctp-product-img {
    transform: scale(1.03);
}

/* Info and details */
.ctp-product-sku {
    font-size: 11px;
    color: #94a3b8;
    letter-spacing: -0.1px;
}

.ctp-review-count {
    font-size: 11px;
    color: #94a3b8;
}

.ctp-product-name {
    font-size: 13px;
    font-weight: 600;
    height: 38px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-height: 1.4;
    margin-bottom: 8px;
}

.ctp-product-name a {
    color: #1e293b !important;
    transition: color 0.2s ease;
}

.ctp-product-name a:hover {
    color: #542580 !important;
}

/* Pricing block */
.ctp-price-container {
    min-height: 48px;
}

.ctp-price {
    font-size: 18px;
    font-weight: 800;
    color: #f37021 !important; /* Premium brand orange price */
}

.ctp-regular-price {
    font-size: 12px;
    color: #94a3b8;
}

.ctp-vat-info {
    font-size: 10px;
    color: #94a3b8;
    margin-top: 2px;
}

/* Quantity and Cart Button Wrapper */
.ctp-action-row .numberinput-group {
    width: 54px !important;
    min-width: 54px !important;
    max-width: 54px !important;
    height: 38px !important;
    margin-right: 8px !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 6px !important;
    overflow: hidden !important;
    background-color: #ffffff !important;
    display: flex !important;
    flex-direction: row !important;
    --ni-addon-width: 22px !important; /* Set arrow button width to 22px to leave 32px for the number */
}

/* Quantity Input Element (kept transparent when not focused to let numberinput-formatted overlay render it) */
.ctp-action-row .numberinput-group .ctp-qty-input {
    border: none !important;
    border-radius: 0 !important;
    width: 100% !important;
    height: 100% !important;
    padding: 0 22px 0 0 !important; /* Exclude the 22px stepper width from content area to center text in white box */
    text-align: center !important;
    font-size: 14px;
    font-weight: 700;
    color: transparent !important; /* Invisible by default to let numberinput-formatted handle it */
    background-color: transparent !important;
    box-shadow: none !important;
    -moz-appearance: textfield !important;
}

/* Make text visible and centered inside content area during manual typing (focus/active) */
.ctp-action-row .numberinput-group .ctp-qty-input:focus,
.ctp-action-row .numberinput-group .ctp-qty-input:active {
    color: #1e293b !important;
    outline: none !important;
    box-shadow: none !important;
}

.ctp-action-row .numberinput-group:focus-within {
    border-color: #542580 !important;
}

/* Style and position the formatted text element in the left white space */
.ctp-action-row .numberinput-group .numberinput-formatted {
    display: flex !important;
    position: absolute !important;
    z-index: 10 !important;
    left: 0 !important;
    top: 0 !important;
    bottom: 0 !important;
    right: 22px !important; /* Exclude the stepper area */
    width: auto !important;
    height: 100% !important;
    justify-content: center !important;
    align-items: center !important;
    font-size: 14px !important;
    font-weight: 700 !important;
    color: #1e293b !important;
    pointer-events: none !important;
    background: transparent !important;
}

.ctp-add-to-cart {
    background-color: #f37021 !important; /* Orange CTA button */
    border-color: #f37021 !important;
    color: #ffffff !important;
    font-size: 13px;
    font-weight: 700;
    border-radius: 6px;
    transition: all 0.2s ease-in-out;
}

.ctp-add-to-cart:hover {
    background-color: #e05e12 !important;
    border-color: #e05e12 !important;
    box-shadow: 0 4px 12px rgba(243, 112, 33, 0.2);
}

/* 5. Mobile Slick Overrides (Carousel arrows on mobile view) */
@media (max-width: 991px) {
    /* Hide Category images in tabs */
    .ctp-tab-image-wrap {
        display: none !important;
    }
    
    .ctp-tab-item {
        min-width: auto;
        padding: 8px 16px;
        border-radius: 20px;
    }
    
    .ctp-tab-arrow {
        display: none !important;
    }

    /* Slick Mobile Carousel Arrow overrides */
    .ctp-products-slider {
        position: relative;
    }

    .ctp-products-slider .slick-arrow {
        position: absolute;
        top: 50%;
        transform: translateY(-50%);
        width: 30px;
        height: 70px;
        background-color: rgba(0, 0, 0, 0.2);
        border: none;
        z-index: 12;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        transition: all 0.25s ease-in-out;
        outline: none;
        color: #ffffff;
        padding: 0;
    }

    .ctp-products-slider .slick-arrow:hover {
        background-color: rgba(0, 0, 0, 0.55);
    }

    .ctp-products-slider .slick-prev {
        left: 0;
        border-radius: 0 6px 6px 0;
    }

    .ctp-products-slider .slick-next {
        right: 0;
        border-radius: 6px 0 0 6px;
    }

    .ctp-products-slider .slick-arrow i {
        font-size: 14px;
        color: #ffffff;
    }

    .ctp-products-slider .slick-arrow::before {
        display: none !important;
        content: "" !important;
    }
}

/* 6. Desktop Grid Tab Width distribution & Style overrides */
@media (min-width: 992px) {
    .ctp-tabs-wrapper {
        overflow: visible !important;
    }
    .ctp-tabs-container {
        display: flex;
        justify-content: space-between;
        width: 100%;
        padding: 0;
        overflow: visible !important;
    }
    .ctp-tab-item {
        flex: 1 1 0%;
        margin-right: 12px;
        min-width: 0;
    }
    .ctp-tab-item:last-child {
        margin-right: 0;
    }
    .ctp-tab-name {
        font-size: 15px !important;
    }
}
