/**
 * Relay Gateway Styles
 */

/* Field container */
.relay-gateway-fields {
    margin-top: 15px;
    padding: 15px;
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.relay-gateway-fields.hidden {
    display: none;
}

/* Field styling */
.relay-gateway-fields .form-row {
    margin-bottom: 15px;
}

.relay-gateway-fields label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
}

.relay-gateway-fields label .required {
    color: #e74c3c;
}

.relay-gateway-fields input[type="text"],
.relay-gateway-fields input[type="email"],
.relay-gateway-fields input[type="tel"],
.relay-gateway-fields input[type="number"],
.relay-gateway-fields select,
.relay-gateway-fields textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.relay-gateway-fields input:focus,
.relay-gateway-fields select:focus,
.relay-gateway-fields textarea:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 1px #0073aa;
}

/* Iframe container */
.relay-gateway-iframe-container {
    margin-top: 15px;
    padding: 15px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.relay-gateway-iframe-container iframe {
    width: 100%;
    min-height: 400px;
    border: none;
}

@media (min-width: 769px) {
    .relay-gateway-iframe-container iframe {
        min-height: 520px;
    }
}

/* Payment method icon - responsive */
/* Match all dynamic gateway classes: payment_method_relay_gateway_* */
[class^="payment_method_relay_gateway_"] img,
[class*="payment_method_relay_gateway_"] img,
[class^="payment_method_relay_gateway_"] .relay-gateway-icon,
[class*="payment_method_relay_gateway_"] .relay-gateway-icon,
.relay-gateway-icon {
    max-width: 100%;
    height: auto;
    vertical-align: middle;
    margin-left: 10px;
    display: inline-block;
}

/* Limit maximum size for better display */
[class^="payment_method_relay_gateway_"] .relay-gateway-icon,
[class*="payment_method_relay_gateway_"] .relay-gateway-icon,
.relay-gateway-icon {
    max-width: 120px;
    max-height: 60px;
    width: auto;
    object-fit: contain;
}

/* Responsive adjustment for mobile */
@media (max-width: 768px) {
    [class^="payment_method_relay_gateway_"] .relay-gateway-icon,
    [class*="payment_method_relay_gateway_"] .relay-gateway-icon,
    .relay-gateway-icon {
        max-width: 80px;
        max-height: 40px;
    }
}

/* Loading state */
.relay-gateway-loading {
    text-align: center;
    padding: 20px;
}

.relay-gateway-loading::after {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #0073aa;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Error messages */
.relay-gateway-error {
    color: #e74c3c;
    font-size: 12px;
    margin-top: 5px;
    display: block;
}

/* Success messages */
.relay-gateway-success {
    color: #27ae60;
    font-size: 12px;
    margin-top: 5px;
    display: block;
}

/* Payment form container on thankyou page */
#relay-gateway-payment-form-container {
    margin: 20px 0;
}

#relay-gateway-payment-form-container iframe {
    width: 100%;
    border: none;
}

/* Payment Modal (Mobile) */
.relay-gateway-payment-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
}

.relay-gateway-modal-open {
    overflow: hidden;
}

.relay-gateway-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 999998;
}

.relay-gateway-modal-content {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #fff;
    z-index: 999999;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.relay-gateway-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #ddd;
    background-color: #f9f9f9;
    flex-shrink: 0;
}

.relay-gateway-modal-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.relay-gateway-modal-close {
    background: none;
    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.2s;
}

.relay-gateway-modal-close:hover,
.relay-gateway-modal-close:focus {
    color: #000;
    outline: none;
}

.relay-gateway-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 0;
    position: relative;
}

.relay-gateway-modal-body #relay-gateway-payment-form-container {
    margin: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.relay-gateway-modal-body #relay-gateway-payment-form-container iframe {
    flex: 1;
    width: 100%;
    height: 100%;
    min-height: 100%;
    border: none;
}

/* Desktop: centered popup (non-fullscreen) */
.relay-gateway-payment-modal--desktop .relay-gateway-modal-content {
    top: 50%;
    left: 50%;
    width: 90%;
    max-width: 560px;
    height: auto;
    max-height: 90vh;
    transform: translate(-50%, -50%);
    border-radius: 8px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.2);
}

.relay-gateway-payment-modal--desktop .relay-gateway-modal-body {
    max-height: calc(90vh - 60px);
    overflow-y: auto;
}

.relay-gateway-payment-modal--desktop .relay-gateway-modal-body #relay-gateway-payment-form-container {
    height: auto;
    min-height: 420px;
}

.relay-gateway-payment-modal--desktop .relay-gateway-modal-body #relay-gateway-payment-form-container iframe {
    min-height: 420px;
}


