/**
 * MerchFoxShield Gateway - Frontend Styles
 * Professional and consistent styling for checkout pages
 */

/* ==================== PAYMENT CONTAINER ==================== */

#mfs-payment-container {
    position: relative;
    min-height: 400px;
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin: 20px 0;
}

#mfs-payment-container.loading {
    display: flex;
    align-items: center;
    justify-content: center;
}

#mfs-payment-container .loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #0073aa;
    border-radius: 50%;
    animation: mfs-spin 1s linear infinite;
}

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

/* ==================== PAYMENT IFRAME ==================== */

#mfs-payment-container iframe {
    width: 100% !important;
    min-height: 400px;
    border: none;
    border-radius: 4px;
}

#mfs-payment-container iframe.full-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 999999;
    border-radius: 0;
}

/* Iframe disabled state */
#iframe-container.mfs-disabled {
    position: relative;
    pointer-events: none;
}

#iframe-container .mfs-disabled-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    border-radius: 4px;
    backdrop-filter: blur(2px);
}

#iframe-container .mfs-disabled-overlay p {
    background: #fff;
    padding: 15px 25px;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    color: #666;
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    margin: 0;
    border-left: 4px solid #ffc107;
}

/* ==================== EXPRESS CHECKOUT BUTTONS ==================== */

.mfs-express-container {
    margin: 20px 0;
    padding: 15px;
    background: #f9f9f9;
    border: 1px solid #e5e5e5;
    border-radius: 4px;
}

.mfs-express-separator {
    text-align: center;
    margin: 10px 0 15px;
    font-size: 14px;
    font-weight: 600;
    color: #666;
    position: relative;
}

.mfs-express-separator::before,
.mfs-express-separator::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 40%;
    height: 1px;
    background: #ddd;
}

.mfs-express-separator::before {
    left: 0;
}

.mfs-express-separator::after {
    right: 0;
}

.mfs-express-button-container {
    min-height: 45px;
    position: relative;
}

.mfs-express-button-container.loading {
    opacity: 0.6;
    pointer-events: none;
}

.mfs-express-button-container.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #0073aa;
    border-top-color: transparent;
    border-radius: 50%;
    animation: mfs-spin 0.6s linear infinite;
}

/* Cart page express checkout - match cart_totals width */
#mfs-express-checkout-cart {
    margin-top: 20px;
    margin-left: auto;
    width: 100%;
    float: right;
    clear: both;
    padding: 0 15px;
    box-sizing: border-box;
}

/* Match Bootstrap grid: col-lg-5 (41.67%) on large screens, with padding like cart_totals */
@media (min-width: 992px) {
    #mfs-express-checkout-cart {
        width: 40%;
        max-width: 40%;
        padding: 0 15px;
    }
}

/* Match Bootstrap grid: col-xl-4 (33.33%) on extra large screens */
@media (min-width: 1200px) {
    #mfs-express-checkout-cart {
        width: 31.8%;
        max-width: 31.8%;
        padding: 0 15px;
    }
}

/* Inner container styling to match cart_totals visual appearance */
#mfs-express-checkout-cart .mfs-express-container {
    padding: 20px;
    margin: 0;
}

/* Product page express checkout */
#mfs-express-checkout-product {
    margin-top: 15px;
}

/* ==================== LOADING OVERLAY ==================== */

.mfs-loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mfs-loading-overlay .mfs-loading-content {
    background: white;
    padding: 40px;
    border-radius: 12px;
    text-align: center;
    max-width: 400px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.mfs-loading-overlay .mfs-loading-icon {
    font-size: 48px;
    margin-bottom: 20px;
    animation: mfs-pulse 1.5s ease-in-out infinite;
}

@keyframes mfs-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(1.1); }
}

.mfs-loading-overlay h3 {
    margin: 0 0 10px;
    color: #333;
    font-size: 20px;
    font-weight: 600;
}

.mfs-loading-overlay p {
    margin: 0;
    color: #666;
    font-size: 14px;
}

.mfs-loading-overlay .mfs-spinner {
    margin: 20px auto 0;
    width: 40px;
    height: 40px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #0073aa;
    border-radius: 50%;
    animation: mfs-spin 1s linear infinite;
}

/* ==================== ERROR MESSAGES ==================== */

.mfs-error-message {
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-left: 4px solid #ffc107;
    color: #856404;
    padding: 15px;
    border-radius: 4px;
    margin: 15px 0;
}

.mfs-error-message.error {
    background: #f8d7da;
    border-color: #dc3545;
    color: #721c24;
}

.mfs-error-message.success {
    background: #d4edda;
    border-color: #28a745;
    color: #155724;
}

.mfs-error-message .mfs-error-icon {
    display: inline-block;
    margin-right: 10px;
    font-size: 18px;
    vertical-align: middle;
}

/* ==================== PAYMENT METHOD ICONS ==================== */

.payment_method_merchfoxshield_paypal img.mfs-payment-icon {
    display: inline-block;
    margin: 0 5px;
    height: 24px;
    width: auto;
    vertical-align: middle;
}

.payment_method_merchfoxshield_paypal .payment-method-description {
    color: #666;
    font-size: 14px;
    margin: 10px 0;
}

/* ==================== RESPONSIVE DESIGN ==================== */

@media (max-width: 768px) {
    #mfs-payment-container {
        padding: 15px;
        margin: 15px 0;
    }

    .mfs-express-container {
        padding: 15px;
    }

    .mfs-loading-overlay .mfs-loading-content {
        padding: 30px 20px;
        margin: 0 20px;
    }

    #mfs-payment-container iframe {
        min-height: 350px;
    }
}

@media (max-width: 480px) {
    #mfs-payment-container {
        padding: 10px;
        margin: 10px 0;
    }

    .mfs-express-separator {
        font-size: 12px;
    }

    .mfs-loading-overlay .mfs-loading-content {
        padding: 20px 15px;
    }

    .mfs-loading-overlay h3 {
        font-size: 18px;
    }
}

/* ==================== CHECKOUT PAGE SPECIFIC ==================== */

.woocommerce-checkout #mfs-payment-container {
    background: #fafafa;
}

.woocommerce-checkout .payment_method_merchfoxshield_paypal {
    background: #fff;
    padding: 15px;
    border-radius: 4px;
}

/* ==================== BUTTON STYLES ==================== */

.mfs-button {
    display: inline-block;
    padding: 12px 24px;
    background: #0073aa;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    text-align: center;
}

.mfs-button:hover {
    background: #005177;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 115, 170, 0.3);
}

.mfs-button:active {
    transform: translateY(0);
}

.mfs-button:disabled {
    background: #ccc;
    cursor: not-allowed;
    opacity: 0.6;
}

.mfs-button.loading {
    position: relative;
    color: transparent;
}

.mfs-button.loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    margin: -10px 0 0 -10px;
    width: 20px;
    height: 20px;
    border: 2px solid white;
    border-top-color: transparent;
    border-radius: 50%;
    animation: mfs-spin 0.6s linear infinite;
}

/* ==================== ACCESSIBILITY ==================== */

.mfs-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* ==================== ANIMATIONS ==================== */

@keyframes mfs-fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.mfs-fade-in {
    animation: mfs-fadeIn 0.3s ease-out;
}

@keyframes mfs-slideDown {
    from {
        opacity: 0;
        max-height: 0;
    }
    to {
        opacity: 1;
        max-height: 500px;
    }
}

.mfs-slide-down {
    animation: mfs-slideDown 0.3s ease-out;
}

/* ==================== UTILITIES ==================== */

.mfs-hidden {
    display: none !important;
}

.mfs-text-center {
    text-align: center;
}

.mfs-mt-10 {
    margin-top: 10px;
}

.mfs-mt-20 {
    margin-top: 20px;
}

.mfs-mb-10 {
    margin-bottom: 10px;
}

.mfs-mb-20 {
    margin-bottom: 20px;
}
