/* Sidebar Sticky Behavior */
.rp-apf-sidebar {
    margin-top: 0px !important;
    position: -webkit-sticky; 
    position: sticky;
    top: 100px; 
    max-height: calc(100vh - 40px); 
    overflow-y: auto; 
    z-index: 100;
}

/* Layout */
.rp-apf-layout {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 30px;
    align-items: start; 
}

.rp-apf-results {
    position: relative;
    min-height: 400px;
    padding-top: 0;
}

.rp-apf-product-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

/* Sidebar Filters */
.rp-apf-filters {
    list-style: none !important;
    padding: 0;
    margin: 0;
    border: 1px solid #eee;
}

.rp-apf-filter {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    background: #fff;
    line-height: 1.4;
}

.rp-apf-filter.active {
    background: #000000 !important;
    color: #ffffff !important;
}

.rp-apf-count {
    margin-left: 8px;
    font-size: 0.9em;
    color: #666;
    flex-shrink: 0;
}

/* Product Cards - Updated for alignment */
.rp-apf-product {
    border: 1px solid #eee;
    padding: 15px;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 15px; 
    justify-content: flex-start;
    align-items: center;
    overflow: visible;
    height: 100%; 
}

/* Pushes the content below to the bottom */
.rp-apf-product-image {
    flex-grow: 1; 
    display: flex;
    align-items: center;
    width: 100%;
}

.rp-apf-product-image img {
    width: 100%;
    height: auto;
    object-fit: contain;
    cursor: pointer;
}

/* Ensure title and price stay together above the quantity */
.rp-apf-product h3, 
.rp-apf-product .price {
    margin: 0;
    width: 100%;
}

/* Quantity Selector Styling - Moves above the button */
.rp-apf-cart {
    display: flex;
    flex-direction: column; 
    gap: 10px;
    width: 100%;
    margin-top: auto; 
}

/* Global Button Styles (Grid & Popup) */
.rp-add-to-cart,
.rp-apf-cart .button.ajax_add_to_cart,
.rp-qv-summary .single_add_to_cart_button.button {
    background: #000000 !important;
    color: #ffffff !important;
    border: none !important;
    padding: 10px 20px !important;
    cursor: pointer;
    text-transform: uppercase;
    font-weight: 500;
    border-radius: 0;
    line-height: 1;
    width: 100%;
}

.rp-apf-cart .button.ajax_add_to_cart:hover,
.rp-qv-summary .single_add_to_cart_button.button:hover {
    background: #333333 !important;
}

/* Sorting */
.rp-apf-sorting {
    margin-bottom: 0px;
    display: flex;
    justify-content: flex-end;
}

/* Quick View Modal */
.rp-modal {
    display: none;
    position: fixed;
    z-index: 99999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
}

.rp-modal-content {
    background: #fff;
    margin: 5% auto;
    padding: 40px;
    width: 80%;
    max-width: 900px;
    position: relative;
    border-radius: 4px;
    max-height: 90vh;
    overflow-y: auto;
}

.rp-qv-container {
    display: flex;
    gap: 40px;
}

.rp-qv-image,
.rp-qv-summary {
    flex: 1;
}

.rp-close {
    position: absolute;
    right: 20px;
    top: 10px;
    font-size: 30px;
    cursor: pointer;
    color: #333;
}

/* Quantity Selector & Removing Browser Arrows */
.rp-qv-cart .cart {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* Hide Chrome/Safari/Brave arrows */
.quantity input::-webkit-outer-spin-button,
.quantity input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* Hide Firefox arrows */
.quantity input[type=number] {
  -moz-appearance: textfield;
}

.quantity {
    display: inline-flex;
    align-items: center;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: #fff;
    overflow: hidden;
    margin: 0 auto;
}

.quantity input.qty {
    border: none !important;
    width: 40px !important;
    text-align: center;
    padding: 0 !important;
    margin: 0 !important;
    height: 32px;
}

.qty-btn {
    width: 32px;
    height: 32px;
    background: #f5f5f5;
    border: none;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.qty-btn:hover {
    background: #e9e9e9;
}

/* --- MOBILE DROPDOWN RESTORED --- */
@media (max-width: 768px) {
    .rp-apf-layout {
        display: block;
    }
    
    .rp-apf-product-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .rp-apf-sidebar {
        position: sticky;
        top: 0;
        z-index: 1001;
        background: #fff;
        margin: 0 -15px 20px -15px;
        max-height: none;
        border-bottom: 2px solid #000;
    }

    /* Mobile Toggle Label */
    .rp-apf-sidebar::before {
        content: "Filter Products ▾";
        display: block;
        padding: 15px;
        font-weight: bold;
        text-align: center;
        background: #000;
        color: #fff;
        cursor: pointer;
    }

    /* Collapse filters on mobile by default */
    .rp-apf-filters {
        display: none;
        max-height: 350px;
        overflow-y: auto;
    }

    /* Class added via JS to show filters */
    .rp-apf-sidebar.open .rp-apf-filters {
        display: block;
    }

    .rp-qv-container {
        flex-direction: column;
    }
}

/* Header & Utility */
.rp-apf-cart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f9f9f9;
    padding: 15px 20px;
    margin-bottom: 20px;
    border: 1px solid #eee;
    border-radius: 4px;
}

.rp-apf-cart-total {
    font-weight: bold;
    font-size: 1.1em;
}

.rp-cart-amount {
    color: #27ae60;
}

.rp-qv-cart {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.rp-apf-loader, .loading-wrapper::after {
    display: none !important;
}

.entry-content ul {
    padding: 0 !important;
}

/* Floating Cart Icon with Glow Effect */
.rp-apf-floating-cart {
    position: fixed !important;
    bottom: 20px !important;
    right: 20px !important;   /* force right side */
    left: auto !important;    /* cancel any left positioning */
    font-size: 28px;
    text-decoration: none;
    color: #fff !important;
    z-index: 9999;
    background: #111 !important;
    border-radius: 50%;
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: none;
    position: relative;
    border: none !important;
}


/* Glow effect around the button */
.rp-apf-floating-cart::before {
    content: "";
    background: linear-gradient(45deg, #ff0000, #ff7300, #fffb00, #48ff00,
                                #00ffd5, #002bff, #7a00ff, #ff00c8, #ff0000);
    position: absolute;
    top: -3px;
    left: -3px;
    background-size: 400%;
    z-index: -1;
    filter: blur(6px);
    width: calc(100% + 6px);
    height: calc(100% + 6px);
    animation: glowing-button-85 20s linear infinite;
    border-radius: 50%;
}

.rp-apf-floating-cart::after {
    z-index: -1;
    content: "";
    position: absolute;
    width: 100%;
    height: 100%;
    background: #111;
    left: 0;
    top: 0;
    border-radius: 50%;
}

/* Overlay for cart count */
.rp-apf-floating-cart .rp-cart-overlay {
    position: absolute;
    top: -6px;
    right: -6px;
    background: #ff0000;
    color: #fff;
    font-size: 12px;
    font-weight: bold;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

/* Glow animation */
@keyframes glowing-button-85 {
    0% { background-position: 0 0; }
    50% { background-position: 400% 0; }
    100% { background-position: 0 0; }
}
/* Product Search Field */
.rp-apf-search {
    display: flex;
    gap: 8px;
    align-items: center;
}

#rp-apf-search-input {
    padding: 6px 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    flex: 1;
}

#rp-apf-search-btn {
    background: #000;
    color: #fff;
    border: none;
    padding: 6px 12px;
    cursor: pointer;
    border-radius: 4px;
}

#rp-apf-search-btn:hover {
    background: #333;
}

/* Clear Cart Button */
.rp-clear-cart-btn {
    background: #c0392b;
    color: #fff;
    border: none;
    padding: 6px 12px;
    cursor: pointer;
    border-radius: 4px;
    margin-left: 10px;
}

.rp-clear-cart-btn:hover {
    background: #a93226;
}
/* Cart Header Layout */
.rp-apf-cart-header {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 15px;
}

/* Each element behaves nicely in flex */
.rp-apf-cart-total,
.rp-clear-cart-btn,
.rp-apf-sorting,
.rp-apf-search {
    flex: 1 1 auto;
    min-width: 120px;
}

/* Buttons and inputs */
.rp-clear-cart-btn,
#rp-apf-search-btn {
    padding: 6px 10px;
    border-radius: 4px;
    cursor: pointer;
}

/* Mobile-specific tweaks */
@media (max-width: 768px) {
    .rp-apf-cart-header {
        flex-direction: column;
        align-items: stretch;
    }

    .rp-apf-cart-total,
    .rp-clear-cart-btn,
    .rp-apf-sorting,
    .rp-apf-search {
        width: 100%;
        margin-bottom: 8px;
    }

    #rp-apf-search-input {
        width: 100%;
    }
}
/* --- UPDATED QUICK VIEW GALLERY --- */

/* 1. The container must be relative for the arrows to anchor to it */
.rp-qv-images {
    position: relative; 
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.rp-qv-image-main {
    position: relative;
    width: 100%;
}

.rp-qv-main-img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
}

/* 2. Style the Navigation Arrows */
.rp-qv-prev, .rp-qv-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.8); /* Light background for visibility */
    color: #000;
    border: 1px solid #ddd;
    font-size: 24px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.rp-qv-prev:hover, .rp-qv-next:hover {
    background: #000;
    color: #fff;
}

.rp-qv-prev { left: 10px; }
.rp-qv-next { right: 10px; }

/* 3. Thumbnail Styling & Active State */
.rp-qv-gallery {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

.rp-qv-thumb img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    cursor: pointer;
    border: 2px solid transparent; /* Space for the active border */
    border-radius: 4px;
    transition: border-color 0.2s ease;
}

/* This matches the JS .addClass('active') */
.rp-qv-thumb img.active {
    border-color: #000;
}

.rp-qv-thumb img:hover {
    border-color: #666;
}

/* 4. Modal Responsiveness Fix */
@media (max-width: 768px) {
    .rp-modal-content {
        width: 95%;
        padding: 20px;
        margin: 10% auto;
    }
    
    .rp-qv-container {
        flex-direction: column;
        gap: 20px;
    }
}
#rp-apf-products {
    background: transparent !important;
}
.rp-apf-product-grid {
    background: transparent !important;
}
.rp-apf-product {
    background: #fff; /* or transparent, depending on your design */
}
.products {
    background: transparent !important;
}
