/* Auth Pages (Client Portal) */
:root {
    --primary-blue: #1e40af;
    --primary-blue-light: #3b82f6;
    --bg-secondary: #f8fafc;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --border-light: #e2e8f0;
    --border-medium: #cbd5e1;
    --gradient-primary: linear-gradient(135deg, var(--primary-blue) 0%, var(--primary-blue-light) 100%);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.auth-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0;
    background: var(--bg-secondary);
}
/* Safe-area para móviles con notch */
.auth-page {
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
}

.brand-header { text-align: center; margin-bottom: 1rem; color: var(--text-primary); }
.brand-logo { width: 48px; height: 48px; border-radius: 12px; background: var(--gradient-primary); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; letter-spacing: 1px; box-shadow: var(--shadow-md); margin-bottom: 0.5rem; }
.brand-title { font-size: 1.5rem; font-weight: 700; }
.brand-subtitle { font-size: 0.95rem; color: var(--text-secondary); }

.auth-card {
    width: 100%;
    max-width: 420px;
    background: #fff;
    border: 1px solid var(--border-light);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    padding: 1.5rem;
}

.auth-card h2 { margin-bottom: 1rem; }
.auth-form .form-group { margin-bottom: 1rem; }

.input {
    width: 100%;
    padding: 0.75rem 0.9rem;
    border: 1.5px solid var(--border-medium);
    border-radius: 10px;
    background: #fff;
    color: var(--text-primary);
    outline: none;
    transition: box-shadow .2s, border-color .2s;
}
.input:focus { border-color: var(--primary-blue); box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.12); }

.auth-help { margin-top: 0.75rem; text-align: center; }
.link-muted { color: var(--text-muted); text-decoration: none; }
.link-muted:hover { color: var(--primary-blue); }

/* ===== Animated Trading Background ===== */
.trading-bg-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

.bg-overlay {
    position: absolute;
    inset: 0;
    z-index: 0;
    background: linear-gradient(120deg, rgba(30,64,175,0.08), rgba(59,130,246,0.08)),
                radial-gradient(1000px 400px at 10% 10%, rgba(59,130,246,0.20), transparent),
                radial-gradient(800px 300px at 90% 80%, rgba(30,64,175,0.18), transparent);
    background-size: 200% 200%;
    filter: saturate(110%);
}

.animated {
    animation: gradientShift 16s ease-in-out infinite;
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Ensure login content stays above background */
.auth-page { position: relative; z-index: 1; }

/* ===== Split Layout (Hero + Panel) ===== */
.auth-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    min-height: 100dvh;
    width: 100vw;
}

.hero {
    position: relative;
    background: linear-gradient(135deg, #0b1734 0%, #0e1c46 40%, #0b1734 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    color: white;
    overflow: hidden;
    min-height: 100vh;
}

/* Subtle grid and vignette for premium feel */
.hero::before {
    content: "";
    position: absolute; inset: 0;
    background: 
        repeating-linear-gradient(
            to bottom,
            rgba(255,255,255,0.04) 0px,
            rgba(255,255,255,0.04) 1px,
            transparent 1px,
            transparent 40px
        ),
        repeating-linear-gradient(
            to right,
            rgba(255,255,255,0.04) 0px,
            rgba(255,255,255,0.04) 1px,
            transparent 1px,
            transparent 60px
        );
    z-index: 0;
}
.hero::after {
    content: "";
    position: absolute; inset: 0;
    background: radial-gradient(1200px 500px at 20% 80%, rgba(0,0,0,0.35), transparent),
                radial-gradient(900px 400px at 80% 20%, rgba(0,0,0,0.25), transparent);
    z-index: 0;
}

.brand-masthead {
    position: relative;
    z-index: 2;
    padding: 72px 72px 48px;
}
.brand-masthead .brand-logo {
    width: 56px; height: 56px; border-radius: 14px;
    display: inline-flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #1e40af, #3b82f6);
    color: #fff; font-weight: 700; font-size: 20px;
    box-shadow: 0 8px 20px rgba(59,130,246,0.3);
}
.brand-masthead .brand-title {
    margin-top: 18px;
    font-size: 42px; font-weight: 800; letter-spacing: 0.5px;
}
.brand-masthead .brand-subtitle {
    margin-top: 8px; opacity: 0.85;
    font-weight: 500; letter-spacing: 0.3px;
}

.symbols {
    position: absolute; inset: 0; z-index: 1; pointer-events: none;
}
.symbol {
    position: absolute;
    color: rgba(255,255,255,0.20);
    font-weight: 700; letter-spacing: 1px;
    filter: blur(0.2px);
    mix-blend-mode: screen;
    animation: floatDiag 24s linear infinite;
}
.symbol.alt { color: rgba(147,197,253,0.22); }

@keyframes floatDiag {
    0% { transform: translate3d(-10%, 5%, 0); opacity: 0.0; }
    10% { opacity: 0.5; }
    50% { opacity: 0.7; }
    100% { transform: translate3d(10%, -5%, 0); opacity: 0.0; }
}

.panel {
    background: #f8fafc;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    position: relative;
}

/* ===== CRM-Style Form Container ===== */
.form-container {
    width: 100%;
    max-width: 450px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 24px;
    padding: 3rem;
    box-shadow: 
        0 25px 50px -12px rgba(0, 0, 0, 0.25),
        0 0 0 1px rgba(255, 255, 255, 0.05);
    position: relative;
}

.form-container::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: linear-gradient(180deg, #1e40af, #3b82f6);
    border-top-left-radius: 24px;
    border-bottom-left-radius: 24px;
}

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

.form-title {
    font-size: 2.25rem;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 0.5rem;
    letter-spacing: -0.025em;
}

.form-subtitle {
    font-size: 1rem;
    color: #64748b;
    font-weight: 400;
}

/* ===== Floating Form Fields ===== */
.form-floating {
    position: relative;
    margin-bottom: 2rem;
}

.form-floating input {
    width: 100%;
    padding: 1.5rem 3rem 0.75rem 1.25rem;
    border: 2px solid #e2e8f0;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.8);
    font-size: 1rem;
    font-weight: 500;
    color: #0f172a;
    outline: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(10px);
}

.form-floating input:focus {
    border-color: #3b82f6;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 
        0 0 0 4px rgba(59, 130, 246, 0.1),
        0 10px 25px -5px rgba(59, 130, 246, 0.1);
    transform: translateY(-2px);
}

.form-floating label {
    position: absolute;
    left: 1.25rem;
    top: 1.5rem;
    font-size: 1rem;
    font-weight: 500;
    color: #64748b;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: transparent;
    z-index: 1;
}

.form-floating input:focus + label,
.form-floating input:not(:placeholder-shown) + label {
    top: -0.5rem; /* Eleva la etiqueta por encima del borde */
    left: 0.9rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: #3b82f6;
    background: #ffffff; /* Fondo sólido para legibilidad */
    padding: 0 0.4rem;
    border-radius: 6px;
}

.login-icon {
    position: absolute;
    right: 1.25rem;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    color: #94a3b8;
    transition: color 0.3s ease;
    z-index: 2;
}

.form-floating input:focus ~ .login-icon {
    color: #3b82f6;
}

/* ===== Form Options ===== */
.form-options {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2rem;
}

.checkbox-container {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    color: #475569;
}

.checkbox-container input[type="checkbox"] {
    display: none;
}

.checkmark {
    width: 18px;
    height: 18px;
    border: 2px solid #cbd5e1;
    border-radius: 4px;
    margin-right: 0.75rem;
    position: relative;
    transition: all 0.3s ease;
}

.checkbox-container input[type="checkbox"]:checked + .checkmark {
    background: #3b82f6;
    border-color: #3b82f6;
}

.checkbox-container input[type="checkbox"]:checked + .checkmark::after {
    content: '';
    position: absolute;
    left: 5px;
    top: 2px;
    width: 4px;
    height: 8px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.forgot-link {
    color: #3b82f6;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: color 0.3s ease;
}

.forgot-link:hover {
    color: #1e40af;
}

/* ===== CRM-Style Button ===== */
.btn-login {
    width: 100%;
    padding: 1.25rem 2rem;
    background: linear-gradient(135deg, #1e40af 0%, #3b82f6 50%, #1e40af 100%);
    background-size: 200% 100%;
    border: none;
    border-radius: 16px;
    color: white;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    box-shadow: 
        0 10px 25px -5px rgba(30, 64, 175, 0.3),
        0 0 0 1px rgba(255, 255, 255, 0.1) inset;
}

.btn-login:hover {
    background-position: 100% 0;
    transform: translateY(-2px);
    box-shadow: 
        0 20px 40px -10px rgba(30, 64, 175, 0.4),
        0 0 0 1px rgba(255, 255, 255, 0.2) inset;
}

.btn-login:active {
    transform: translateY(0);
}

.btn-arrow {
    width: 20px;
    height: 20px;
    transition: transform 0.3s ease;
}

.btn-login:hover .btn-arrow {
    transform: translateX(4px);
}

/* ===== Login Footer ===== */
.login-footer {
    text-align: center;
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid #e2e8f0;
}

.login-footer p {
    color: #64748b;
    font-size: 0.95rem;
    margin: 0;
}

.register-link {
    color: #3b82f6;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s ease;
}

.register-link:hover {
    color: #1e40af;
}

/* ===== Alert Styles ===== */
.alert {
    padding: 1rem 1.25rem;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    font-weight: 500;
}

.alert-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: #dc2626;
}

.alert-error strong {
    font-weight: 600;
}
/* Info alert (para mensajes informativos en registro) */
.alert-info {
    background: rgba(59, 130, 246, 0.08);
    border: 1px solid rgba(59, 130, 246, 0.18);
    color: #2563eb;
}

/* Responsive */
@media (max-width: 1024px) {
    .auth-layout {
        grid-template-columns: 1fr;
        grid-template-rows: minmax(160px, 40vh) auto;
    }
    .hero {
        position: relative;
        padding: 24px;
    }
    .brand-masthead { 
        padding: 32px 24px; 
        text-align: center;
    }
    .brand-masthead .brand-title {
        font-size: 32px;
    }
    .panel { 
        padding: 24px; 
        justify-content: center; 
        min-height: auto;
    }
    .auth-card {
        max-width: 400px;
        padding: 32px;
    }
    .auth-card h2 {
        font-size: 24px;
    }
    .symbol { display: none; }
    .bg-overlay.animated { animation: none; }
    .news-ticker {
        height: 40px;
    }
    .ticker-item {
        font-size: 13px;
    }
}

@media (max-width: 768px) {
    .auth-layout {
        grid-template-rows: minmax(140px, 30vh) auto;
    }
    .brand-masthead {
        padding: 24px 16px;
    }
    .brand-masthead .brand-title {
        font-size: 28px;
    }
    .brand-masthead .brand-subtitle {
        font-size: 14px;
    }
    .panel {
        padding: 16px;
    }
    .auth-card {
        max-width: 100%;
        padding: 24px;
        margin: 0 8px;
    }
    .auth-card h2 {
        font-size: 22px;
    }
    .news-ticker {
        height: 36px;
    }
    .ticker-item {
        font-size: 12px;
        gap: 24px;
    }
    /* Mejoras de usabilidad táctil */
    .btn-login { min-height: 48px; }
    .form-container { padding: 20px; border-radius: 20px; }
    .form-floating input { font-size: 16px; }
}

@media (max-width: 480px) {
    .auth-layout {
        grid-template-rows: minmax(120px, 28vh) auto;
    }
    .brand-masthead .brand-title {
        font-size: 24px;
    }
    .auth-card {
        padding: 20px;
        border-radius: 16px;
    }
    .auth-card h2 {
        font-size: 20px;
        margin-bottom: 20px;
    }
    .input {
        padding: 12px;
        font-size: 16px; /* Evitar zoom en iOS */
    }
    .btn-lux {
        padding: 14px;
        font-size: 16px;
    }
    /* Ajustes móviles adicionales */
    .hero { padding: 16px; }
    .auth-card { margin: 0 10px; }
    .form-title { font-size: 1.5rem; }
    .form-subtitle { font-size: 0.95rem; }
    .form-floating input {
        padding: 1.25rem 1rem 0.6rem 1rem;
        font-size: 16px; /* Evitar zoom en iOS */
    }
    .form-floating label {
        top: 1.3rem;
        left: 1rem;
        font-size: 1rem;
    }
    .form-floating input:focus + label,
    .form-floating input:not(:placeholder-shown) + label {
        top: -0.4rem;
        left: 0.8rem;
        font-size: 0.75rem;
    }
    .btn-login { padding: 1rem; font-size: 1rem; }
    .login-footer { margin-top: 1.25rem; padding-top: 1.25rem; }
    .bg-overlay.animated { animation: none; }
    .news-ticker { display: none; }
}

/* Teléfonos muy pequeños */
@media (max-width: 360px) {
    .auth-layout { grid-template-rows: 40vh 60vh; }
    .form-title { font-size: 1.35rem; }
    .form-container { padding: 16px; }
    .btn-login { min-height: 44px; }
}

/* ===== News / Assets Ticker ===== */
.news-ticker {
    position: absolute; bottom: 0; left: 0; right: 0; z-index: 2;
    height: 48px;
    background: linear-gradient(90deg, rgba(12,20,50,0.85), rgba(12,20,50,0.70));
    border-top: 1px solid rgba(255,255,255,0.12);
    backdrop-filter: blur(8px);
    overflow: hidden;
}
.ticker-track {
    position: absolute; left: 100%; top: 0; height: 100%;
    display: flex; align-items: center; gap: 40px; padding: 0 32px;
    white-space: nowrap;
    animation: tickerScroll 20s linear infinite;
}
.ticker-item {
    color: #e5efff; font-weight: 700; font-size: 15px; letter-spacing: .4px;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
    transition: all 0.3s ease;
}
.ticker-item.up { 
    color: #22c55e; 
    text-shadow: 0 0 8px rgba(34,197,94,0.4);
}
.ticker-item.down { 
    color: #ef4444; 
    text-shadow: 0 0 8px rgba(239,68,68,0.4);
}
.ticker-item:hover {
    transform: scale(1.05);
    filter: brightness(1.2);
}
@keyframes tickerScroll {
    from { transform: translateX(0); }
    to { transform: translateX(-120%); }
}

/* Brand features list (left hero column) */
.brand-features {
    margin-top: 24px;
    color: rgba(255,255,255,0.92);
}
.brand-features li {
    list-style: none;
    margin: 8px 0;
    font-weight: 500;
}

/* ===== Responsive refinements for tablet & mobile ===== */
@media (max-width: 1024px) {
  .auth-layout { grid-template-rows: minmax(160px, 40vh) auto; }
  .auth-page .form-container { max-width: 480px; padding: 2.5rem; }
  .auth-page .form-title { font-size: 2rem; }
  .auth-page .form-subtitle { font-size: 0.95rem; }
  .auth-page .form-floating { margin-bottom: 1.5rem; }
  .auth-page .btn-login { min-height: 50px; }
}

@media (max-width: 768px) {
  .auth-layout { grid-template-rows: minmax(140px, 30vh) auto; }
  .auth-page .form-container { max-width: 100%; padding: 22px; border-radius: 20px; }
  .auth-page .form-title { font-size: 1.75rem; }
  .auth-page .form-floating { margin-bottom: 1.35rem; }
}

@media (max-width: 768px) and (orientation: landscape) {
  .auth-layout { grid-template-rows: minmax(120px, 25vh) auto; }
}

@media (max-width: 480px) {
  .auth-layout { grid-template-rows: minmax(120px, 26vh) auto; }
  .auth-page .form-container { padding: 18px; border-radius: 16px; }
  .auth-page .form-floating { margin-bottom: 1.25rem; }
}
.brand-features li::before {
    content: '✓';
    color: #22c55e;
    font-weight: 700;
    margin-right: 10px;
}

/* Overrides adicionales para mejorar scroll en móviles */
@media (max-width: 1024px) {
    .hero { min-height: auto; }
    .auth-layout .panel { overflow: visible; }
}
@media (max-width: 768px) {
    .hero { min-height: auto; }
    .auth-layout .panel { overflow: visible; }
}
@media (max-width: 480px) {
    .auth-layout { min-height: 100dvh; }
    .hero { min-height: auto; }
    .auth-layout .panel { overflow: visible; }
}