/**
 * Frontend CSS for Quick Buy Modal
 */

/* Modal Overlay */
.wcqbm-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.wcqbm-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Modal Container */
.wcqbm-modal {
    background-color: #fff;
    border-radius: 6px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    width: 90%;
    max-width: 550px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.wcqbm-modal-overlay.active .wcqbm-modal {
    opacity: 1;
    transform: translateY(0);
}

/* Modal Header */
.wcqbm-modal-header {
    padding: 20px 25px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #f8f9fa;
    border-top-left-radius: 6px;
    border-top-right-radius: 6px;
}

.wcqbm-modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
    color: var(--wcqbm-heading-color, #333333);
}

.wcqbm-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    line-height: 1;
    color: #999;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.wcqbm-modal-close:hover {
    background-color: #f1f1f1;
    color: #333;
}

/* Modal Body */
.wcqbm-modal-body {
    padding: 25px;
}

/* Product Info */
.wcqbm-product-info {
    display: flex;
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
}

.wcqbm-product-image {
    width: 80px;
    height: 80px;
    margin-right: 15px;
    border: 1px solid #eee;
    border-radius: 4px;
    overflow: hidden;
    background-color: #f9f9f9;
    flex-shrink: 0;
}

.wcqbm-product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.wcqbm-product-details {
    flex-grow: 1;
}

.wcqbm-product-title {
    margin: 0 0 8px;
    font-size: 1.2rem;
    line-height: 1.4;
    font-weight: 600;
}

.wcqbm-product-price {
    font-size: 1.1rem;
    color: var(--wcqbm-button-color, #0073aa);
    font-weight: 600;
}

/* Form Styles */
#wcqbm-order-form .wcqbm-form-row {
    margin-bottom: 20px;
}

#wcqbm-order-form label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    font-size: 0.95rem;
}

#wcqbm-order-form input[type="text"],
#wcqbm-order-form input[type="tel"],
#wcqbm-order-form input[type="email"],
#wcqbm-order-form textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    line-height: 1.5;
    transition: border-color 0.2s ease;
    outline: none;
    background-color: #f9f9f9;
}

#wcqbm-order-form input[type="text"]:focus,
#wcqbm-order-form input[type="tel"]:focus,
#wcqbm-order-form input[type="email"]:focus,
#wcqbm-order-form textarea:focus {
    border-color: var(--wcqbm-button-color, #0073aa);
    box-shadow: 0 0 0 2px rgba(0, 115, 170, 0.2);
    background-color: #fff;
}

#wcqbm-order-form textarea {
    height: 100px;
    resize: vertical;
}

/* Quantity Controls */
.wcqbm-quantity-container {
    margin-bottom: 25px;
}

.wcqbm-quantity-controls {
    display: flex;
    align-items: center;
    max-width: 150px;
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow: hidden;
    background-color: #f9f9f9;
}

.wcqbm-quantity-minus,
.wcqbm-quantity-plus {
    background: none;
    border: none;
    width: 36px;
    height: 36px;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #555;
    background-color: #f1f1f1;
    transition: background-color 0.2s ease;
}

.wcqbm-quantity-minus:hover,
.wcqbm-quantity-plus:hover {
    background-color: #e5e5e5;
}

#wcqbm-quantity {
    flex-grow: 1;
    border: none;
    text-align: center;
    font-size: 16px;
    padding: 8px 0;
    width: 50px;
    -moz-appearance: textfield;
    background-color: transparent;
}

#wcqbm-quantity::-webkit-outer-spin-button,
#wcqbm-quantity::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Submit Button */
.wcqbm-submit-order {
    background-color: var(--wcqbm-button-color, #0073aa);
    color: var(--wcqbm-button-text-color, #fff);
    border: none;
    border-radius: 4px;
    padding: 12px 24px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    text-align: center;
    transition: background-color 0.2s ease;
    margin-top: 10px;
}

.wcqbm-submit-order:hover {
    background-color: var(--wcqbm-button-hover-color, #005f8b);
}

/* Modal Footer */
.wcqbm-modal-footer {
    padding: 15px 25px;
    border-top: 1px solid #eee;
    text-align: center;
    background-color: #f8f9fa;
    border-bottom-left-radius: 6px;
    border-bottom-right-radius: 6px;
}

.wcqbm-secure-checkout {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: #666;
}

.wcqbm-secure-checkout .dashicons {
    color: #4CAF50;
    margin-right: 8px;
}

/* Error Message */
.wcqbm-error-message {
    color: #D32F2F;
    padding: 10px;
    margin-bottom: 15px;
    border-radius: 4px;
    font-size: 14px;
    display: none;
}

.wcqbm-error-message.active {
    display: block;
    background-color: #FFEBEE;
    border-left: 3px solid #D32F2F;
}

/* Success Message */
.wcqbm-success-message {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background-color: #fff;
    border-radius: 6px;
    text-align: center;
    padding: 30px;
}

.wcqbm-success-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: #4CAF50;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
    color: white;
    margin-bottom: 20px;
}

.wcqbm-success-message h3 {
    font-size: 1.5rem;
    margin-bottom: 10px;
}

.wcqbm-success-message p {
    color: #666;
    margin-bottom: 20px;
}

.wcqbm-close-success {
    background-color: var(--wcqbm-button-color, #0073aa);
    color: var(--wcqbm-button-text-color, #fff);
    border: none;
    border-radius: 4px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.wcqbm-close-success:hover {
    background-color: var(--wcqbm-button-hover-color, #005f8b);
}

/* Shop/Archive Button */
.wcqbm-buy-button {
    background-color: var(--wcqbm-button-color, #0073aa) !important;
    color: var(--wcqbm-button-text-color, #fff) !important;
    transition: background-color 0.2s ease !important;
}

.wcqbm-buy-button:hover {
    background-color: var(--wcqbm-button-hover-color, #005f8b) !important;
}

/* Animations */
@keyframes wcqbm-fadein {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes wcqbm-slidein {
    from { transform: translateY(20px); opacity: 0; }
    to   { transform: translateY(0); opacity: 1; }
}

/* Responsive Styles */
@media (max-width: 600px) {
    .wcqbm-modal {
        width: 95%;
        max-height: 95vh;
    }
    
    .wcqbm-modal-header h2 {
        font-size: 1.3rem;
    }
    
    .wcqbm-product-info {
        flex-direction: column;
    }
    
    .wcqbm-product-image {
        width: 100%;
        height: 200px;
        margin-right: 0;
        margin-bottom: 15px;
    }
    
    #wcqbm-order-form input[type="text"],
    #wcqbm-order-form input[type="tel"],
    #wcqbm-order-form input[type="email"],
    #wcqbm-order-form textarea {
        font-size: 16px; /* Prevent zoom on iOS */
    }
    
    .wcqbm-modal-body,
    .wcqbm-modal-header,
    .wcqbm-modal-footer {
        padding: 15px;
    }
}
