/* ========================================
   LOGIN.CSS - Estilos específicos para la página de login
   ======================================== */

.page-login {
    background: linear-gradient(135deg, var(--color-primary) 0%, #16a34a 100%);
    min-height: 100vh;
}

.login-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 120px);
    padding: 1rem;
}

.login-container {
    background: var(--color-white);
    border-radius: 20px;
    padding: 2rem;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    width: 100%;
    max-width: 400px;
    animation: fadeInUp 0.6s ease-out;
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-title {
    color: var(--color-dark);
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    font-family: var(--font-primary);
}

.login-subtitle {
    color: var(--color-gray);
    font-size: 0.9rem;
    line-height: 1.5;
    margin-bottom: 1.5rem;
}

/* ========================================
   TOGGLE ENTRE LOGIN Y REGISTRO
   ======================================== */
.auth-toggle {
    display: flex;
    background: var(--color-gray-light);
    border-radius: 12px;
    padding: 4px;
    margin-bottom: 2rem;
}

.auth-toggle-btn {
    flex: 1;
    padding: 0.75rem;
    background: transparent;
    border: none;
    border-radius: 8px;
    font-family: var(--font-primary);
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--color-gray);
    cursor: pointer;
    transition: var(--transition-default);
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.auth-toggle-btn.active {
    background: var(--color-white);
    color: var(--color-primary);
    font-weight: 600;
    box-shadow: var(--shadow-sm);
}

/* ========================================
   FORMULARIOS
   ======================================== */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.auth-form.hidden {
    display: none;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-label {
    font-weight: 500;
    color: var(--color-dark);
    font-size: 0.9rem;
    font-family: var(--font-primary);
}

.form-input {
    padding: 0.875rem 1rem;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    font-size: 1rem;
    font-family: var(--font-primary);
    transition: var(--transition-default);
    background: var(--color-white);
}

.form-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.1);
}

.form-input.error {
    border-color: #ef4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.form-error {
    color: #ef4444;
    font-size: 0.85rem;
    margin-top: 0.25rem;
    font-family: var(--font-primary);
}

/* ========================================
   BOTONES DE AUTENTICACIÓN
   ======================================== */
.btn-auth {
    background: linear-gradient(135deg, var(--color-primary), #16a34a);
    color: var(--color-white);
    border: none;
    padding: 1rem 2rem;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    font-family: var(--font-primary);
    cursor: pointer;
    transition: var(--transition-default);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.btn-auth:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(34, 197, 94, 0.3);
}

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

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

.btn-loading {
    display: none;
}

.btn-auth.loading .btn-text {
    display: none;
}

.btn-auth.loading .btn-loading {
    display: flex;
}

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid var(--color-white);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* ========================================
   OPCIONES ADICIONALES
   ======================================== */
.login-options {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 0px;
    text-align: center;
}

.forgot-password,
.auth-link {
    color: var(--color-primary);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: var(--transition-default);
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.forgot-password:hover,
.auth-link:hover {
    color: #16a34a;
    text-decoration: underline;
}

.divider {
    text-align: center;
    position: relative;
    margin: 1.5rem 0;
}

.divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: #e5e7eb;
}

.divider span {
    background: var(--color-white);
    padding: 0 1rem;
    position: relative;
    color: var(--color-gray);
    font-size: 0.85rem;
}

/* ========================================
   LOGIN SOCIAL
   ======================================== */
.social-login {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.social-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.875rem;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    background: var(--color-white);
    font-family: var(--font-primary);
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--color-dark);
    text-decoration: none;
    cursor: pointer;
    transition: var(--transition-default);
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.social-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.social-btn svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.social-btn.google:hover {
    background: #f8f9fa;
    border-color: #4285f4;
}

.social-btn.instagram:hover {
    background: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
    color: var(--color-white);
    border-color: transparent;
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */
@media (min-width: 768px) {
    .login-container {
        padding: 2.5rem;
        max-width: 420px;
    }
    
    .login-title {
        font-size: 1.75rem;
    }
    
    .login-subtitle {
        font-size: 1rem;
    }
    
    .form-input {
        font-size: 1rem;
        padding: 1rem;
    }
    
    .btn-auth {
        font-size: 1.1rem;
        padding: 1.125rem 2rem;
    }
    
    .social-btn {
        font-size: 1rem;
        padding: 1rem;
    }
}

@media (min-width: 1024px) {
    .login-container {
        padding: 3rem;
        max-width: 450px;
    }
    
    .login-title {
        font-size: 2rem;
    }
}

/* ========================================
   ANIMACIONES
   ======================================== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

/* ========================================
   ESTADOS DE ACCESIBILIDAD
   ======================================== */
.form-input:focus,
.btn-auth:focus,
.social-btn:focus,
.auth-toggle-btn:focus,
.forgot-password:focus,
.auth-link:focus {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

/* ========================================
   REDUCIR ANIMACIONES PARA USUARIOS QUE LO PREFIEREN
   ======================================== */
@media (prefers-reduced-motion: reduce) {
    .login-container {
        animation: none;
    }
    
    .btn-auth:hover,
    .social-btn:hover {
        transform: none;
    }
    
    .spinner {
        animation: none;
    }
}

/* ========================================
   SISTEMA DE CÓDIGO DE ACCESO - MOBILE FIRST
   ======================================== */

/* Enlace "¿Has olvidado tu contraseña?" */
.access-code-link,
.forgot-password {
    color: var(--color-primary) !important;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: var(--transition-default);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.forgot-password:hover {
    color: #16a34a !important;
    text-decoration: underline;
}

/* Sección principal del código de acceso */
.access-code-section {
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    border: 2px solid #3b82f6;
    border-radius: 16px;
    padding: 1.25rem;
    margin-top: 1.5rem;
    animation: slideInDown 0.3s ease-out;
}

.access-code-title {
    font-size: 1.1rem;
    color: var(--color-dark);
    margin-bottom: 0.5rem;
    font-weight: 600;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.access-code-title::before {
    content: "🔒";
    font-size: 1.2rem;
}

.access-code-desc {
    color: #1e40af;
    font-size: 0.9rem;
    margin-bottom: 1.25rem;
    text-align: center;
    line-height: 1.5;
    font-weight: 500;
}

/* Formulario para enviar código */
.access-code-form {
    display: flex;
    flex-direction: column;
    gap: 0.875rem;
    margin-bottom: 1.5rem;
}

.btn-send-code,
.btn-verify-code {
    width: 100%;
    padding: 0.875rem;
    background: #3b82f6;
    color: white;
    border: none;
    border-radius: 12px;
    font-family: var(--font-primary);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.2);
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.btn-send-code:hover,
.btn-verify-code:hover {
    background: #2563eb;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.btn-send-code:active,
.btn-verify-code:active {
    transform: scale(0.98);
}

.btn-send-code:disabled,
.btn-verify-code:disabled {
    background: #94a3b8 !important;
    cursor: not-allowed !important;
    transform: none !important;
    opacity: 0.6;
    box-shadow: none !important;
}

/* Sección para introducir código */
.code-input-section {
    border-top: 1px solid #bfdbfe;
    padding-top: 1.25rem;
    margin-top: 1.25rem;
    animation: fadeInUp 0.5s ease-out;
}

.code-sent-message {
    background: #dcfce7;
    border: 2px solid #22c55e;
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    font-size: 0.95rem;
    color: #15803d;
    text-align: center;
    animation: slideInUp 0.5s ease-out;
}

.code-sent-message .success-icon {
    width: 24px;
    height: 24px;
    background: #22c55e;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: bold;
    flex-shrink: 0;
}

/* Formulario de código */
.code-input-form {
    display: flex;
    flex-direction: column;
    gap: 0.875rem;
}

.code-input {
    text-align: center;
    font-size: 1.1rem;
    font-weight: bold;
    font-family: 'Courier New', monospace;
    letter-spacing: 0.25rem;
    padding: 1rem;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    background: white;
    transition: var(--transition-default);
}

.code-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.code-input.error {
    border-color: #ef4444 !important;
    background-color: #fef2f2;
    animation: shake 0.4s;
}

/* Timer del código */
.code-timer {
    text-align: center;
    margin: 1rem 0;
    font-size: 0.85rem;
    color: #6b7280;
    background: white;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.code-timer::before {
    content: "⏰";
    font-size: 1rem;
}

/* Enlace para reenviar código */
.resend-code {
    text-align: center;
    margin-top: 0.75rem;
}

.resend-code-link {
    color: #3b82f6 !important;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    transition: var(--transition-default);
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.2);
}

.resend-code-link:hover {
    color: #2563eb !important;
    background: rgba(59, 130, 246, 0.15);
    text-decoration: none;
}

/* Enlace para volver al login tradicional */
.back-to-login {
    text-align: center;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid #bfdbfe;
}

.back-to-login-link {
    color: #6b7280 !important;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    transition: var(--transition-default);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.back-to-login-link:hover {
    color: var(--color-primary) !important;
    text-decoration: none;
}

/* Estados de carga para los botones */
.btn-send-code.loading,
.btn-verify-code.loading {
    position: relative;
    color: transparent;
}

.btn-send-code.loading::after,
.btn-verify-code.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 18px;
    height: 18px;
    border: 2px solid transparent;
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Estados especiales cuando código enviado */
.access-code-section.code-sent .access-code-form {
    display: none !important;
}

.access-code-section.code-sent .code-input-section {
    display: block !important;
    border-top: none;
    padding-top: 0;
    margin-top: 0;
}

.access-code-section.code-sent .access-code-title {
    color: #22c55e;
}

.access-code-section.code-sent .access-code-title::before {
    content: "✅";
}

.access-code-section.code-sent .access-code-desc {
    color: #15803d;
    font-weight: 500;
    background: #dcfce7;
    padding: 0.75rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
}

/* ========================================
   ANIMACIONES
   ======================================== */
@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

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

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-3px); }
    20%, 40%, 60%, 80% { transform: translateX(3px); }
}

/* ========================================
   RESPONSIVE DESIGN - TABLET (768px+)
   ======================================== */
@media (min-width: 768px) {
    .access-code-section {
        padding: 1.5rem;
        border-radius: 20px;
        margin-top: 2rem;
    }
    
    .access-code-title {
        font-size: 1.2rem;
    }
    
    .access-code-desc {
        font-size: 1rem;
        margin-bottom: 1.5rem;
    }
    
    .access-code-form {
        gap: 1rem;
        margin-bottom: 2rem;
    }
    
    .btn-send-code,
    .btn-verify-code {
        font-size: 1rem;
        padding: 1rem 1.5rem;
    }
    
    .code-input-section {
        padding-top: 1.5rem;
        margin-top: 1.5rem;
    }
    
    .code-sent-message {
        padding: 1.25rem;
        font-size: 1rem;
        margin-bottom: 2rem;
    }
    
    .code-sent-message .success-icon {
        width: 28px;
        height: 28px;
        font-size: 0.9rem;
    }
    
    .code-input-form {
        gap: 1rem;
    }
    
    .code-input {
        font-size: 1.2rem;
        padding: 1.25rem;
        letter-spacing: 0.5rem;
    }
    
    .code-timer {
        font-size: 0.9rem;
        padding: 0.75rem 1rem;
    }
    
    .resend-code-link {
        font-size: 0.9rem;
        padding: 0.6rem 1rem;
    }
    
    .back-to-login-link {
        font-size: 0.9rem;
    }
}

/* ========================================
   RESPONSIVE DESIGN - DESKTOP (1024px+)
   ======================================== */
@media (min-width: 1024px) {
    .access-code-section {
        padding: 2rem;
    }
    
    .access-code-title {
        font-size: 1.3rem;
    }
    
    .code-input {
        font-size: 1.3rem;
        padding: 1.5rem;
        letter-spacing: 0.75rem;
        max-width: 300px;
        margin: 0 auto;
    }
    
    .btn-send-code,
    .btn-verify-code {
        font-size: 1.1rem;
        padding: 1.125rem 2rem;
    }
}

/* ========================================
   ACCESIBILIDAD Y MEJORAS UX
   ======================================== */
.code-input:focus,
.btn-send-code:focus,
.btn-verify-code:focus,
.forgot-password:focus,
.resend-code-link:focus,
.back-to-login-link:focus {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

/* Mejoras para dispositivos táctiles */
@media (hover: none) {
    .forgot-password:hover,
    .btn-send-code:hover,
    .btn-verify-code:hover {
        transform: none;
    }
    
    .forgot-password:active,
    .btn-send-code:active,
    .btn-verify-code:active {
        transform: scale(0.95);
    }
}

/* Modo de alto contraste */
@media (prefers-contrast: high) {
    .access-code-section {
        border-width: 3px;
    }
    
    .code-input {
        border-width: 3px;
    }
    
    .btn-send-code,
    .btn-verify-code {
        box-shadow: none;
        border: 2px solid transparent;
    }
    
    .btn-send-code:focus,
    .btn-verify-code:focus {
        border-color: white;
    }
}

/* Reducir movimiento para usuarios que lo prefieren */
@media (prefers-reduced-motion: reduce) {
    .access-code-section,
    .code-input-section,
    .code-sent-message {
        animation: none;
    }
    
    .btn-send-code:hover,
    .btn-verify-code:hover {
        transform: none;
    }
    
    .code-input.error {
        animation: none;
    }
}
/* ========================================
   CHECKBOX DE TÉRMINOS Y CONDICIONES
   ======================================== */

.terms-checkbox-wrapper {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1rem;
    background: #f9fafb;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    transition: var(--transition-default);
}

.terms-checkbox-wrapper:has(.terms-checkbox:checked) {
    background: #dcfce7;
    border-color: var(--color-primary);
}

.terms-checkbox {
    width: 18px;
    height: 18px;
    min-width: 18px;
    cursor: pointer;
    accent-color: var(--color-primary);
    margin-top: 2px;
}

.terms-label {
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--color-dark);
    cursor: pointer;
    user-select: none;
}

.terms-link {
    color: var(--color-primary) !important;
    font-weight: 600;
    text-decoration: none;
    transition: var(--transition-default);
}

.terms-link:hover {
    color: #16a34a !important;
    text-decoration: underline;
}

.terms-link:focus {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
    border-radius: 2px;
}

/* Estilo del error para términos */
#acceptTermsError {
    margin-top: 0.5rem;
}

/* Responsive */
@media (max-width: 768px) {
    .terms-label {
        font-size: 0.85rem;
    }
    
    .terms-checkbox {
        width: 16px;
        height: 16px;
        min-width: 16px;
    }
}

