/* === Custom Product Slider Styling === */

/* --- Main Container --- */
.custom-product-slider-container {
    position: relative; /* Needed for arrows */
    margin-top: 20px;
    margin-bottom: 20px;
    overflow: hidden; /* Prevent unexpected overflow */
    /* Padding adjusted via arrows/content if needed */
    padding-left: 5px; /* Minimal padding for safety */
    padding-right: 5px;
}

/* --- Individual Slide --- */
.product-slide {
    text-align: center;
    height: auto; /* Allow height to adjust based on content */
}

.product-slide-inner {
    height: 100%; /* Make inner container fill slide height */
    display: flex;
    flex-direction: column; /* Stack image, title, price, button vertically */
    /* Optional: Add border/background to card */
    /* border: 1px solid #eee; */
    /* padding: 15px; */
}

/* --- Image --- */
.product-slide-image-link {
    display: block; /* Was flex, block might be better for spacing control */
    margin-bottom: 8px; /* Space below image */
    text-align: center; /* Center image within link */
    /* Removed flex-grow: 1; and related flex properties */
}

.product-slide-image {
    max-width: 100%;
    height: auto;
    display: inline-block; /* Allows centering via text-align on parent */
}

/* --- Title --- */
.product-slide-title {
    font-size: 18px;
    font-weight: 400;
    color: #333;
    min-height: 2.6em; /* Allow space for ~2 lines */
    line-height: 1.3;
    margin-bottom: 5px !important; /* Consistent spacing */
    
}

.product-slide-title a {
    color: inherit;
    text-decoration: none;
}
.product-slide-title a:hover {
    color: #8EAC71;
}

/* --- Price --- */
.product-slide-price {
    font-size: 18px !important; /* INCREASED font size */
    color: #2f2f2f;
    font-weight: 600;
    margin-bottom: 8px !important; /* Consistent spacing */
    line-height: 1.3; /* Ensure consistent line height */
}

/* --- Add to Cart Area --- */
.custom-product-slider-container .product-slide .product-slide-add-to-cart {
    margin-top: auto; /* Push to bottom if using flexbox */
    padding-top: 5px; /* Small space above button */
    padding-bottom: 10px; /* Space at the very bottom */
    min-height: 2.5em; /* Prevent layout jump when button swaps */
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

/* Default Button Style - FIXED WIDTH FOR CONSISTENCY */
.custom-product-slider-container .product-slide .product-slide-add-to-cart .button {
    display: inline-block;
    background-color: #8EAC71;
    color: #FFFFFF !important;
    padding: 8px 18px;
    border: none;
    border-radius: 4px;
    font-size: 0.9em;
    font-weight: 600;
    text-align: center;
    text-decoration: none !important;
    cursor: pointer;
    transition: background-color 0.3s ease;
    line-height: normal;
    width: 140px !important; /* FIXED WIDTH - all buttons same size */
    max-width: 100%; /* Don't exceed container on very small screens */
    box-sizing: border-box; /* Include padding in width calculation */
    white-space: nowrap; /* Prevent text wrapping */
    overflow: hidden; /* Hide any overflow */
    text-overflow: ellipsis; /* Add ... if text too long */
}
.custom-product-slider-container .product-slide .product-slide-add-to-cart .button:hover {
    background-color: #7b9761;
    color: #FFFFFF !important;
}

/* Loading Spinner */
.custom-product-slider-container .product-slide .product-slide-add-to-cart .add_to_cart_button.loading {
    opacity: 0.7;
    background-color: #8EAC71;
    color: transparent !important;
    position: relative;
    /* Maintain consistent button size */
    width: 140px !important; /* Same as normal button */
    min-width: 140px; /* Ensure minimum width */
}
.custom-product-slider-container .product-slide .product-slide-add-to-cart .add_to_cart_button.loading::after {
    content: "";
    display: block;
    width: 1em;
    height: 1em;
    margin: -0.5em 0 0 -0.5em;
    position: absolute;
    top: 50%;
    left: 50%;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-left-color: #ffffff;
    border-radius: 50%;
    animation: product-slide-spinner 0.75s infinite linear;
}
@keyframes product-slide-spinner { to { transform: rotate(1turn); } }

/* --- Button Replacement Logic --- */
/* HIDE the original button *after* product is added */
.custom-product-slider-container .product-slide .product-slide-add-to-cart .add_to_cart_button.added {
    display: none !important;
}

/* Style the 'View Cart' link that appears */
.custom-product-slider-container .product-slide .product-slide-add-to-cart .added_to_cart {
    display: inline-block !important; /* Make sure it's visible */
    color: #8EAC71; /* Green color */
    font-weight: 600;
    font-size: 0.9em;
    text-decoration: underline !important;
    text-underline-offset: 3px;
    background: none !important;
    border: none !important;
    padding: 0 !important;
    margin: 0; /* Reset margins */
    line-height: normal; /* Match button line height */
}
.custom-product-slider-container .product-slide .product-slide-add-to-cart .added_to_cart:hover {
    color: #7b9761; /* Darker green hover */
}

/* Out of Stock / Read More Button Styling */
.custom-product-slider-container .product-slide.outofstock .product-slide-add-to-cart .button {
    background-color: #6C5D71 !important; /* Purple */
    border-color: #6C5D71 !important;
    color: #FFFFFF !important;
}
.custom-product-slider-container .product-slide.outofstock .product-slide-add-to-cart .button:hover {
    background-color: #564a5a !important; /* Darker purple */
    border-color: #564a5a !important;
    color: #FFFFFF !important;
}


/* --- Arrow Styling --- */
.product-slider-arrow {
    color: #8EAC71;
    width: 30px;
    height: 30px;
    margin-top: -15px; /* Adjust based on final slide height */
    background-color: rgba(255, 255, 255, 0.7);
    border-radius: 50%;
    transition: background-color 0.3s ease, color 0.3s ease;
}
.product-slider-arrow::after {
    font-size: 16px;
    font-weight: bold;
}
.product-slider-arrow:hover {
     background-color: #8EAC71;
     color: #fff;
}
/* Optional: Move arrows further out if needed */
 .product-slider-arrow-prev { left: -10px; } 
 .product-slider-arrow-next { right: -10px; } 

/* === RESPONSIVE BUTTON SIZING === */
@media (max-width: 768px) {
    /* Slightly smaller buttons on mobile/tablet */
    .custom-product-slider-container .product-slide .product-slide-add-to-cart .button {
        width: 120px !important;
        font-size: 0.85em;
        padding: 7px 15px;
    }
    
    .custom-product-slider-container .product-slide .product-slide-add-to-cart .add_to_cart_button.loading {
        width: 120px !important;
        min-width: 120px;
    }
}

@media (max-width: 480px) {
    /* Even smaller buttons on very small screens */
    .custom-product-slider-container .product-slide .product-slide-add-to-cart .button {
        width: 100px !important;
        font-size: 0.8em;
        padding: 6px 12px;
    }
    
    .custom-product-slider-container .product-slide .product-slide-add-to-cart .add_to_cart_button.loading {
        width: 100px !important;
        min-width: 100px;
    }
}
