/**
 * PMS WooCommerce Gateways - Frontend Styles
 */

/* Payment Fields Container */
#pms-wcg-payment-fields-wrapper {
    margin-top: 25px;
    padding: 0;
}

.pms-wcg-fields-container {
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
}

/* Gateway Description */
.pms-wcg-description {
    margin-bottom: 20px;
    padding: 12px 15px;
    background: #fff;
    border-left: 4px solid #0073aa;
    border-radius: 4px;
    font-size: 14px;
    color: #555;
}

.pms-wcg-description p {
    margin: 0;
}

/* Payment Form */
.pms-wcg-form {
    background: #fff;
    padding: 20px;
    border-radius: 6px;
    border: 1px solid #e5e5e5;
}

/* WooCommerce form styling */
.pms-wcg-form .form-row {
    margin-bottom: 15px;
}

.pms-wcg-form label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #333;
}

.pms-wcg-form input[type="text"],
.pms-wcg-form input[type="number"],
.pms-wcg-form input[type="tel"],
.pms-wcg-form select {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.pms-wcg-form input:focus,
.pms-wcg-form select:focus {
    border-color: #0073aa;
    outline: none;
    box-shadow: 0 0 0 2px rgba(0, 115, 170, 0.1);
}

/* Credit Card Icons */
.pms-wcg-form .wc-credit-card-form-card-icons {
    margin-bottom: 15px;
}

.pms-wcg-form .wc-credit-card-form-card-icons img {
    max-height: 28px;
    margin-right: 8px;
}

/* Stripe Elements */
.pms-wcg-form .wc-stripe-elements-field,
.pms-wcg-form .StripeElement,
.pms-wcg-form #stripe-card-element {
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fff;
}

/* Two column layout */
.pms-wcg-form .form-row-first {
    float: left;
    width: 48%;
    margin-right: 4%;
}

.pms-wcg-form .form-row-last {
    float: left;
    width: 48%;
}

.pms-wcg-form .form-row-wide {
    clear: both;
    width: 100%;
}

.pms-wcg-form::after {
    content: '';
    display: table;
    clear: both;
}

/* PayPal Buttons */
.pms-wcg-form #paypal-button-container,
.pms-wcg-form .paypal-buttons {
    margin-top: 15px;
}

/* Error styling */
.pms-wcg-form .woocommerce-error,
.pms-wcg-form .wc-stripe-error {
    color: #dc3545;
    padding: 10px;
    background: #fef2f2;
    border-radius: 4px;
    margin-bottom: 15px;
}

/* Gateway Label Enhancement */
#pms-paygates-wrapper label {
    display: flex;
    align-items: center;
    padding: 14px 18px;
    margin-bottom: 10px;
    background: #fff;
    border: 2px solid #e5e5e5;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

#pms-paygates-wrapper label:hover {
    border-color: #0073aa;
    background: #f7fbfd;
}

#pms-paygates-wrapper input[type="radio"] {
    margin-right: 12px;
    width: 18px;
    height: 18px;
}

#pms-paygates-wrapper input[type="radio"]:checked + .pms-paygate-name,
#pms-paygates-wrapper input[type="radio"]:checked ~ .pms-paygate-name {
    color: #0073aa;
    font-weight: 600;
}

/* Modern selected state */
#pms-paygates-wrapper label:has(input[type="radio"]:checked) {
    border-color: #0073aa;
    background: linear-gradient(135deg, #fdfbf8 0%, #f9f5f0 100%) !important;
}

/* ======================================
   Gateway Logo Display Styles
   ====================================== */

/* Gateway Logo - Base Styles */
.pms-gateway-logo {
    max-height: 32px;
    width: auto;
    object-fit: contain;
    vertical-align: middle;
}

/* Logo Only Mode */
#pms-paygates-wrapper label.pms-display-logo .pms-paygate-name {
    display: flex;
    align-items: center;
    justify-content: center;
}

#pms-paygates-wrapper label.pms-display-logo .pms-gateway-logo {
    max-height: 36px;
}

/* Logo + Text Mode */
#pms-paygates-wrapper label.pms-display-logo-text .pms-paygate-name {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-direction: column !important;
    border: none !important;
    background-color: transparent !important;
    box-shadow: none !important;
}

#pms-paygates-wrapper label.pms-display-logo-text .pms-gateway-logo {
    max-height: 28px;
    flex-shrink: 0;
}

#pms-paygates-wrapper label.pms-display-logo-text .pms-gateway-title {
    font-size: 14px;
}

/* Text Fallback (when logo mode but no logo available) */
#pms-paygates-wrapper label.pms-display-text-fallback .pms-paygate-name {
    font-style: normal;
}

/* RTL Support */
[dir="rtl"] .pms-wcg-description {
    border-left: none;
    border-right: 4px solid #0073aa;
}

[dir="rtl"] .pms-wcg-form .form-row-first {
    float: right;
    margin-right: 0;
    margin-left: 4%;
}

[dir="rtl"] .pms-wcg-form .form-row-last {
    float: right;
}

[dir="rtl"] #pms-paygates-wrapper input[type="radio"] {
    margin-right: 0;
    margin-left: 12px;
}

[dir="rtl"] .pms-wcg-form .wc-credit-card-form-card-icons img {
    margin-right: 0;
    margin-left: 8px;
}

/* RTL: Logo + Text Mode - reverse flex direction */
[dir="rtl"] #pms-paygates-wrapper label.pms-display-logo-text .pms-paygate-name {
    flex-direction: column;
}

/* Responsive */
@media (max-width: 768px) {
    .pms-wcg-fields-container {
        padding: 15px;
    }

    .pms-wcg-form {
        padding: 15px;
    }

    .pms-wcg-form .form-row-first,
    .pms-wcg-form .form-row-last {
        width: 100%;
        float: none;
        margin-right: 0;
    }
}
