/* 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;
}

/* Product Quantity Controls - FIXED SYMBOLS */
.checkout-popup-body .quantity {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    flex-wrap: nowrap;
    position: relative;
}

.checkout-popup-body .quantity .qty {
    width: 70px;
    padding: 10px 8px;
    text-align: center;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 600;
    -moz-appearance: textfield;
    order: 2;
}

.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 - All Possible Selectors */
.checkout-popup-body .quantity-button,
.checkout-popup-body .quantity .plus,
.checkout-popup-body .quantity .minus,
.checkout-popup-body .quantity .increase,
.checkout-popup-body .quantity .decrease,
.checkout-popup-body .quantity button[type="button"] {
    width: 35px !important;
    height: 35px !important;
    min-width: 35px !important;
    min-height: 35px !important;
    padding: 0 !important;
    border: 1px solid #ddd !important;
    background: #f8f8f8 !important;
    cursor: pointer !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 4px !important;
    transition: all 0.3s ease;
    font-size: 20px !important;
    font-weight: bold !important;
    color: #333 !important;
    line-height: 1 !important;
    flex-shrink: 0 !important;
}

.checkout-popup-body .quantity .minus,
.checkout-popup-body .quantity .decrease {
    order: 1;
}

.checkout-popup-body .quantity .plus,
.checkout-popup-body .quantity .increase {
    order: 3;
}

.checkout-popup-body .quantity .plus:hover,
.checkout-popup-body .quantity .minus:hover,
.checkout-popup-body .quantity .increase:hover,
.checkout-popup-body .quantity .decrease:hover,
.checkout-popup-body .quantity button[type="button"]:hover {
    background: #e0e0e0 !important;
    border-color: #ccc !important;
}

.checkout-popup-body .quantity .plus:active,
.checkout-popup-body .quantity .minus:active,
.checkout-popup-body .quantity .increase:active,
.checkout-popup-body .quantity .decrease:active,
.checkout-popup-body .quantity button[type="button"]:active {
    background: #d0d0d0 !important;
    transform: scale(0.95);
}

/* CRITICAL: Add + and - symbols */
.checkout-popup-body .quantity .plus::before,
.checkout-popup-body .quantity .increase::before {
    content: "+" !important;
    display: block !important;
    font-size: 20px !important;
    line-height: 1 !important;
}

.checkout-popup-body .quantity .minus::before,
.checkout-popup-body .quantity .decrease::before {
    content: "\2212" !important; /* Unicode minus sign */
    display: block !important;
    font-size: 20px !important;
    line-height: 1 !important;
}

/* Fallback for buttons without classes */
.checkout-popup-body .quantity button[type="button"]:first-child::before {
    content: "\2212" !important; /* Minus for first button */
    display: block !important;
}

.checkout-popup-body .quantity button[type="button"]:last-child::before {
    content: "+" !important; /* Plus for last button */
    display: block !important;
}

/* Mobile - Larger buttons */
@media (max-width: 768px) {
    .checkout-popup-body .quantity-button,
    .checkout-popup-body .quantity .plus,
    .checkout-popup-body .quantity .minus,
    .checkout-popup-body .quantity .increase,
    .checkout-popup-body .quantity .decrease,
    .checkout-popup-body .quantity button[type="button"] {
        width: 45px !important;
        height: 45px !important;
        font-size: 24px !important;
        touch-action: manipulation;
        -webkit-tap-highlight-color: rgba(0,0,0,0.1);
    }
    
    .checkout-popup-body .quantity .plus::before,
    .checkout-popup-body .quantity .increase::before,
    .checkout-popup-body .quantity .minus::before,
    .checkout-popup-body .quantity .decrease::before,
    .checkout-popup-body .quantity button[type="button"]::before {
        font-size: 24px !important;
    }
    
    .checkout-popup-body .quantity .qty {
        width: 80px;
        font-size: 18px;
        padding: 12px;
    }
    
    .checkout-popup-body .quantity {
        gap: 8px;
    }
}

.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;
}

/* 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: 50px;
        padding: 6px;
        height: 30px;
    }
}

/* 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;
}