/* Quick Buy Now Frontend Styles */

/* Buy Now Button */
.qbn-buy-now-wrapper {
    margin: 15px 0;
}

.qbn-buy-now-btn {
    background-color: #0073aa;
    color: #ffffff;
    border: none;
    padding: 12px 24px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    width: 100%;
    max-width: 300px;
    display: block;
    margin: 0 auto;
}

.qbn-buy-now-btn:hover {
    background-color: #005a87;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.qbn-buy-now-btn:active {
    transform: translateY(0);
}

/* Modal Styles */
.qbn-modal {
    position: fixed;
    z-index: 999999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
    animation: qbnFadeIn 0.3s ease;
}

.qbn-modal-content {
    background-color: #ffffff;
    margin: 5% auto;
    padding: 0;
    border: 1px solid #ddd;
    border-radius: 8px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    animation: qbnSlideIn 0.3s ease;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.qbn-modal-content h3 {
    margin: 0;
    padding: 20px 30px;
    background: linear-gradient(135deg, #0073aa, #005a87);
    color: white;
    border-radius: 8px 8px 0 0;
    font-size: 24px;
    font-weight: 600;
}

.qbn-close {
    position: absolute;
    right: 15px;
    top: 15px;
    color: white;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    z-index: 1;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.3s;
}

.qbn-close:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

/* Form Styles */
.qbn-form {
    padding: 30px;
}

.qbn-product-info {
    display: flex;
    align-items: center;
    margin-bottom: 25px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #e9ecef;
}

.qbn-product-image {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 6px;
    margin-right: 15px;
    border: 2px solid #dee2e6;
}

.qbn-product-details h4 {
    margin: 0 0 8px 0;
    color: #333;
    font-size: 18px;
    font-weight: 600;
}

.qbn-price {
    font-size: 16px;
    font-weight: 600;
    color: #0073aa;
    margin: 0;
}

.qbn-field {
    margin-bottom: 20px;
}

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

.qbn-field .required {
    color: #e74c3c;
}

.qbn-field input,
.qbn-field select,
.qbn-field textarea {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.3s, box-shadow 0.3s;
    background-color: #ffffff;
    color: #333333;
    box-sizing: border-box;
}

.qbn-field input:focus,
.qbn-field select:focus,
.qbn-field textarea:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.1);
}

.qbn-field textarea {
    resize: vertical;
    min-height: 80px;
}

.qbn-total-price {
    background: #f8f9fa;
    padding: 15px 20px;
    border-radius: 6px;
    margin: 25px 0;
    text-align: center;
    border: 2px solid #0073aa;
}

.qbn-total-price strong {
    font-size: 18px;
    color: #0073aa;
}

#qbn-total-amount {
    color: #e74c3c;
    font-weight: 700;
}

/* Variation Grid Styles */
.qbn-variations-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-top: 10px;
}

.qbn-modal .qbn-variation-card,
.qbn-variation-card {
    position: relative;
    border: 2px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s ease;
    cursor: pointer;
    background: #ffffff;
}

.qbn-modal .qbn-variation-card:hover,
.qbn-variation-card:hover {
    border-color: #0073aa !important;
    box-shadow: 0 4px 12px rgba(0, 115, 170, 0.15);
    transform: translateY(-2px);
}

.qbn-variation-card input[type="radio"]:checked + .qbn-variation-label {
    background: #f0f8ff;
}

.qbn-variation-card input[type="radio"]:checked ~ .qbn-variation-label {
    background: #f0f8ff;
}

.qbn-variation-card:has(input[type="radio"]:checked) {
    border-color: #0073aa;
    background: #f0f8ff;
}

.qbn-variation-card:has(input[type="radio"]:checked) .qbn-variation-label::after {
    content: '✓';
    position: absolute;
    top: 8px;
    right: 8px;
    background: #0073aa;
    color: white;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
}

/* Fallback for browsers that don't support :has() */
.qbn-modal .qbn-variation-card.selected,
.qbn-variation-card.selected {
    border-color: #0073aa !important;
    background: #f0f8ff !important;
}

.qbn-modal .qbn-variation-card.selected .qbn-variation-label::after,
.qbn-variation-card.selected .qbn-variation-label::after {
    content: '✓';
    position: absolute;
    top: 8px;
    right: 8px;
    background: #0073aa;
    color: white;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    z-index: 10;
}

.qbn-variation-label {
    display: block;
    padding: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    border-radius: 6px;
    position: relative;
}

.qbn-variation-image {
    width: 100%;
    height: 120px;
    object-fit: cover;
    border-radius: 4px;
    margin-bottom: 10px;
}

.qbn-variation-info {
    text-align: center;
}

.qbn-variation-name {
    display: block;
    font-weight: 600;
    color: #333;
    margin-bottom: 5px;
    font-size: 14px;
}

.qbn-variation-price {
    display: block;
    color: #0073aa;
    font-weight: 600;
    font-size: 16px;
}

/* Responsive adjustments for variations grid */
@media (max-width: 768px) {
    .qbn-variations-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 10px;
    }
    
    .qbn-variation-image {
        height: 100px;
    }
    
    .qbn-variation-label {
        padding: 12px;
    }
}

@media (max-width: 480px) {
    .qbn-variations-grid {
        grid-template-columns: 1fr 1fr;
    }
}

/* Form Actions */
.qbn-form-actions {
    display: flex;
    gap: 15px;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.qbn-place-order-btn,
.qbn-cancel-btn {
    flex: 1;
    padding: 15px 20px;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.qbn-place-order-btn {
    background-color: #0073aa;
    color: #ffffff;
}

.qbn-place-order-btn:hover {
    background-color: #005a87;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 115, 170, 0.3);
}

.qbn-place-order-btn:disabled {
    background-color: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.qbn-cancel-btn {
    background-color: #6c757d;
    color: #ffffff;
}

.qbn-cancel-btn:hover {
    background-color: #5a6268;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(108, 117, 125, 0.3);
}

/* Loading State */
.qbn-loading {
    position: relative;
    pointer-events: none;
}

.qbn-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #ffffff;
    border-top: 2px solid transparent;
    border-radius: 50%;
    animation: qbnSpin 1s linear infinite;
}

/* Animations */
@keyframes qbnFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes qbnSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes qbnSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Error Messages */
.qbn-error {
    background-color: #f8d7da;
    color: #721c24;
    padding: 12px 15px;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
    margin-bottom: 20px;
    font-size: 14px;
}

.qbn-success {
    background-color: #d4edda;
    color: #155724;
    padding: 12px 15px;
    border: 1px solid #c3e6cb;
    border-radius: 4px;
    margin-bottom: 20px;
    font-size: 14px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .qbn-modal-content {
        margin: 2% auto;
        width: 95%;
        max-height: 95vh;
    }
    
    .qbn-form {
        padding: 20px;
    }
    
    .qbn-modal-content h3 {
        padding: 15px 20px;
        font-size: 20px;
    }
    
    .qbn-product-info {
        flex-direction: column;
        text-align: center;
    }
    
    .qbn-product-image {
        margin-right: 0;
        margin-bottom: 15px;
    }
    
    .qbn-form-actions {
        flex-direction: column;
    }
    
    .qbn-buy-now-btn {
        max-width: none;
        width: 100%;
    }
}

@media (max-width: 480px) {
    .qbn-modal-content {
        margin: 1% auto;
        width: 98%;
    }
    
    .qbn-form {
        padding: 15px;
    }
    
    .qbn-field input,
    .qbn-field select,
    .qbn-field textarea {
        padding: 10px 12px;
    }
    
    .qbn-place-order-btn,
    .qbn-cancel-btn {
        padding: 12px 15px;
        font-size: 14px;
    }
}