/* =================================================================
   LOGIN MINIMALISTA - StudyHub
   Diseño elegante con fondo negro y layout dividido
================================================================= */

/* Variables minimalistas */
:root {
    --login-primary: #ffffff;
    --login-secondary: #f8f9fa;
    --login-accent: #3498db;
    --login-gray: #6c757d;
    --login-dark: #000000;
    --login-border: #dee2e6;
    --login-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    --login-transition: all 0.3s ease;
}

/* Modal de autenticación con fondo negro */
#auth-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--login-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

#auth-modal .modal-content {
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 0;
    max-width: 1200px;
    width: 95%;
    height: 700px;
    animation: slideInFromBottom 0.8s ease-out;
}

@keyframes slideInFromBottom {
    from {
        opacity: 0;
        transform: translateY(50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Contenedor principal dividido */
.auth-container {
    display: flex;
    height: 100%;
    background: var(--login-primary);
    border-radius: 0;
    box-shadow: var(--login-shadow);
    overflow: hidden;
    position: relative;
}

/* Lado izquierdo - Logo y branding */
.auth-left {
    flex: 1;
    background: var(--login-dark);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 40px;
    color: var(--login-primary);
    position: relative;
}

.auth-left .logo {
    width: 240px;
    height: 240px;
    margin-bottom: 40px;
    border-radius: 20px;
    box-shadow: 0 15px 35px rgba(255, 255, 255, 0.1);
    object-fit: contain;
    animation: logoFloat 3s ease-in-out infinite;
}

@keyframes logoFloat {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

.auth-left h1 {
    font-size: 3.5rem;
    font-weight: 800;
    margin-bottom: 20px;
    text-align: center;
    letter-spacing: -2px;
    color: var(--login-primary);
}

.auth-left p {
    font-size: 1.3rem;
    text-align: center;
    opacity: 0.8;
    line-height: 1.6;
    max-width: 350px;
    color: var(--login-secondary);
}

/* Lado derecho - Formularios */
.auth-right {
    flex: 1;
    padding: 60px 50px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: var(--login-primary);
    position: relative;
    overflow-y: auto;
    max-height: 100vh;
}

/* Formularios */
.auth-form {
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
    flex-shrink: 0;
}

/* Ajuste especial para formulario de registro */
#register-form {
    margin: auto 0;
}

.auth-form.active {
    display: block;
    animation: fadeInRight 0.6s ease-out;
}

.auth-form:not(.active) {
    display: none;
}

@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.auth-form h2 {
    font-size: 2.8rem;
    font-weight: 700;
    color: var(--login-dark);
    margin-bottom: 8px;
    text-align: center;
    letter-spacing: -1px;
}

.auth-form .subtitle {
    text-align: center;
    color: var(--login-gray);
    font-size: 1.1rem;
    margin-bottom: 40px;
    font-weight: 400;
}

/* Grupos de formulario */
.form-group {
    margin-bottom: 25px;
    position: relative;
}

/* Reducir espaciado en formulario de registro */
#register-form .form-group {
    margin-bottom: 20px;
}

#register-form .auth-form h2 {
    margin-bottom: 15px;
}

#register-form .subtitle {
    margin-bottom: 25px;
}

.form-group i {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--login-gray);
    font-size: 1.1rem;
    z-index: 2;
    transition: var(--login-transition);
}

.form-group input {
    width: 100%;
    padding: 18px 20px 18px 50px;
    border: 2px solid var(--login-border);
    border-radius: 12px;
    font-size: 1rem;
    background: var(--login-primary);
    color: var(--login-dark);
    transition: var(--login-transition);
    font-weight: 500;
}

.form-group input:focus {
    outline: none;
    border-color: var(--login-accent);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.form-group input:focus + i {
    color: var(--login-accent);
}

.form-group input::placeholder {
    color: var(--login-gray);
    opacity: 0.7;
}

/* Texto de ayuda */
.form-help {
    display: block;
    margin-top: 8px;
    color: var(--login-gray);
    font-size: 0.85rem;
    padding-left: 15px;
}

/* Botones */
.auth-form .btn {
    width: 100%;
    padding: 18px 30px;
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: 12px;
    background: var(--login-accent);
    border: none;
    color: var(--login-primary);
    cursor: pointer;
    transition: var(--login-transition);
    margin-top: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.auth-form .btn:hover {
    background: #2980b9;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(52, 152, 219, 0.3);
}

.auth-form .btn i {
    position: static;
    transform: none;
    color: var(--login-primary);
    margin: 0;
}

/* Notificación de invitación */
.invite-notice {
    background: rgba(52, 152, 219, 0.1);
    border: 1px solid rgba(52, 152, 219, 0.2);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 30px;
    text-align: center;
}

.invite-notice i {
    font-size: 2rem;
    color: var(--login-accent);
    margin-bottom: 10px;
    display: block;
    position: static;
    transform: none;
}

.invite-notice p {
    margin: 0;
    color: var(--login-dark);
    font-weight: 600;
}

/* Información de autenticación */
.auth-info {
    text-align: center;
    margin-top: 25px;
    padding: 20px;
    background: rgba(52, 152, 219, 0.1);
    border: 1px solid rgba(52, 152, 219, 0.2);
    border-radius: 12px;
    color: var(--login-accent);
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.5;
}

.auth-info i {
    margin-right: 10px;
    position: static;
    transform: none;
    font-size: 1.2rem;
}

/* Enlaces de cambio */
.auth-switch {
    text-align: center;
    margin-top: 30px;
    color: var(--login-gray);
}

.auth-switch a {
    color: var(--login-accent);
    text-decoration: none;
    font-weight: 600;
    transition: var(--login-transition);
}

.auth-switch a:hover {
    color: #2980b9;
    text-decoration: underline;
}

/* Estados de validación */
.form-group.error input {
    border-color: #e74c3c;
    box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.1);
}

.form-group.error i {
    color: #e74c3c;
}

.form-group.success input {
    border-color: #27ae60;
    box-shadow: 0 0 0 3px rgba(39, 174, 96, 0.1);
}

.form-group.success i {
    color: #27ae60;
}

/* Estados de carga */
.auth-form .btn.loading {
    pointer-events: none;
    opacity: 0.8;
    background: var(--login-gray);
}

.auth-form .btn.loading i {
    animation: spin 1s linear infinite;
}

/* Ocultar enlaces de registro para sistema solo por invitación */
#login-form .auth-switch {
    display: none;
}

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

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

@media (max-width: 1024px) {
    .auth-container {
        flex-direction: column;
        height: auto;
        min-height: 100vh;
    }
    
    .auth-left {
        flex: none;
        height: 40vh;
        padding: 40px 30px;
    }
    
    .auth-left .logo {
        width: 140px;
        height: 140px;
        margin-bottom: 20px;
    }
    
    .auth-left h1 {
        font-size: 2.5rem;
        margin-bottom: 15px;
    }
    
    .auth-left p {
        font-size: 1.1rem;
    }
    
    .auth-right {
        flex: none;
        padding: 40px 30px;
        justify-content: flex-start;
        overflow-y: auto;
        max-height: 60vh;
    }
    
    /* Ajustes especiales para registro en tablet */
    #register-form .auth-left {
        height: 25vh;
    }
    
    #register-form .auth-right {
        max-height: 75vh;
        padding: 30px;
    }
}

@media (max-width: 768px) {
    #auth-modal .modal-content {
        width: 100%;
        height: 100vh;
        max-width: none;
    }
    
    .auth-container {
        border-radius: 0;
    }
    
    .auth-left {
        height: 35vh;
        padding: 30px 20px;
    }
    
    .auth-left .logo {
        width: 120px;
        height: 120px;
    }
    
    .auth-left h1 {
        font-size: 2rem;
    }
    
    .auth-right {
        padding: 30px 20px;
        justify-content: flex-start;
        overflow-y: auto;
        max-height: 65vh;
    }
    
    .auth-form h2 {
        font-size: 2.2rem;
    }
    
    .form-group input {
        padding: 16px 18px 16px 45px;
    }
    
    /* Formulario de registro en móvil */
    #register-form .auth-left {
        height: 20vh;
        padding: 20px;
    }
    
    #register-form .auth-right {
        max-height: 80vh;
        padding: 20px;
    }
}

@media (max-width: 480px) {
    .auth-left {
        height: 30vh;
        padding: 20px 15px;
    }
    
    .auth-left .logo {
        width: 100px;
        height: 100px;
        margin-bottom: 15px;
    }
    
    .auth-left h1 {
        font-size: 1.8rem;
    }
    
    .auth-left p {
        font-size: 1rem;
    }
    
    .auth-right {
        padding: 20px 15px;
        justify-content: flex-start;
        overflow-y: auto;
        max-height: 70vh;
    }
    
    .auth-form h2 {
        font-size: 2rem;
    }
    
    .form-group {
        margin-bottom: 20px;
    }
    
    .form-group input {
        padding: 14px 16px 14px 40px;
        border-radius: 10px;
    }
    
    .auth-form .btn {
        padding: 16px 25px;
        border-radius: 10px;
    }
    
    /* Formulario de registro en móvil pequeño */
    #register-form .auth-left {
        height: 20vh;
    }
    
    #register-form .auth-right {
        max-height: 80vh;
        padding: 15px;
    }
    
    #register-form .form-group {
        margin-bottom: 15px;
    }
}

/* =================================================================
   MODO OSCURO (opcional para futuro)
================================================================= */

[data-theme="dark"] .auth-right {
    background: #1a1a1a;
}

[data-theme="dark"] .auth-form h2 {
    color: var(--login-primary);
}

[data-theme="dark"] .form-group input {
    background: #2d2d2d;
    color: var(--login-primary);
    border-color: #404040;
}

[data-theme="dark"] .invite-notice {
    background: rgba(52, 152, 219, 0.15);
}

/* =================================================================
   REGISTRO DE DOS PASOS
================================================================= */

/* Indicador de pasos */
.step-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 25px;
    gap: 15px;
}

.step {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    background: var(--login-border);
    color: var(--login-gray);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    transition: var(--login-transition);
}

.step.active {
    background: var(--login-accent);
    color: white;
}

.step.completed {
    background: #27ae60;
    color: white;
}

.step-divider {
    width: 40px;
    height: 2px;
    background: var(--login-border);
    transition: var(--login-transition);
}

.step-divider.completed {
    background: #27ae60;
}

/* Pasos del registro */
.register-step {
    display: none;
}

.register-step.active {
    display: block;
    animation: fadeInSlide 0.4s ease-out;
}

@keyframes fadeInSlide {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.register-step h3 {
    color: var(--login-dark);
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 20px;
    text-align: center;
}

/* Contenedor de contraseña con toggle */
.password-input-container {
    position: relative;
    display: flex;
    align-items: center;
}

.password-input-container input {
    padding-right: 45px !important;
}

.password-toggle {
    position: absolute;
    right: 12px;
    background: none;
    border: none;
    color: var(--login-gray);
    cursor: pointer;
    padding: 5px;
    transition: var(--login-transition);
}

.password-toggle:hover {
    color: var(--login-accent);
}

/* Medidor de fuerza de contraseña */
.password-strength {
    margin-top: 8px;
}

.strength-meter {
    width: 100%;
    height: 4px;
    background: var(--login-border);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 5px;
}

.strength-bar {
    height: 100%;
    width: 0%;
    transition: all 0.3s ease;
    border-radius: 2px;
}

.strength-bar.weak {
    background: #e74c3c;
    width: 33.33%;
}

.strength-bar.medium {
    background: #f39c12;
    width: 66.66%;
}

.strength-bar.strong {
    background: #27ae60;
    width: 100%;
}

.strength-text {
    font-size: 12px;
    color: var(--login-gray);
    display: block;
}

.strength-text.weak {
    color: #e74c3c;
}

.strength-text.medium {
    color: #f39c12;
}

.strength-text.strong {
    color: #27ae60;
}

/* Indicador de coincidencia de contraseñas */
.password-match {
    margin-top: 5px;
    font-size: 12px;
    min-height: 16px;
}

.password-match.match {
    color: #27ae60;
}

.password-match.no-match {
    color: #e74c3c;
}

/* Acciones del formulario */
.form-actions {
    display: flex;
    gap: 15px;
    align-items: center;
}

.form-actions .btn {
    flex: 1;
}

.form-actions .btn-outline {
    flex: 0 0 auto;
    min-width: 100px;
}

/* Responsive para pasos */
@media (max-width: 768px) {
    .step-indicator {
        gap: 10px;
    }
    
    .step {
        width: 30px;
        height: 30px;
        font-size: 12px;
    }
    
    .step-divider {
        width: 30px;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .form-actions .btn {
        width: 100%;
    }
}
