/**
 * USDC Payments Checkout Styles
 */

/* Payment Container */
#usdc-payment-container {
    margin: 20px 0;
    padding: 20px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 6px;
}

#usdc-payment-container h3 {
    margin: 0 0 15px 0;
    color: #333;
    font-size: 20px;
}

#usdc-payment-container p {
    margin: 0 0 15px 0;
    color: #666;
    line-height: 1.6;
}

/* Payment Summary */
.usdc-payment-summary {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 15px;
    margin: 15px 0;
}

.usdc-payment-summary p {
    margin: 8px 0;
    font-size: 14px;
}

.usdc-payment-summary strong {
    color: #333;
}

/* Payment Button */
#usdc-open-payment {
    background: #2271b1;
    color: white;
    border: none;
    padding: 12px 24px;
    font-size: 16px;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    text-decoration: none;
    display: inline-block;
    line-height: 1.4;
}

#usdc-open-payment:hover {
    background: #135e96;
    color: white;
}

#usdc-open-payment:focus {
    outline: 2px solid #005a87;
    outline-offset: 2px;
}

#usdc-open-payment:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* Payment Modal */
#usdc-payment-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}

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

.usdc-modal-content {
    position: relative;
    background: white;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    max-width: 900px;
    width: 100%;
    max-height: 90vh;
    overflow: hidden;
    z-index: 1000000;
}

.usdc-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #dee2e6;
    background: #f8f9fa;
}

.usdc-modal-header h3 {
    margin: 0;
    color: #333;
    font-size: 18px;
}

.usdc-close-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.usdc-close-btn:hover {
    background: #e9ecef;
    color: #333;
}

.usdc-close-btn:focus {
    outline: 2px solid #2271b1;
    outline-offset: 2px;
}

/* Payment Iframe */
#usdc-payment-iframe {
    width: 100%;
    height: 600px;
    border: none;
    display: block;
}

/* Loading State */
.usdc-loading {
    text-align: center;
    padding: 40px;
    color: #666;
    font-style: italic;
}

.usdc-loading::before {
    content: "";
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #2271b1;
    border-radius: 50%;
    animation: usdc-spin 1s linear infinite;
    margin-right: 10px;
    vertical-align: middle;
}

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

/* Payment Status Messages */
#usdc-payment-status {
    margin-top: 20px;
}

#usdc-payment-status .woocommerce-message,
#usdc-payment-status .woocommerce-error,
#usdc-payment-status .woocommerce-info {
    margin: 10px 0;
    padding: 12px 15px;
    border-radius: 4px;
    border-left: 4px solid;
}

#usdc-payment-status .woocommerce-message {
    background: #d1e7dd;
    border-left-color: #198754;
    color: #0f5132;
}

#usdc-payment-status .woocommerce-error {
    background: #f8d7da;
    border-left-color: #dc3545;
    color: #721c24;
}

#usdc-payment-status .woocommerce-info {
    background: #d1ecf1;
    border-left-color: #0dcaf0;
    color: #055160;
}

/* Body scroll lock */
body.usdc-modal-open {
    overflow: hidden;
}

/* Customer Order Details */
.woocommerce-order-details .usdc-contract-info {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 20px;
    margin: 20px 0;
}

.woocommerce-order-details .usdc-contract-info h3 {
    margin: 0 0 15px 0;
    color: #333;
}

.woocommerce-order-usdc-contract {
    margin: 30px 0;
}

.woocommerce-order-usdc-contract .woocommerce-order-details__title {
    margin-bottom: 15px;
}

.woocommerce-order-usdc-contract .shop_table {
    margin-bottom: 15px;
}

.woocommerce-order-usdc-contract .button {
    background: #2271b1;
    color: white;
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 4px;
    display: inline-block;
    transition: background-color 0.2s ease;
}

.woocommerce-order-usdc-contract .button:hover {
    background: #135e96;
    color: white;
}

/* Responsive Design */
@media (max-width: 768px) {
    #usdc-payment-modal {
        padding: 10px;
    }
    
    .usdc-modal-content {
        max-height: 95vh;
    }
    
    .usdc-modal-header {
        padding: 15px;
    }
    
    .usdc-modal-header h3 {
        font-size: 16px;
    }
    
    #usdc-payment-iframe {
        height: 500px;
    }
    
    #usdc-payment-container {
        padding: 15px;
        margin: 15px 0;
    }
    
    .usdc-payment-summary {
        padding: 12px;
    }
}

@media (max-width: 480px) {
    .usdc-modal-content {
        margin: 10px;
        max-width: calc(100% - 20px);
    }
    
    #usdc-payment-iframe {
        height: 400px;
    }
    
    #usdc-open-payment {
        width: 100%;
        padding: 15px;
        font-size: 18px;
    }
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    #usdc-payment-container {
        border: 2px solid #000;
    }
    
    #usdc-open-payment {
        border: 2px solid #000;
    }
    
    .usdc-modal-content {
        border: 2px solid #000;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    #usdc-open-payment,
    .usdc-close-btn {
        transition: none;
    }
    
    .usdc-loading::before {
        animation: none;
    }
}

/* Print Styles */
@media print {
    #usdc-payment-modal,
    #usdc-open-payment {
        display: none !important;
    }
}

/* Payment method icon sizing - multiple selectors to catch all cases */
.payment_method_usdc_payments img,
.wc_payment_method img,
#payment .payment_methods .payment_method_usdc_payments img,
.woocommerce-checkout #payment .payment_methods .payment_method_usdc_payments img,
li.payment_method_usdc_payments img {
    max-height: 25px !important;
    max-width: 40px !important;
    width: auto !important;
    height: auto !important;
    vertical-align: middle !important;
    display: inline-block !important;
    object-fit: contain !important;
}

/* Fallback Mode Styles */
.usdc-fallback-instructions {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 20px;
    margin: 20px 0;
}

.usdc-fallback-instructions h4 {
    margin: 0 0 15px 0;
    color: #333;
    font-size: 18px;
}

.usdc-fallback-instructions ol {
    margin: 0 0 20px 0;
    padding-left: 25px;
}

.usdc-fallback-instructions ol li {
    margin: 15px 0;
    line-height: 1.6;
    color: #555;
}

.usdc-wallet-address,
.usdc-contract-address {
    display: inline-block;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 8px 12px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 14px;
    color: #333;
    word-break: break-all;
    margin: 5px 8px 5px 0;
    max-width: 100%;
    box-sizing: border-box;
}

.usdc-copy-btn {
    background: #6c757d;
    color: white;
    border: none;
    padding: 4px 8px;
    font-size: 12px;
    border-radius: 3px;
    cursor: pointer;
    margin-left: 5px;
    transition: background-color 0.2s ease;
    vertical-align: middle;
}

.usdc-copy-btn:hover {
    background: #545b62;
    color: white;
}

.usdc-copy-btn:focus {
    outline: 2px solid #005a87;
    outline-offset: 2px;
}

.usdc-payment-warning {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 4px;
    padding: 15px;
    margin: 20px 0;
}

.usdc-payment-warning p {
    margin: 0 0 10px 0;
    color: #856404;
    font-weight: bold;
}

.usdc-payment-warning ul {
    margin: 0;
    padding-left: 20px;
}

.usdc-payment-warning li {
    margin: 5px 0;
    color: #856404;
}

/* Manual Payment Form */
.usdc-manual-form {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 20px;
    margin: 20px 0;
}

.usdc-manual-form h4 {
    margin: 0 0 20px 0;
    color: #333;
    font-size: 18px;
}

.usdc-manual-form label {
    display: block;
    margin: 0 0 5px 0;
    color: #555;
    font-weight: bold;
}

.usdc-tx-input,
.usdc-wallet-input {
    width: 100%;
    max-width: 500px;
    padding: 10px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 14px;
    box-sizing: border-box;
    transition: border-color 0.2s ease;
}

.usdc-tx-input:focus,
.usdc-wallet-input:focus {
    border-color: #2271b1;
    outline: none;
    box-shadow: 0 0 0 3px rgba(34, 113, 177, 0.1);
}

.usdc-tx-input:invalid,
.usdc-wallet-input:invalid {
    border-color: #dc3545;
}

#usdc-submit-manual {
    background: #28a745;
    color: white;
    border: none;
    padding: 12px 24px;
    font-size: 16px;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    margin-top: 10px;
}

#usdc-submit-manual:hover {
    background: #218838;
    color: white;
}

#usdc-submit-manual:disabled {
    background: #6c757d;
    cursor: not-allowed;
}

#usdc-submit-manual:focus {
    outline: 2px solid #005a87;
    outline-offset: 2px;
}

/* Manual Payment Status */
#usdc-manual-status {
    margin-top: 20px;
}

#usdc-manual-status .woocommerce-message,
#usdc-manual-status .woocommerce-error,
#usdc-manual-status .woocommerce-info {
    margin: 10px 0;
    padding: 12px 15px;
    border-radius: 4px;
    border-left: 4px solid;
}

#usdc-manual-status .woocommerce-message {
    background: #d1e7dd;
    border-left-color: #198754;
    color: #0f5132;
}

#usdc-manual-status .woocommerce-error {
    background: #f8d7da;
    border-left-color: #dc3545;
    color: #721c24;
}

#usdc-manual-status .woocommerce-info {
    background: #d1ecf1;
    border-left-color: #0dcaf0;
    color: #055160;
}

/* Responsive Design for Fallback Mode */
@media (max-width: 768px) {
    .usdc-fallback-instructions {
        padding: 15px;
    }
    
    .usdc-wallet-address,
    .usdc-contract-address {
        display: block;
        margin: 10px 0;
        word-break: break-all;
    }
    
    .usdc-copy-btn {
        display: block;
        margin: 10px 0 0 0;
        width: 100px;
    }
    
    .usdc-manual-form {
        padding: 15px;
    }
    
    .usdc-tx-input,
    .usdc-wallet-input {
        max-width: 100%;
    }
    
    #usdc-submit-manual {
        width: 100%;
        padding: 15px;
        font-size: 18px;
    }
}