/* ============================================================
   auth.css — PyMEFlow login/auth screens
   Design system: SaaS B2B Professional
   Fonts: Poppins (headings) + Open Sans (body)
   Primary: #2563EB | Bg: #F8FAFC | Foreground: #0F172A
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Open+Sans:wght@300;400;500;600;700&family=Poppins:wght@400;500;600;700&display=swap');

/* ── Tokens ── */
:root {
    --auth-primary:       #2563EB;
    --auth-primary-dark:  #1e40af;
    --auth-primary-light: #dbeafe;
    --auth-accent:        #059669;
    --auth-bg:            #F8FAFC;
    --auth-foreground:    #0F172A;
    --auth-muted:         #64748b;
    --auth-border:        #E4ECFC;
    --auth-error:         #DC2626;
    --auth-white:         #ffffff;
    --auth-shadow:        0 8px 32px rgba(37, 99, 235, 0.10);
    --auth-radius:        16px;
    --auth-transition:    200ms ease-out;
}

/* ── Reset base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Open Sans', system-ui, sans-serif;
    background: var(--auth-bg);
    color: var(--auth-foreground);
    min-height: 100dvh;
}

/* ── Root: split layout ── */
.auth-root {
    display: flex;
    min-height: 100dvh;
}

/* ============================================================
   PANEL IZQUIERDO — Marca / Branding
   ============================================================ */
.auth-brand {
    flex: 1;
    background: linear-gradient(145deg, var(--auth-primary-dark) 0%, var(--auth-primary) 60%, #3b82f6 100%);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 48px 40px;
    position: relative;
    overflow: hidden;
}

/* Decoración geométrica sutil en el fondo */
.auth-brand::before {
    content: '';
    position: absolute;
    top: -80px; right: -80px;
    width: 320px; height: 320px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.06);
    pointer-events: none;
}

.auth-brand::after {
    content: '';
    position: absolute;
    bottom: -60px; left: -60px;
    width: 240px; height: 240px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.04);
    pointer-events: none;
}

.auth-brand-inner {
    position: relative;
    z-index: 1;
    animation: fadeSlideIn 0.5s ease-out both;
}

/* Logo sobre fondo azul — invertir a blanco */
.brand-logo {
    display: block;
    filter: brightness(0) invert(1);
    margin-bottom: 32px;
    max-width: 200px;
}

.brand-tagline {
    font-family: 'Poppins', sans-serif;
    font-size: 22px;
    font-weight: 600;
    color: var(--auth-white);
    line-height: 1.4;
    margin-bottom: 28px;
}

.brand-bullets {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.brand-bullets li {
    font-size: 14px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.85);
    padding-left: 20px;
    position: relative;
}

.brand-bullets li::before {
    content: '';
    position: absolute;
    left: 0; top: 50%;
    transform: translateY(-50%);
    width: 6px; height: 6px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.6);
}

.brand-copy {
    position: relative;
    z-index: 1;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
}

/* ============================================================
   PANEL DERECHO — Formulario
   ============================================================ */
.auth-panel {
    flex: 0 0 480px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 32px;
    background: var(--auth-bg);
}

.auth-card {
    width: 100%;
    max-width: 400px;
    background: var(--auth-white);
    border: 1px solid var(--auth-border);
    border-radius: var(--auth-radius);
    padding: 40px 36px;
    box-shadow: var(--auth-shadow);
    animation: fadeSlideIn 0.4s ease-out 0.1s both;
}

/* ── Card header ── */
.auth-card-header {
    text-align: center;
    margin-bottom: 32px;
}

.card-logo {
    display: block;
    margin: 0 auto 20px;
    max-width: 140px;
}

.auth-title {
    font-family: 'Poppins', sans-serif;
    font-size: 24px;
    font-weight: 600;
    color: var(--auth-foreground);
    margin-bottom: 6px;
}

.auth-subtitle {
    font-size: 14px;
    color: var(--auth-muted);
}

/* ============================================================
   FORMULARIO
   ============================================================ */
.auth-card-body form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Grupo: label + input + error */
.form-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--auth-foreground);
    letter-spacing: 0.01em;
}

.form-label .required {
    color: var(--auth-error);
    margin-left: 2px;
}

/* Wrapper para input + ícono opcional */
.form-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.form-input {
    width: 100%;
    padding: 11px 14px;
    border: 1.5px solid var(--auth-border);
    border-radius: 8px;
    font-size: 14px;
    font-family: 'Open Sans', sans-serif;
    color: var(--auth-foreground);
    background: var(--auth-white);
    transition: border-color var(--auth-transition), box-shadow var(--auth-transition);
    outline: none;
    min-height: 44px; /* touch target */
}

.form-input::placeholder {
    color: #94a3b8;
}

.form-input:focus {
    border-color: var(--auth-primary);
    box-shadow: 0 0 0 3px var(--auth-primary-light);
}

.form-input.is-invalid {
    border-color: var(--auth-error);
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.12);
}

/* Botón de mostrar/ocultar contraseña */
.btn-toggle-password {
    position: absolute;
    right: 12px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    color: var(--auth-muted);
    display: flex;
    align-items: center;
    transition: color var(--auth-transition);
    min-width: 44px;
    justify-content: center;
}

.btn-toggle-password:hover { color: var(--auth-primary); }

.form-error {
    font-size: 12px;
    color: var(--auth-error);
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Validation summary */
.validation-summary {
    background: rgba(220, 38, 38, 0.06);
    border: 1px solid rgba(220, 38, 38, 0.2);
    border-radius: 8px;
    padding: 12px 14px;
    font-size: 13px;
    color: var(--auth-error);
    display: none;
}

.validation-summary ul { padding-left: 16px; }
.validation-summary:not(:empty) { display: block; }

/* ── Botón submit ── */
.btn-submit {
    width: 100%;
    padding: 12px 20px;
    background: linear-gradient(135deg, var(--auth-primary) 0%, #3b82f6 100%);
    color: var(--auth-white);
    border: none;
    border-radius: 8px;
    font-family: 'Poppins', sans-serif;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: transform var(--auth-transition), box-shadow var(--auth-transition), opacity var(--auth-transition);
    min-height: 48px;
    position: relative;
    overflow: hidden;
    letter-spacing: 0.01em;
}

.btn-submit:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.35);
}

.btn-submit:active:not(:disabled) {
    transform: translateY(0) scale(0.98);
    box-shadow: none;
}

.btn-submit:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

/* Spinner dentro del botón mientras carga */
.btn-submit .spinner {
    display: none;
    width: 16px; height: 16px;
    border: 2px solid rgba(255,255,255,0.4);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    margin-right: 8px;
    vertical-align: middle;
}

.btn-submit.loading .spinner { display: inline-block; }
.btn-submit.loading .btn-label { opacity: 0.8; }

/* ── Footer links ── */
.auth-footer {
    margin-top: 20px;
    text-align: center;
    font-size: 13px;
    color: var(--auth-muted);
}

.auth-footer a {
    color: var(--auth-primary);
    text-decoration: none;
    font-weight: 500;
    transition: color var(--auth-transition), text-decoration var(--auth-transition);
}

.auth-footer a:hover {
    color: var(--auth-primary-dark);
    text-decoration: underline;
}

/* ============================================================
   REGISTRO — wizard de 2 pasos
   ============================================================ */
.wizard-step {
    font-size: 12px;
    font-weight: 600;
    color: var(--auth-primary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 16px;
}

/* Campo trampa anti-bot: fuera de la vista, pero presente en el DOM para que un bot lo llene */
.hp-field {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.plan-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 4px;
}

.plan-option {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    border: 1.5px solid var(--auth-border);
    border-radius: 10px;
    cursor: pointer;
    transition: border-color var(--auth-transition), box-shadow var(--auth-transition);
}

.plan-option:has(input:checked) {
    border-color: var(--auth-primary);
    box-shadow: 0 0 0 3px var(--auth-primary-light);
}

.plan-option input[type="radio"] {
    margin-top: 3px;
    accent-color: var(--auth-primary);
    min-width: 16px;
    min-height: 16px;
}

.plan-option-body {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.plan-option-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
}

.plan-option-name {
    font-family: 'Poppins', sans-serif;
    font-size: 15px;
    font-weight: 600;
    color: var(--auth-foreground);
}

.plan-option-price {
    font-size: 13px;
    font-weight: 600;
    color: var(--auth-primary);
    white-space: nowrap;
}

.plan-option-desc {
    font-size: 13px;
    color: var(--auth-muted);
    line-height: 1.4;
}

.plan-option-trial {
    font-size: 12px;
    font-weight: 600;
    color: var(--auth-accent);
}

.plan-option-modulos {
    font-size: 11px;
    color: #94a3b8;
}

/* ============================================================
   ANIMACIONES
   ============================================================ */
@keyframes fadeSlideIn {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
    .auth-brand-inner,
    .auth-card { animation: none; }
    .btn-submit { transition: none; }
    .form-input { transition: none; }
}

/* ============================================================
   RESPONSIVE — móvil: ocultar panel izquierdo
   ============================================================ */
@media (max-width: 767px) {
    .auth-root { flex-direction: column; }

    .auth-brand { display: none; }

    .auth-panel {
        flex: 1;
        padding: 24px 16px;
        align-items: flex-start;
        padding-top: 40px;
    }

    .auth-card {
        padding: 32px 24px;
    }
}

/* Tablet: panel izquierdo más estrecho */
@media (min-width: 768px) and (max-width: 1023px) {
    .auth-brand { flex: 0 0 300px; padding: 40px 28px; }
    .auth-panel { flex: 1; }
    .brand-tagline { font-size: 18px; }
}
