/* Quick View Modal - Clean Design */
#cwqv-modal {
    position: fixed;
    top: 0px;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999; /* Reduced to avoid conflicts */
    display: none;
    align-items: center;
    justify-content: center;
}

#cwqv-modal.show {
    display: flex;
}

.cwqv-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.cwqv-modal-container {
    position: relative;
    z-index: 10000;
    max-width: 450px; /* Matches second screenshot width */
    width: 90%;
    max-height: 85vh;
    margin: 0 auto;
    top:75px;
}

.cwqv-modal-content {
    background: white;
    border-radius: 12px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    text-align: center; /* Center all content */
    /* padding: 12px; */ /* Added padding to match screenshot */
}

.cwqv-modal-close {
    position: absolute;
    top: 7px;
    right: 7px;
    background: none;
    border: none;
    font-size: 24px;
    color: #999;
    cursor: pointer;
    z-index: 10;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.cwqv-modal-close:hover {
    background: #f0f0f0;
    color: #333;
}

.cwqv-content-wrapper {
    /* max-height: 77vh; */
    /* overflow-y: auto; */
}

.cwqv-loading {
    text-align: center;
    padding: 40px 20px;
    font-size: 16px;
    color: #666;
}

/* Modal Header */
.cwqv-modal-header {
    text-align: center;
    padding: 12px; /* Adjusted to match screenshot */
    border-bottom: 1px solid #f0f0f0;
}

.cwqv-product-title {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
    color: #333;
}

/* Modal Body */
.cwqv-modal-body {
    padding: 12px 12px 20px 12px; /* Removed padding to control with .cwqv-modal-content */
    display: flex;
    flex-direction: column;
    align-items: center;
    max-height: 77vh;
    overflow-y: auto;
}
.cwqv-product-info {
    width: 100%;
}
.cwqv-product-image {
    text-align: center;
    margin-bottom: 20px;
}

.cwqv-product-image img {
    width: 120px;
    height: 120px;
    object-fit: cover;
    border-radius: 50%;
    border: 3px solid #f0f0f0;
}

/* Price Section */
.cwqv-price-section {
    margin-bottom: 20px;
    font-size: 16px;
}

.cwqv-price-label {
    color: #666;
    margin-right: 5px;
}

.cwqv-price-value {
    color: #333;
    font-weight: 600;
}

/* Quantity Section */
.cwqv-quantity-section {
    margin-bottom: 20px;
}

.cwqv-quantity-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    max-width: 100%;
    margin: 0 auto;
    overflow: hidden;
     /* Matches screenshot background */
    border-radius: 10px;
}

button[type=button].cwqv-qty-btn {
    background: #ff8c42; /* Orange as in screenshot */
    color: white;
    border: none;
    width: 40px;
    height: 40px; /* Adjusted to match screenshot */
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0; /* Remove padding to fit screenshot */
    border-radius: 0;
}

.cwqv-qty-btn:hover {
    background: #e67a35;
}

.cwqv-qty-plus {
    order: 3;
}

.cwqv-qty-minus {
    order: 1;
}

input[type=number].cwqv-qty-input {
    border-radius: 0;
    order: 2;
    width: 60px;
    height: 40px; /* Adjusted to match screenshot */
    text-align: center;
    border: none;
    background: white;
    font-size: 16px;
    font-weight: 600;
    color: #333;
    outline: none;
    border-top: 1px solid #666;
    padding: .5rem 1rem;
    transition: all .3s;
    width: 100%;
    border-bottom: 1px solid #666;
}

/* Notes Section */
.cwqv-notes-section {
    margin-bottom: 20px;
}

.cwqv-notes {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    min-height: 40px;
    transition: border-color 0.3s ease;
}

.cwqv-notes:focus {
    outline: none;
    border-color: #ff8c42;
    box-shadow: 0 0 0 3px rgba(255, 140, 66, 0.1);
}

.cwqv-notes::placeholder {
    color: #999;
}

/* Total Section */
.cwqv-total-section {
    margin-bottom: 25px;
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

.cwqv-total-label {
    margin-right: 5px;
}

.cwqv-total-amount {
    color: #ff8c42;
}

/* Buttons */
.cwqv-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
}

.cwqv-add-to-cart-btn,
.cwqv-close-btn {
    width: 100%;
    padding: 14px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: none;
}

.cwqv-buttons-custom button[type=button].cwqv-add-to-cart-btn {
    background: #ff8c42; /* Orange as in screenshot */
    color: white;
    border:0;
}
.cwqv-buttons-custom button[type=button].cwqv-close-btn {
    display: block;
    border: 0;
}
.cwqv-add-to-cart-btn:hover:not(:disabled) {
    background: #e67a35;
    transform: translateY(-1px);
}

.cwqv-add-to-cart-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

.cwqv-add-to-cart-btn.loading {
    opacity: 0.7;
    pointer-events: none;
}

button[type=button].cwqv-close-btn {
    background: #dc3545; /* Red as in screenshot */
    color: white;
    display: none;
}

.cwqv-close-btn:hover {
    background: #c82333;
    transform: translateY(-1px);
}

/* Out of Stock */
.cwqv-out-of-stock {
    text-align: center;
    padding: 20px;
    color: #dc3545;
    font-weight: 600;
    display: none; /* Hide by default, show conditionally via JS/PHP */
}

/* Messages */
.cwqv-message {
    margin-bottom: 15px;
    padding: 12px 15px;
    border-radius: 6px;
    font-size: 14px;
    position: relative;
}

.cwqv-message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.cwqv-message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.cwqv-message-close {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 16px;
    cursor: pointer;
    color: inherit;
    opacity: 0.7;
}

.cwqv-message-close:hover {
    opacity: 1;
}

/* Quick View Button */
.cwqv-button-wrapper {
    position: absolute;
    top: 10px;
    right: 10px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.woocommerce ul.products li.product:hover .cwqv-button-wrapper {
    opacity: 1;
}

.cwqv-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: rgba(255, 140, 66, 0.9);
    color: white;
    border-radius: 50%;
    text-decoration: none;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.cwqv-button:hover {
    background: #ff8c42;
    transform: scale(1.1);
    color: white;
    text-decoration: none;
}

.cwqv-icon {
    font-size: 16px;
}

/* Plus Button Styles */
.cwqv-plus-button-wrapper {
    display: inline-block;
    margin: 5px;
}

.cwqv-plus-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: #ff8c42;
    color: white;
    border-radius: 10px;
    text-decoration: none;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(255, 140, 66, 0.3);
}

.cwqv-plus-button:hover {
    background: #e67a35;
    transform: scale(1.1);
    color: white;
    text-decoration: none;
    box-shadow: 0 4px 12px rgba(255, 140, 66, 0.4);
}

.cwqv-plus-icon {
    font-size: 20px;
    font-weight: bold;
    line-height: 1;
}

.cwqv-plus-text {
    font-size: 12px;
    font-weight: 600;
}

/* Responsive Design */
@media (max-width: 768px) {
    .cwqv-modal-container {
        width: 95%;
        max-width: none;
    }
    
    .cwqv-modal-content {
        border-radius: 8px;
        top:50px;
    }
    
    .cwqv-product-image img {
        width: 100px;
        height: 100px;
    }
    
    .cwqv-product-title {
        font-size: 16px;
    }
    
    .cwqv-modal-body {
        padding: 15px;
    }
    
    .cwqv-modal-header {
        padding: 15px 15px 10px 15px;
    }
}

@media (max-width: 480px) {
    .cwqv-modal-container {
        width: 98%;
    }
    
    .cwqv-product-image img {
        width: 80px;
        height: 80px;
    }
    
    .cwqv-quantity-controls {
        max-width: 120px;
    }
    
    .cwqv-qty-btn {
        width: 35px;
        height: 40px;
        font-size: 16px;
    }
    
    .cwqv-qty-input {
        width: 50px;
        height: 40px;
        font-size: 14px;
    }
}

/* Animation */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

#cwqv-modal.show .cwqv-modal-content {
    animation: fadeIn 0.3s ease;
}

/* Loading Animation */
.cwqv-loading {
    position: relative;
}

.cwqv-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #ff8c42;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 10px;
}

@keyframes spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Custom Scrollbar */
.cwqv-content-wrapper::-webkit-scrollbar {
    width: 6px;
}

.cwqv-content-wrapper::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.cwqv-content-wrapper::-webkit-scrollbar-thumb {
    background: #ff8c42;
    border-radius: 3px;
}

.cwqv-content-wrapper::-webkit-scrollbar-thumb:hover {
    background: #e67a35;
}

/* Focus States for Accessibility */
.cwqv-button:focus,
.cwqv-modal-close:focus,
.cwqv-add-to-cart-btn:focus,
.cwqv-close-btn:focus,
.cwqv-qty-btn:focus {
    outline: 2px solid #ff8c42;
    outline-offset: 2px;
}

/* RTL Support */
[dir="rtl"] .cwqv-select {
    background-position: left 12px center;
    padding-left: 40px;
    padding-right: 15px;
}

[dir="rtl"] .cwqv-modal-close {
    right: auto;
    left: 15px;
}

[dir="rtl"] .cwqv-button-wrapper {
    right: auto;
    left: 10px;
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .cwqv-modal-content {
        border: 2px solid #000;
    }
    
    .cwqv-select,
    .cwqv-notes {
        border-color: #000;
    }
    
    .cwqv-add-to-cart-btn,
    .cwqv-close-btn {
        border: 2px solid #000;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .cwqv-button,
    .cwqv-modal-close,
    .cwqv-add-to-cart-btn,
    .cwqv-close-btn,
    .cwqv-select,
    .cwqv-notes,
    .cwqv-qty-btn,
    #cwqv-modal,
    .cwqv-modal-content {
        transition: none;
        animation: none;
    }
    
    .cwqv-button:hover {
        transform: none;
    }
    
    .cwqv-add-to-cart-btn:hover:not(:disabled),
    .cwqv-close-btn:hover {
        transform: none;
    }
}

.cwqv-buttons-custom {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
}