/* --- 1. PRODUCT LOOP ICONS (Grid Fix) --- */

/* Quick View Button */
.product .quick-view-button {
    display: none;
    position: absolute;
    top: 50%;
    /* Center + 5px Right (Gap reduced) */
    left: calc(50% + 5px) !important; 
    transform: translate(0, -50%) !important;
    background: var(--sb-qv-bg);
    border-radius: 50%;
    width: 35px;   /* Reduced Size */
    height: 35px;  /* Reduced Size */
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    z-index: 20;
    opacity: 0;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    padding: 0; /* Remove extra padding */
}

/* Wishlist Button */
.woocommerce ul.products li.product .bdm-wishlist-button-archive {
    display: none;
    position: absolute;
    top: 50% !important;
    /* Center - 5px Left (Gap reduced) */
    left: calc(50% - 5px) !important; 
    transform: translate(-100%, -50%) !important;
    background: #fff;
    border-radius: 50%;
    padding: 0 !important;
    width: 35px !important; /* Reduced Size */
    height: 35px !important; /* Reduced Size */
    line-height: 35px !important;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    z-index: 20;
    opacity: 0;
    text-align: center;
    justify-content: center;
    align-items: center;
}

/* Show on Hover */
.woocommerce ul.products li.product:hover .quick-view-button,
.woocommerce ul.products li.product:hover .bdm-wishlist-button-archive {
    display: flex !important;
    opacity: 1 !important;
}

.quick-view-button svg {
    width: 18px !important; /* Smaller icon inside */
    height: 18px !important;
    fill: var(--sb-qv-icon);
    stroke: var(--sb-qv-icon);
    display: block;
    transition: all 0.3s;
}

.bdm-wishlist-button-archive svg {
    width: 18px !important; /* Smaller icon inside */
    height: 18px !important;
    fill: #8C8CEA; /* Default Brand Color */
    stroke: #8C8CEA;
    display: block;
    transition: all 0.3s;
}

/* --- HOVER COLORS (Fixed Logic) --- */

/* 1. Quick View Hover: Always White */
.quick-view-button:hover {
    background: var(--sb-qv-hover-bg) !important;
}
.quick-view-button:hover svg {
    fill: var(--sb-qv-hover-icon) !important;
    stroke: var(--sb-qv-hover-icon) !important;
}

/* 2. Wishlist Hover (Not Added): White */
.bdm-wishlist-button-archive:not(.added):hover {
    background: #8C8CEA !important;
}
.bdm-wishlist-button-archive:not(.added):hover svg path {
    fill: #fff !important;
    stroke: #fff !important;
}

/* 3. Wishlist Hover (Added): Keep Green (#A1EF8B) */
/* Note: Background stays white or changes slightly, Icon stays Green */
.bdm-wishlist-button-archive.added {
    background: #fff !important; /* Keep background white when added */
}
.bdm-wishlist-button-archive.added:hover {
    background: #f0f0f0 !important; /* Slight gray on hover */
}
.bdm-wishlist-button-archive.added svg path,
.bdm-wishlist-button-archive.added:hover svg path {
    fill: #A1EF8B !important; 
    stroke: #A1EF8B !important;
}


/* --- 2. POPUP STYLES --- */

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.8);
    z-index: 99999;
    display: flex;
    justify-content: center;
    align-items: center;
}
.loading-overlay .spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #8C8CEA;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Popup Overlay */
.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(5, 51, 49, 0.7);
    z-index: 99999;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    animation: fadeIn 0.3s forwards;
    backdrop-filter: blur(3px);
}
@keyframes fadeIn { to { opacity: 1; } }

/* Popup Box */
.quick-view-popup {
    background: #fff;
    border-radius: 10px;
    width: 1050px; /* Increased Width */
    max-width: 90%;
    display: flex;
    position: relative;
    box-shadow: 0 20px 50px rgba(0,0,0,0.3);
    overflow: hidden;
    max-height: 90vh;
}

.close-popup {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 32px;
    color: #053331;
    cursor: pointer;
    z-index: 100;
    line-height: 0.8;
    transition: color 0.2s;
}
.close-popup:hover { color: #E5AE41; }

/* Layout */
.popup-left {
    width: 52%;
    position: relative;
    background: #F7F5FF;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.popup-right {
    width: 48%;
    padding: 40px 35px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

/* Zoom Container */
.zoom-container {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    cursor: crosshair;
}
.zoom-container img {
    max-width: 95%;
    max-height: 500px;
    object-fit: contain;
    transition: transform 0.1s ease-out;
}

/* Swiper Slider */
.sb-qv-swiper { width: 100%; height: 100%; position: relative; }
.sb-swiper-wrapper { display: flex; width: 100%; height: 100%; box-sizing: content-box; }
.sb-swiper-slide { flex-shrink: 0; width: 100%; height: 100%; position: relative; display: flex; align-items: center; justify-content: center; }

/* Navigation Arrows (Always Visible) */
.sb-swiper-button-next, .sb-swiper-button-prev {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    color: #5A7AED;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 50;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    transition: all 0.2s;
    opacity: 1 !important;
    border: 1px solid #eee;
}
.sb-swiper-button-next:hover, .sb-swiper-button-prev:hover {
    background: #5A7AED; color: #fff; border-color: #5A7AED;
}
.sb-swiper-button-prev { left: 15px; }
.sb-swiper-button-next { right: 15px; }
.sb-swiper-button-next svg, .sb-swiper-button-prev svg {
    width: 20px; height: 20px; stroke: currentColor; display: block;
}

/* Pagination */
.sb-swiper-pagination { position: absolute; bottom: 15px; left: 0; width: 100%; text-align: center; z-index: 50; }
.sb-swiper-pagination-bullet { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #AABADA; margin: 0 5px; cursor: pointer; opacity: 1; transition: all 0.3s; }
.sb-swiper-pagination-bullet-active { background: #5A7AED; transform: scale(1.3); }

/* Product Info */
.popup-right h2 {
    margin-top: 0;
    font-size: 26px;
    margin-bottom: 15px;
    line-height: 1.3;
    color: #053331;
}

/* Pricing (Brand Colors - No Red) */
.sb-custom-price {
    font-family: sans-serif;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}
.sb-custom-price del {
    color: #AABADA;
    font-size: 18px; /* Smaller */
    text-decoration: line-through;
    font-weight: 500;
}
.sb-custom-price ins {
    color: #5A7AED; /* Blueberry */
    font-size: 30px; /* Larger */
    font-weight: 700;
    text-decoration: none;
}
.sb-custom-price .amount bdi { font-family: inherit; }

/* Discount Badge (Meat Brown) */
.sb-discount-badge {
    color: #fff;
    font-weight: 700;
    font-size: 14px;
    background: #E5AE41; /* Brand Highlight */
    padding: 3px 8px;
    border-radius: 4px;
}

.popup-right .description {
    font-size: 15px;
    color: #666;
    margin-bottom: 30px;
    line-height: 1.6;
}

/* Buttons Layout */
.popup-buttons {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 10px !important;
    margin-top: auto;
}
.popup-buttons a,
.popup-buttons button {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 12px 20px !important;
    font-size: 15px !important;
    font-weight: 600 !important;
    border-radius: 6px !important;
    text-decoration: none !important;
    border: none !important;
    flex: 1 1 auto !important;
    min-width: 120px !important;
    text-align: center !important;
    cursor: pointer !important;
    color: #fff !important;
    transition: transform 0.2s, opacity 0.2s !important;
}
.popup-buttons a:hover,
.popup-buttons button:hover {
    transform: translateY(-2px) !important;
    opacity: 0.95 !important;
}

/* Specific Button Colors */
.popup-buttons .add_to_cart_button.loading { opacity: 0.7 !important; cursor: wait !important; }
.popup-buttons .added_to_cart { background-color: #1C7B7F !important; display: inline-flex !important; } /* View Cart Color */

.popup-buttons .buy_now_button {
    /* Style handled by dynamic CSS */
}
.popup-buttons .whatsapp_button {
    /* Style handled by dynamic CSS */
}
.popup-buttons .call-now-button {
    white-space: nowrap !important;
    /* Style handled by dynamic CSS */
}

/* Wishlist Button inside Popup */
.popup-buttons .bdm-wishlist-button {
    min-width: 45px !important;
    width: 45px !important;
    height: auto !important;
    flex: 0 0 45px !important;
    padding: 0 !important;
    background: transparent !important;
    border: 2px solid #E5E5E5 !important;
    border-radius: 6px !important;
    display: flex !important;
}
.popup-buttons .bdm-wishlist-button svg { width: 24px; height: 24px; }
.popup-buttons .bdm-wishlist-button svg path { stroke: #8C8CEA !important; }
.popup-buttons .bdm-wishlist-button.added svg path { fill: #A1EF8B !important; stroke: #A1EF8B !important; }

/* --- MOBILE RESPONSIVE FIXES --- */
@media (max-width: 768px) {
    .quick-view-popup {
        flex-direction: column;
        width: 95% !important;
        height: auto;
        max-height: 85vh;
        overflow-y: auto;
    }
    .popup-left {
        width: 100%;
        height: 250px;
        background: #fff;
    }
    .zoom-container img { max-height: 220px; }
    
    .popup-right {
        width: 100%;
        padding: 20px;
    }
    
    /* Hide Description on Mobile */
    .popup-right .description {
        display: none !important;
    }
    
    .popup-right h2 { font-size: 18px; }
    .sb-custom-price ins { font-size: 24px; }
    
    .popup-buttons {
        display: grid !important;
        grid-template-columns: 1fr 1fr;
        gap: 10px !important;
    }
    
    .popup-buttons a, 
    .popup-buttons button {
        padding: 10px !important;
        font-size: 13px !important;
        width: 100% !important; /* Ensure buttons fill the grid area */
        min-width: auto !important;
    }
    
    /* Button layout is now handled by the generic flex rule above */

    /* Hide Number inside Call Button on Mobile */
    .call-now-number-text {
        display: none !important;
    }
}