/* Quick View Modal Styles */
.quick-view-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 99999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.quick-view-modal.open {
    display: block;
    opacity: 1;
}

.quick-view-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

.quick-view-content {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background: #fff;
    border-radius: 20px 20px 0 0;
    padding: 25px;
    box-shadow: 0 -5px 30px rgba(0,0,0,0.15);
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    max-height: 90vh;
    overflow-y: auto;
    direction: rtl;
}

.quick-view-modal.open .quick-view-content {
    transform: translateY(0);
}

@media (min-width: 768px) {
    .quick-view-content {
        bottom: auto;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%) scale(0.95);
        width: 90%;
        max-width: 900px;
        border-radius: 16px;
        display: flex;
        gap: 40px;
        padding: 40px;
        overflow: visible;
    }
    
    .quick-view-modal.open .quick-view-content {
        transform: translate(50%, -50%) scale(1);
    }
    
    html[dir="rtl"] .quick-view-content {
         transform: translate(50%, -50%) scale(0.95);
         right: 50%;
         left: auto;
    }
    html[dir="rtl"] .quick-view-modal.open .quick-view-content {
        transform: translate(50%, -50%) scale(1);
    }

    .qv-product-image {
        width: 45%;
        flex-shrink: 0;
    }
    
    .qv-product-details {
        flex-grow: 1;
        padding-top: 10px;
    }
}

/* Close Button */
.close-modal {
    position: absolute;
    top: 15px;
    left: 15px;
    right: auto;
    background: #f0f0f0;
    border: none;
    font-size: 20px;
    cursor: pointer;
    z-index: 100;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: #333;
    transition: all 0.2s ease;
    outline: none !important;
}

.close-modal:hover {
    background: #e0e0e0;
    transform: rotate(90deg);
}

/* Remove Blue Highlight */
button:focus, 
input:focus, 
select:focus, 
a:focus {
    outline: none !important;
    box-shadow: none !important;
    -webkit-tap-highlight-color: transparent;
}

/* Product Details */
.qv-product-image img {
    width: 100%;
    height: auto;
    border-radius: 12px;
    object-fit: cover;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.qv-product-details h3 {
    margin: 0 0 15px;
    font-size: 22px;
    font-weight: 700;
    color: #1a1a1a;
    line-height: 1.3;
}

.qv-price {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 25px;
    color: #000;
    display: flex;
    align-items: center;
    gap: 10px;
}

.qv-price del {
    color: #999;
    font-size: 16px;
    font-weight: 400;
}

/* Variations */
.variations {
    width: 100%;
    margin-bottom: 20px;
    border: none;
}

.variations td {
    display: block;
    padding: 0 0 15px;
    border: none;
}

.variations label {
    font-weight: 600;
    margin-bottom: 8px;
    display: block;
    color: #444;
    font-size: 14px;
}

.variations select {
    width: 100%;
    padding: 12px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background: #fff;
    font-size: 14px;
    color: #333;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: left 12px center;
    background-size: 16px;
}

/* === Quantity Box Styling (Unified for Quick View & Single Product) === */
/* We target both contexts to ensure consistency and fix the "right align" issue */
.quick-view-content .quantity,
.product-page-container .quantity,
.quantity {
    display: flex !important;
    align-items: center !important;
    background: #fff !important;
    border: 1px solid #e1e1e1 !important;
    border-radius: 8px !important;
    height: 48px !important;
    padding: 0 !important;
    gap: 0 !important;
    overflow: hidden !important;
    width: 140px !important;
    margin-left: 15px !important;
    box-sizing: border-box !important;
}

/* Buttons (+/-) */
.quantity button, 
.quantity .plus, 
.quantity .minus {
    width: 40px !important;
    height: 100% !important;
    background: #f9f9f9 !important;
    border: none !important;
    color: #333 !important;
    font-size: 18px !important;
    font-weight: 500 !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.2s ease !important;
    flex-shrink: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
}

.quantity button:hover,
.quantity .plus:hover, 
.quantity .minus:hover {
    background: #eee !important;
    color: #000 !important;
}

/* Input Field */
.quantity input.qty,
.quantity .qty {
    flex: 1 !important;
    height: 100% !important;
    text-align: center !important;
    border: none !important;
    border-left: 1px solid #e1e1e1 !important;
    border-right: 1px solid #e1e1e1 !important;
    background: #fff !important;
    color: #000 !important;
    font-size: 16px !important;
    font-weight: 600 !important;
    padding: 0 !important;
    margin: 0 !important;
    line-height: normal !important;
    box-shadow: none !important;
    outline: none !important;
    -moz-appearance: textfield !important;
    -webkit-appearance: none !important;
    width: auto !important;
    min-width: 0 !important;
}

/* Hide spin buttons */
.quantity input[type=number]::-webkit-inner-spin-button, 
.quantity input[type=number]::-webkit-outer-spin-button { 
  -webkit-appearance: none; 
  margin: 0; 
}

/* Add to Cart Section */
.woocommerce-variation-add-to-cart, 
.cart {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    gap: 10px;
}

button.single_add_to_cart_button {
    flex-grow: 1;
    background: #000;
    color: #fff;
    border: none;
    padding: 0 25px;
    height: 48px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: background 0.3s ease;
}

button.single_add_to_cart_button:hover {
    background: #333;
}

/* Buy Now Button */
button.buy_now_btn {
    width: 100%;
    margin-top: 12px;
    background: #fff;
    color: #000;
    border: 2px solid #000;
    padding: 12px;
    height: 48px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
}

button.buy_now_btn:hover {
    background: #000;
    color: #fff;
}

/* Loading State */
.quick-view-content.loading {
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.quick-view-content.loading::after {
    content: "";
    width: 40px;
    height: 40px;
    border: 3px solid #f3f3f3;
    border-top-color: #000;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}
