/* ==========================================================================
   REGISTER.CSS — Página de Registro de Cuenta
   Complementa login.css (que se carga primero) con estilos únicos del registro
   ========================================================================== */

/* ========================================================
   1. TÍTULO DE LA CARD — "Crear cuenta"
   ======================================================== */
.register-card .login-card-header {
    margin-bottom: 24px;
}

.register-card .login-subtitle {
    margin-top: 2px;
}

/* ========================================================
   2. FORMULARIO DE REGISTRO — Ajustes de gap
   ======================================================== */
.register-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

/* ========================================================
   3. SELECTOR DE ROL — Toggle Estudiante / Docente
   ======================================================== */
.role-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.role-label {
    font-size: 0.87rem;
    font-weight: 600;
    color: var(--text-main);
    letter-spacing: 0.01em;
    transition: color var(--transition-base);
}

.role-selector {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

/* Ocultar el radio real */
.role-radio {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

.role-option {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 13px 16px;
    border-radius: var(--radius-input);
    border: 1.5px solid var(--input-border);
    background-color: var(--input-bg);
    cursor: pointer;
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--text-muted);
    transition:
        background-color 0.25s ease,
        border-color 0.25s ease,
        color 0.25s ease,
        box-shadow 0.25s ease,
        transform 0.2s var(--ease-spring);
    user-select: none;
    position: relative;
    overflow: hidden;
}

.role-option:hover {
    border-color: color-mix(in srgb, var(--accent-terracotta) 40%, var(--input-border));
    transform: translateY(-1px);
}

/* Estado activo del rol */
.role-radio:checked + .role-option {
    background-color: var(--accent-terracotta);
    border-color: var(--accent-terracotta);
    color: #ffffff;
    box-shadow: 0 4px 16px rgba(189, 89, 63, 0.3);
}

.role-radio:checked + .role-option .role-icon {
    color: #ffffff;
}

.role-radio:focus-visible + .role-option {
    outline: 2px solid var(--accent-terracotta);
    outline-offset: 2px;
}

.role-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    transition: color 0.25s ease;
    flex-shrink: 0;
}

/* ========================================================
   4. CHECKBOX — Términos y Condiciones
   ======================================================== */
.terms-group {
    display: flex;
    align-items: flex-start;
    gap: 0;
    margin-top: 2px;
}

.terms-label {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
    font-size: 0.86rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.terms-checkbox {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.terms-custom {
    width: 17px;
    height: 17px;
    min-width: 17px;
    border: 1.5px solid var(--input-border);
    border-radius: 4px;
    background-color: var(--input-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
    position: relative;
    margin-top: 1px;
}

.terms-custom::after {
    content: '';
    display: block;
    width: 5px;
    height: 8px;
    border: 2px solid white;
    border-top: none;
    border-left: none;
    transform: rotate(45deg) translateY(-1px);
    opacity: 0;
    transition: opacity 0.15s ease;
}

.terms-checkbox:checked + .terms-custom {
    background-color: var(--accent-terracotta);
    border-color: var(--accent-terracotta);
}

.terms-checkbox:checked + .terms-custom::after {
    opacity: 1;
}

.terms-checkbox:focus-visible + .terms-custom {
    outline: 2px solid var(--accent-terracotta);
    outline-offset: 2px;
}

/* Error del checkbox de términos */
.terms-group.has-error .terms-custom {
    border-color: #ef4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.terms-link {
    color: var(--accent-terracotta);
    text-decoration: none;
    font-weight: 600;
    transition: color var(--transition-base);
}

.terms-link:hover {
    color: color-mix(in srgb, var(--accent-terracotta) 80%, black);
    text-decoration: underline;
}

.terms-error {
    font-size: 0.8rem;
    color: #ef4444;
    min-height: 0;
    display: block;
    font-weight: 500;
    line-height: 1.4;
    margin-top: 2px;
}

.terms-error:not(:empty) {
    min-height: 16px;
    animation: errorIn 0.25s var(--ease-out-expo) both;
}

/* ========================================================
   5. BOTÓN "REGISTRARSE" — Color terracotta (no negro)
   ======================================================== */
.btn-register {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 15px 24px;
    background: linear-gradient(135deg, var(--accent-terracotta), #c96b4f) !important;
    color: #ffffff !important;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 700;
    border: 2px solid transparent;
    border-radius: var(--radius-input);
    cursor: pointer;
    letter-spacing: 0.01em;
    transition:
        background 0.25s ease,
        transform 0.2s var(--ease-spring),
        box-shadow 0.25s ease;
    position: relative;
    overflow: hidden;
    outline: none;
    margin-top: 4px;
    z-index: 0;
}

/* Efecto brillo en hover */
.btn-register::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        135deg,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.18) 50%,
        rgba(255, 255, 255, 0) 100%
    );
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.btn-register:hover::before {
    opacity: 1;
}

.btn-register:hover:not([data-loading="true"]) {
    transform: translateY(-2px);
    box-shadow: 0 8px 28px rgba(189, 89, 63, 0.45);
}

.btn-register:active:not([data-loading="true"]) {
    transform: translateY(0);
    box-shadow: 0 4px 12px rgba(189, 89, 63, 0.3);
}

.btn-register:focus-visible {
    outline: 3px solid var(--accent-terracotta);
    outline-offset: 3px;
}

/* Estado de carga y deshabilitado */
.btn-register[data-loading="true"],
.btn-register:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
    filter: grayscale(30%);
}

.btn-register-text {
    position: relative;
    z-index: 2;
    transition: opacity 0.2s ease;
    color: inherit;
}

.btn-register[data-loading="true"] .btn-register-text {
    opacity: 0;
}

/* Spinner */
.btn-register-spinner {
    position: absolute;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.btn-register[data-loading="true"] .btn-register-spinner {
    opacity: 1;
}

.btn-register-spinner svg {
    animation: spinnerRotate 0.8s linear infinite;
    stroke-dasharray: 50;
    stroke-dashoffset: 14;
}

/* ========================================================
   6. ENLACE "YA TIENES CUENTA"
   ======================================================== */
.login-link-text {
    text-align: center;
    font-size: 0.87rem;
    color: var(--text-muted);
}

.login-link {
    color: var(--accent-terracotta);
    text-decoration: none;
    font-weight: 700;
    transition: color var(--transition-base);
}

.login-link:hover {
    color: color-mix(in srgb, var(--accent-terracotta) 80%, black);
    text-decoration: underline;
}

.login-link:focus-visible {
    outline: 2px solid var(--accent-terracotta);
    outline-offset: 2px;
    border-radius: 3px;
}

/* ========================================================
   7. PASSWORD STRENGTH INDICATOR
   ======================================================== */
.password-strength {
    display: flex;
    gap: 4px;
    margin-top: 4px;
}

.strength-bar {
    flex: 1;
    height: 3px;
    border-radius: 2px;
    background-color: var(--border-color);
    transition: background-color 0.3s ease;
}

.strength-bar.active.weak    { background-color: #ef4444; }
.strength-bar.active.medium  { background-color: #f59e0b; }
.strength-bar.active.strong  { background-color: #22c55e; }

.strength-text {
    font-size: 0.78rem;
    font-weight: 500;
    margin-top: 2px;
    transition: color 0.3s ease;
    color: var(--text-muted);
}

.strength-text.weak    { color: #ef4444; }
.strength-text.medium  { color: #f59e0b; }
.strength-text.strong  { color: #22c55e; }

/* ========================================================
   8. DARK MODE — Ajustes específicos registro
   ======================================================== */
[data-theme="dark"] .role-option {
    background-color: var(--input-bg);
    border-color: var(--input-border);
    color: var(--text-muted);
}

[data-theme="dark"] .role-option:hover {
    border-color: color-mix(in srgb, var(--accent-terracotta) 50%, var(--input-border));
}

[data-theme="dark"] .role-radio:checked + .role-option {
    background-color: var(--accent-terracotta);
    border-color: var(--accent-terracotta);
    color: #ffffff;
    box-shadow: 0 4px 20px rgba(212, 105, 77, 0.35);
}

[data-theme="dark"] .btn-register {
    background: linear-gradient(135deg, #d4694d, #c4593a) !important;
    box-shadow: 0 4px 20px rgba(212, 105, 77, 0.35);
}

[data-theme="dark"] .btn-register:hover:not([data-loading="true"]) {
    box-shadow: 0 8px 28px rgba(184, 69, 46, 0.5);
}

/* ========================================================
   9. RESPONSIVE — Ajustes específicos del registro
   ======================================================== */

/* Panel izquierdo: texto adaptado al registro */
.register-page .left-description {
    max-width: 420px;
}

@media (max-width: 768px) {
    .role-selector {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    .role-option {
        padding: 11px 12px;
        font-size: 0.88rem;
        gap: 8px;
    }
}

@media (max-width: 480px) {
    .role-option {
        padding: 10px 10px;
        font-size: 0.84rem;
        gap: 6px;
    }

    .terms-label {
        font-size: 0.82rem;
    }
}

/* ── Pantallas con poca altura ── */
@media (max-height: 820px) {
    .register-form {
        gap: 14px;
    }

    .btn-register {
        padding: 13px 24px;
        margin-top: 2px;
    }

    .role-option {
        padding: 11px 14px;
    }
}

@media (max-height: 700px) {
    .register-form {
        gap: 10px;
    }

    .btn-register {
        padding: 11px 20px;
        font-size: 0.93rem;
    }

    .role-option {
        padding: 9px 12px;
        font-size: 0.88rem;
    }
}

/* ══════════════════════════════════════════
   OTP CARD DESIGN
   ══════════════════════════════════════════ */
#otp-card {
    padding: 3.5rem 2.5rem;
    text-align: center;
}

.otp-header {
    margin-bottom: 2rem;
}

.otp-icon {
    color: var(--accent-terracotta);
    margin-bottom: 1.5rem;
    display: inline-block;
}

.otp-group {
    margin-bottom: 2rem;
}

.otp-input {
    font-size: 3rem;
    text-align: center;
    letter-spacing: 1.2rem;
    font-weight: 700;
    padding: 1.5rem;
    color: var(--text-color);
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-md);
    transition: var(--transition-bounce);
    width: 100%;
}

.otp-input:focus {
    border-color: var(--accent-terracotta);
    box-shadow: 0 0 0 4px rgba(189, 89, 63, 0.15);
    background: var(--input-bg);
}

.otp-expiration {
    text-align: center;
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-top: 1rem;
    font-weight: 500;
    transition: color 0.3s ease;
}

.otp-expiration span {
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    letter-spacing: 1px;
}

.otp-expiration.danger {
    color: #ef4444;
    animation: pulse-danger 1s infinite;
}

@keyframes pulse-danger {
    0% { opacity: 1; }
    50% { opacity: 0.6; }
    100% { opacity: 1; }
}

#btn-verify-otp {
    width: 100%;
    margin-bottom: 1.5rem;
}

.resend-text {
    font-size: 0.95rem;
    color: var(--text-muted);
    margin-top: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.8rem;
}

.btn-resend-link {
    background-color: transparent;
    border: 2px solid var(--accent-terracotta);
    color: var(--accent-terracotta);
    font-weight: 600;
    cursor: pointer;
    padding: 0.7rem 1.5rem;
    font-size: 0.95rem;
    border-radius: var(--radius-input);
    transition: all 0.25s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
}

.btn-resend-link:hover:not(:disabled) {
    background-color: var(--accent-terracotta);
    color: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(189, 89, 63, 0.25);
}

.btn-resend-link:disabled {
    border-color: var(--input-border);
    color: var(--text-muted);
    background-color: rgba(0, 0, 0, 0.03);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* ========================================================
   OTP DIGIT BOXES DESIGN
   ======================================================== */
.otp-digit-group {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 10px;
    width: 100%;
}

.otp-digit {
    width: 100%;
    aspect-ratio: 1/1.2;
    text-align: center;
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-color);
    background-color: var(--bg-alt);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    transition: all 0.3s ease;
}

.otp-digit:focus {
    border-color: #9ca3af;
    box-shadow: 0 0 0 3px rgba(156, 163, 175, 0.2);
    outline: none;
    background-color: var(--input-bg);
}

[data-theme="dark"] .otp-digit:focus {
    border-color: #6b7280;
    box-shadow: 0 0 0 3px rgba(107, 114, 128, 0.2);
    background-color: var(--bg-card);
}

.otp-digit:not(:placeholder-shown):valid {
    border-color: #9ca3af;
    color: var(--text-main);
}

/* Remove arrows from number inputs if ever changed to type="number" */
.otp-digit::-webkit-outer-spin-button,
.otp-digit::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
