/* ==================== VARIABLES Y RESET ==================== */
:root {
  --c-primary: #5B4FCF;
  --c-secondary: #FF6B6B;
  --c-accent: #FFD166;
  --c-green: #06D6A0;
  --c-blue: #4CC9F0;
  --c-bg: #0f0f1e;
  --c-surface: #1a1a2e;
  --c-muted: #8b8b9a;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.25);
  --radius: 20px;
  --radius-sm: 12px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  width: 100%;
  height: 100%;
  font-family: 'Nunito', sans-serif;
  background: var(--c-bg);
  color: #fff;
}

/* ==================== CONTENEDOR PRINCIPAL ==================== */
.login-container {
  position: relative;
  width: 100%;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow: hidden;
}

.background-overlay {
  position: absolute;
  inset: 0;
  background-image: linear-gradient(135deg, rgba(0,0,0,0.5), rgba(91,79,207,0.3)), url('image/Aventura magica sobre montañas.png');
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  z-index: 0;
}

/* ==================== BOTÓN DE RETORNO ==================== */
.back-button {
  position: fixed;
  top: 24px;
  left: 24px;
  width: 48px;
  height: 48px;
  background: rgba(91, 79, 207, 0.9);
  border: 2px solid rgba(91, 79, 207, 0.5);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: #fff;
  text-decoration: none;
  z-index: 100;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(91, 79, 207, 0.3);
  cursor: pointer;
  animation: slideInLeft 0.5s ease both;
}

@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.back-button:hover {
  background: rgba(91, 79, 207, 1);
  border-color: var(--c-accent);
  transform: translateX(-4px);
  box-shadow: 0 8px 24px rgba(91, 79, 207, 0.6), 0 0 20px rgba(91, 79, 207, 0.4);
}

.back-button:active {
  transform: translateX(-2px) scale(0.95);
}

/* ==================== TARJETA DE AUTENTICACIÓN ==================== */
.auth-card {
  position: relative;
  z-index: 10;
  width: 100%;
  max-width: 420px;
  background: rgba(26, 26, 46, 0.75);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(91, 79, 207, 0.3);
  border-radius: var(--radius);
  padding: 48px 32px;
  box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  animation: slideUp 0.6s ease both;
  transform: scale(0.95);
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(30px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(0.95);
  }
}

/* ==================== LOGO Y ENCABEZADO ==================== */
.logo-section {
  text-align: center;
  margin-bottom: 32px;
  animation: fadeIn 0.8s ease 0.1s both;
}

.logo-text {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-bottom: 8px;
}

.logo-english {
  font-family: 'Baloo 2', cursive;
  font-size: 28px;
  font-weight: 800;
  color: var(--c-primary);
}

.logo-quest {
  font-family: 'Baloo 2', cursive;
  font-size: 28px;
  font-weight: 800;
  color: var(--c-secondary);
}

.logo-icon {
  font-size: 32px;
  animation: spin 3s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.logo-subtitle {
  font-size: 0.9rem;
  color: var(--c-muted);
  font-weight: 500;
  letter-spacing: 0.5px;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* ==================== TOGGLE BOTONES ==================== */
.toggle-container {
  position: relative;
  display: flex;
  gap: 8px;
  background: rgba(91, 79, 207, 0.1);
  padding: 6px;
  border-radius: 50px;
  margin-bottom: 32px;
  border: 1px solid rgba(91, 79, 207, 0.2);
}

.toggle-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--c-muted);
  padding: 10px 20px;
  font-family: 'Nunito', sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  border-radius: 40px;
  transition: color 0.3s ease;
  position: relative;
  z-index: 2;
}

.toggle-btn.active {
  color: #fff;
}

.toggle-indicator {
  position: absolute;
  top: 6px;
  left: 6px;
  height: calc(100% - 12px);
  width: calc(50% - 4px);
  background: linear-gradient(135deg, var(--c-primary), var(--c-accent));
  border-radius: 40px;
  transition: left 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 4px 12px rgba(91, 79, 207, 0.4);
  z-index: 1;
}

.toggle-btn:nth-child(2).active ~ .toggle-indicator {
  left: calc(50% + 2px);
}

/* ==================== FORMULARIOS ==================== */
.form-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
  opacity: 0;
  height: 0;
  overflow: hidden;
  transition: all 0.4s ease;
  transform: translateX(-20px);
}

.form-container.active {
  opacity: 1;
  height: auto;
  transform: translateX(0);
}

/* ==================== GRUPOS DE FORMULARIO ==================== */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  animation: slideIn 0.5s ease forwards;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.form-group:nth-child(2) { animation-delay: 0.05s; }
.form-group:nth-child(3) { animation-delay: 0.1s; }
.form-group:nth-child(4) { animation-delay: 0.15s; }
.form-group:nth-child(5) { animation-delay: 0.2s; }
.form-group:nth-child(6) { animation-delay: 0.25s; }

.form-group label {
  font-size: 0.9rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.3px;
}

.form-group.checkbox {
  gap: 12px;
}

.form-group.checkbox label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 500;
  font-size: 0.85rem;
  color: var(--c-muted);
  cursor: pointer;
  transition: color 0.2s ease;
}

.form-group.checkbox label:hover {
  color: #fff;
}

.form-group.checkbox input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--c-primary);
  cursor: pointer;
}

.link {
  color: var(--c-primary);
  text-decoration: none;
  font-weight: 700;
  transition: color 0.2s ease;
}

.link:hover {
  color: var(--c-accent);
}

/* ==================== INPUT WRAPPER ==================== */
.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

input[type="email"],
input[type="password"],
input[type="text"] {
  width: 100%;
  background: rgba(255, 255, 255, 0.08);
  border: 1.5px solid rgba(91, 79, 207, 0.3);
  border-radius: var(--radius-sm);
  padding: 12px 40px 12px 16px;
  color: #fff;
  font-family: 'Nunito', sans-serif;
  font-size: 0.95rem;
  transition: all 0.3s ease;
}

input[type="email"]::placeholder,
input[type="password"]::placeholder,
input[type="text"]::placeholder {
  color: rgba(255, 255, 255, 0.4);
}

input[type="email"]:focus,
input[type="password"]:focus,
input[type="text"]:focus {
  outline: none;
  background: rgba(255, 255, 255, 0.12);
  border-color: var(--c-primary);
  box-shadow: 0 0 20px rgba(91, 79, 207, 0.3), inset 0 0 8px rgba(91, 79, 207, 0.1);
}

.input-icon {
  position: absolute;
  right: 12px;
  font-size: 1.1rem;
  pointer-events: none;
  opacity: 0.7;
  transition: opacity 0.2s ease;
}

input:focus ~ .input-icon {
  opacity: 1;
  transform: scale(1.1);
}

/* ==================== BOTÓN TOGGLE PASSWORD ==================== */
.toggle-password {
  position: absolute;
  right: 36px;
  background: none;
  border: none;
  font-size: 1rem;
  cursor: pointer;
  color: var(--c-muted);
  transition: all 0.2s ease;
  padding: 0;
}

.toggle-password:hover {
  color: var(--c-primary);
  transform: scale(1.15);
}

/* ==================== REMEMBER Y FORGOT ==================== */
.remember-forgot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  margin-bottom: 8px;
}

.remember-me {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  color: var(--c-muted);
  transition: color 0.2s ease;
}

.remember-me:hover {
  color: #fff;
}

.remember-me input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--c-primary);
  cursor: pointer;
}

.forgot-password {
  color: var(--c-primary);
  text-decoration: none;
  font-weight: 700;
  transition: all 0.2s ease;
}

.forgot-password:hover {
  color: var(--c-accent);
  text-decoration: underline;
}

/* ==================== BOTÓN SUBMIT CON GLOW ==================== */
.btn-submit {
  width: 100%;
  background: linear-gradient(135deg, var(--c-primary), #7c6ee8);
  border: none;
  border-radius: 50px;
  padding: 14px 28px;
  color: #fff;
  font-family: 'Baloo 2', cursive;
  font-size: 1.05rem;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.3s ease;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 8px;
}

.glow-button {
  position: relative;
  overflow: hidden;
}

.glow-button::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  transition: left 0.5s ease;
}

.glow-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 30px rgba(91, 79, 207, 0.6), 
              0 0 50px rgba(91, 79, 207, 0.4),
              0 8px 24px rgba(91, 79, 207, 0.35);
}

.glow-button:active {
  transform: translateY(0);
}

.glow-button:hover::before {
  left: 100%;
}

/* ==================== DIVISOR ==================== */
.divider {
  text-align: center;
  color: var(--c-muted);
  font-size: 0.85rem;
  font-weight: 600;
  position: relative;
  margin: 16px 0 12px;
}

.divider::before,
.divider::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 32%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--c-muted), transparent);
}

.divider::before {
  left: 0;
}

.divider::after {
  right: 0;
}

/* ==================== BOTONES SOCIALES ==================== */
.social-buttons {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.social-btn {
  background: rgba(91, 79, 207, 0.2);
  border: 1.5px solid rgba(91, 79, 207, 0.3);
  border-radius: var(--radius-sm);
  padding: 12px;
  color: #fff;
  font-size: 1.2rem;
  cursor: pointer;
  transition: all 0.3s ease;
  font-weight: 800;
  position: relative;
  overflow: hidden;
}

.social-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: var(--c-primary);
  z-index: -1;
  transition: left 0.3s ease;
}

.social-btn:hover {
  color: #fff;
  border-color: var(--c-primary);
  transform: translateY(-2px);
  box-shadow: 0 0 20px rgba(91, 79, 207, 0.5);
}

.social-btn:hover::before {
  left: 0;
}

.social-btn.google:hover {
  box-shadow: 0 0 20px rgba(244, 67, 54, 0.5);
}

.social-btn.facebook:hover {
  box-shadow: 0 0 20px rgba(59, 89, 152, 0.5);
}

.social-btn.apple:hover {
  box-shadow: 0 0 20px rgba(200, 200, 200, 0.5);
}

/* ==================== MENSAJE DE ÉXITO ==================== */
.success-message {
  position: absolute;
  inset: 0;
  background: rgba(15, 15, 30, 0.8);
  backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  opacity: 0;
  pointer-events: none;
  transition: all 0.4s ease;
  z-index: 20;
}

.success-message.show {
  opacity: 1;
  pointer-events: all;
}

.success-content {
  text-align: center;
  animation: popIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes popIn {
  0% {
    opacity: 0;
    transform: scale(0.5);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

.success-icon {
  display: block;
  font-size: 64px;
  margin-bottom: 16px;
  animation: bounce 0.8s cubic-bezier(0.68, -0.55, 0.265, 1.55) infinite;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-12px); }
}

.success-content h3 {
  font-family: 'Baloo 2', cursive;
  font-size: 1.8rem;
  margin-bottom: 8px;
  color: var(--c-accent);
}

.success-content p {
  color: var(--c-muted);
  margin-bottom: 24px;
  font-size: 0.95rem;
}

.btn-success {
  display: inline-block;
  background: linear-gradient(135deg, var(--c-green), #05c695);
  color: #fff;
  padding: 12px 32px;
  border-radius: 50px;
  text-decoration: none;
  font-weight: 800;
  transition: all 0.3s ease;
  box-shadow: 0 0 20px rgba(6, 214, 160, 0.4);
}

.btn-success:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 30px rgba(6, 214, 160, 0.6);
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 600px) {
  .back-button {
    top: 16px;
    left: 16px;
    width: 44px;
    height: 44px;
    font-size: 20px;
  }

  .auth-card {
    padding: 32px 20px;
    max-width: 100%;
    margin: 0 20px;
  }

  .logo-text {
    font-size: 20px;
  }

  .logo-icon {
    font-size: 24px;
  }

  .btn-submit,
  .social-btn {
    padding: 12px 16px;
  }

  .remember-forgot {
    flex-direction: column;
    gap: 8px;
    align-items: flex-start;
  }

  input[type="email"],
  input[type="password"],
  input[type="text"] {
    padding: 10px 36px 10px 14px;
    font-size: 0.9rem;
  }
}
