/* Main wrapper - WFACP Compatibility */
.forex-rr-payment-wrapper,
#forex-rr-payment-form,
fieldset#forex-rr-payment-form,
.payment_box.payment_method_forex_rr_gateway {
    margin: 20px 0;
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
}

/* Force visibility for WFACP */
.wfacp_main_form .payment_box.payment_method_forex_rr_gateway,
.wfacp_main_form #forex-rr-payment-form,
.wfacp-payment-method-forex_rr_gateway,
li.wc_payment_method.payment_method_forex_rr_gateway {
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
    max-height: none !important;
    padding: 20px !important;
    overflow: visible !important;
}

/* Ensure list item displays */
li.wc_payment_method.payment_method_forex_rr_gateway,
li.payment_method_forex_rr_gateway {
    display: list-item !important;
}

/* WFACP specific overrides */
.wfacp_main_form .payment_box.payment_method_forex_rr_gateway {
    background: #f8f8f8;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.wfacp_main_form #forex-rr-payment-form {
    background: transparent;
}

.wfacp-compatible {
    width: 100%;
}

/* Ensure visibility when selected */
li.wc_payment_method.payment_method_forex_rr_gateway.wc_payment_method.selected .payment_box,
li.wc_payment_method.payment_method_forex_rr_gateway input[type="radio"]:checked ~ .payment_box {
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
    max-height: none !important;
}

/* Ensure visibility */
fieldset#forex-rr-payment-form {
    border: none;
    padding: 0;
    margin: 0;
    min-height: auto;
}

/* Tab Navigation */
.forex-rr-payment-tabs {
    margin-bottom: 20px;
}

.forex-rr-tabs-nav {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    border-bottom: 2px solid #e0e0e0;
    background: #f9f9f9;
    border-radius: 8px 8px 0 0;
}

.forex-rr-tabs-nav li {
    margin: 0;
    padding: 0;
    flex: 1;
}

.forex-rr-tabs-nav li:first-child a {
    border-radius: 8px 0 0 0;
}

.forex-rr-tabs-nav li:last-child a {
    border-radius: 0 8px 0 0;
}

.forex-rr-tabs-nav a {
    display: block;
    padding: 15px 20px;
    text-decoration: none;
    color: #666;
    font-weight: 500;
    text-align: center;
    border-right: 1px solid #ddd;
    background: #f9f9f9;
    transition: all 0.3s ease;
    position: relative;
}

.forex-rr-tabs-nav li:last-child a {
    border-right: none;
}

.forex-rr-tabs-nav li.active a {
    color: #0073aa;
    background: #fff;
    border-bottom: 2px solid #0073aa;
    margin-bottom: -2px;
}

.forex-rr-tabs-nav a:hover {
    background: #f0f0f0;
    color: #0073aa;
}

.forex-rr-tabs-nav li.active a:hover {
    background: #fff;
}

/* Tab Content */
.forex-rr-tabs-content {
    background: #fff;
    border: 2px solid #e0e0e0;
    border-top: none;
    border-radius: 0 0 8px 8px;
    padding: 25px;
    min-height: 120px;
}

.forex-rr-tab-content {
    display: none !important;
}

.forex-rr-tab-content.active {
    display: block !important;
}

/* Card Element Wrapper */
.forex-rr-card-wrapper {
    width: 100%;
}

#forex-rr-card-element {
    padding: 15px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    background: #fff;
    margin-bottom: 15px;
    transition: all 0.3s ease;
    min-height: 40px;
}

#forex-rr-card-element:focus-within,
#forex-rr-card-element.StripeElement--focus {
    border-color: #0073aa;
    box-shadow: 0 0 0 1px #0073aa;
}

#forex-rr-card-element.complete {
    border-color: #28a745;
}

#forex-rr-card-element.loaded {
    border-color: #d1d1d1;
}

/* Stripe Element Styling */
#forex-rr-card-element .StripeElement {
    height: auto;
    min-height: 40px;
    padding: 10px 0;
}

#forex-rr-card-element .StripeElement--focus {
    outline: none;
}

#forex-rr-card-element .StripeElement--invalid {
    border-color: #fa755a;
}

#forex-rr-card-element .StripeElement--webkit-autofill {
    background-color: #fefde5 !important;
}

/* Error Messages */
#forex-rr-card-errors,
#forex-rr-apple-pay-errors,
#forex-rr-google-pay-errors {
    color: #fa755a;
    font-size: 14px;
    margin-top: 10px;
    display: none;
    padding: 10px 15px;
    background: #fdf2f2;
    border: 1px solid #fecaca;
    border-radius: 4px;
    line-height: 1.5;
}

/* Apple Pay and Google Pay Buttons */
.forex-rr-apple-pay-wrapper,
.forex-rr-google-pay-wrapper {
    text-align: center;
    padding: 10px 0;
}

#forex-rr-payment-request-button,
#forex-rr-google-pay-button {
    max-width: 100%;
    margin: 0 auto;
}

.forex-rr-payment-button {
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Stripe Payment Request Button */
.StripeElement--payment-request-button {
    height: 48px !important;
    padding: 0;
}

/* Processing State */
.processing #forex-rr-payment-form,
.processing .forex-rr-payment-wrapper {
    opacity: 0.6;
    pointer-events: none;
    position: relative;
}

.processing #forex-rr-card-element {
    position: relative;
}

.processing #forex-rr-card-element::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #0073aa;
    border-top: 2px solid transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Payment Method Icons */
.forex-rr-tabs-nav a::before {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    margin-right: 8px;
    vertical-align: middle;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

.forex-rr-tabs-nav a[data-tab="card"]::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='1' y='4' width='22' height='16' rx='2' ry='2'%3E%3C/rect%3E%3Cline x1='1' y1='10' x2='23' y2='10'%3E%3C/line%3E%3C/svg%3E");
}

.forex-rr-tabs-nav a[data-tab="apple_pay"]::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='%23666'%3E%3Cpath d='M18.71 19.5c-.83 1.24-1.71 2.45-3.05 2.47-1.34.03-1.77-.79-3.29-.79-1.53 0-2 .77-3.27.82-1.31.05-2.3-1.32-3.14-2.53C4.25 17 2.94 12.45 4.7 9.39c.87-1.52 2.43-2.48 4.12-2.51 1.28-.02 2.5.87 3.29.87.78 0 2.26-1.07 3.81-.91.65.03 2.47.26 3.64 1.98-.09.06-2.17 1.28-2.15 3.81.03 3.02 2.65 4.03 2.68 4.04-.03.07-.42 1.44-1.38 2.83M13 3.5c.73-.83 1.94-1.46 2.94-1.5.13 1.17-.34 2.35-1.04 3.19-.69.85-1.83 1.51-2.95 1.42-.15-1.15.41-2.35 1.05-3.11z'/%3E%3C/svg%3E");
}

.forex-rr-tabs-nav a[data-tab="google_pay"]::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath fill='%23666' d='M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1.41 13.4l-1.41 1.41-4.24-4.24 1.41-1.41L12 13.99l5.66-5.66 1.41 1.41-6.66 6.66z'/%3E%3C/svg%3E");
}

.forex-rr-tabs-nav li.active a[data-tab="card"]::before,
.forex-rr-tabs-nav li.active a[data-tab="apple_pay"]::before,
.forex-rr-tabs-nav li.active a[data-tab="google_pay"]::before {
    filter: hue-rotate(200deg) saturate(2) brightness(0.8);
}

/* Success States */
.forex-rr-success {
    color: #155724;
    background-color: #d4edda;
    border-color: #c3e6cb;
    padding: 10px 15px;
    border-radius: 4px;
    margin-top: 10px;
}

/* Loading States */
.forex-rr-loading {
    position: relative;
    overflow: hidden;
}

.forex-rr-loading::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.8), transparent);
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% { left: -100%; }
    100% { left: 100%; }
}

/* Responsive Design */
@media (max-width: 768px) {
    .forex-rr-tabs-nav {
        flex-direction: column;
    }
    
    .forex-rr-tabs-nav li {
        flex: none;
    }
    
    .forex-rr-tabs-nav li:first-child a,
    .forex-rr-tabs-nav li:last-child a {
        border-radius: 0;
    }
    
    .forex-rr-tabs-nav li:first-child a {
        border-radius: 8px 8px 0 0;
    }
    
    .forex-rr-tabs-nav a {
        border-right: none;
        border-bottom: 1px solid #ddd;
    }
    
    .forex-rr-tabs-nav li:last-child a {
        border-bottom: none;
    }
    
    .forex-rr-tabs-content {
        padding: 20px;
    }
}

@media (max-width: 480px) {
    .forex-rr-tabs-nav a {
        padding: 12px 15px;
        font-size: 14px;
    }
    
    .forex-rr-tabs-content {
        padding: 15px;
    }
    
    #forex-rr-card-element {
        padding: 12px;
    }
}

/* WFACP Specific Adjustments */
.wfacp_main_form .forex-rr-tabs-nav {
    margin-top: 10px;
}

.wfacp_main_form #forex-rr-payment-form {
    background: transparent;
}

.wfacp_main_form .forex-rr-tabs-content {
    background: #fafafa;
}

/* Ensure payment box is visible */
li.wc_payment_method.payment_method_forex_rr_gateway {
    display: list-item !important;
}

.payment_box.payment_method_forex_rr_gateway {
    display: block !important;
}

/* Hide when not selected - but keep in DOM for initialization */
li.wc_payment_method:not(.selected) .payment_box.payment_method_forex_rr_gateway {
    max-height: 0;
    overflow: hidden;
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
}

li.wc_payment_method.selected .payment_box.payment_method_forex_rr_gateway {
    max-height: none !important;
    overflow: visible !important;
    padding: 20px !important;
}

/* Fix for some themes */
.woocommerce #payment #place_order,
.woocommerce-page #payment #place_order {
    margin-top: 20px;
}

/* Stripe Element iframe */
.forex-rr-stripe-element .__PrivateStripeElement {
    width: 100%;
}

/* Block UI overlay compatibility */
.blockUI.blockOverlay {
    z-index: 1000 !important;
}

.processing .blockUI.blockMsg {
    z-index: 1001 !important;
}

/* Tab Navigation */
.forex-rr-payment-tabs {
    margin-bottom: 20px;
}

.forex-rr-tabs-nav {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    border-bottom: 2px solid #e0e0e0;
    background: #f9f9f9;
    border-radius: 8px 8px 0 0;
}

.forex-rr-tabs-nav li {
    margin: 0;
    padding: 0;
    flex: 1;
}

.forex-rr-tabs-nav li:first-child a {
    border-radius: 8px 0 0 0;
}

.forex-rr-tabs-nav li:last-child a {
    border-radius: 0 8px 0 0;
}

.forex-rr-tabs-nav a {
    display: block;
    padding: 15px 20px;
    text-decoration: none;
    color: #666;
    font-weight: 500;
    text-align: center;
    border-right: 1px solid #ddd;
    background: #f9f9f9;
    transition: all 0.3s ease;
    position: relative;
}

.forex-rr-tabs-nav li:last-child a {
    border-right: none;
}

.forex-rr-tabs-nav li.active a {
    color: #0073aa;
    background: #fff;
    border-bottom: 2px solid #0073aa;
    margin-bottom: -2px;
}

.forex-rr-tabs-nav a:hover {
    background: #f0f0f0;
    color: #0073aa;
}

.forex-rr-tabs-nav li.active a:hover {
    background: #fff;
}

/* Tab Content */
.forex-rr-tabs-content {
    background: #fff;
    border: 2px solid #e0e0e0;
    border-top: none;
    border-radius: 0 0 8px 8px;
    padding: 25px;
    min-height: 120px;
}

.forex-rr-tab-content {
    display: none;
}

.forex-rr-tab-content.active {
    display: block;
}

/* Card Element */
#forex-rr-card-element {
    padding: 15px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    background: #fff;
    margin-bottom: 15px;
    transition: border-color 0.3s ease;
}

#forex-rr-card-element:focus-within {
    border-color: #0073aa;
    box-shadow: 0 0 0 1px #0073aa;
}

#forex-rr-card-element .StripeElement {
    height: 40px;
    padding: 10px 12px;
    color: #32325d;
    background-color: white;
    border: none;
    border-radius: 4px;
}

#forex-rr-card-element .StripeElement--focus {
    outline: none;
}

#forex-rr-card-element .StripeElement--invalid {
    border-color: #fa755a;
}

#forex-rr-card-element .StripeElement--webkit-autofill {
    background-color: #fefde5 !important;
}

/* Error Messages */
#forex-rr-card-errors {
    color: #fa755a;
    font-size: 14px;
    margin-top: 10px;
    display: none;
    padding: 10px;
    background: #fdf2f2;
    border: 1px solid #fecaca;
    border-radius: 4px;
}

/* Apple Pay and Google Pay Elements */
#forex-rr-apple-pay-element,
#forex-rr-google-pay-element {
    text-align: center;
    padding: 20px 0;
}

#forex-rr-apple-pay-element .StripeElement,
#forex-rr-google-pay-element .StripeElement {
    height: 50px;
    padding: 0;
}

/* Payment Request Button Styling */
.StripeElement--payment-request-button {
    height: 50px;
    padding: 0;
}

/* Processing State */
.processing #forex-rr-payment-form {
    opacity: 0.6;
    pointer-events: none;
}

.processing #forex-rr-card-element {
    position: relative;
}

.processing #forex-rr-card-element::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #0073aa;
    border-top: 2px solid transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Responsive Design */
@media (max-width: 768px) {
    .forex-rr-tabs-nav {
        flex-direction: column;
    }
    
    .forex-rr-tabs-nav li {
        flex: none;
    }
    
    .forex-rr-tabs-nav li:first-child a,
    .forex-rr-tabs-nav li:last-child a {
        border-radius: 0;
    }
    
    .forex-rr-tabs-nav li:first-child a {
        border-radius: 8px 8px 0 0;
    }
    
    .forex-rr-tabs-nav a {
        border-right: none;
        border-bottom: 1px solid #ddd;
    }
    
    .forex-rr-tabs-nav li:last-child a {
        border-bottom: none;
    }
    
    .forex-rr-tabs-content {
        padding: 20px;
    }
}

@media (max-width: 480px) {
    .forex-rr-tabs-nav a {
        padding: 12px 15px;
        font-size: 14px;
    }
    
    .forex-rr-tabs-content {
        padding: 15px;
    }
    
    #forex-rr-card-element {
        padding: 12px;
    }
}

/* Loading States */
.forex-rr-loading {
    position: relative;
    overflow: hidden;
}

.forex-rr-loading::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.8), transparent);
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}

/* Success States */
.forex-rr-success {
    color: #155724;
    background-color: #d4edda;
    border-color: #c3e6cb;
    padding: 10px;
    border-radius: 4px;
    margin-top: 10px;
}

/* Payment Method Icons */
.forex-rr-tabs-nav a::before {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    margin-right: 8px;
    vertical-align: middle;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

.forex-rr-tabs-nav a[data-tab="card"]::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='1' y='4' width='22' height='16' rx='2' ry='2'%3E%3C/rect%3E%3Cline x1='1' y1='10' x2='23' y2='10'%3E%3C/line%3E%3C/svg%3E");
}

.forex-rr-tabs-nav a[data-tab="apple_pay"]::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='%23666'%3E%3Cpath d='M18.71 19.5c-.83 1.24-1.71 2.45-3.05 2.47-1.34.03-1.77-.79-3.29-.79-1.53 0-2 .77-3.27.82-1.31.05-2.3-1.32-3.14-2.53C4.25 17 2.94 12.45 4.7 9.39c.87-1.52 2.43-2.48 4.12-2.51 1.28-.02 2.5.87 3.29.87.78 0 2.26-1.07 3.81-.91.65.03 2.47.26 3.64 1.98-.09.06-2.17 1.28-2.15 3.81.03 3.02 2.65 4.03 2.68 4.04-.03.07-.42 1.44-1.38 2.83M13 3.5c.73-.83 1.94-1.46 2.94-1.5.13 1.17-.34 2.35-1.04 3.19-.69.85-1.83 1.51-2.95 1.42-.15-1.15.41-2.35 1.05-3.11z'/%3E%3C/svg%3E");
}

.forex-rr-tabs-nav a[data-tab="google_pay"]::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath fill='%23666' d='M12.97 2.45c.34-.06.69-.04 1.02.07 1.33.43 2.42 1.41 3.02 2.68.61 1.28.7 2.75.23 4.09-.5 1.43-1.49 2.65-2.76 3.38-.59.34-1.25.54-1.93.58-.68-.04-1.34-.24-1.93-.58-1.27-.73-2.26-1.95-2.76-3.38-.47-1.34-.38-2.81.23-4.09.6-1.27 1.69-2.25 3.02-2.68.33-.11.68-.13 1.02-.07zm.01 2.04c-.57-.11-1.16.08-1.59.46-.44.39-.72.95-.77 1.53-.05.58.1 1.17.41 1.65.32.48.8.83 1.35.97.56.14 1.16.06 1.65-.21.49-.28.87-.73 1.04-1.26.17-.53.12-1.11-.12-1.62-.24-.5-.63-.92-1.11-1.17-.48-.25-1.03-.35-1.59-.35z'/%3E%3C/svg%3E");
}

.forex-rr-tabs-nav li.active a[data-tab="card"]::before,
.forex-rr-tabs-nav li.active a[data-tab="apple_pay"]::before,
.forex-rr-tabs-nav li.active a[data-tab="google_pay"]::before {
    filter: hue-rotate(200deg) saturate(2);
}