/**
 * Modal d'authentification LMS Pro
 * Design conforme aux maquettes UI
 */

/* ========== MODAL OVERLAY ========== */
.lms-auth-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 99999;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.lms-auth-modal.active {
  display: flex;
  align-items: center;
  justify-content: center;
}

.lms-auth-modal.visible {
  opacity: 1;
}

.lms-auth-modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: transparent;
}

/* ========== MODAL CONTAINER ========== */
.lms-auth-modal-container {
  position: relative;
  width: 100%;
  max-width: 440px;
  margin: 20px;
  background: #ffffff;
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  padding: 35px 40px 30px 40px;
  z-index: 1;
  transform: translateY(20px);
  transition: transform 0.3s ease;
}

.lms-auth-modal.visible .lms-auth-modal-container {
  transform: translateY(0);
}

/* ========== BOUTON FERMER ========== */
.lms-auth-close {
  position: absolute;
  top: 15px;
  right: 15px;
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  color: #999;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s ease;
}

.lms-auth-close:hover {
  background: #f0f0f0;
  color: #333;
}

/* ========== FORMULAIRES ========== */
.lms-auth-form {
  display: none;
}

.lms-auth-form.active {
  display: block;
}

/* ========== HEADER ========== */
.lms-auth-header {
  text-align: center;
  margin-bottom: 30px;
}

.lms-auth-header h2 {
  font-size: 24px;
  font-weight: 400;
  color: #1e1e1e;
  margin: 0 0 8px 0;
}

.lms-auth-header h2 strong {
  font-weight: 700;
}

.lms-auth-subtitle {
  font-size: 14px;
  color: #666;
  margin: 0;
}

/* Message "Vous devez vous connecter" */
.lms-auth-connect-message {
  font-size: 18px;
  font-weight: 400;
  color: #666;
  margin: 0 0 15px 0;
  text-align: center;
}

/* ========== CHAMPS ========== */
.lms-auth-fields {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.lms-auth-field {
  position: relative;
  display: flex;
  align-items: center;
  background: rgba(100, 100, 100, 0.9);
  border-radius: 10px;
  overflow: hidden;
}

.lms-field-icon {
  position: absolute;
  left: 15px;
  width: 20px;
  height: 20px;
  pointer-events: none;
  opacity: 0.7;
}

.lms-auth-field input {
  width: 100%;
  padding: 16px 50px 16px 50px;
  border: none;
  background: transparent;
  color: #ffffff;
  font-size: 14px;
  outline: none;
}

.lms-auth-field input[type="text"],
.lms-auth-field input[type="password"],
.lms-auth-field input[type="email"] {
  border: none !important;
  color: #ffffff !important;
  padding-left: 4em;
}

.lms-auth-field input::placeholder {
  color: rgba(255, 255, 255, 0.6);
}

.lms-auth-field input:-webkit-autofill,
.lms-auth-field input:-webkit-autofill:hover,
.lms-auth-field input:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0 1000px #4a4a4a inset !important;
  -webkit-text-fill-color: #ffffff !important;
  caret-color: #ffffff;
}

/* Toggle password */
.lms-toggle-password {
  position: absolute;
  right: 12px;
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.7;
  transition: opacity 0.2s ease;
}

.lms-toggle-password:hover {
  opacity: 1;
}

.lms-toggle-password img {
  width: 20px;
  height: 20px;
}

/* ========== LIEN MOT DE PASSE OUBLIÉ ========== */
.lms-auth-forgot {
  text-align: right;
  margin-top: -5px;
}

.lms-auth-forgot a {
  font-size: 12px;
  color: #888;
  text-decoration: none;
  transition: color 0.2s ease;
}

.lms-auth-forgot a:hover {
  color: #3b82f6;
}

/* ========== ACTIONS ========== */
.lms-auth-actions {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-top: 10px;
}

.lms-auth-submit {
  padding: 14px 28px;
  background: #3b82f6;
  color: #ffffff;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.lms-auth-submit:hover {
  background: #2563eb;
  transform: translateY(-1px);
}

.lms-auth-submit:active {
  transform: translateY(0);
}

.lms-auth-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* Checkbox mémoriser */
.lms-auth-remember {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 15px;
  color: #666;
}

.lms-auth-remember input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: #3b82f6;
  cursor: pointer;
}

/* Checkbox CGU */
.lms-auth-cgu {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 14px;
  color: #666;
}

.lms-auth-cgu input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: #3b82f6;
  cursor: pointer;
}

.lms-auth-cgu a {
  color: #3b82f6;
  text-decoration: none;
}

.lms-auth-cgu a:hover {
  text-decoration: underline;
}

/* ========== MESSAGES ========== */
.lms-auth-message {
  display: none;
  padding: 12px 15px;
  border-radius: 8px;
  font-size: 13px;
  margin-top: 10px;
}

.lms-auth-message:not(:empty) {
  display: block;
}

.lms-auth-message.error {
  display: block;
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid #fecaca;
}

.lms-auth-message.success {
  display: block;
  background: #f0fdf4;
  color: #16a34a;
  border: 1px solid #bbf7d0;
}

/* ========== SWITCH FORMULAIRE ========== */
.lms-auth-switch {
  text-align: center;
  margin-top: 20px;
  padding-top: 15px;
  border-top: none;
  font-size: 14px;
  color: #888;
}

.lms-auth-switch a {
  color: #3b82f6;
  text-decoration: none;
  font-weight: 600;
  margin-left: 5px;
}

.lms-auth-switch a:hover {
  text-decoration: underline;
}

/* ========== LOGO ========== */
.lms-auth-logo {
  text-align: center;
  margin-top: 20px;
}

.lms-auth-logo img {
  height: 33px;
  opacity: 0.6;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 480px) {
  .lms-auth-modal-container {
    margin: 15px;
    padding: 30px 25px;
    border-radius: 16px;
  }

  .lms-auth-header h2 {
    font-size: 20px;
  }

  .lms-auth-actions {
    flex-direction: column;
    gap: 12px;
  }

  .lms-auth-submit {
    width: 100%;
  }

  .lms-auth-remember {
    order: 2;
  }
}

/* ========== ANIMATION LOADING ========== */
.lms-auth-submit.loading {
  position: relative;
  color: transparent;
}

.lms-auth-submit.loading::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: lms-spin 0.8s linear infinite;
}

@keyframes lms-spin {
  to {
    transform: rotate(360deg);
  }
}

/* ========== EMAIL CONFIRMATION BOX ========== */
.lms-email-confirmation-box {
  background: linear-gradient(135deg, #f0f9ff 0%, #e8f4fd 100%);
  border: 1px solid #b8daf5;
  border-left: 4px solid #2196f3;
  border-radius: 8px;
  padding: 24px;
  margin: 20px 0;
  text-align: left;
}

.lms-email-confirmation-box p {
  color: #1565c0;
  font-size: 14px;
  line-height: 1.6;
  margin: 0 0 12px 0;
}

.lms-email-confirmation-box p:last-child {
  margin-bottom: 0;
  font-style: italic;
  color: #5c6bc0;
}

.lms-email-confirmation-box p:first-child {
  font-weight: 600;
  font-size: 15px;
}

/* Mode développement */
.lms-email-confirmation-box.dev-mode {
  background: linear-gradient(135deg, #f0fff4 0%, #e8fdf0 100%);
  border-color: #68d391;
  border-left-color: #38a169;
}

.lms-email-confirmation-box.dev-mode p {
  color: #276749;
}

.lms-dev-confirm-link {
  display: inline-block;
  background: #38a169;
  color: #ffffff !important;
  padding: 10px 20px;
  border-radius: 6px;
  text-decoration: none !important;
  font-weight: 600;
  margin-top: 8px;
  transition: background 0.2s ease;
}

.lms-dev-confirm-link:hover {
  background: #2f855a;
}
