/* Modern premium styling for WooCommerce Treazure Market Payment Method popup */

/* Hide the payment methods in the default checkout flow */
form.woocommerce-checkout .woocommerce-checkout-payment ul.payment_methods:not(.in-popup) {
    display: none !important;
}

/* Modal Overlay */
.tm-checkout-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.4);
    /* Subtle dark overlay */
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.tm-checkout-popup-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Modal Content Container */
.tm-checkout-popup-content {
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.15);
    width: 95%;
    max-width: 550px;
    position: relative;
    transform: scale(0.95) translateY(10px);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    overflow: hidden;
    border: 1px solid #f1f5f9;
}

.tm-checkout-popup-overlay.active .tm-checkout-popup-content {
    transform: scale(1) translateY(0);
}

/* Modal Close Button */
.tm-checkout-popup-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: #94a3b8;
    transition: color 0.2s ease, background-color 0.2s ease;
    padding: 0;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    z-index: 10;
}

.tm-checkout-popup-close:hover {
    color: #334155;
    background: #f1f5f9;
}

/* Modal Header */
.tm-checkout-popup-header {
    padding: 30px 30px 15px 30px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Brand container */
.tm-header-brand-container {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    display: none;
}

/* Pink box logo container */
.tm-popup-logo-icon {
    width: 48px;
    height: 48px;
    background: #ffe4e6;
    /* Rose 100 */
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tm-popup-logo-img {
    max-height: 48px;
    width: auto;
    object-fit: contain;
}

.tm-header-brand-text {
    display: flex;
    flex-direction: column;
    text-align: left;
}

.tm-brand-name {
    font-size: 18px;
    line-height: 1.2;
    font-weight: 700;
    color: #e11d48;
    /* Pink/rose branding */
}

.tm-secure-badge {
    font-size: 12px;
    line-height: 1.2;
    color: #64748b;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 2px;
}

.tm-secure-badge svg {
    color: #94a3b8;
}

.tm-payment-title {
    margin: 0 0 6px 0;
    font-size: 24px;
    font-weight: 700;
    color: #0f172a;
}

.tm-payment-subtitle {
    margin: 0;
    font-size: 14px;
    color: #64748b;
}

/* Modal Body */
.tm-checkout-popup-body {
    flex: 1;
    overflow-y: auto;
    padding: 0 30px 15px 30px;
}

/* Payment Methods inside popup */
.tm-checkout-popup-body ul.payment_methods.in-popup {
    list-style: none !important;
    padding: 0 !important;
    margin: 0 !important;
    display: block !important;
}

.tm-checkout-popup-body ul.payment_methods.in-popup li.wc_payment_method {
    margin-bottom: 12px !important;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 16px 20px !important;
    transition: all 0.2s ease;
    cursor: pointer;
    position: relative;
    display: flex;
    align-items: center;
    background-color: #ffffff;
}

.tm-checkout-popup-body ul.payment_methods.in-popup li.wc_payment_method:hover {
    border-color: #cbd5e1;
    background-color: #fafafa;
}

/* Selected state matching the screen */
.tm-checkout-popup-body ul.payment_methods.in-popup li.wc_payment_method.tm-selected {
    border-color: #f43f5e;
    /* Rose 500 */
    background-color: #fff1f2;
    /* Rose 50 */
    box-shadow: 0 0 0 1px #f43f5e;
}

/* Checkbox/Radio Styling */
.tm-checkout-popup-body ul.payment_methods.in-popup li.wc_payment_method input[type="radio"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

/* Custom radio indicator */
.tm-checkout-popup-body ul.payment_methods.in-popup li.wc_payment_method::before {
    content: "";
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #cbd5e1;
    border-radius: 50%;
    margin-right: 15px;
    background-color: #ffffff;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.tm-checkout-popup-body ul.payment_methods.in-popup li.wc_payment_method.tm-selected::before {
    border-color: #f43f5e;
    background-color: #f43f5e;
    box-shadow: inset 0 0 0 4px #fff1f2;
    /* Custom radio circle dot */
}

/* Hide payment method icons if we style custom labels, but keep WC defaults styled nicely */
.tm-checkout-popup-body ul.payment_methods.in-popup li.wc_payment_method img {
    max-height: 24px;
    margin-left: 8px;
    object-fit: contain;
}

.tm-checkout-popup-body ul.payment_methods.in-popup li.wc_payment_method label {
    font-size: 15px !important;
    font-weight: 600 !important;
    color: #1e293b !important;
    cursor: pointer;
    margin: 0 !important;
    padding: 0 !important;
    flex-grow: 1;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Right arrow indicator */
.tm-arrow-icon {
    margin-left: 10px;
    color: #94a3b8;
    display: flex;
    align-items: center;
    transition: transform 0.2s ease, color 0.2s ease;
}

.tm-checkout-popup-body ul.payment_methods.in-popup li.wc_payment_method.tm-selected .tm-arrow-icon {
    color: #f43f5e;
}

/* Payment box details description */
.tm-checkout-popup-body ul.payment_methods.in-popup li.wc_payment_method .payment_box {
    display: none !important;
    /* Keep description hidden inside the list buttons to match layout */
}

/* Footer Section */
.tm-checkout-popup-footer {
    padding: 15px 30px 20px 30px;
    border-top: 1px solid #f1f5f9;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Terms & Conditions Checkboxes style */
.tm-terms-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.tm-custom-checkbox-row {
    display: flex;
    align-items: flex-start;
}

.tm-custom-checkbox-label {
    display: inline-flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 13px !important;
    color: #4f46e5;
    /* Indigo/blue link wrapper or slate */
    cursor: pointer;
    font-weight: 500 !important;
    line-height: 1.4;
}

.tm-custom-checkbox-label input[type="checkbox"] {
    margin-top: 3px;
    accent-color: #f43f5e;
    /* Pink checkbox theme */
    transform: scale(1.1);
    cursor: pointer;
}

.tm-custom-checkbox-label span {
    color: #f43f5e;
    /* Rose colored texts */
}

.tm-custom-checkbox-label a {
    color: #f43f5e !important;
    text-decoration: underline !important;
    font-weight: 600;
}

/* Submit button with lock icon */
.tm-checkout-popup-submit {
    background-color: #f43f5e !important;
    /* Rose 500 */
    color: #ffffff !important;
    border: none !important;
    border-radius: 12px !important;
    padding: 14px 24px !important;
    font-size: 16px !important;
    font-weight: 600 !important;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 4px 6px -1px rgba(244, 63, 94, 0.2);
}

.tm-checkout-popup-submit:hover {
    background-color: #e11d48 !important;
    /* Rose 600 */
    box-shadow: 0 10px 15px -3px rgba(244, 63, 94, 0.3);
}

.tm-checkout-popup-submit:active {
    transform: scale(0.99);
}

.tm-checkout-popup-submit:disabled {
    background-color: #fca5a5 !important;
    cursor: not-allowed;
    box-shadow: none;
}

.tm-lock-icon {
    display: inline-block;
}

/* Redirect text below button */
.tm-redirect-info {
    font-size: 12px;
    color: #64748b;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

/* Bottom Trust Badge Bar */
.tm-checkout-popup-trust-bar {
    background-color: #f8fafc;
    /* Cool gray background */
    padding: 20px 30px;
    border-top: 1px solid #f1f5f9;
    display: flex;
    justify-content: space-between;
    gap: 15px;
}

.tm-trust-col {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    flex: 1;
}

.tm-trust-col svg {
    color: #f43f5e;
    /* Pink icons */
    flex-shrink: 0;
    margin-top: 2px;
}

.tm-trust-col div {
    display: flex;
    flex-direction: column;
}

.tm-trust-col strong {
    font-size: 12px;
    color: #0f172a;
    font-weight: 700;
}

.tm-trust-col span {
    font-size: 11px;
    color: #64748b;
    margin-top: 2px;
}

/* Responsive adjustment */
@media (max-width: 480px) {
    .tm-checkout-popup-trust-bar {
        flex-direction: column;
        gap: 12px;
        padding: 15px 20px;
    }

    .tm-checkout-popup-content {
        padding: 0;
    }

    .tm-checkout-popup-header {
        padding: 20px 20px 10px 20px;
    }

    .tm-checkout-popup-body {
        padding: 0 20px 10px 20px;
    }

    .tm-checkout-popup-footer {
        padding: 10px 20px 15px 20px;
    }
}