/* Checkout Popup Overlay */
.checkout-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow-y: auto;
}

.checkout-popup-wrapper {
    position: relative;
    width: 100%;
    max-width: 900px;
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    max-height: 90vh;
    min-height: 300px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: popupSlideIn 0.3s ease-out;
    margin: auto;
}

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

/* Checkout Popup Header */
.checkout-popup-header {
    padding: 20px 30px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8f8f8;
}

.checkout-popup-header h2 {
    margin: 0;
    font-size: 24px;
    color: #333;
    font-weight: 600;
}

.checkout-popup-close {
    background: transparent;
    border: none;
    font-size: 32px;
    line-height: 1;
    color: #666;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.3s ease;
}

.checkout-popup-close:hover {
    color: #333;
}

/* Checkout Popup Body */
.checkout-popup-body {
    padding: 10px 0px;
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1;
    transition: opacity 0.3s ease;
    position: relative;
    max-height: calc(90vh - 80px);
}

.checkout-popup-body::-webkit-scrollbar {
    width: 8px;
}

.checkout-popup-body::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.checkout-popup-body::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.checkout-popup-body::-webkit-scrollbar-thumb:hover {
    background: #555;
}

.checkout-popup-body.updating {
    opacity: 0.6;
    pointer-events: none;
}

.checkout-popup-body.updating::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    z-index: 10;
}

/* WooCommerce Checkout Form Styles */
.checkout-popup-body .woocommerce {
    max-width: 100%;
}

.checkout-popup-body .woocommerce-checkout {
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
}

.checkout-popup-body .col2-set {
    flex: 1 1 60%;
    min-width: 300px;
}

.checkout-popup-body #order_review_heading,
.checkout-popup-body #order_review {
    flex: 1 1 35%;
    min-width: 250px;
}

.checkout-popup-body form.checkout {
    overflow: visible;
}

.checkout-popup-body {
    -webkit-overflow-scrolling: touch;
}

/* Cart Table */
.checkout-popup-body .shop_table {
    width: 100%;
    margin-bottom: 20px;
}

.checkout-popup-body .shop_table th,
.checkout-popup-body .shop_table td {
    padding: 5px;
    border: 1px solid #e0e0e0;
}

.checkout-popup-body .shop_table thead th {
    background: #f8f8f8;
    font-weight: 600;
    text-align: left;
}

/* ============================================
   QUANTITY CONTROLS - FIXED
   ============================================ */
.checkout-popup-body .quantity {
    display: inline-flex !important;
    align-items: center;
    gap: 0;
    flex-wrap: nowrap;
    position: relative;
}

.checkout-popup-body .quantity .qty {
    width: 50px;
    padding: 8px 4px;
    text-align: center;
    border-top: 1px solid #ddd;
    border-bottom: 1px solid #ddd;
    border-left: none;
    border-right: none;
    font-size: 16px;
    font-weight: 600;
    -moz-appearance: textfield;
    outline: none;
    height: 38px;
    box-sizing: border-box;
}

.checkout-popup-body .quantity .qty::-webkit-outer-spin-button,
.checkout-popup-body .quantity .qty::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Quantity Buttons */
.checkout-popup-body .quantity button.minus,
.checkout-popup-body .quantity button.plus {
    width: 38px !important;
    height: 38px !important;
    min-width: 38px !important;
    min-height: 38px !important;
    padding: 0 !important;
    margin: 0 !important;
    border: 1px solid #ddd !important;
    background: #f5f5f5 !important;
    cursor: pointer !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 20px !important;
    font-weight: bold !important;
    color: #333 !important;
    line-height: 1 !important;
    flex-shrink: 0 !important;
    transition: background 0.2s ease, border-color 0.2s ease;
    box-sizing: border-box !important;
    -webkit-appearance: none !important;
    appearance: none !important;
    vertical-align: middle !important;
}

.checkout-popup-body .quantity button.minus {
    border-radius: 4px 0 0 4px !important;
    border-right: none !important;
}

.checkout-popup-body .quantity button.plus {
    border-radius: 0 4px 4px 0 !important;
    border-left: none !important;
}

.checkout-popup-body .quantity button.minus:hover,
.checkout-popup-body .quantity button.plus:hover {
    background: #e0e0e0 !important;
    border-color: #ccc !important;
}

.checkout-popup-body .quantity button.minus:active,
.checkout-popup-body .quantity button.plus:active {
    background: #d0d0d0 !important;
    transform: scale(0.95);
}

/* Mobile - Larger touch targets */
@media (max-width: 768px) {
    .checkout-popup-body .quantity button.minus,
    .checkout-popup-body .quantity button.plus {
        width: 44px !important;
        height: 44px !important;
        min-width: 44px !important;
        min-height: 44px !important;
        font-size: 24px !important;
        touch-action: manipulation;
        -webkit-tap-highlight-color: rgba(0,0,0,0.1);
    }

    .checkout-popup-body .quantity .qty {
        width: 55px;
        font-size: 18px;
        padding: 10px 4px;
        height: 44px;
    }
}

.checkout-popup-body .product-quantity .quantity,
.checkout-popup-body td.product-quantity .quantity {
    display: inline-flex !important;
}

.checkout-popup-body .shop_table .product-quantity {
    text-align: center;
}

.checkout-popup-body .shop_table .product-quantity .quantity {
    margin: 0 auto;
    justify-content: center;
}

/* Product Thumbnail */
.checkout-popup-body .product-thumbnail img {
    max-width: 80px;
    height: auto;
    border-radius: 4px;
}

/* Product Remove Button */
.checkout-popup-body .product-remove a {
    color: #e74c3c;
    text-decoration: none;
    font-size: 20px;
    font-weight: bold;
}

.checkout-popup-body .product-remove a:hover {
    color: #c0392b;
}

/* Order Total */
.checkout-popup-body .order-total {
    font-size: 18px;
    font-weight: 600;
}

.checkout-popup-body .order-total .amount {
    color: #27ae60;
}

/* Form Fields */
.checkout-popup-body .form-row {
    margin-bottom: 20px;
}

.checkout-popup-body .form-row label {
    display: block;
    margin-bottom: 0px;
    margin-left: 5px;
    font-weight: 500;
    color: #333;
    line-height: 2 !important;
}

.checkout-popup-body .form-row input[type="text"],
.checkout-popup-body .form-row input[type="email"],
.checkout-popup-body .form-row input[type="tel"],
.checkout-popup-body .form-row textarea,
.checkout-popup-body .form-row select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.checkout-popup-body .form-row input:focus,
.checkout-popup-body .form-row textarea:focus,
.checkout-popup-body .form-row select:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.1);
}

/* Place Order Button */
.checkout-popup-body #place_order {
    width: 100%;
    padding: 15px 30px;
    background: #27ae60;
    color: #ffffff;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s ease;
}

.checkout-popup-body #place_order:hover {
    background: #229954;
}

.checkout-popup-body #place_order:disabled {
    background: #95a5a6;
    cursor: not-allowed;
}

/* Loading State */
.add_to_cart_button.loading {
    opacity: 0.6;
    pointer-events: none;
}

.add_to_cart_button.loading::after {
    content: "";
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #ffffff;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    margin-left: 8px;
}

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

/* Body scroll */
body.checkout-popup-open {
    overflow: hidden !important;
}

.checkout-popup-overlay .checkout-popup-wrapper {
    display: flex !important;
    flex-direction: column !important;
}

.checkout-popup-overlay .checkout-popup-body {
    overflow-y: auto !important;
    overflow-x: hidden !important;
}

/* ============================================
   ORDER CONFIRMATION POPUP STYLES
   ============================================ */

.order-confirmation-content {
    text-align: center;
}

.order-success-icon {
    font-size: 60px;
    margin-bottom: 10px;
}

.order-confirmation-content h3 {
    font-size: 24px;
    color: #27ae60;
    margin-bottom: 5px;
}

.order-confirmation-content .order-number {
    font-size: 16px;
    color: #666;
    margin-bottom: 20px;
}

.order-details-box {
    background: #f9f9f9;
    border: 1px solid #eee;
    border-radius: 8px;
    padding: 20px;
    margin: 15px 0;
    text-align: left;
}

.order-details-box h4 {
    margin: 0 0 12px 0;
    font-size: 16px;
    color: #333;
    border-bottom: 1px solid #eee;
    padding-bottom: 8px;
}

.order-details-box table {
    width: 100%;
    border-collapse: collapse;
}

.order-details-box table td {
    padding: 6px 0;
    font-size: 14px;
    color: #555;
    border: none;
}

.order-details-box table td:last-child {
    text-align: right;
    font-weight: 600;
    color: #333;
}

/* Bank Transfer Section */
.bank-transfer-section {
    background: #fff8e1;
    border: 1px solid #ffecb3;
    border-radius: 8px;
    padding: 20px;
    margin: 15px 0;
    text-align: left;
}

.bank-transfer-section h4 {
    margin: 0 0 10px 0;
    font-size: 16px;
    color: #e65100;
}

.bank-transfer-section .bank-details {
    background: #fff;
    border: 1px solid #eee;
    border-radius: 6px;
    padding: 15px;
    margin: 10px 0;
}

.bank-transfer-section .bank-details p {
    margin: 5px 0;
    font-size: 14px;
    color: #555;
}

.bank-transfer-section .bank-details strong {
    color: #333;
}

/* Screenshot Upload Area */
#screenshot-upload-area {
    margin-top: 15px;
}

.screenshot-upload-box {
    border: 2px dashed #ccc;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    background: #fafafa;
    transition: border-color 0.3s ease, background 0.3s ease;
}

.screenshot-upload-box:hover {
    border-color: #4a90e2;
    background: #f0f8ff;
}

.screenshot-upload-box label {
    display: block;
    cursor: pointer;
    padding: 10px;
}

.screenshot-upload-box .upload-icon {
    font-size: 36px;
    color: #999;
    margin-bottom: 8px;
    display: block;
}

.screenshot-upload-box .upload-text {
    font-size: 14px;
    color: #666;
    display: block;
    margin-bottom: 4px;
}

.screenshot-upload-box .upload-hint {
    font-size: 12px;
    color: #999;
    display: block;
}

#bank-transfer-screenshot {
    display: none;
}

#screenshot-file-name {
    font-size: 13px;
    color: #333;
    margin-top: 8px;
    font-weight: 500;
}

#screenshot-preview {
    margin-top: 10px;
}

#submit-screenshot-btn {
    display: none;
    margin-top: 12px;
    padding: 12px 30px;
    background: #4a90e2;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s ease;
    width: 100%;
}

#submit-screenshot-btn:hover {
    background: #357abd;
}

#submit-screenshot-btn:disabled {
    background: #95a5a6;
    cursor: not-allowed;
}

/* Close button for confirmation */
.order-confirmation-close-btn {
    margin-top: 20px;
    padding: 12px 40px;
    background: #007237;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s ease;
}

.order-confirmation-close-btn:hover {
    background: #005a2b;
}

/* Responsive */
@media (max-width: 768px) {
    .checkout-popup-overlay {
        padding: 0;
        align-items: flex-start;
    }

    .checkout-popup-wrapper {
        max-width: 100%;
        margin: 0;
        border-radius: 0;
        max-height: 100vh;
        min-height: 100vh;
    }

    .checkout-popup-header {
        padding: 12px;
    }

    .checkout-popup-header h2 {
        font-size: 20px;
    }

    .checkout-popup-body {
        padding: 20px;
        max-height: calc(100vh - 60px);
    }

    .checkout-popup-body .woocommerce-checkout {
        flex-direction: column;
    }

    .checkout-popup-body .col2-set,
    .checkout-popup-body #order_review_heading,
    .checkout-popup-body #order_review {
        flex: 1 1 100%;
        min-width: 100%;
    }

    .checkout-popup-body .shop_table th,
    .checkout-popup-body .shop_table td {
        padding: 8px;
        font-size: 13px;
    }

    .checkout-popup-body .product-thumbnail img {
        max-width: 60px;
    }
}

@media (max-width: 480px) {
    .checkout-popup-body {
        padding: 5px 10px;
    }

    .checkout-popup-body .shop_table {
        font-size: 12px;
    }

    .checkout-popup-body .quantity .qty {
        width: 45px;
        padding: 6px;
        height: 36px;
    }

    .checkout-popup-body .quantity button.minus,
    .checkout-popup-body .quantity button.plus {
        width: 36px !important;
        height: 36px !important;
        min-width: 36px !important;
        min-height: 36px !important;
    }
}

/* WooCommerce Messages */
.checkout-popup-body .woocommerce-message,
.checkout-popup-body .woocommerce-error,
.checkout-popup-body .woocommerce-info {
    padding: 12px 20px;
    margin-bottom: 20px;
    border-radius: 4px;
    border-left: 4px solid;
}

.checkout-popup-body .woocommerce-message {
    background: #d4edda;
    border-left-color: #28a745;
    color: #155724;
}

.checkout-popup-body .woocommerce-error {
    background: #f8d7da;
    border-left-color: #dc3545;
    color: #721c24;
}

.checkout-popup-body .woocommerce-info {
    background: #d1ecf1;
    border-left-color: #17a2b8;
    color: #0c5460;
}

/* Payment Methods */
.checkout-popup-body .woocommerce-checkout-payment {
    background: #f8f8f8;
    padding: 20px;
    border-radius: 4px;
    margin-top: -10px;
}

.checkout-popup-body .wc_payment_methods {
    list-style: none;
    padding: 0;
    margin: 0 0 5px 0;
}

.checkout-popup-body .wc_payment_method {
    margin-bottom: 10px;
}

.checkout-popup-body .wc_payment_method label {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 10px;
    background: #ffffff;
    border: 1px solid #ddd;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.checkout-popup-body .wc_payment_method label:hover {
    border-color: #3498db;
    background: #f0f8ff;
}

.checkout-popup-body .wc_payment_method input[type="radio"] {
    margin-right: 10px;
}
