/**
 * ============================================================================
 * ESTILOS DE AUTENTICACIÓN - CLIENTE FRONTEND
 * ============================================================================
 * Diseño premium con paleta azul corporativa CIMSystem
 * ============================================================================
 */

/* ============================================================================
   BASE
   ============================================================================ */

.auth-page-body {
    margin: 0;
    padding: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: #e8f4fd;
    min-height: 100vh;
}

.auth-container {
    min-height: 100vh;
    display: flex;
}

/* ============================================================================
   PANEL IZQUIERDO - BRANDING
   ============================================================================ */

.auth-branding {
    flex: 0 0 55%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(145deg, #0f2044 0%, #1e3a5f 35%, #1e40af 70%, #1d6fa4 100%);
    padding: 60px 48px;
    position: relative;
    overflow: hidden;
}

/* Decoraciones de fondo animadas */
.auth-branding::before {
    content: '';
    position: absolute;
    top: -30%;
    right: -20%;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(30, 144, 212, 0.25) 0%, transparent 65%);
    border-radius: 50%;
    animation: float-blob 12s ease-in-out infinite;
}

.auth-branding::after {
    content: '';
    position: absolute;
    bottom: -25%;
    left: -15%;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.18) 0%, transparent 65%);
    border-radius: 50%;
    animation: float-blob 16s ease-in-out infinite reverse;
}

@keyframes float-blob {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33%       { transform: translate(4%, -6%) scale(1.06); }
    66%       { transform: translate(-3%, 5%) scale(0.95); }
}

/* Blob extra decorativo */
.auth-blob-extra {
    position: absolute;
    top: 40%;
    left: 60%;
    width: 280px;
    height: 280px;
    background: radial-gradient(circle, rgba(255,255,255,0.05) 0%, transparent 70%);
    border-radius: 50%;
    animation: float-blob 20s ease-in-out infinite;
    pointer-events: none;
}

/* Patrón grid sutil */
.auth-branding-grid {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px);
    background-size: 40px 40px;
    pointer-events: none;
}

.auth-branding-content {
    position: relative;
    z-index: 2;
    max-width: 500px;
    color: #fff;
    text-align: center;
}

/* Logo */
.auth-branding-logo {
    width: 110px;
    height: 110px;
    margin: 0 auto 32px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(12px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25), inset 0 1px 0 rgba(255,255,255,0.15);
    transition: transform 0.3s ease;
}

.auth-branding-logo:hover {
    transform: scale(1.04);
}

.auth-branding-logo img {
    width: 78px;
    height: 78px;
    object-fit: contain;
    border-radius: 14px;
}

/* Título */
.auth-branding-title {
    font-size: 2.4rem;
    font-weight: 800;
    margin-bottom: 14px;
    line-height: 1.15;
    letter-spacing: -0.5px;
}

.auth-branding-title .highlight {
    background: linear-gradient(135deg, #7dd3fc, #38bdf8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    display: block;
    font-size: 1.1rem;
    font-weight: 500;
    letter-spacing: 0;
    margin-top: 6px;
}

.auth-branding-subtitle {
    font-size: 1rem;
    opacity: 0.78;
    line-height: 1.65;
    margin-bottom: 40px;
    max-width: 380px;
    margin-left: auto;
    margin-right: auto;
}

/* Features */
.auth-features {
    display: flex;
    flex-direction: column;
    gap: 14px;
    text-align: left;
}

.auth-feature {
    display: flex;
    align-items: center;
    gap: 16px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    padding: 16px 20px;
    border-radius: 14px;
    backdrop-filter: blur(8px);
    transition: background 0.25s ease, transform 0.25s ease;
}

.auth-feature:hover {
    background: rgba(255, 255, 255, 0.13);
    transform: translateX(4px);
}

.auth-feature-icon {
    width: 46px;
    height: 46px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border: 1px solid rgba(255,255,255,0.1);
}

.auth-feature-icon svg {
    width: 22px;
    height: 22px;
    color: #7dd3fc;
}

.auth-feature-text h4 {
    font-size: 0.95rem;
    font-weight: 600;
    margin: 0 0 3px;
    color: #fff;
}

.auth-feature-text p {
    font-size: 0.82rem;
    opacity: 0.72;
    margin: 0;
    color: #cbd5e1;
}

/* Badge de seguridad inferior */
.auth-trust-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 32px;
    padding: 8px 18px;
    background: rgba(255,255,255,0.07);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 100px;
    font-size: 0.8rem;
    color: rgba(255,255,255,0.75);
}

.auth-trust-badge svg {
    width: 15px;
    height: 15px;
    color: #4ade80;
}

/* ============================================================================
   PANEL DERECHO - FORMULARIO
   ============================================================================ */

.auth-form-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 40px;
    background: #ffffff;
    position: relative;
}

/* Decoración superior derecha */
.auth-form-section::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 220px;
    height: 220px;
    background: radial-gradient(circle at top right, rgba(30, 144, 212, 0.07) 0%, transparent 65%);
    pointer-events: none;
}

.auth-form-container {
    width: 100%;
    max-width: 420px;
    position: relative;
    z-index: 1;
}

/* Logo en móvil */
.auth-logo-mobile {
    display: none;
    text-align: center;
    margin-bottom: 28px;
}

.auth-logo-mobile img {
    width: 72px;
    height: 72px;
    object-fit: contain;
    border-radius: 18px;
    box-shadow: 0 8px 24px rgba(30, 64, 175, 0.15);
}

/* Header */
.auth-form-header {
    text-align: center;
    margin-bottom: 32px;
}

.auth-form-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #1e90d4;
    margin-bottom: 10px;
}

.auth-form-eyebrow svg {
    width: 13px;
    height: 13px;
    color: #4ade80;
}

.auth-form-title {
    font-size: 1.9rem;
    font-weight: 800;
    color: #0f172a;
    margin-bottom: 8px;
    letter-spacing: -0.5px;
    line-height: 1.2;
}

.auth-form-subtitle {
    font-size: 0.92rem;
    color: #64748b;
    line-height: 1.5;
}

/* Alertas */
.auth-alert {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-left: 4px solid #ef4444;
    border-radius: 10px;
    margin-bottom: 22px;
    color: #dc2626;
    animation: slideDown 0.25s ease;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.auth-alert.success {
    background: #f0fdf4;
    border-color: #bbf7d0;
    border-left-color: #22c55e;
    color: #16a34a;
}

.auth-alert-icon { flex-shrink: 0; margin-top: 1px; }
.auth-alert-content { flex: 1; }
.auth-alert-title { font-weight: 600; margin-bottom: 3px; }
.auth-alert-message { font-size: 0.88rem; line-height: 1.5; }

/* Formulario */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.form-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #334155;
}

.form-label .required { color: #ef4444; }

/* Inputs */
.input-wrapper { position: relative; }

.form-input {
    width: 100%;
    height: 52px;
    padding: 0 16px 0 46px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-size: 0.95rem;
    font-family: inherit;
    background: #f8fafc;
    transition: all 0.2s ease;
    color: #0f172a;
    outline: none;
}

.form-input:focus {
    border-color: #1e90d4;
    background: #fff;
    box-shadow: 0 0 0 4px rgba(30, 144, 212, 0.12);
}

.form-input.error {
    border-color: #ef4444;
    background: #fef2f2;
    box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.08);
}

.form-input::placeholder { color: #94a3b8; }

.input-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    pointer-events: none;
    transition: color 0.2s;
    width: 18px;
    height: 18px;
}

.input-wrapper:focus-within .input-icon {
    color: #1e90d4;
}

.toggle-password {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
    border-radius: 6px;
}

.toggle-password:hover { color: #1e3a5f; }

/* Opciones del form */
.form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

/* Checkbox custom */
.form-checkbox {
    display: flex;
    align-items: center;
    gap: 9px;
    cursor: pointer;
    user-select: none;
}

.form-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #1e40af;
    cursor: pointer;
    border-radius: 4px;
}

.form-checkbox-label {
    font-size: 0.87rem;
    color: #475569;
}

.form-forgot {
    font-size: 0.87rem;
    color: #1e90d4;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s;
}

.form-forgot:hover {
    color: #1e3a5f;
    text-decoration: underline;
}

/* Botón submit */
.btn-auth {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    height: 52px;
    padding: 0 24px;
    background: linear-gradient(135deg, #1e3a5f 0%, #1e40af 50%, #1e90d4 100%);
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 16px rgba(30, 64, 175, 0.35);
    position: relative;
    overflow: hidden;
    letter-spacing: 0.01em;
}

/* Shimmer en hover */
.btn-auth::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 60%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.12), transparent);
    transition: left 0.5s ease;
}

.btn-auth:hover::after { left: 150%; }

.btn-auth:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(30, 64, 175, 0.45);
}

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

.btn-auth:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.btn-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    flex-shrink: 0;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Footer del form */
.auth-form-footer {
    text-align: center;
    margin-top: 28px;
    padding-top: 22px;
    border-top: 1px solid #f1f5f9;
}

.auth-form-footer p {
    font-size: 0.92rem;
    color: #64748b;
}

.auth-form-footer a {
    color: #1e40af;
    font-weight: 700;
    text-decoration: none;
    transition: color 0.2s;
}

.auth-form-footer a:hover {
    color: #1e90d4;
    text-decoration: underline;
}

/* Separador */
.auth-divider {
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 18px 0;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #e2e8f0;
}

.auth-divider span {
    font-size: 0.82rem;
    color: #94a3b8;
    font-weight: 500;
}

/* Link volver */
.auth-back-link {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    color: #64748b;
    text-decoration: none;
    font-size: 0.88rem;
    transition: color 0.2s;
    padding: 4px 0;
}

.auth-back-link:hover { color: #1e3a5f; }

.auth-back-link svg {
    width: 15px;
    height: 15px;
    transition: transform 0.2s;
}

.auth-back-link:hover svg { transform: translateX(-3px); }

/* Copyright */
.auth-copyright {
    text-align: center;
    font-size: 0.78rem;
    color: #94a3b8;
    margin-top: 32px;
}

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

/* Tablet */
@media (max-width: 1024px) {
    .auth-branding {
        flex: 0 0 45%;
        padding: 48px 32px;
    }

    .auth-branding-title { font-size: 2rem; }
    .auth-branding-subtitle { font-size: 0.92rem; }
    .auth-form-section { padding: 40px 32px; }
}

/* Mobile — panel izquierdo se convierte en banner compacto */
@media (max-width: 768px) {
    .auth-container {
        flex-direction: column;
    }

    .auth-branding {
        flex: none;
        padding: 32px 24px 28px;
        min-height: auto;
    }

    .auth-branding-logo {
        width: 80px;
        height: 80px;
        margin-bottom: 20px;
        border-radius: 20px;
    }

    .auth-branding-logo img {
        width: 56px;
        height: 56px;
    }

    .auth-branding-title {
        font-size: 1.6rem;
        margin-bottom: 8px;
    }

    .auth-branding-title .highlight {
        font-size: 0.9rem;
    }

    .auth-branding-subtitle {
        font-size: 0.88rem;
        margin-bottom: 24px;
    }

    .auth-features {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
    }

    .auth-feature {
        flex-direction: column;
        gap: 8px;
        padding: 12px;
        text-align: center;
    }

    .auth-feature:hover { transform: none; }

    .auth-feature-icon {
        width: 38px;
        height: 38px;
        margin: 0 auto;
    }

    .auth-feature-text h4 { font-size: 0.8rem; }
    .auth-feature-text p  { font-size: 0.72rem; }

    .auth-trust-badge { font-size: 0.75rem; margin-top: 20px; }

    .auth-form-section {
        flex: 1;
        padding: 32px 24px;
    }

    .auth-form-container { max-width: 100%; }
    .auth-logo-mobile { display: none; } /* ya se muestra en el panel */
}

/* Móvil pequeño */
@media (max-width: 480px) {
    .auth-branding { padding: 28px 16px 24px; }

    .auth-features {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .auth-feature {
        flex-direction: row;
        text-align: left;
        padding: 12px 14px;
    }

    .auth-feature-icon { margin: 0; }

    .auth-form-section { padding: 28px 16px; }

    .auth-form-title { font-size: 1.6rem; }

    .form-input { font-size: 16px; } /* Evita zoom en iOS */

    .form-row { grid-template-columns: 1fr; }

    .form-options {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .btn-auth { height: 50px; font-size: 0.95rem; }
}

/* Muy pequeño */
@media (max-width: 360px) {
    .auth-branding { padding: 20px 12px; }
    .auth-form-section { padding: 24px 12px; }
}
