/* assets/css/auth.css */

:root {
    --primary:   #4361ee;
    --secondary: #3f37c9;
    --success:   #27ae60;
    --danger:    #e74c3c;
    --warning:   #f39c12;
    --dark:      #1a1a2e;
    --gray:      #6c757d;
    --border:    #dee2e6;
    --radius:    12px;
    --shadow:    0 4px 20px rgba(0,0,0,0.08);
}

* { margin:0; padding:0; box-sizing:border-box; }

body.auth-body {
    font-family: 'Segoe UI', system-ui, sans-serif;
    min-height: 100vh;
    background: #f0f4ff;
}

/* ── Split Layout ──────────────────────────────────────── */
.auth-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    min-height: 100vh;
}

/* Panel izquierdo */
.auth-brand {
    background: linear-gradient(135deg, #1a1a2e 0%, #0f3460 60%, #533483 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    position: relative;
    overflow: hidden;
}

.auth-brand::before {
    content: '';
    position: absolute;
    width: 400px; height: 400px;
    background: rgba(255,255,255,0.03);
    border-radius: 50%;
    top: -100px; right: -100px;
}

.auth-brand-content { color: white; max-width: 420px; }

.brand-logo {
    width: 70px; height: 70px;
    background: rgba(255,255,255,0.15);
    border-radius: 18px;
    display: flex; align-items: center; justify-content: center;
    font-size: 2rem;
    margin-bottom: 24px;
    backdrop-filter: blur(10px);
}

.auth-brand h1 {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 12px;
    line-height: 1.2;
}

.auth-brand > div > p {
    font-size: .95rem;
    opacity: .75;
    line-height: 1.7;
    margin-bottom: 32px;
}

.brand-features { display: flex; flex-direction: column; gap: 14px; }

.brand-feature {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: .875rem;
    opacity: .85;
}

.brand-feature i {
    width: 36px; height: 36px;
    background: rgba(255,255,255,0.1);
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}

/* Panel derecho */
.auth-form-panel {
    background: white;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    max-height: 100vh;
}

.auth-form-container {
    flex: 1;
    padding: 48px 48px 24px;
    max-width: 520px;
    margin: 0 auto;
    width: 100%;
}

.auth-footer {
    padding: 16px 48px;
    text-align: center;
    color: var(--gray);
    font-size: .78rem;
    border-top: 1px solid var(--border);
}

/* ── Tabs ──────────────────────────────────────────────── */
.auth-tabs {
    display: flex;
    gap: 4px;
    background: #f0f4ff;
    border-radius: var(--radius);
    padding: 4px;
    margin-bottom: 32px;
}

.auth-tab {
    flex: 1;
    padding: 10px;
    border: none;
    border-radius: 10px;
    background: transparent;
    font-size: .875rem;
    font-weight: 600;
    color: var(--gray);
    cursor: pointer;
    transition: all .25s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    font-family: inherit;
}

.auth-tab.active {
    background: white;
    color: var(--primary);
    box-shadow: var(--shadow);
}

/* ── Paneles ───────────────────────────────────────────── */
.auth-panel { display: none; }
.auth-panel.active { display: block; }

.auth-panel-header { margin-bottom: 24px; }
.auth-panel-header h2 {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--dark);
    margin-bottom: 4px;
}
.auth-panel-header p {
    color: var(--gray);
    font-size: .875rem;
}

/* ── Campos ────────────────────────────────────────────── */
.auth-field { margin-bottom: 18px; }
.auth-field > label {
    display: block;
    font-size: .82rem;
    font-weight: 700;
    color: var(--dark);
    margin-bottom: 6px;
}

.auth-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.auth-input-icon {
    position: absolute;
    left: 14px;
    color: var(--gray);
    font-size: .9rem;
    pointer-events: none;
    z-index: 1;
}

.auth-input-wrap input,
.auth-input-wrap select,
.auth-select {
    width: 100%;
    padding: 11px 14px 11px 40px;
    border: 2px solid var(--border);
    border-radius: 10px;
    font-size: .875rem;
    color: var(--dark);
    background: white;
    transition: all .25s;
    font-family: inherit;
    outline: none;
    -webkit-appearance: none;
}

.auth-input-wrap input:focus,
.auth-input-wrap select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(67, 97, 238,0.1);
}

.auth-input-wrap input.readonly-field {
    background: #f8f9fa;
    color: var(--gray);
}

.auth-eye {
    position: absolute;
    right: 12px;
    background: none;
    border: none;
    color: var(--gray);
    cursor: pointer;
    font-size: .9rem;
    transition: color .2s;
}
.auth-eye:hover { color: var(--primary); }

.auth-forgot {
    display: block;
    text-align: right;
    font-size: .78rem;
    color: var(--primary);
    text-decoration: none;
    margin-top: 5px;
}
.auth-forgot:hover { text-decoration: underline; }

/* ── Botones ───────────────────────────────────────────── */
.auth-btn {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 10px;
    font-size: .9rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all .25s;
    font-family: inherit;
    text-decoration: none;
    margin-bottom: 12px;
}

.auth-btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    box-shadow: 0 4px 15px rgba(67, 97, 238,0.3);
}
.auth-btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(67, 97, 238,0.4);
}
.auth-btn-primary:disabled { opacity: .7; cursor: not-allowed; transform: none; }

.auth-btn-google {
    background: white;
    color: var(--dark);
    border: 2px solid var(--border);
}
.auth-btn-google:hover { border-color: #4285f4; background: #f8f9ff; }

.auth-btn-ghost {
    background: transparent;
    color: var(--gray);
    border: 2px solid var(--border);
    width: auto;
    padding: 10px 20px;
}
.auth-btn-ghost:hover { border-color: var(--primary); color: var(--primary); }

/* ── Divider ───────────────────────────────────────────── */
.auth-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 16px 0;
    color: var(--gray);
    font-size: .78rem;
}
.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

/* ── Alertas ───────────────────────────────────────────── */
.auth-alert {
    padding: 12px 14px;
    border-radius: 10px;
    font-size: .82rem;
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 18px;
    animation: shake .4s ease;
}
@keyframes shake {
    0%,100% { transform: translateX(0); }
    25%      { transform: translateX(-4px); }
    75%      { transform: translateX(4px); }
}
.auth-alert-danger  { background:#fdecea; color:#c0392b; border:1px solid #f1948a; }
.auth-alert-success { background:#e8f5e9; color:#27ae60; border:1px solid #82e0aa; }
.auth-alert-warning { background:#fff8e1; color:#d68910; border:1px solid #f9e79f; }
.auth-alert a { color: inherit; font-weight: 700; text-decoration: underline; }

.auth-age-warning {
    background: #fff8e1;
    border: 1px solid #f9e79f;
    border-left: 4px solid var(--warning);
    color: #d68910;
    padding: 12px 14px;
    border-radius: 8px;
    font-size: .82rem;
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 16px;
}

/* ── Selección de tipo de usuario ──────────────────────── */
.user-type-selector { display: flex; flex-direction: column; gap: 14px; }

.user-type-card {
    width: 100%;
    padding: 20px;
    border: 2px solid var(--border);
    border-radius: 14px;
    background: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 16px;
    text-align: left;
    transition: all .25s;
    font-family: inherit;
}
.user-type-card:hover {
    border-color: var(--primary);
    background: #f8f9ff;
    transform: translateX(4px);
}

.user-type-icon {
    width: 52px; height: 52px;
    background: linear-gradient(135deg, #e8edff, #d0dbff);
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.3rem;
    color: var(--primary);
    flex-shrink: 0;
    overflow: hidden;
}

.user-type-icon.has-logo {
    width: 100px; height: 64px;
    background: #ffffff;
    border: 1px solid var(--border);
    padding: 6px;
    border-radius: 10px;
}

.user-type-icon.has-logo img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.user-type-card h3 { font-size: 1rem; font-weight: 800; margin-bottom: 3px; color: var(--dark); }
.user-type-card p  { font-size: .78rem; color: var(--gray); line-height: 1.4; }
.user-type-arrow   { margin-left: auto; color: var(--gray); font-size: 1.1rem; flex-shrink: 0; }

/* ── Barra de progreso ─────────────────────────────────── */
.reg-progress {
    margin-bottom: 24px;
}

.reg-progress-bar-wrap {
    height: 4px;
    background: #f0f2f5;
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 10px;
}

.reg-progress-bar {
    height: 4px;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    border-radius: 2px;
    transition: width .4s ease;
}

.reg-steps-labels {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    margin-top: 6px;
}
.reg-steps-labels span {
    font-size: .68rem;
    padding: 2px 8px;
    border-radius: 50px;
    background: #f0f2f5;
    color: var(--gray);
    white-space: nowrap;
}
.reg-steps-labels span.done {
    background: var(--primary);
    color: white;
}

/* ── Grid del formulario de registro ───────────────────── */
.reg-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

/* ── Selección de documento ────────────────────────────── */
.doc-type-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
}

.doc-option {
    cursor: pointer;
}
.doc-option input { display: none; }
.doc-option span {
    display: inline-block;
    padding: 6px 14px;
    border: 2px solid var(--border);
    border-radius: 50px;
    font-size: .78rem;
    font-weight: 600;
    color: var(--gray);
    transition: all .2s;
    cursor: pointer;
}
.doc-option input:checked + span {
    border-color: var(--primary);
    background: var(--primary);
    color: white;
}

/* ── Selección de sexo ─────────────────────────────────── */
.sex-selector { display: flex; gap: 12px; }
.sex-option { cursor: pointer; }
.sex-option input { display: none; }
.sex-option span {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    border: 2px solid var(--border);
    border-radius: 10px;
    font-size: .875rem;
    font-weight: 600;
    color: var(--gray);
    cursor: pointer;
    transition: all .2s;
}
.sex-option input:checked + span {
    border-color: var(--primary);
    color: var(--primary);
    background: #f0f4ff;
}

/* ── Cantidad de estudiantes ───────────────────────────── */
.cantidad-selector {
    display: flex;
    gap: 10px;
    margin-bottom: 28px;
    flex-wrap: wrap;
}

.cantidad-btn {
    flex: 1;
    min-width: 70px;
    padding: 16px 10px;
    border: 2px solid var(--border);
    border-radius: 12px;
    background: white;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    transition: all .25s;
    font-family: inherit;
}
.cantidad-btn.active {
    border-color: var(--primary);
    background: #f0f4ff;
}
.cantidad-num  { font-size: 1.8rem; font-weight: 800; color: var(--dark); line-height: 1; }
.cantidad-label{ font-size: .72rem; color: var(--gray); }
.cantidad-btn.active .cantidad-num { color: var(--primary); }

/* ── Relación con el estudiante ────────────────────────── */
.relacion-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}
.relacion-option { cursor: pointer; }
.relacion-option input { display: none; }
.relacion-option span {
    display: inline-block;
    padding: 7px 14px;
    border: 2px solid var(--border);
    border-radius: 50px;
    font-size: .78rem;
    font-weight: 600;
    color: var(--gray);
    cursor: pointer;
    transition: all .2s;
}
.relacion-option input:checked + span {
    border-color: var(--primary);
    background: var(--primary);
    color: white;
}

/* ── Password strength ─────────────────────────────────── */
.password-strength-bar {
    height: 4px;
    background: #f0f2f5;
    border-radius: 2px;
    margin-top: 8px;
    overflow: hidden;
}
.psb-fill { height: 100%; border-radius: 2px; width: 0; transition: all .3s; }
.psb-label { font-size: .75rem; font-weight: 600; margin-top: 4px; display: block; }
.pass-match-msg { font-size: .75rem; font-weight: 600; display: block; margin-top: 4px; }

/* ── Terms checkbox ────────────────────────────────────── */
.auth-terms { margin-bottom: 18px; }
.auth-checkbox {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
    font-size: .82rem;
    color: var(--gray);
    line-height: 1.5;
}
.auth-checkbox a { color: var(--primary); }
.auth-checkbox input[type="checkbox"] { margin-top: 2px; width: 16px; height: 16px; flex-shrink: 0; }

/* ── Navegación de pasos ───────────────────────────────── */
.reg-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 24px;
    padding-top: 18px;
    border-top: 1px solid var(--border);
    gap: 12px;
}

/* ── Carga ─────────────────────────────────────────────── */
.auth-loading {
    font-size: .82rem;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 0;
}

/* ── Éxito de registro ─────────────────────────────────── */
.reg-success-message {
    text-align: center;
    padding: 40px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
}
.reg-success-icon {
    width: 72px; height: 72px;
    background: linear-gradient(135deg, #e8f5e9, #d4edda);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 2.2rem;
    color: var(--success);
    animation: popIn .5s cubic-bezier(.34,1.56,.64,1);
}
@keyframes popIn {
    from { transform: scale(0); opacity: 0; }
    to   { transform: scale(1); opacity: 1; }
}

.req { color: #e74c3c; margin-left: 2px; }

/* ── Responsive ────────────────────────────────────────── */
@media (max-width: 900px) {
    .auth-split { grid-template-columns: 1fr; }
    .auth-brand { display: none; }
    .auth-form-panel { max-height: none; }
    .auth-form-container { padding: 32px 24px; }
}

@media (max-width: 480px) {
    .reg-grid-2        { grid-template-columns: 1fr; }
    .cantidad-selector { gap: 6px; }
    .auth-form-container { padding: 24px 16px; }
}

/* Agregar al final de auth.css */

.auth-switch-text {
    text-align: center;
    margin-top: 16px;
    font-size: .82rem;
    color: var(--gray);
}
.auth-switch-text a {
    color: var(--primary);
    font-weight: 600;
    text-decoration: none;
}
.auth-switch-text a:hover { text-decoration: underline; }

/* Progress bar nueva */
.reg-progress-wrap    { margin-bottom: 24px; }
.reg-progress-track   {
    height: 5px;
    background: #f0f2f5;
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 10px;
}
.reg-progress-fill    {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    border-radius: 3px;
    transition: width .4s ease;
}
.reg-step-labels      { display: flex; flex-wrap: wrap; gap: 6px; }
.step-lbl             {
    font-size: .7rem;
    padding: 3px 10px;
    border-radius: 50px;
    background: #f0f2f5;
    color: var(--gray);
    white-space: nowrap;
    transition: all .3s;
}
.step-lbl.done        { background: #e8edff; color: var(--primary); }
.step-lbl.current     { background: var(--primary); color: white; font-weight: 700; }

/* Botón pequeño */
.auth-btn-sm { width: auto; padding: 10px 20px; flex: 0; }

/* Éxito registro */
.reg-success {
    text-align: center;
    padding: 40px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
}
.reg-success-icon {
    width: 72px; height: 72px;
    background: #e8f5e9;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 2.2rem;
    color: var(--success);
    animation: popIn .5s cubic-bezier(.34,1.56,.64,1);
}
.reg-success h2 { font-size: 1.5rem; font-weight: 800; color: var(--dark); }
.reg-success p  { color: var(--gray); font-size: .875rem; }

@keyframes popIn {
    from { transform: scale(0); opacity: 0; }
    to   { transform: scale(1); opacity: 1; }
}

/* ── Prefijo visual de documento (REQ-04) ─────────────────── */
.auth-input-wrap.has-doc-prefix input { padding-left: 54px; }
.doc-prefix {
    position: absolute;
    left: 38px;
    color: var(--gray);
    font-size: .8rem;
    font-weight: 700;
    pointer-events: none;
    z-index: 1;
}

/* ── Validación visual inline (REQ-02) ─────────────────────── */
.auth-input-wrap input.field-invalid,
.auth-input-wrap select.field-invalid { border-color: #e74c3c !important; }
.auth-input-wrap input.field-valid,
.auth-input-wrap select.field-valid   { border-color: var(--success) !important; }
.field-error-msg {
    display: block;
    font-size: .72rem;
    color: #e74c3c;
    margin-top: 4px;
}

/* ── Campo obligatorio faltante — para grupos sin un único input que
   pueda llevar .field-invalid (Sexo, Teléfono compuesto, etc.). Usa
   outline en vez de border para no mover el layout de alrededor. ──── */
.campo-faltante {
    outline: 2px solid #e74c3c;
    outline-offset: 6px;
    border-radius: 10px;
}

/* ── Teléfono compuesto: prefijo + número (REQ-05) ─────────── */
.tel-compound { display: flex; gap: 8px; }
.tel-compound .auth-input-wrap:first-child { flex: 0 0 118px; }
.tel-compound .auth-input-wrap:last-child  { flex: 1; }
.tel-link-toggle {
    display: block;
    font-size: .72rem;
    color: var(--primary);
    margin-top: 5px;
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
    font-family: inherit;
}
.tel-link-toggle:hover { text-decoration: underline; }

/* ── Ubicación: link "otro país" / "otros" (REQ-06) ────────── */
.loc-link-toggle {
    display: inline-block;
    font-size: .72rem;
    color: var(--primary);
    margin-top: 5px;
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
    font-family: inherit;
}
.loc-link-toggle:hover { text-decoration: underline; }

/* ── Términos y Condiciones (REQ-01) ────────────────────────── */
.terms-box {
    max-height: 140px;
    overflow-y: auto;
    border: 2px solid var(--border);
    border-radius: 10px;
    padding: 12px 14px;
    font-size: .74rem;
    line-height: 1.6;
    color: var(--gray);
    margin-bottom: 12px;
    background: #f8f9fa;
}
.terms-box h4 { font-size: .78rem; color: var(--dark); margin: 10px 0 4px; }
.terms-box h4:first-child { margin-top: 0; }
.terms-box p { margin: 0 0 6px; }