/**
 * Stablezact WP Checkout Styles
 */

/* Payment method selection */
.wc_payment_method.payment_method_stablezact label {
    display: flex !important;
    align-items: center;
}

.wc_payment_method.payment_method_stablezact label img {
    max-height: 40px;
    margin-left: 10px;
    max-width: 120px;
    height: auto;
    width: auto;
}

/* Custom checkout description */
.payment_box.payment_method_stablezact {
    background-color: #f8f8f8 !important;
    border-left: 4px solid #7042D2 !important;
}

.payment_box.payment_method_stablezact::before {
    border-bottom-color: #f8f8f8 !important;
}

/* Benefits list */
.stablezact-benefits {
    margin: 10px 0 0 0;
    padding: 0;
    list-style: none;
}

.stablezact-benefits li {
    position: relative;
    padding-left: 25px;
    margin-bottom: 8px;
    font-size: 14px;
}

.stablezact-benefits li::before {
    content: "✓";
    position: absolute;
    left: 0;
    color: #7042D2;
    font-weight: bold;
}

/* Security badge */
.stablezact-security {
    margin-top: 15px;
    display: flex;
    align-items: center;
    font-size: 12px;
    color: #666;
}

.stablezact-security svg {
    margin-right: 6px;
    color: #7042D2;
}

/* Responsive styles */
@media screen and (max-width: 768px) {
    .wc_payment_method.payment_method_stablezact label {
        flex-wrap: wrap;
    }
    
    .wc_payment_method.payment_method_stablezact label img {
        margin-left: 0;
        margin-top: 8px;
    }
}

.stablezact-payment-fields {
    margin: 10px 0;
}

.stablezact-payment-fields .form-row {
    margin-bottom: 15px;
}

.stablezact-payment-fields label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #333;
}

.stablezact-payment-fields select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    background-color: #fff;
    transition: border-color 0.3s ease;
}

.stablezact-payment-fields select:focus {
    outline: none;
    border-color: #4CAF50;
    box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.2);
}

.stablezact-payment-fields .required {
    color: #e74c3c;
    font-weight: bold;
}

/* Test mode notice */
.stablezact-payment-fields p[style*="color: #ff6600"] {
    background-color: #fff3cd;
    border: 1px solid #ffeaa7;
    padding: 10px;
    border-radius: 4px;
    margin: 10px 0;
}

/* Classic checkout compatibility */
.wc-payment-form fieldset {
    border: none;
    padding: 0;
    margin: 0;
}

.wc-payment-form .form-row {
    margin-bottom: 15px;
}

.wc-payment-form label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
}

.wc-payment-form select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

/* Payment fields styling */
.stablezact-currency-selector {
    margin-bottom: 15px;
}

.stablezact-currency-selector label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
}

.stablezact-currency-selector select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.stablezact-payment-info {
    margin-top: 15px;
}

.stablezact-benefits {
    list-style: none;
    padding: 0;
    margin: 10px 0;
}

.stablezact-benefits li {
    padding: 5px 0;
    color: #666;
}

.stablezact-benefits li:before {
    content: "✓";
    color: #4CAF50;
    font-weight: bold;
    margin-right: 8px;
}

.stablezact-security-badge {
    display: flex;
    align-items: center;
    margin-top: 10px;
    font-size: 12px;
    color: #666;
}

.stablezact-security-badge svg {
    margin-right: 5px;
    color: #4CAF50;
}

/* Responsive design */
@media (max-width: 768px) {
    .stablezact-payment-fields select {
        font-size: 16px; /* Prevents zoom on iOS */
    }
}

/* Stablezact Pay Checkout Styles */

.stablezact-payment-fields {
    margin-top: 15px;
}

.stablezact-payment-fields .form-row {
    margin-bottom: 20px;
}

.stablezact-payment-fields label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #374151;
}

.stablezact-payment-fields .required {
    color: #dc2626;
}

.stablezact-payment-fields select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    background: #fff;
    font-size: 14px;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.stablezact-payment-fields select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.stablezact-payment-fields select:invalid {
    border-color: #dc2626;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .stablezact-payment-fields label {
        color: #d1d5db;
    }
    
    .stablezact-payment-fields select {
        background: #374151;
        border-color: #4b5563;
        color: #fff;
    }
    
    .stablezact-payment-fields select:focus {
        border-color: #60a5fa;
        box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.1);
    }
}

/* WooCommerce specific overrides */
.woocommerce .stablezact-payment-fields .form-row {
    padding: 0;
}

.woocommerce .stablezact-payment-fields .form-row label {
    margin-bottom: 8px;
}

.woocommerce .stablezact-payment-fields select.select {
    height: auto;
    line-height: 1.5;
}

/* Stablezact SDK Modal - Ensure modal and dropdowns work correctly */
#stablezact-payment-container {
    z-index: 999998 !important;
}

#stablezact-payment-container [data-headlessui-state="open"] {
    z-index: 9999999 !important;
}

#stablezact-payment-container [role="listbox"] {
    z-index: 10000000 !important;
    pointer-events: auto !important;
    /* FIX: Prevent dropdown from blocking scroll */
    touch-action: auto !important;
}

/* Ensure all interactive elements inside Stablezact modal work */
#stablezact-payment-container button,
#stablezact-payment-container [role="button"],
#stablezact-payment-container [role="option"],
#stablezact-payment-container a {
    pointer-events: auto !important;
}

/* Ensure success modal buttons are clickable */
#stablezact-payment-container [class*="success"] button,
#stablezact-payment-container [class*="Success"] button,
#stablezact-payment-container [class*="success"] a,
#stablezact-payment-container [class*="Success"] a {
    pointer-events: auto !important;
    cursor: pointer !important;
}

/* FIX: Ensure modal content is scrollable even when dropdown is open */
#stablezact-payment-container .overflow-y-auto,
#stablezact-payment-container [class*="overflow-y-auto"] {
    overflow-y: auto !important;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

/* Custom scrollbar styling for better UX */
#stablezact-payment-container .overflow-y-auto::-webkit-scrollbar {
    width: 6px;
}

#stablezact-payment-container .overflow-y-auto::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 3px;
}

#stablezact-payment-container .overflow-y-auto::-webkit-scrollbar-thumb {
    background: rgba(112, 66, 210, 0.3);
    border-radius: 3px;
}

#stablezact-payment-container .overflow-y-auto::-webkit-scrollbar-thumb:hover {
    background: rgba(112, 66, 210, 0.5);
}
/*
 * SDK 0.66.0 compatibility fix.
 * The stablezact-pay SDK renders its modal into a React portal (.coinley-pay-sdk-root)
 * but also leaves an empty, full-viewport #coinley-payment-container at z-index 999999
 * on top of it. While empty, that container swallows every click, making the payment
 * modal completely uninteractive. Let clicks fall through to the modal beneath it.
 * The :empty guard means the container regains pointer events if the SDK ever renders
 * into it directly.
 */
#coinley-payment-container:empty {
    pointer-events: none !important;
}
