/* Bank Styles - Professional Split Layout */
:root {
    --transition-speed: 0.3s;
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.07);
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.1);
    --shadow-xl: 0 20px 25px rgba(0,0,0,0.15);
    
    /* Layout Vars */
    --hero-width: 55%;
    --form-width: 45%;
}

*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family, 'Inter', 'Roboto', sans-serif);
    background: #fff;
    color: var(--text-color, #333);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* Split Layout Container */
.split-layout {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

/* Hero Section (Left Side) */
.split-hero {
    display: none; /* Hidden on mobile */
    width: var(--hero-width);
    background: var(--background-gradient);
    position: relative;
    flex-direction: column;
    justify-content: center;
    padding: 4rem;
    color: #fff;
    overflow: hidden;
    z-index: 1;
}

/* Fix for specific banks */
.bg-liverpool {
    background: linear-gradient(135deg, #e10098 0%, #cc008a 100%) !important;
}

/* Dynamic Background Container */
#hero-background-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0; /* Behind content */
    overflow: hidden;
    pointer-events: none;
}

/* Default Pattern Overlay */
.split-hero::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 1;
    background: linear-gradient(to bottom, rgba(0,0,0,0.1), rgba(0,0,0,0.3));
}

.hero-content {
    position: relative;
    z-index: 2;
    max-width: 600px;
    text-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

.hero-content h1 {
    font-size: 3.5rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    line-height: 1.1;
    letter-spacing: -0.02em;
}

.hero-content p {
    font-size: 1.25rem;
    opacity: 0.95;
    margin-bottom: 3rem;
    font-weight: 300;
}

.hero-features {
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
}

.feature-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    font-weight: 600;
    background: rgba(255,255,255,0.15);
    padding: 0.5rem 1rem;
    border-radius: 50px;
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255,255,255,0.2);
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
}

/* --- ANIMATIONS & DYNAMIC BACKGROUNDS --- */

/* 1. Banorte: "Pulse of Strength" (Red Circles) */
.bg-banorte .circle-ripple {
    position: absolute;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.1);
    opacity: 0;
    animation: ripple 8s infinite linear;
}
@keyframes ripple {
    0% { transform: scale(0.5); opacity: 0; }
    50% { opacity: 0.3; }
    100% { transform: scale(2.5); opacity: 0; }
}

/* 2. BBVA: "Sparkles" (Digital Glints) */
.bg-bbva .sparkle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: white;
    border-radius: 50%;
    box-shadow: 0 0 10px 2px rgba(255, 255, 255, 0.8);
    opacity: 0;
    animation: sparkle 4s infinite ease-in-out;
}
@keyframes sparkle {
    0%, 100% { transform: scale(0); opacity: 0; }
    50% { transform: scale(1.5); opacity: 1; }
}

/* 3. Santander: "Flame Flow" (Liquid Red) */
.bg-santander .flame-wave {
    position: absolute;
    bottom: -50%;
    left: -20%;
    width: 140%;
    height: 100%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 60%);
    opacity: 0.6;
    animation: flameFlow 10s infinite alternate ease-in-out;
    transform-origin: center bottom;
}
@keyframes flameFlow {
    0% { transform: skewX(-10deg) translateY(0); }
    100% { transform: skewX(10deg) translateY(-20px); }
}

/* 4. Banamex: "Orbiting Arcs" */
.bg-banamex .arc {
    position: absolute;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    animation: rotateArc 20s infinite linear;
}
@keyframes rotateArc {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* 5. Azteca: "Rising Prosperity" (Gold Particles) */
.bg-azteca .gold-particle {
    position: absolute;
    width: 6px;
    height: 6px;
    background: #FFD700;
    border-radius: 50%;
    box-shadow: 0 0 8px #FFD700;
    opacity: 0;
    animation: riseUp 6s infinite ease-in;
}
@keyframes riseUp {
    0% { transform: translateY(100vh) scale(0.5); opacity: 0; }
    50% { opacity: 0.8; }
    100% { transform: translateY(-10vh) scale(1.2); opacity: 0; }
}

/* 6. HSBC: "Hexagon Grid" */
.bg-hsbc .hex {
    position: absolute;
    width: 100px;
    height: 115px; /* Hexagon aspect ratio */
    background: rgba(255, 255, 255, 0.03);
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    animation: pulseHex 4s infinite alternate;
}
@keyframes pulseHex {
    0% { transform: scale(1); opacity: 0.1; }
    100% { transform: scale(1.1); opacity: 0.3; }
}

/* 7. Scotiabank: "Globe Spin" */
.bg-scotiabank .globe-wireframe {
    position: absolute;
    right: -20%;
    bottom: -20%;
    width: 80vh;
    height: 80vh;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    animation: spinGlobe 30s infinite linear;
}
.bg-scotiabank .globe-wireframe::before,
.bg-scotiabank .globe-wireframe::after {
    content: '';
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transform: rotateX(60deg);
}
@keyframes spinGlobe {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* 8. Amex: "Card Float" */
.bg-amex .card-shape {
    position: absolute;
    width: 200px;
    height: 120px;
    background: linear-gradient(135deg, rgba(255,255,255,0.1), rgba(255,255,255,0.02));
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.1);
    backdrop-filter: blur(4px);
    animation: floatCard 8s infinite ease-in-out;
}
@keyframes floatCard {
    0%, 100% { transform: translateY(0) rotate(5deg); }
    50% { transform: translateY(-20px) rotate(8deg); }
}

/* 9. Liverpool: "Floating Bubbles" */
.bg-liverpool .bubble {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.4), rgba(255, 255, 255, 0.1));
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(2px);
    animation: floatBubble 8s infinite ease-in-out;
}
@keyframes floatBubble {
    0% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-30px) scale(1.1); }
    100% { transform: translateY(0) scale(1); }
}


/* General Floating Animation helper */
@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-15px); }
}


/* Form Section (Right Side) */
.split-form {
    flex: 1;
    width: 100%; /* Mobile default */
    background: #f4f6f9; /* Soft background instead of pure white */
    display: flex;
    flex-direction: column;
    position: relative;
    min-height: 100vh;
}

/* Header inside Form Side */
header {
    padding: 1.5rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 80px;
    background: #fff;
    box-shadow: var(--shadow-sm);
    z-index: 10;
}

.logo-container img {
    height: var(--logo-height, 40px);
    max-width: 180px;
    object-fit: contain;
    display: block !important;
}

.logo-container img[src="/subdomains/banamex/logo.png"] {
    height: 76px !important;
    max-width: 320px !important;
}

#dynamic-logo-container img[src="/subdomains/banamex/logo.png"],
#fallback-logo[src="/subdomains/banamex/logo.png"],
#form-logo[src="/subdomains/banamex/logo.png"] {
    width: auto !important;
    max-width: 340px !important;
    max-height: 120px !important;
    height: auto !important;
    object-fit: contain !important;
    display: block !important;
    margin: 0 auto !important;
}

#form-logo-container {
    text-align: center;
    margin-bottom: 1.25rem;
}

body[data-bank="bancoppel"] .logo-container {
    background: transparent;
    padding: 0;
    border-radius: 0;
    display: inline-block;
}

.btn-internet {
    background: transparent;
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
    padding: 0.5rem 1rem;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
}

.btn-internet:hover {
    background: var(--primary-color);
    color: #fff;
}

/* Main Wrapper */
#main-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    width: 100%;
    margin: 0 auto;
    box-sizing: border-box;
}

/* Card Styles */
.form-card {
    width: 100%;
    max-width: 420px;
    padding: 2.5rem 2rem;
    background: white;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    animation: fadeIn 0.4s ease-out;
    margin: 0 auto;
    box-sizing: border-box;
}

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

.welcome-header {
    text-align: center;
    margin-bottom: 2rem;
}

.form-header {
    text-align: center;
    margin-bottom: 2rem;
}

.form-title {
    font-family: var(--title-font-family, inherit);
    font-size: clamp(1.4rem, 5vw, 1.8rem);
    font-weight: 700;
    color: var(--text-color, #1a1a1a);
    margin-bottom: 0.5rem;
    letter-spacing: -0.01em;
    line-height: 1.2;
    text-align: center;
}

.form-subtitle {
    color: #666;
    font-size: clamp(0.9rem, 3vw, 1rem);
    line-height: 1.4;
    text-align: center;
}

.input-group {
    margin-bottom: 1.5rem;
    position: relative;
    width: 100%;
}

.input-group input, .input-group select {
    width: 100%;
    padding: 14px 16px 14px 45px !important; /* Space for icon fixed */
    border: 1px solid #d1d5db;
    border-radius: var(--input-border-radius, 8px);
    font-size: 1rem;
    transition: all 0.2s ease;
    background: #f9fafb;
    color: #111;
    text-align: left !important;
    box-sizing: border-box;
    height: 52px;
}

.input-group input:focus, .input-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(var(--primary-rgb), 0.1);
}

.floating-label label {
    position: absolute;
    left: 45px; /* Alineado con el padding del input */
    top: 50%;
    transform: translateY(-50%);
    color: #6b7280;
    pointer-events: none;
    transition: all 0.2s ease;
    font-size: 1rem;
    z-index: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: calc(100% - 60px);
    max-width: calc(100% - 60px);
    margin: 0;
}

.floating-label input:focus ~ label,
.floating-label input:not(:placeholder-shown) ~ label,
.floating-label select:focus ~ label,
.floating-label select:not([value=""]) ~ label {
    top: -10px;
    transform: none;
    left: 10px;
    font-size: 0.75rem;
    background: linear-gradient(to bottom, transparent 40%, #fff 40%, #fff 100%);
    padding: 0 5px;
    color: var(--primary-color);
    font-weight: 600;
    width: auto;
    max-width: 90%;
}

.input-icon {
    position: absolute !important;
    left: 16px !important;
    right: auto !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    color: #9ca3af;
    font-size: 1.1rem;
    transition: color 0.2s;
    z-index: 2;
    pointer-events: none; /* Asegura que no bloquee el click */
    width: 20px;
    text-align: center;
}

.input-group input:focus ~ .input-icon {
    color: var(--primary-color);
}

/* Button (Full width, bold) */
.btn-primary {
    width: 100%;
    padding: 16px;
    background: var(--button-background, #000);
    color: #fff;
    border: none;
    border-radius: var(--button-border-radius, 8px);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 15px rgba(0,0,0,0.1);
    background: var(--button-hover-background);
}

/* Links & Footer */
.help-links {
    margin-top: 2rem;
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
}

.help-links a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

.help-links a:hover {
    text-decoration: underline;
}

footer {
    padding: 1.5rem 2rem;
    border-top: 1px solid #f3f4f6;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #9ca3af;
    font-size: 0.8rem;
}

.security-badges {
    display: flex;
    gap: 1rem;
}

.security-badges span {
    display: flex;
    align-items: center;
    gap: 5px;
}

/* --- PROFESSIONAL SPINNER --- */
#spinner-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(255,255,255,0.92); /* Slightly more opaque */
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    backdrop-filter: blur(5px);
    flex-direction: column;
}

#spinner-overlay.active {
    display: flex;
}

.spinner-container {
    text-align: center;
}

/* New Modern Spinner */
.spinner {
    width: 60px;
    height: 60px;
    position: relative;
    margin: 0 auto 1.5rem;
}

.spinner::before, .spinner::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 3px solid transparent;
}

.spinner::before {
    border-top-color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    animation: spin-modern 1.5s cubic-bezier(0.68, -0.55, 0.27, 1.55) infinite;
}

.spinner::after {
    border-left-color: var(--secondary-color, var(--primary-color));
    border-right-color: var(--secondary-color, var(--primary-color));
    width: 70%;
    height: 70%;
    top: 15%;
    left: 15%;
    animation: spin-modern 1s cubic-bezier(0.68, -0.55, 0.27, 1.55) infinite reverse;
}

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

/* Status Carousel Text */
#spinner-text {
    font-size: 1.1rem;
    color: #333;
    font-weight: 600;
    min-height: 1.5em;
    transition: opacity 0.3s ease;
    letter-spacing: 0.5px;
}

/* Desktop Media Query */
@media (min-width: 1024px) {
    .split-hero {
        display: flex;
    }
    
    .split-form {
        width: var(--form-width);
        flex: none;
        box-shadow: -10px 0 30px rgba(0,0,0,0.05);
        z-index: 10;
    }

    .form-card {
        padding: 3rem;
    }
}

@media (max-width: 1024px) and (min-width: 768px) {
    .form-card {
        max-width: 500px;
        padding: 2.5rem;
    }
}

@media (max-width: 768px) {
    header {
        padding: 1rem;
        height: auto;
        min-height: 60px;
    }
    
    .logo-container img {
        height: 35px;
        max-width: 140px;
    }
    
    #main-wrapper {
        padding: 1.5rem 1rem;
        align-items: center; /* Mantener centrado vertical en móvil */
    }
    
    .form-card {
        padding: 2rem 1.5rem;
        border-radius: 10px;
        box-shadow: var(--shadow-md);
    }
    
    .form-title {
        font-size: 1.5rem;
    }
    
    footer {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
        padding: 1.5rem 1rem;
    }
}

.hidden { display: none !important; }
