/* Viva Wallet Payment Method Styles - Enhanced with Smart Checkout Integration */

/* Force show button when Viva Wallet is selected */
body .current-step-payment__pay a.latepoint-btn.latepoint-btn-primary.latepoint-next-btn.disabled[data-pre-last-step-label="Submit"] {
  background-color: var(--latepoint-brand-primary)!important;
}
body .current-step-payment__pay .latepoint-next-btn.disabled[data-pre-last-step-label="Submit"] span, 
body .current-step-payment__pay .latepoint-next-btn.disabled[data-pre-last-step-label="Submit"] i.latepoint-icon-arrow-2-right {
  color: #fff!important;
}


.lp-payment-method-content[data-payment-method="viva_wallet_smart_checkout"] {
    padding: 20px;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    background: #fff;
}

.viva-wallet-payment-info h4 {
    margin: 0 0 10px 0;
    color: #333;
    font-size: 16px;
}

.viva-wallet-payment-info p {
    margin: 0 0 15px 0;
    color: #666;
    font-size: 14px;
}

.viva-wallet-accepted-cards {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 15px;
}

.viva-wallet-accepted-cards img {
    height: 30px;
    border-radius: 4px;
}

.viva-wallet-installments-info {
    background: #f8f9fa;
    padding: 10px;
    border-radius: 4px;
    margin: 10px 0;
}

.latepoint-secured-payments-label {
    font-size: 12px;
    color: #999;
    text-align: center;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #eee;
}

/* ERROR MESSAGE STYLES */

/* Error message container - positioned for .latepoint-body */
.viva-wallet-error-message {
    position: relative !important;
    z-index: 1000 !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
    box-sizing: border-box !important;
    animation: vivaWalletErrorSlideIn 0.3s ease-out !important;
}

/* Ensure error message is always on top in .latepoint-body */
.latepoint-body .viva-wallet-error-message:first-child {
    margin-bottom: 20px !important;
}

/* Error message animations */
@keyframes vivaWalletErrorSlideIn {
    from { 
        opacity: 0; 
        transform: translateY(-20px); 
    }
    to { 
        opacity: 1; 
        transform: translateY(0); 
    }
}

@keyframes vivaWalletErrorSlideOut {
    from { 
        opacity: 1; 
        transform: translateY(0); 
    }
    to { 
        opacity: 0; 
        transform: translateY(-20px); 
    }
}

/* Error message close button styling */
.viva-wallet-error-close {
    transition: opacity 0.2s ease !important;
}

.viva-wallet-error-close:hover {
    opacity: 1 !important;
    transform: scale(1.1) !important;
}

/* Fallback error message for when lightbox isn't available */
#viva-wallet-fallback-error {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
    animation: vivaWalletFallbackSlideDown 0.4s ease-out !important;
}

@keyframes vivaWalletFallbackSlideDown {
    from { 
        opacity: 0; 
        transform: translateX(-50%) translateY(-20px); 
    }
    to { 
        opacity: 1; 
        transform: translateX(-50%) translateY(0); 
    }
}

/* LOADING OVERLAY STYLES */
.viva-wallet-payment-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.viva-wallet-loader-content {
    background: white;
    padding: 40px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
    max-width: 400px;
    margin: 20px;
}

.viva-wallet-loader-content h3 {
    margin: 0 0 15px 0;
    color: #333;
}

.viva-wallet-loader-content p {
    margin: 0 0 20px 0;
    color: #666;
}

.viva-wallet-spinner {
    border: 3px solid #f3f3f3;
    border-top: 3px solid var(--latepoint-brand-primary);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: viva-wallet-spin 1s linear infinite;
    margin: 0 auto;
}

@keyframes viva-wallet-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* VIVA WALLET BRANDING */
.viva-wallet-branding {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 10px;
    font-size: 12px;
    color: #999;
}

.viva-wallet-branding::before {
    content: "Powered by ";
}

.viva-wallet-branding::after {
    content: "Viva Wallet";
    font-weight: 600;
    color: #0066cc;
    margin-left: 4px;
}

/* SMART CHECKOUT INTEGRATION STYLES */
.viva-wallet-smart-checkout-info {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px;
    border-radius: 8px;
    margin: 10px 0;
    text-align: center;
}

.viva-wallet-smart-checkout-info h5 {
    margin: 0 0 8px 0;
    font-size: 14px;
    font-weight: 600;
}

.viva-wallet-smart-checkout-info p {
    margin: 0;
    font-size: 12px;
    opacity: 0.9;
}

/* FEATURES HIGHLIGHTS */
.viva-wallet-features {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin: 15px 0;
}

.viva-wallet-feature {
    display: flex;
    align-items: center;
    font-size: 12px;
    color: #666;
}

.viva-wallet-feature::before {
    content: "?";
    color: #28a745;
    font-weight: bold;
    margin-right: 8px;
}

/* SECURITY BADGES */
.viva-wallet-security {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin: 15px 0;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 6px;
}

.viva-wallet-security-badge {
    display: flex;
    align-items: center;
    font-size: 11px;
    color: #666;
}

.viva-wallet-security-badge::before {
    content: "???";
    margin-right: 5px;
}

/* RESPONSIVE DESIGN */
@media (max-width: 768px) {
    .viva-wallet-payment-info {
        text-align: center;
    }
    
    .viva-wallet-accepted-cards {
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .viva-wallet-loader-content {
        margin: 10px;
        padding: 30px 20px;
    }
    
    .viva-wallet-error-message {
        margin: 0 10px 15px 10px !important;
        padding: 12px 15px !important;
        font-size: 13px !important;
    }
    
    #viva-wallet-fallback-error {
        left: 10px !important;
        right: 10px !important;
        transform: none !important;
        max-width: none !important;
    }
    
    .viva-wallet-features {
        grid-template-columns: 1fr;
    }
    
    .viva-wallet-security {
        flex-direction: column;
        gap: 8px;
    }
}

/* ACCESSIBILITY IMPROVEMENTS */
.viva-wallet-error-message {
    border-radius: 6px !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1) !important;
}

.viva-wallet-error-message:focus-within {
    outline: 2px solid var(--latepoint-brand-primary);
    outline-offset: 2px;
}

.viva-wallet-error-close:focus {
    outline: 2px solid var(--latepoint-brand-primary);
    outline-offset: 2px;
    border-radius: 2px;
}

/* HIGH CONTRAST MODE SUPPORT */
@media (prefers-contrast: high) {
    .viva-wallet-error-message {
        border-width: 2px !important;
    }
    
    .viva-wallet-error-close {
        background: rgba(0,0,0,0.1) !important;
        border-radius: 3px !important;
    }
}

/* REDUCED MOTION SUPPORT */
@media (prefers-reduced-motion: reduce) {
    .viva-wallet-error-message,
    #viva-wallet-fallback-error,
    .viva-wallet-spinner {
        animation: none !important;
    }
}

/* PRINT STYLES */
@media print {
    .viva-wallet-error-message,
    #viva-wallet-fallback-error,
    .viva-wallet-payment-loader {
        display: none !important;
    }
}

/* DARK MODE SUPPORT */
@media (prefers-color-scheme: dark) {
    .viva-wallet-payment-info {
        background: #2d3748;
        color: #e2e8f0;
    }
    
    .viva-wallet-installments-info {
        background: #4a5568;
        color: #e2e8f0;
    }
    
    .latepoint-secured-payments-label {
        color: #a0aec0;
    }
    
    .viva-wallet-features .viva-wallet-feature {
        color: #a0aec0;
    }
    
    .viva-wallet-security {
        background: #4a5568;
    }
    
    .viva-wallet-security-badge {
        color: #a0aec0;
    }
}

/* MODERN BROWSER ENHANCEMENTS */
@supports (backdrop-filter: blur(10px)) {
    .viva-wallet-payment-loader {
        backdrop-filter: blur(10px);
    }
}

@supports (display: grid) {
    .viva-wallet-features {
        display: grid;
    }
}

/* VIVA WALLET SPECIFIC ANIMATIONS */
@keyframes viva-wallet-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.viva-wallet-processing {
    animation: viva-wallet-pulse 2s infinite;
}

/* SMOOTH TRANSITIONS */
.viva-wallet-payment-info,
.viva-wallet-installments-info,
.viva-wallet-accepted-cards img {
    transition: all 0.3s ease;
}



.viva-wallet-accepted-cards img:hover {
    transform: scale(1.05);
    filter: brightness(1.1);
}

/* FOCUS STATES FOR KEYBOARD NAVIGATION */
.lp-payment-method-content[data-payment-method="viva_wallet_smart_checkout"]:focus-within {
    outline: 2px solid var(--latepoint-brand-primary);
    outline-offset: 2px;
    border-radius: 8px;
}

/* LOADING STATES */
.viva-wallet-loading {
    position: relative;
    overflow: hidden;
}

.viva-wallet-loading::after {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    animation: viva-wallet-shimmer 1.5s infinite;
}

@keyframes viva-wallet-shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

/* VIVA WALLET BRAND COLORS */
:root {
    --viva-wallet-primary: #0066cc;
    --viva-wallet-secondary: #667eea;
    --viva-wallet-success: #28a745;
    --viva-wallet-error: #dc3545;
    --viva-wallet-warning: #ffc107;
}

/* COMPONENT VARIANTS */
.viva-wallet-compact .viva-wallet-payment-info {
    padding: 15px;
}

.viva-wallet-compact .viva-wallet-accepted-cards img {
    height: 24px;
}

.viva-wallet-minimal .viva-wallet-features,
.viva-wallet-minimal .viva-wallet-security,
.viva-wallet-minimal .viva-wallet-branding {
    display: none;
}

/* INTEGRATION SPECIFIC OVERRIDES */
.latepoint-lightbox-w .viva-wallet-payment-info {
    margin-bottom: 0;
}

.latepoint-popup .viva-wallet-accepted-cards {
    justify-content: center;
}

/* FINAL CATCH-ALL RULES */
.viva-wallet-error-message * {
    box-sizing: border-box;
}

.viva-wallet-payment-info * {
    box-sizing: border-box;
}