/**
 * Estilos para Modal de Autenticación
 * Login, Registro y Recuperación de Contraseña
 */

/* Modal de autenticación */
.auth-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.auth-modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.auth-modal {
  background: #ffffff;
  border-radius: 16px;
  width: 90%;
  max-width: 440px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  transform: scale(0.9);
  transition: transform 0.3s ease;
}

.auth-modal-overlay.active .auth-modal {
  transform: scale(1);
}

/* Header del modal */
.auth-modal-header {
  padding: 24px 24px 0;
  text-align: center;
  position: relative;
}

.auth-modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: transparent;
  border: none;
  font-size: 28px;
  color: #64748b;
  cursor: pointer;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: background 0.2s ease, color 0.2s ease;
}

.auth-modal-close:hover {
  background: #f1f5f9;
  color: #1e293b;
}

.auth-modal-logo {
  font-size: 32px;
  font-weight: 700;
  color: var(--color-primary);
  margin-bottom: 8px;
  background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.auth-modal-subtitle {
  color: #64748b;
  font-size: 14px;
  margin-bottom: 24px;
}

/* Pestañas */
.auth-tabs {
  display: flex;
  gap: 8px;
  padding: 0 24px;
  margin-bottom: 24px;
}

.auth-tab {
  flex: 1;
  padding: 12px 16px;
  background: transparent;
  border: none;
  color: #64748b;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  border-radius: 8px;
  transition: all 0.2s ease;
  position: relative;
}

.auth-tab:hover {
  background: #f1f5f9;
  color: #1e293b;
}

.auth-tab.active {
  background: var(--color-primary);
  color: white;
}

/* Cuerpo del modal */
.auth-modal-body {
  padding: 0 24px 24px;
}

.auth-form {
  display: none;
}

.auth-form.active {
  display: block;
}

/* Campos del formulario */
.auth-form-group {
  margin-bottom: 16px;
}

.auth-form-label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: #1e293b;
  margin-bottom: 8px;
}

.auth-form-input {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  font-size: 15px;
  background: #f8fafc;
  color: #1e293b;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  font-family: inherit;
}

.auth-form-input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.auth-form-input.error {
  border-color: var(--color-danger);
}

.auth-form-input.error:focus {
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.auth-error-message {
  color: var(--color-danger);
  font-size: 13px;
  margin-top: 6px;
  display: none;
}

.auth-error-message.show {
  display: block;
}

/* Checkbox recordar */
.auth-remember {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}

.auth-remember input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--color-primary);
}

.auth-remember label {
  font-size: 14px;
  color: #64748b;
  cursor: pointer;
  user-select: none;
}

/* Link de contraseña olvidada */
.auth-forgot-link {
  display: block;
  text-align: right;
  font-size: 13px;
  color: var(--color-primary);
  text-decoration: none;
  margin-top: -8px;
  margin-bottom: 16px;
  transition: color 0.2s ease;
}

.auth-forgot-link:hover {
  color: var(--color-accent);
  text-decoration: underline;
}

/* Botones */
.auth-btn {
  width: 100%;
  padding: 14px 24px;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: inherit;
}

.auth-btn-primary {
  background: var(--color-primary);
  color: white;
  margin-bottom: 12px;
}

.auth-btn-primary:hover {
  background: var(--color-primary-dark, #1d4ed8);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

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

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

/* Divisor */
.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  color: #64748b;
  font-size: 13px;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #e2e8f0;
}

/* Botón de Google */
.auth-btn-google {
  background: white;
  color: #1f2937;
  border: 2px solid #e5e7eb;
}

.auth-btn-google:hover {
  background: #f9fafb;
  border-color: #d1d5db;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.auth-btn-google svg {
  width: 20px;
  height: 20px;
}

/* Loading spinner */
.auth-spinner {
  width: 20px;
  height: 20px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: white;
  animation: spin 0.8s linear infinite;
}

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

/* Modal de recuperación de contraseña */
.password-reset-info {
  background: #f1f5f9;
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 20px;
  font-size: 14px;
  color: #475569;
  line-height: 1.5;
}

/* Mensaje de éxito */
.auth-success-message {
  background: #10b981;
  color: white;
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 14px;
  text-align: center;
  display: none;
}

.auth-success-message.show {
  display: block;
  animation: slideDown 0.3s ease;
}

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

/* Responsive */
@media (max-width: 480px) {
  .auth-modal {
    width: 95%;
    max-height: 95vh;
  }

  .auth-modal-header {
    padding: 20px 16px 0;
  }

  .auth-modal-body {
    padding: 0 16px 20px;
  }

  .auth-tabs {
    padding: 0 16px;
  }
}
