Ultra-Premium Redesign of Auth System and critical Map fixes

This commit is contained in:
2026-03-01 15:20:49 -05:00
parent 8a6b9fe5e8
commit 66b76cee61
6 changed files with 705 additions and 452 deletions

BIN
frontend/public/auth-bg.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 688 KiB

View File

@ -16,7 +16,11 @@ const authStore = useAuthStore()
const favoritesStore = useFavoritesStore() const favoritesStore = useFavoritesStore()
const isSplashScreen = computed(() => route.name === 'splash') const isSplashScreen = computed(() => route.name === 'splash')
const isAuthScreen = computed(() => route.name === 'auth' || route.path === '/login') const isAuthScreen = computed(() => {
const name = route.name?.toString().toLowerCase() || ''
const path = route.path.toLowerCase()
return name.includes('auth') || path.includes('/login') || path.includes('/register')
})
onMounted(() => { onMounted(() => {
themeStore.applyTheme() themeStore.applyTheme()

View File

@ -25,7 +25,6 @@ const handleLogin = async () => {
try { try {
await authStore.login(email.value.trim().toLowerCase(), password.value, keepSession.value) await authStore.login(email.value.trim().toLowerCase(), password.value, keepSession.value)
// Al iniciar sesión, el store ya tiene el rol. Redirigir según corresponda.
const role = (authStore.role || 'PASSENGER').toUpperCase() const role = (authStore.role || 'PASSENGER').toUpperCase()
if (role === 'ADMIN') router.push('/admin') if (role === 'ADMIN') router.push('/admin')
else if (role === 'DRIVER') router.push('/driver') else if (role === 'DRIVER') router.push('/driver')
@ -46,252 +45,288 @@ const handleLogin = async () => {
</script> </script>
<template> <template>
<div class="login-form"> <div class="login-form-content">
<form @submit.prevent="handleLogin" class="form-container"> <form @submit.prevent="handleLogin" class="premium-form">
<!-- Email --> <!-- Welcome Text (Mobile-ish) -->
<div class="field"> <div class="welcome-header">
<label class="field-label">{{ t('auth.emailLabel') }}</label> <h2>{{ t('auth.loginTab') }}</h2>
<div class="input-wrap"> <p>Bienvenido de vuelta a SIBU</p>
<span class="material-icons input-icon">alternate_email</span> </div>
<input
v-model="email" <!-- Input Group -->
type="email" <div class="input-group">
:placeholder="t('auth.emailPlaceholder')" <div class="field-container">
required <label>{{ t('auth.emailLabel') }}</label>
class="field-input" <div class="input-inner">
/> <span class="material-icons i-icon">mail_outline</span>
<input
v-model="email"
type="email"
placeholder="tu@correo.com"
required
/>
</div>
</div>
<div class="field-container">
<div class="label-row">
<label>{{ t('auth.passLabel') }}</label>
</div>
<div class="input-inner">
<span class="material-icons i-icon">lock_outline</span>
<input
v-model="password"
:type="showPassword ? 'text' : 'password'"
placeholder="••••••••"
required
/>
<button type="button" class="eye-btn" @click="showPassword = !showPassword">
<span class="material-icons">{{ showPassword ? 'visibility_off' : 'visibility' }}</span>
</button>
</div>
</div> </div>
</div> </div>
<!-- Password --> <div class="form-options">
<div class="field"> <label class="custom-checkbox">
<label class="field-label">{{ t('auth.passLabel') }}</label>
<div class="input-wrap">
<span class="material-icons input-icon">lock</span>
<input
v-model="password"
:type="showPassword ? 'text' : 'password'"
placeholder="••••••••"
required
class="field-input"
/>
<button
type="button"
class="toggle-pw"
@click="showPassword = !showPassword"
>
<span class="material-icons">{{ showPassword ? 'visibility_off' : 'visibility' }}</span>
</button>
</div>
</div>
<!-- Keep Session -->
<div class="options-row">
<label class="checkbox-container">
<input type="checkbox" v-model="keepSession" /> <input type="checkbox" v-model="keepSession" />
<span class="checkmark"></span> <span class="checkmark"></span>
<span class="checkbox-label">{{ t('auth.keepSession') }}</span> <span class="cb-text">{{ t('auth.keepSession') }}</span>
</label> </label>
</div> </div>
<!-- Error Message --> <!-- Error UI -->
<transition name="shake"> <Transition name="shake">
<div v-if="errorMessage" class="error-box"> <div v-if="errorMessage" class="error-toast">
<span class="material-icons">error_outline</span> <span class="material-icons">warning_amber</span>
{{ errorMessage }} <span>{{ errorMessage }}</span>
</div> </div>
</transition> </Transition>
<!-- Submit Button --> <button type="submit" class="submit-action" :disabled="isLoading">
<button type="submit" class="submit-btn" :disabled="isLoading"> <span v-if="isLoading" class="loader-white"></span>
<span v-if="isLoading" class="loader"></span>
<span v-else>{{ t('auth.loginTab') }}</span> <span v-else>{{ t('auth.loginTab') }}</span>
<span v-if="!isLoading" class="material-icons">arrow_forward</span>
</button> </button>
<!-- Switch --> <div class="switch-footer">
<p class="switch-p"> <span>{{ t('auth.noAccount') }}</span>
{{ t('auth.noAccount') }} <button type="button" @click="emit('toggle')" class="text-link">
<button type="button" @click="emit('toggle')" class="switch-btn">
{{ t('auth.registerHere') }} {{ t('auth.registerHere') }}
</button> </button>
</p> </div>
</form> </form>
</div> </div>
</template> </template>
<style scoped> <style scoped>
.login-form { .login-form-content {
padding: 1.5rem 2rem 2rem; padding: 1.5rem 2rem;
} }
.form-container { .premium-form {
display: flex;
flex-direction: column;
gap: 1.5rem;
}
.welcome-header {
margin-bottom: 0.5rem;
}
.welcome-header h2 {
font-size: 1.5rem;
font-weight: 800;
margin: 0;
color: #fff;
}
.welcome-header p {
font-size: 0.9rem;
color: rgba(255,255,255,0.5);
margin: 0.25rem 0 0;
}
.input-group {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 1.25rem; gap: 1.25rem;
} }
.field { .field-container {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 0.5rem; gap: 0.5rem;
} }
.field-label { .field-container label {
font-size: 0.75rem; font-size: 0.8rem;
font-weight: 700; font-weight: 700;
color: var(--text-secondary); color: rgba(255,255,255,0.6);
padding-left: 0.5rem; text-transform: uppercase;
letter-spacing: 0.05em;
padding-left: 0.25rem;
} }
.input-wrap { .input-inner {
position: relative; position: relative;
display: flex; display: flex;
align-items: center; align-items: center;
} }
.input-icon { .i-icon {
position: absolute; position: absolute;
left: 1rem; left: 1rem;
font-size: 1.1rem; font-size: 1.25rem;
color: var(--text-secondary); color: rgba(255,255,255,0.4);
opacity: 0.7;
} }
.field-input { .input-inner input {
width: 100%; width: 100%;
padding: 0.875rem 1rem 0.875rem 2.75rem; background: rgba(255,255,255,0.05);
background: var(--bg-primary); border: 1.5px solid rgba(255,255,255,0.1);
border: 1.5px solid var(--border-color);
border-radius: 1rem; border-radius: 1rem;
color: var(--text-primary); padding: 1rem 1rem 1rem 3rem;
color: #fff;
font-family: inherit; font-family: inherit;
font-size: 0.95rem; font-size: 1rem;
transition: all 0.2s; transition: all 0.2s;
} }
.field-input:focus { .input-inner input:focus {
outline: none; outline: none;
background: rgba(255,255,255,0.08);
border-color: var(--active-color); border-color: var(--active-color);
box-shadow: 0 0 0 4px rgba(254, 231, 21, 0.1); box-shadow: 0 0 0 4px rgba(254, 231, 21, 0.1);
} }
.toggle-pw { .eye-btn {
position: absolute; position: absolute;
right: 1rem; right: 1rem;
background: none; background: none;
border: none; border: none;
color: var(--text-secondary); color: rgba(255,255,255,0.4);
cursor: pointer; cursor: pointer;
display: flex; display: flex;
} }
/* Checkbox Estilizado */ /* Checkbox */
.checkbox-container { .custom-checkbox {
display: flex; display: flex;
align-items: center; align-items: center;
gap: 0.75rem; gap: 0.75rem;
cursor: pointer; cursor: pointer;
user-select: none;
} }
.checkbox-container input { .custom-checkbox input {
display: none; display: none;
} }
.checkmark { .checkmark {
width: 1.25rem; width: 1.25rem;
height: 1.25rem; height: 1.25rem;
border: 1.5px solid var(--border-color); background: rgba(255,255,255,0.05);
border: 1.5px solid rgba(255,255,255,0.1);
border-radius: 6px; border-radius: 6px;
position: relative; position: relative;
transition: all 0.2s; transition: all 0.2s;
} }
.checkbox-container input:checked + .checkmark { .custom-checkbox input:checked + .checkmark {
background: var(--active-color); background: var(--active-color);
border-color: var(--active-color); border-color: var(--active-color);
} }
.checkmark:after { .checkmark:after {
content: "check"; content: "";
font-family: 'Material Icons';
position: absolute; position: absolute;
font-size: 0.9rem; left: 6px;
color: #101820; top: 2px;
width: 5px;
height: 10px;
border: solid #000;
border-width: 0 2px 2px 0;
transform: rotate(45deg);
display: none; display: none;
} }
.checkbox-container input:checked + .checkmark:after { .custom-checkbox input:checked + .checkmark:after {
display: block; display: block;
} }
.checkbox-label { .cb-text {
font-size: 0.85rem; font-size: 0.9rem;
font-weight: 600; color: rgba(255,255,255,0.7);
color: var(--text-secondary);
} }
/* Botones */ /* Submit Action */
.submit-btn { .submit-action {
width: 100%; width: 100%;
padding: 1rem; padding: 1.1rem;
background: var(--active-color); background: var(--active-color);
color: #101820; color: #101820;
border: none; border: none;
border-radius: 1rem; border-radius: 1.25rem;
font-size: 1.1rem;
font-weight: 800; font-weight: 800;
font-size: 1rem;
cursor: pointer; cursor: pointer;
margin-top: 0.5rem;
transition: all 0.2s;
display: flex; display: flex;
align-items: center;
justify-content: center; justify-content: center;
gap: 0.75rem;
transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
} }
.submit-btn:disabled { .submit-action:hover:not(:disabled) {
opacity: 0.6; transform: scale(1.02);
box-shadow: 0 10px 20px rgba(254, 231, 21, 0.2);
}
.submit-action:active:not(:disabled) {
transform: scale(0.98);
}
.submit-action:disabled {
opacity: 0.5;
cursor: not-allowed; cursor: not-allowed;
} }
.submit-btn:hover:not(:disabled) { .error-toast {
transform: translateY(-2px); background: rgba(239, 68, 68, 0.15);
box-shadow: 0 5px 15px rgba(254, 231, 21, 0.3); color: #fb7185;
} padding: 0.875rem 1rem;
border-radius: 1rem;
.error-box { font-size: 0.9rem;
background: rgba(239, 68, 68, 0.1);
color: #ef4444;
padding: 0.75rem 1rem;
border-radius: 0.75rem;
font-size: 0.85rem;
font-weight: 600; font-weight: 600;
display: flex; display: flex;
align-items: center; align-items: center;
gap: 0.5rem; gap: 0.75rem;
border: 1px solid rgba(239, 68, 68, 0.2);
} }
.switch-p { .switch-footer {
text-align: center; text-align: center;
font-size: 0.85rem; font-size: 0.9rem;
color: var(--text-secondary); color: rgba(255,255,255,0.5);
margin-top: 0.5rem;
} }
.switch-btn { .text-link {
background: none; background: none;
border: none; border: none;
color: var(--active-color); color: var(--active-color);
font-weight: 800; font-weight: 800;
cursor: pointer;
padding: 0; padding: 0;
margin-left: 0.25rem; margin-left: 0.5rem;
cursor: pointer;
text-decoration: underline; text-decoration: underline;
} }
.loader { .loader-white {
width: 1.2rem; width: 1.5rem;
height: 1.2rem; height: 1.5rem;
border: 2px solid rgba(16, 24, 32, 0.3); border: 3px solid rgba(0,0,0,0.1);
border-top-color: #101820; border-top-color: #000;
border-radius: 50%; border-radius: 50%;
animation: spin 0.8s linear infinite; animation: spin 0.8s linear infinite;
} }

View File

@ -34,7 +34,6 @@ const handleRegister = async () => {
isSuccess.value = true isSuccess.value = true
setTimeout(() => { setTimeout(() => {
// Redirigir según el rol asignado (usualmente PASSENGER)
const role = (authStore.role || 'PASSENGER').toUpperCase() const role = (authStore.role || 'PASSENGER').toUpperCase()
if (role === 'ADMIN') router.push('/admin') if (role === 'ADMIN') router.push('/admin')
else if (role === 'DRIVER') router.push('/driver') else if (role === 'DRIVER') router.push('/driver')
@ -56,309 +55,358 @@ const handleRegister = async () => {
</script> </script>
<template> <template>
<div class="register-form"> <div class="register-form-content">
<!-- Éxito --> <div v-if="isSuccess" class="success-wrap">
<div v-if="isSuccess" class="success-view"> <div class="glow-circle">
<div class="success-icon-wrap">
<span class="material-icons">check_circle</span> <span class="material-icons">check_circle</span>
</div> </div>
<h3>{{ t('auth.successTitle') }}</h3> <h2>¡Bienvenido!</h2>
<p>{{ t('common.loading') }}</p> <p>Tu cuenta ha sido creada exitosamente.</p>
<div class="dots-loader">
<span></span><span></span><span></span>
</div>
</div> </div>
<!-- Formulario --> <form v-else @submit.prevent="handleRegister" class="premium-form">
<form v-else @submit.prevent="handleRegister" class="form-container"> <div class="welcome-header">
<!-- Full Name --> <h2>{{ t('auth.registerTab') }}</h2>
<div class="field"> <p>Únete a la nueva red de transporte</p>
<label class="field-label">{{ t('auth.fullNameLabel') }}</label> </div>
<div class="input-wrap">
<span class="material-icons input-icon">person</span> <div class="input-group">
<input <div class="field-container">
v-model="fullName" <label>{{ t('auth.fullNameLabel') }}</label>
type="text" <div class="input-inner">
:placeholder="t('auth.fullNamePlaceholder')" <span class="material-icons i-icon">badge</span>
required <input
class="field-input" v-model="fullName"
/> type="text"
:placeholder="t('auth.fullNamePlaceholder')"
required
/>
</div>
</div>
<div class="field-container">
<label>{{ t('auth.emailLabel') }}</label>
<div class="input-inner">
<span class="material-icons i-icon">mail_outline</span>
<input
v-model="email"
type="email"
placeholder="tu@correo.com"
required
/>
</div>
</div>
<div class="field-container">
<label>{{ t('auth.passLabel') }}</label>
<div class="input-inner">
<span class="material-icons i-icon">lock_outline</span>
<input
v-model="password"
:type="showPassword ? 'text' : 'password'"
:placeholder="t('auth.passMin8')"
required
minlength="8"
/>
<button type="button" class="eye-btn" @click="showPassword = !showPassword">
<span class="material-icons">{{ showPassword ? 'visibility_off' : 'visibility' }}</span>
</button>
</div>
</div> </div>
</div> </div>
<!-- Email --> <div class="form-options">
<div class="field"> <label class="custom-checkbox">
<label class="field-label">{{ t('auth.emailLabel') }}</label>
<div class="input-wrap">
<span class="material-icons input-icon">alternate_email</span>
<input
v-model="email"
type="email"
:placeholder="t('auth.emailPlaceholder')"
required
class="field-input"
/>
</div>
</div>
<!-- Password -->
<div class="field">
<label class="field-label">{{ t('auth.passLabel') }}</label>
<div class="input-wrap">
<span class="material-icons input-icon">lock</span>
<input
v-model="password"
:type="showPassword ? 'text' : 'password'"
:placeholder="t('auth.passMin8')"
required
minlength="8"
class="field-input"
/>
<button
type="button"
class="toggle-pw"
@click="showPassword = !showPassword"
>
<span class="material-icons">{{ showPassword ? 'visibility_off' : 'visibility' }}</span>
</button>
</div>
</div>
<!-- Smart Location -->
<div class="options-row">
<label class="checkbox-container">
<input type="checkbox" v-model="autoLocation" /> <input type="checkbox" v-model="autoLocation" />
<span class="checkmark"></span> <span class="checkmark"></span>
<span class="checkbox-label">{{ t('auth.smartLocation') }}</span> <span class="cb-text">{{ t('auth.smartLocation') }}</span>
</label> </label>
</div> </div>
<!-- Error Message --> <!-- Error UI -->
<transition name="shake"> <Transition name="shake">
<div v-if="errorMessage" class="error-box"> <div v-if="errorMessage" class="error-toast">
<span class="material-icons">error_outline</span> <span class="material-icons">warning_amber</span>
{{ errorMessage }} <span>{{ errorMessage }}</span>
</div> </div>
</transition> </Transition>
<!-- Submit Button --> <button type="submit" class="submit-action" :disabled="isLoading">
<button type="submit" class="submit-btn" :disabled="isLoading"> <span v-if="isLoading" class="loader-white"></span>
<span v-if="isLoading" class="loader"></span>
<span v-else>{{ t('auth.registerTab') }}</span> <span v-else>{{ t('auth.registerTab') }}</span>
<span v-if="!isLoading" class="material-icons">person_add_alt</span>
</button> </button>
<!-- Switch --> <div class="switch-footer">
<p class="switch-p"> <span>{{ t('auth.hasAccount') }}</span>
{{ t('auth.hasAccount') }} <button type="button" @click="emit('toggle')" class="text-link">
<button type="button" @click="emit('toggle')" class="switch-btn">
{{ t('auth.loginHere') }} {{ t('auth.loginHere') }}
</button> </button>
</p> </div>
</form> </form>
</div> </div>
</template> </template>
<style scoped> <style scoped>
.register-form { .register-form-content {
padding: 1.5rem 2rem 2rem; padding: 1.5rem 2rem;
} }
.success-view { .success-wrap {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
gap: 1rem;
padding: 2rem 0;
text-align: center; text-align: center;
animation: zoomIn 0.4s ease-out; padding: 3rem 0;
animation: zoomIn 0.5s ease-out;
} }
@keyframes zoomIn { .glow-circle {
from { opacity: 0; transform: scale(0.9); } width: 90px;
to { opacity: 1; transform: scale(1); } height: 90px;
}
.success-icon-wrap {
width: 80px;
height: 80px;
background: rgba(74, 222, 128, 0.1); background: rgba(74, 222, 128, 0.1);
color: #4ade80; color: #4ade80;
border-radius: 50%; border-radius: 50%;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
margin-bottom: 1.5rem;
box-shadow: 0 0 30px rgba(74, 222, 128, 0.2);
} }
.success-icon-wrap .material-icons { .glow-circle .material-icons {
font-size: 3.5rem; font-size: 4rem;
} }
.form-container { .success-wrap h2 {
font-size: 1.75rem;
margin-bottom: 0.5rem;
}
.success-wrap p {
color: rgba(255,255,255,0.6);
margin-bottom: 2rem;
}
.dots-loader {
display: flex;
gap: 0.5rem;
}
.dots-loader span {
width: 8px;
height: 8px;
background: var(--active-color);
border-radius: 50%;
animation: dotBlink 1.4s infinite;
}
.dots-loader span:nth-child(2) { animation-delay: 0.2s; }
.dots-loader span:nth-child(3) { animation-delay: 0.4s; }
@keyframes dotBlink {
0%, 80%, 100% { opacity: 0; }
40% { opacity: 1; }
}
.premium-form {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 1.1rem; gap: 1.25rem;
} }
.field { .welcome-header h2 {
font-size: 1.5rem;
font-weight: 800;
margin: 0;
color: #fff;
}
.welcome-header p {
font-size: 0.9rem;
color: rgba(255,255,255,0.5);
margin: 0.25rem 0 0;
}
.input-group {
display: flex;
flex-direction: column;
gap: 1rem;
}
.field-container {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 0.4rem; gap: 0.4rem;
} }
.field-label { .field-container label {
font-size: 0.75rem; font-size: 0.75rem;
font-weight: 700; font-weight: 700;
color: var(--text-secondary); color: rgba(255,255,255,0.5);
padding-left: 0.5rem; text-transform: uppercase;
letter-spacing: 0.05em;
padding-left: 0.25rem;
} }
.input-wrap { .input-inner {
position: relative; position: relative;
display: flex; display: flex;
align-items: center; align-items: center;
} }
.input-icon { .i-icon {
position: absolute; position: absolute;
left: 1rem; left: 1rem;
font-size: 1.1rem; font-size: 1.25rem;
color: var(--text-secondary); color: rgba(255,255,255,0.4);
opacity: 0.7;
} }
.field-input { .input-inner input {
width: 100%; width: 100%;
padding: 0.8rem 1rem 0.8rem 2.75rem; background: rgba(255,255,255,0.05);
background: var(--bg-primary); border: 1.5px solid rgba(255,255,255,0.1);
border: 1.5px solid var(--border-color);
border-radius: 1rem; border-radius: 1rem;
color: var(--text-primary); padding: 0.85rem 1rem 0.85rem 3rem;
color: #fff;
font-family: inherit; font-family: inherit;
font-size: 0.95rem; font-size: 1rem;
transition: all 0.2s; transition: all 0.2s;
} }
.field-input:focus { .input-inner input:focus {
outline: none; outline: none;
background: rgba(255,255,255,0.08);
border-color: var(--active-color); border-color: var(--active-color);
box-shadow: 0 0 0 4px rgba(254, 231, 21, 0.1); box-shadow: 0 0 0 4px rgba(254, 231, 21, 0.1);
} }
.toggle-pw { .eye-btn {
position: absolute; position: absolute;
right: 1rem; right: 1rem;
background: none; background: none;
border: none; border: none;
color: var(--text-secondary); color: rgba(255,255,255,0.4);
cursor: pointer; cursor: pointer;
display: flex; display: flex;
} }
/* Checkbox Estilizado */ /* Checkbox */
.checkbox-container { .custom-checkbox {
display: flex; display: flex;
align-items: center; align-items: center;
gap: 0.75rem; gap: 0.75rem;
cursor: pointer; cursor: pointer;
} }
.checkbox-container input { .custom-checkbox input {
display: none; display: none;
} }
.checkmark { .checkmark {
width: 1.25rem; width: 1.25rem;
height: 1.25rem; height: 1.25rem;
border: 1.5px solid var(--border-color); background: rgba(255,255,255,0.05);
border: 1.5px solid rgba(255,255,255,0.1);
border-radius: 6px; border-radius: 6px;
position: relative; position: relative;
transition: all 0.2s; transition: all 0.2s;
} }
.checkbox-container input:checked + .checkmark { .custom-checkbox input:checked + .checkmark {
background: var(--active-color); background: var(--active-color);
border-color: var(--active-color); border-color: var(--active-color);
} }
.checkmark:after { .checkmark:after {
content: "check"; content: "";
font-family: 'Material Icons';
position: absolute; position: absolute;
font-size: 0.9rem; left: 6px;
color: #101820; top: 2px;
width: 5px;
height: 10px;
border: solid #000;
border-width: 0 2px 2px 0;
transform: rotate(45deg);
display: none; display: none;
} }
.checkbox-container input:checked + .checkmark:after { .custom-checkbox input:checked + .checkmark:after {
display: block; display: block;
} }
.checkbox-label { .cb-text {
font-size: 0.8rem; font-size: 0.85rem;
font-weight: 600; color: rgba(255,255,255,0.6);
color: var(--text-secondary); line-height: 1.3;
line-height: 1.2;
} }
/* Botones */ /* Submit Action */
.submit-btn { .submit-action {
width: 100%; width: 100%;
padding: 1rem; padding: 1.1rem;
background: var(--active-color); background: var(--active-color);
color: #101820; color: #101820;
border: none; border: none;
border-radius: 1rem; border-radius: 1.25rem;
font-size: 1.1rem;
font-weight: 800; font-weight: 800;
font-size: 1rem;
cursor: pointer; cursor: pointer;
margin-top: 0.5rem;
transition: all 0.2s;
display: flex; display: flex;
align-items: center;
justify-content: center; justify-content: center;
gap: 0.75rem;
transition: all 0.3s ease;
} }
.submit-btn:disabled { .submit-action:hover:not(:disabled) {
opacity: 0.6; transform: scale(1.02);
box-shadow: 0 10px 20px rgba(254, 231, 21, 0.2);
}
.submit-action:disabled {
opacity: 0.5;
cursor: not-allowed; cursor: not-allowed;
} }
.submit-btn:hover:not(:disabled) { .error-toast {
transform: translateY(-2px); background: rgba(239, 68, 68, 0.15);
box-shadow: 0 5px 15px rgba(254, 231, 21, 0.3); color: #fb7185;
} padding: 0.875rem 1rem;
border-radius: 1rem;
.error-box { font-size: 0.9rem;
background: rgba(239, 68, 68, 0.1);
color: #ef4444;
padding: 0.75rem 1rem;
border-radius: 0.75rem;
font-size: 0.85rem;
font-weight: 600; font-weight: 600;
display: flex; display: flex;
align-items: center; align-items: center;
gap: 0.5rem; gap: 0.75rem;
border: 1px solid rgba(239, 68, 68, 0.2);
} }
.switch-p { .switch-footer {
text-align: center; text-align: center;
font-size: 0.85rem; font-size: 0.9rem;
color: var(--text-secondary); color: rgba(255,255,255,0.5);
margin-top: 0.5rem;
} }
.switch-btn { .text-link {
background: none; background: none;
border: none; border: none;
color: var(--active-color); color: var(--active-color);
font-weight: 800; font-weight: 800;
cursor: pointer;
padding: 0; padding: 0;
margin-left: 0.25rem; margin-left: 0.5rem;
cursor: pointer;
text-decoration: underline; text-decoration: underline;
} }
.loader { .loader-white {
width: 1.2rem; width: 1.5rem;
height: 1.2rem; height: 1.5rem;
border: 2px solid rgba(16, 24, 32, 0.3); border: 3px solid rgba(0,0,0,0.1);
border-top-color: #101820; border-top-color: #000;
border-radius: 50%; border-radius: 50%;
animation: spin 0.8s linear infinite; animation: spin 0.8s linear infinite;
} }
@ -375,4 +423,9 @@ const handleRegister = async () => {
30%, 50%, 70% { transform: translate3d(-4px, 0, 0); } 30%, 50%, 70% { transform: translate3d(-4px, 0, 0); }
40%, 60% { transform: translate3d(4px, 0, 0); } 40%, 60% { transform: translate3d(4px, 0, 0); }
} }
@keyframes zoomIn {
from { opacity: 0; transform: scale(0.9); }
to { opacity: 1; transform: scale(1); }
}
</style> </style>

View File

@ -1,5 +1,5 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref } from 'vue' import { ref, onMounted } from 'vue'
import { useRouter } from 'vue-router' import { useRouter } from 'vue-router'
import { useI18n } from 'vue-i18n' import { useI18n } from 'vue-i18n'
import LoginForm from '../components/auth/LoginForm.vue' import LoginForm from '../components/auth/LoginForm.vue'
@ -8,6 +8,11 @@ import RegisterForm from '../components/auth/RegisterForm.vue'
const { t } = useI18n() const { t } = useI18n()
const router = useRouter() const router = useRouter()
const isLogin = ref(true) const isLogin = ref(true)
const mounted = ref(false)
onMounted(() => {
mounted.value = true
})
const toggleAuth = () => { const toggleAuth = () => {
isLogin.value = !isLogin.value isLogin.value = !isLogin.value
@ -15,233 +20,389 @@ const toggleAuth = () => {
</script> </script>
<template> <template>
<div class="auth-page"> <div class="auth-page" :class="{ 'is-mounted': mounted }">
<!-- Fondo Decorativo --> <!-- Immersive Background -->
<div class="bg-decoration"> <div class="auth-bg-wrapper">
<div class="circle circle-1"></div> <div class="auth-bg-overlay"></div>
<div class="circle circle-2"></div> <img src="/auth-bg.png" alt="" class="auth-bg-image" />
</div> </div>
<!-- Contenido Principal --> <!-- Main Content -->
<div class="auth-container"> <main class="auth-main">
<!-- Botón Volver --> <!-- Top Navigation -->
<button @click="router.push('/')" class="back-btn"> <nav class="auth-nav">
<span class="material-icons">arrow_back</span> <button @click="router.push('/map')" class="glass-btn back-btn">
<span>{{ t('auth.back') }}</span> <span class="material-icons">arrow_back</span>
</button> <span>{{ t('auth.back') }}</span>
</button>
</nav>
<div class="auth-card"> <div class="auth-content-grid">
<!-- Header con Logo --> <!-- Branding Side (Desktop only) -->
<header class="auth-header"> <div class="branding-section">
<img src="/sibu.png" alt="SIBU Logo" class="auth-logo" /> <img src="/sibu.png" alt="SIBU Logo" class="brand-logo" />
<p class="auth-subtitle">{{ t('auth.brandingSubtitle') }}</p> <h1 class="brand-title">SIBU</h1>
</header> <p class="brand-tagline">{{ t('auth.brandingSubtitle') }}</p>
<div class="brand-features">
<!-- Selector de Pestañas --> <div class="feature-item">
<nav class="auth-tabs"> <span class="material-icons">directions_bus</span>
<button <span>Rutas en tiempo real</span>
class="tab-btn" </div>
:class="{ active: isLogin }" <div class="feature-item">
@click="isLogin = true" <span class="material-icons">payments</span>
> <span>Ofertas exclusivas</span>
{{ t('auth.loginTab') }} </div>
</button> <div class="feature-item">
<button <span class="material-icons">location_on</span>
class="tab-btn" <span>Paradas inteligentes</span>
:class="{ active: !isLogin }" </div>
@click="isLogin = false"
>
{{ t('auth.registerTab') }}
</button>
<div class="tab-indicator" :class="{ 'on-right': !isLogin }"></div>
</nav>
<!-- Contenido de Formularios -->
<div class="auth-body">
<div v-if="isLogin" class="form-wrapper">
<LoginForm @toggle="toggleAuth" />
</div>
<div v-else class="form-wrapper">
<RegisterForm @toggle="toggleAuth" @success="isLogin = true" />
</div> </div>
</div> </div>
<!-- Footer --> <!-- Form Section -->
<footer class="auth-footer"> <div class="form-section">
<p>{{ t('auth.footer') }}</p> <div class="glass-card auth-card">
</footer> <!-- Mobile Logo -->
<div class="mobile-header">
<img src="/sibu.png" alt="SIBU Logo" class="mobile-logo" />
</div>
<!-- Tab Selector -->
<div class="auth-tabs-pill">
<button
class="pill-btn"
:class="{ active: isLogin }"
@click="isLogin = true"
>
{{ t('auth.loginTab') }}
</button>
<button
class="pill-btn"
:class="{ active: !isLogin }"
@click="isLogin = false"
>
{{ t('auth.registerTab') }}
</button>
<div class="pill-slider" :class="{ 'slide-right': !isLogin }"></div>
</div>
<!-- Forms Container -->
<div class="auth-forms-container">
<Transition name="form-fade" mode="out-in">
<div :key="isLogin ? 'login' : 'register'" class="form-transition-wrapper">
<LoginForm v-if="isLogin" @toggle="toggleAuth" />
<RegisterForm v-else @toggle="toggleAuth" @success="isLogin = true" />
</div>
</Transition>
</div>
<footer class="auth-footer">
<p>{{ t('auth.footer') }}</p>
</footer>
</div>
</div>
</div> </div>
</div> </main>
</div> </div>
</template> </template>
<style scoped> <style scoped>
.auth-page { .auth-page {
position: relative;
min-height: 100vh; min-height: 100vh;
display: flex;
align-items: center;
justify-content: center;
background: var(--bg-primary);
padding: 1rem;
position: relative;
overflow: hidden;
}
.bg-decoration {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
z-index: 0;
pointer-events: none;
}
.circle {
position: absolute;
border-radius: 50%;
filter: blur(80px);
opacity: 0.15;
}
.circle-1 {
width: 400px;
height: 400px;
background: var(--active-color);
top: -100px;
right: -100px;
}
.circle-2 {
width: 300px;
height: 300px;
background: #3b82f6;
bottom: -50px;
left: -50px;
}
.auth-container {
width: 100%; width: 100%;
max-width: 420px; display: flex;
position: relative; flex-direction: column;
background: #000;
color: #fff;
overflow-x: hidden;
}
/* Background Systems */
.auth-bg-wrapper {
position: fixed;
inset: 0;
z-index: 0;
}
.auth-bg-image {
width: 100%;
height: 100%;
object-fit: cover;
opacity: 0.6;
transform: scale(1.1);
filter: blur(5px);
transition: transform 10s ease-out;
}
.is-mounted .auth-bg-image {
transform: scale(1);
}
.auth-bg-overlay {
position: absolute;
inset: 0;
background: radial-gradient(circle at center, rgba(0,0,0,0.2) 0%, rgba(0,0,0,0.8) 100%);
z-index: 1; z-index: 1;
} }
.back-btn { /* Layout */
.auth-main {
position: relative;
z-index: 10;
flex: 1;
display: flex; display: flex;
align-items: center; flex-direction: column;
gap: 0.5rem; padding: 1.5rem;
background: none; max-width: 1200px;
border: none; margin: 0 auto;
color: var(--text-secondary); width: 100%;
font-size: 0.9rem;
font-weight: 600;
cursor: pointer;
margin-bottom: 1.5rem;
padding: 0.5rem;
border-radius: 8px;
transition: all 0.2s;
} }
.back-btn:hover { .auth-nav {
color: var(--text-primary); height: 60px;
background: rgba(255,255,255,0.05); display: flex;
align-items: center;
}
.auth-content-grid {
flex: 1;
display: grid;
grid-template-columns: 1fr 450px;
gap: 4rem;
align-items: center;
padding: 2rem 0;
}
/* Branding Section */
.branding-section {
display: flex;
flex-direction: column;
gap: 1.5rem;
animation: slideInLeft 0.8s ease-out;
}
.brand-logo {
width: 80px;
filter: drop-shadow(0 0 20px rgba(254, 231, 21, 0.4));
}
.brand-title {
font-size: 5rem;
font-weight: 800;
margin: 0;
letter-spacing: -0.04em;
background: linear-gradient(to right, #fff, var(--active-color));
-webkit-background-clip: text;
background-clip: text;
-webkit-text-fill-color: transparent;
}
.brand-tagline {
font-size: 1.25rem;
color: rgba(255,255,255,0.7);
max-width: 400px;
line-height: 1.6;
}
.brand-features {
display: flex;
flex-direction: column;
gap: 1rem;
margin-top: 1.5rem;
}
.feature-item {
display: flex;
align-items: center;
gap: 1rem;
font-size: 1rem;
font-weight: 500;
color: rgba(255,255,255,0.9);
}
.feature-item .material-icons {
color: var(--active-color);
background: rgba(254, 231, 21, 0.1);
padding: 0.5rem;
border-radius: 12px;
}
/* Form Section */
.form-section {
display: flex;
justify-content: center;
animation: slideInRight 0.8s ease-out;
}
.glass-card {
background: rgba(15, 23, 42, 0.7);
backdrop-filter: blur(20px);
-webkit-backdrop-filter: blur(20px);
border: 1px solid rgba(255, 255, 255, 0.1);
border-radius: 2.5rem;
width: 100%;
box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
display: flex;
flex-direction: column;
overflow: hidden;
} }
.auth-card { .auth-card {
background: var(--bg-secondary); padding: 0;
border: 1px solid var(--border-color);
border-radius: 2rem;
box-shadow: 0 20px 50px rgba(0,0,0,0.2);
overflow: hidden;
display: flex;
flex-direction: column;
} }
.auth-header { .mobile-header {
display: none;
padding: 2rem 2rem 1rem; padding: 2rem 2rem 1rem;
text-align: center; text-align: center;
} }
.auth-logo { .mobile-logo {
height: 60px; height: 50px;
margin-bottom: 0.5rem;
} }
.auth-subtitle { /* Custom Pills Tabs */
font-size: 0.85rem; .auth-tabs-pill {
font-weight: 700;
color: var(--text-secondary);
text-transform: uppercase;
letter-spacing: 0.1em;
margin: 0;
}
.auth-tabs {
position: relative; position: relative;
display: flex; display: flex;
margin: 0 1.5rem; background: rgba(0,0,0,0.3);
background: var(--bg-primary); margin: 2rem 2rem 1rem;
padding: 0.35rem; padding: 0.4rem;
border-radius: 1rem; border-radius: 1.5rem;
border: 1px solid var(--border-color); border: 1px solid rgba(255,255,255,0.1);
} }
.tab-btn { .pill-btn {
flex: 1; flex: 1;
padding: 0.75rem; padding: 0.8rem;
border: none; border: none;
background: none; background: none;
color: var(--text-secondary); color: rgba(255,255,255,0.6);
font-size: 0.85rem; font-size: 0.9rem;
font-weight: 800; font-weight: 700;
cursor: pointer; cursor: pointer;
z-index: 1; z-index: 2;
transition: color 0.3s; transition: all 0.3s ease;
} }
.tab-btn.active { .pill-btn.active {
color: #101820; color: #000;
} }
.tab-indicator { .pill-slider {
position: absolute; position: absolute;
top: 0.35rem; top: 0.4rem;
bottom: 0.35rem; bottom: 0.4rem;
left: 0.35rem; left: 0.4rem;
width: calc(50% - 0.35rem); width: calc(50% - 0.4rem);
background: var(--active-color); background: var(--active-color);
border-radius: 0.75rem; border-radius: 1.1rem;
transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1); transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
z-index: 1;
} }
.tab-indicator.on-right { .pill-slider.slide-right {
transform: translateX(100%); transform: translateX(100%);
} }
.auth-body { /* Forms Container */
min-height: 200px; .auth-forms-container {
min-height: 400px;
padding-bottom: 2rem;
} }
.form-wrapper { .form-transition-wrapper {
animation: fadeIn 0.4s ease-out; width: 100%;
} }
@keyframes fadeIn { /* Buttons */
from { opacity: 0; transform: translateY(10px); } .glass-btn {
to { opacity: 1; transform: translateY(0); } background: rgba(255,255,255,0.1);
backdrop-filter: blur(10px);
border: 1px solid rgba(255,255,255,0.2);
color: #fff;
padding: 0.6rem 1.2rem;
border-radius: 1rem;
display: flex;
align-items: center;
gap: 0.5rem;
cursor: pointer;
font-weight: 600;
transition: all 0.2s;
}
.glass-btn:hover {
background: rgba(255,255,255,0.2);
transform: translateX(-5px);
} }
.auth-footer { .auth-footer {
padding: 1.5rem; padding: 1.5rem;
border-top: 1px solid rgba(255,255,255,0.05);
text-align: center; text-align: center;
border-top: 1px solid var(--border-color);
} }
.auth-footer p { .auth-footer p {
font-size: 0.75rem; font-size: 0.75rem;
color: var(--text-secondary); color: rgba(255,255,255,0.4);
opacity: 0.6;
margin: 0; margin: 0;
} }
/* Animations */
@keyframes slideInLeft {
from { opacity: 0; transform: translateX(-50px); }
to { opacity: 1; transform: translateX(0); }
}
@keyframes slideInRight {
from { opacity: 0; transform: translateX(50px); }
to { opacity: 1; transform: translateX(0); }
}
.form-fade-enter-active,
.form-fade-leave-active {
transition: all 0.3s ease;
}
.form-fade-enter-from {
opacity: 0;
transform: scale(0.95);
}
.form-fade-leave-to {
opacity: 0;
transform: scale(1.05);
}
/* Responsive */
@media (max-width: 1024px) {
.auth-content-grid {
grid-template-columns: 1fr;
gap: 2rem;
}
.branding-section {
display: none;
}
.mobile-header {
display: block;
}
.form-section {
width: 100%;
max-width: 450px;
margin: 0 auto;
}
}
@media (max-width: 480px) {
.auth-main {
padding: 1rem;
}
.glass-card {
border-radius: 2rem;
}
.auth-tabs-pill {
margin: 1.5rem 1.5rem 0.5rem;
}
}
</style> </style>

View File

@ -341,7 +341,7 @@ function clearMapMarkers() {
limpiarTodoCentralizado() limpiarTodoCentralizado()
// Tras limpiar todo, si tenemos ubicación de usuario, la restauramos // Tras limpiar todo, si tenemos ubicación de usuario, la restauramos
// porque el marcador celestre sonar es un overlay que el centralizado elimina // porque el marcador celestre sonar es un overlay que el centralizado elimina
if (userCoords.value && authStore.userProfile?.auto_location) { if (userCoords.value) {
reDrawUserMarker(); reDrawUserMarker();
} }
} }