/* ===================== ESTILOS GENERALES ===================== */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600&display=swap');

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Poppins', sans-serif;
}

body {
  background: linear-gradient(120deg, rgba(200,16,46,0.9), rgba(20,20,20,0.9)),
              url('../img/Sample10.jpg') center/cover no-repeat;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}

/* ===================== CONTENEDOR PRINCIPAL ===================== */
.container {
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 14px 28px rgba(0,0,0,0.25), 
              0 10px 10px rgba(0,0,0,0.22);
  position: relative;
  overflow: hidden;
  width: 900px;
  max-width: 100%;
  min-height: 540px;
  transition: all 0.6s ease-in-out;
}

/* ===================== FORMULARIOS ===================== */
.form-container {
  position: absolute;
  top: 0;
  height: 100%;
  transition: all 0.6s ease-in-out;
}

.sign-in-container {
  left: 0;
  width: 50%;
  z-index: 2;
}

.sign-up-container {
  left: 0;
  width: 50%;
  opacity: 0;
  z-index: 1;
}

/* Activación del panel derecho */
.container.right-panel-active .sign-in-container {
  transform: translateX(100%);
}

.container.right-panel-active .sign-up-container {
  transform: translateX(100%);
  opacity: 1;
  z-index: 5;
  animation: show 0.6s;
}

@keyframes show {
  0%, 49.99% {
    opacity: 0;
    z-index: 1;
  }
  50%, 100% {
    opacity: 1;
    z-index: 5;
  }
}

/* ===================== FORMULARIO ===================== */
form {
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: 0 50px;
  height: 100%;
  text-align: center;
}

form h1 {
  font-weight: 600;
  margin-bottom: 25px;
  color: #111;
  font-size: clamp(1.3rem, 4vw, 2rem);
}

form input {
  background: #eee;
  border: none;
  padding: 12px 15px;
  margin: 10px 0;
  width: 100%;
  max-width: 400px;
  border-radius: 8px;
  font-size: clamp(13px, 2vw, 15px);
  outline: none;
  transition: 0.3s ease;
}

form input:focus {
  background: #f8f8f8;
  box-shadow: 0 0 0 2px rgba(200,16,46,0.3);
}

form input:valid {
  border: 2px solid #4CAF50;
}

.input-error {
  border: 2px solid #c8102e !important;
  background-color: #fff5f5;
}

.error-text {
  font-size: clamp(0.7rem, 1.5vw, 0.85rem);
  color: #c8102e;
  margin-top: 5px;
  display: block;
}

/* ===================== BOTONES ===================== */
button {
  border-radius: 20px;
  border: 1px solid #c8102e;
  background-color: #c8102e;
  color: #fff;
  font-size: clamp(12px, 2vw, 14px);
  font-weight: 600;
  padding: 12px 45px;
  letter-spacing: 1px;
  text-transform: uppercase;
  transition: all 0.3s ease;
  cursor: pointer;
  margin-top: 15px;
}

button:hover {
  background-color: #a30d25;
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(200,16,46,0.3);
}

button:active {
  transform: scale(0.95);
}

button.ghost {
  background-color: transparent;
  border-color: #fff;
}

button.ghost:hover {
  background-color: rgba(255,255,255,0.1);
}

.btn-volver {
  display: inline-block;
  margin-top: 15px;
  padding: 10px 20px;
  background-color: #c8102e;
  color: #fff;
  border: none;
  border-radius: 25px;
  cursor: pointer;
  text-decoration: none;
  font-weight: 600;
  font-size: clamp(12px, 2vw, 14px);
  transition: all 0.3s ease;
}

.btn-volver:hover { 
  background-color: #a10d24;
  transform: translateY(-2px);
}

/* ===================== BOTONES DE CAMBIO MÓVIL (OCULTOS EN DESKTOP) ===================== */
.mobile-toggle {
  display: none !important; /* Forzar oculto en desktop */
  margin-top: 20px;
  padding: 10px 30px;
  background-color: transparent;
  color: #c8102e;
  border: 2px solid #c8102e;
  border-radius: 25px;
  cursor: pointer;
  font-weight: 600;
  font-size: clamp(12px, 2vw, 14px);
  transition: all 0.3s ease;
  text-transform: none;
  letter-spacing: 0;
}

.mobile-toggle:hover {
  background-color: #c8102e;
  color: #fff;
  transform: translateY(0);
}

/* Botón primario de registro en móvil */
.mobile-toggle.primary {
  background-color: #c8102e;
  color: #fff;
  border-color: #c8102e;
  margin-top: 25px;
  padding: 14px 35px;
  font-size: clamp(13px, 2.5vw, 15px);
  box-shadow: 0 4px 15px rgba(200,16,46,0.3);
}

.mobile-toggle.primary:hover {
  background-color: #a10d24;
  box-shadow: 0 6px 20px rgba(200,16,46,0.4);
}

/* Botón secundario (volver) */
.mobile-toggle.secondary {
  background-color: transparent;
  color: #666;
  border-color: #ddd;
  margin-top: 15px;
  padding: 10px 25px;
  font-size: clamp(12px, 2vw, 13px);
}

.mobile-toggle.secondary:hover {
  background-color: #f5f5f5;
  color: #333;
  border-color: #ccc;
}

/* ===================== OVERLAY ===================== */
.overlay-container {
  position: absolute;
  top: 0;
  left: 50%;
  width: 50%;
  height: 100%;
  overflow: hidden;
  transition: transform 0.6s ease-in-out;
  z-index: 100;
}

.container.right-panel-active .overlay-container {
  transform: translateX(-100%);
}

.overlay {
  background: linear-gradient(to right, #c8102e, #8b001d);
  background-repeat: no-repeat;
  background-size: cover;
  background-position: center;
  color: #fff;
  position: relative;
  left: -100%;
  height: 100%;
  width: 200%;
  transform: translateX(0);
  transition: transform 0.6s ease-in-out;
}

.container.right-panel-active .overlay {
  transform: translateX(50%);
}

/* ===================== PANEL TEXTO ===================== */
.overlay-panel {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: 0 40px;
  text-align: center;
  top: 0;
  height: 100%;
  width: 50%;
  transform: translateX(0);
  transition: transform 0.6s ease-in-out;
}

.overlay-panel h1 {
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 700;
}

.overlay-panel p {
  font-size: clamp(0.85rem, 1.5vw, 0.95rem);
  margin: 20px 0 30px;
  line-height: 1.5;
}

.overlay-left {
  transform: translateX(-20%);
}

.container.right-panel-active .overlay-left {
  transform: translateX(0);
}

.overlay-right {
  right: 0;
  transform: translateX(0);
}

.container.right-panel-active .overlay-right {
  transform: translateX(20%);
}

/* ===================== ENLACES ===================== */
form a {
  color: #c8102e;
  font-weight: 600;
  text-decoration: none;
  font-size: clamp(12px, 2vw, 14px);
  transition: all 0.3s ease;
  margin-top: 12px;
  display: inline-block;
}

form a:hover {
  color: #a10d24;
  text-decoration: underline;
}

/* ===================== RESPONSIVE: TABLETS Y MENORES ===================== */

/* Tablets grandes (992px - 1199px) */
@media (max-width: 1199px) {
  .container {
    width: 100%;
    max-width: 850px;
  }
  
  form {
    padding: 0 40px;
  }
  
  .overlay-panel {
    padding: 0 30px;
  }
}

/* Tablets (768px - 991px) */
@media (max-width: 991px) {
  body {
    padding: 15px;
  }
  
  .container {
    max-width: 750px;
    min-height: 500px;
  }
  
  form {
    padding: 0 30px;
  }
  
  form input {
    margin: 8px 0;
  }
  
  button {
    padding: 11px 35px;
  }
  
  .overlay-panel {
    padding: 0 25px;
  }
}

/* ===================== MODO MÓVIL (767px y menos) ===================== */
@media (max-width: 767px) {
  body {
    padding: 0;
    background-attachment: fixed;
  }
  
  .container {
    width: 100%;
    max-width: 100%;
    min-height: 100vh;
    border-radius: 0;
    box-shadow: none;
  }

  /* OCULTAR OVERLAY EN MÓVIL */
  .overlay-container {
    display: none !important;
  }

  /* MOSTRAR BOTONES DE CAMBIO MÓVIL (sobreescribir display:none) */
  .mobile-toggle {
    display: inline-block !important;
  }
  
  .mobile-toggle.primary {
    display: inline-block !important;
  }
  
  .mobile-toggle.secondary {
    display: inline-block !important;
  }

  /* FORMULARIOS EN MODO STACK VERTICAL */
  .sign-in-container,
  .sign-up-container {
    width: 100% !important;
    position: static !important;
    transform: none !important;
    opacity: 1 !important;
    height: auto !important;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  /* Sistema de alternancia entre formularios */
  .sign-up-container {
    display: none;
  }
  
  .container.right-panel-active .sign-in-container {
    display: none;
  }
  
  .container.right-panel-active .sign-up-container {
    display: flex !important;
  }
  
  form {
    padding: 40px 30px;
    height: auto;
    min-height: 100vh;
    width: 100%;
    max-width: 500px;
  }
  
  form h1 {
    margin-bottom: 20px;
  }
  
  form input {
    max-width: 100%;
    margin: 8px 0;
  }
  
  button {
    width: 100%;
    max-width: 100%;
    padding: 12px 30px;
    margin-top: 12px;
  }
  
  .btn-volver {
    width: 100%;
    max-width: 100%;
    text-align: center;
  }
  
  .mobile-toggle {
    width: 100%;
    max-width: 100%;
  }
  
  .mobile-toggle.primary {
    width: 100%;
    max-width: 100%;
  }
  
  .mobile-toggle.secondary {
    width: 100%;
    max-width: 100%;
  }
}

/* Móviles pequeños (hasta 575px) */
@media (max-width: 575px) {
  form {
    padding: 30px 20px;
  }
  
  form input {
    padding: 11px 14px;
    margin: 7px 0;
  }
  
  button {
    padding: 11px 25px;
  }
}

/* Móviles muy pequeños (hasta 400px) */
@media (max-width: 400px) {
  form {
    padding: 25px 15px;
  }
  
  form input {
    padding: 10px 12px;
    margin: 6px 0;
  }
  
  button {
    padding: 10px 20px;
  }
}

/* ===================== LANDSCAPE MODE (Modo horizontal en móviles) ===================== */
@media (max-height: 600px) and (orientation: landscape) {
  body {
    padding: 10px;
  }
  
  .container {
    min-height: auto;
    margin: 10px auto;
  }
  
  form {
    padding: 20px 30px;
    min-height: auto;
  }
  
  form h1 {
    margin-bottom: 12px;
  }
  
  form input {
    margin: 5px 0;
    padding: 9px 12px;
  }
  
  button {
    padding: 9px 25px;
    margin-top: 8px;
  }
  
  .overlay-panel {
    padding: 0 20px;
  }
  
  .overlay-panel p {
    margin: 10px 0 15px;
  }
}

/* Landscape extremo (altura muy pequeña) */
@media (max-height: 450px) and (orientation: landscape) {
  form {
    padding: 15px 25px;
  }
  
  form h1 {
    margin-bottom: 8px;
  }
  
  form input {
    margin: 4px 0;
    padding: 8px 10px;
  }
  
  button {
    padding: 8px 20px;
  }
}

/* ===================== MEJORAS DE ACCESIBILIDAD ===================== */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Para pantallas táctiles */
@media (hover: none) and (pointer: coarse) {
  button {
    padding: 14px 45px;
    min-height: 44px;
  }
  
  form input {
    padding: 14px 15px;
    min-height: 44px;
  }
  
  .btn-volver {
    padding: 12px 20px;
    min-height: 44px;
  }
  
  .mobile-toggle {
    padding: 12px 30px;
    min-height: 44px;
  }
  
  .mobile-toggle.primary {
    padding: 14px 35px;
    min-height: 48px;
  }
  
  .mobile-toggle.secondary {
    padding: 11px 25px;
    min-height: 44px;
  }
}

/* ===================== ESTADO DE CARGA ===================== */
form input:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  background-color: #999;
}

/* ===================== FOCUS VISIBLE PARA TECLADO ===================== */
button:focus-visible,
input:focus-visible,
a:focus-visible {
  outline: 3px solid #c8102e;
  outline-offset: 2px;
}