/**
 * @file
 * Styles pour les onglets de connexion OTP.
 */

/* Container principal */
.login-tabs-container {
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  margin-top: 1rem;
}

/* Navigation des onglets */
.login-nav-tabs {
  border-bottom: 1px solid #dee2e6;
  margin-bottom: 0;
}

.login-nav-tabs .nav-item {
  margin-bottom: 0;
}

.login-nav-tabs .nav-link {
  border: none;
  border-radius: 0;
  padding: 1rem 1.5rem;
  font-weight: 500;
  color: #6c757d;
  background-color: #f8f9fa;
  transition: all 0.2s ease;
}

.login-nav-tabs .nav-link:hover {
  color: #007bff;
  background-color: #e9ecef;
  border-color: transparent;
}

.login-nav-tabs .nav-link.active {
  color: #007bff;
  background-color: #fff;
  border-color: transparent;
  border-bottom: 3px solid #007bff;
}

.login-nav-tabs .nav-link i {
  margin-right: 0.5rem;
}

/* Contenu des onglets */
.login-tab-content {
  padding: 2rem;
  min-height: 300px;
}

/* Description OTP */
.otp-description {
  border-left: 4px solid #17a2b8;
  margin-bottom: 1.5rem;
}

.otp-description i {
  margin-right: 0.5rem;
  color: #17a2b8;
}

/* Étapes OTP */
.otp-step {
  transition: all 0.3s ease;
}

.otp-step-1 {
  text-align: center;
}

.otp-step-2 {
  animation: slideInUp 0.3s ease-out;
}

@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Bouton retour */
.otp-back-btn {
  padding: 0.25rem 0.5rem;
  font-size: 0.875rem;
  color: #6c757d;
  text-decoration: none;
  margin-bottom: 1rem;
  margin: 10px auto;
  max-width: 300px;
  display: block;
}

.otp-back-btn:hover {
  color: #007bff;
  text-decoration: none;
}

.otp-back-btn i {
  margin-right: 0.25rem;
}

/* Informations du code */
.otp-code-info {
  text-align: center;
  margin-bottom: 1.5rem;
  padding: 1rem;
  background-color: #f8f9fa;
  border-radius: 6px;
  border: 1px solid #e9ecef;
}

.otp-code-info p {
  margin-bottom: 0.5rem;
}

.otp-code-info p:last-child {
  margin-bottom: 0;
}

#otp-sent-email {
  color: #007bff;
  font-weight: 500;
}

/* Container des chiffres OTP */
.otp-digits-container {
  display: flex !important;
  justify-content: center;
  gap: 1rem;
  margin: 1.5rem 0;
  flex-wrap: wrap;
}

/* Champs de saisie OTP */
.otp-digit {
  width: 60px;
  height: 60px;
  text-align: center;
  font-size: 1.5rem;
  font-weight: bold;
  border: 2px solid #ced4da;
  border-radius: 8px;
  background: #fff;
  transition: all 0.2s ease;
  box-sizing: border-box;
}

.otp-digit:focus {
  border-color: #007bff;
  outline: none;
  box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.15);
  transform: scale(1.05);
}

.otp-digit.filled {
  background-color: #e7f3ff;
  border-color: #007bff;
  color: #007bff;
}

.otp-digit.error {
  border-color: #dc3545;
  background-color: #fff5f5;
  animation: shake 0.5s ease-in-out;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

/* Boutons */
.otp-send-btn,
.otp-verify-btn {
  min-height: 48px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.otp-send-btn {
  background: linear-gradient(45deg, #007bff, #0056b3);
  border: none;
}

.otp-verify-btn {
  background: linear-gradient(45deg, #28a745, #1e7e34);
  border: none;
}

/* Messages */
#otp-messages-wrapper {
    margin-top: 10px !important
}

.otp-messages {
  margin-top: 1rem;
}

.otp-messages .alert {
  margin-bottom: 0;
  border-radius: 6px;
  border: none;
  font-weight: 500;
}

.alert-success {
  background: linear-gradient(45deg, #d4edda, #c3e6cb);
  color: #155724;
}

.alert-danger {
  background: linear-gradient(45deg, #f8d7da, #f5c6cb);
  color: #721c24;
}

/* États de chargement */
.otp-send-btn:disabled,
.otp-verify-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.otp-send-btn.loading {
  position: relative;
  color: transparent;
}

.otp-send-btn.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid transparent;
  border-top: 2px solid #fff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Responsive Mobile */
@media (max-width: 768px) {
  .login-tab-content {
    padding: 1.5rem 1rem;
  }
  
  .login-nav-tabs .nav-link {
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
  }
  
  .otp-digits-container {
    gap: 0.75rem;
    margin: 1rem 0;
  }
  
  .otp-digit {
    width: 50px;
    height: 50px;
    font-size: 1.25rem;
  }
  
  /* Ajustement pour éviter que le clavier recouvre */
  .otp-step-2.keyboard-visible {
    padding-bottom: 300px;
  }
}

@media (max-width: 480px) {
  .login-nav-tabs .nav-link {
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
  }
  
  .login-nav-tabs .nav-link i {
    display: none;
  }
  
  .otp-digits-container {
    gap: 0.5rem;
  }
  
  .otp-digit {
    width: 45px;
    height: 45px;
    font-size: 1.1rem;
  }
}

/* Mode sombre */
@media (prefers-color-scheme: dark) {
  .login-tabs-container {
    background: #2d3748;
    color: #e2e8f0;
  }
  
  .login-nav-tabs .nav-link {
    background-color: #4a5568;
    color: #cbd5e0;
  }
  
  .login-nav-tabs .nav-link:hover {
    background-color: #718096;
    color: #e2e8f0;
  }
  
  .login-nav-tabs .nav-link.active {
    background-color: #2d3748;
    color: #63b3ed;
    border-bottom-color: #63b3ed;
  }
  
  .otp-code-info {
    background-color: #4a5568;
    border-color: #718096;
    color: #e2e8f0;
  }
  
  .otp-digit {
    background-color: #4a5568;
    border-color: #718096;
    color: #e2e8f0;
  }
  
  .otp-digit:focus {
    border-color: #63b3ed;
  }
  
  .otp-digit.filled {
    background-color: #2a4a6b;
    border-color: #63b3ed;
    color: #63b3ed;
  }
}

/* Accessibilité */
@media (prefers-reduced-motion: reduce) {
  .otp-step-2 {
    animation: none;
  }
  
  .otp-digit {
    transition: none;
  }
  
  .otp-digit:focus {
    transform: none;
  }
  
  .otp-digit.error {
    animation: none;
  }
  
  .otp-send-btn.loading::after {
    animation: none;
  }
}

/* Focus management pour accessibilité */
.login-nav-tabs .nav-link:focus {
  box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.25);
  outline: none;
}

/* Une seule action visible à la fois sur mobile */
@media (max-width: 768px) {
  .otp-step-1.step-completed {
    display: none;
  }
  
  .otp-step-2.step-active {
    display: block;
  }
}

/* === PAGE OTP SÉPARÉE === */
.otp-redirect-panel {
  padding: 40px 20px;
  text-align: center;
}

.otp-redirect-panel .alert {
  border: none;
  box-shadow: 0 4px 15px rgba(0,123,255,0.1);
  padding: 40px 30px;
}

.otp-redirect-panel .btn-lg {
  padding: 15px 30px;
  font-size: 18px;
  font-weight: 600;
  border-radius: 25px;
  box-shadow: 0 4px 15px rgba(0,123,255,0.2);
  transition: all 0.3s ease;
}

.otp-redirect-panel .btn-lg:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,123,255,0.3);
}

.otp-redirect-panel .fa-3x {
  color: #007bff;
}

/* === PAGE OTP COMPLÈTE === */
.page-otp-login-form .card {
  box-shadow: 0 10px 30px rgba(0,0,0,0.1);
  border: none;
  border-radius: 15px;
  overflow: hidden;
}

.page-otp-login-form .card-header {
  background: linear-gradient(135deg, #007bff, #0056b3);
  color: white;
  padding: 25px;
  border-bottom: none;
}

.page-otp-login-form .card-body {
  padding: 40px;
}

.page-otp-login-form .card-footer {
  background-color: #f8f9fa;
  border-top: 1px solid #dee2e6;
  padding: 20px;
}

/* === RESPONSIVE POUR PAGE SÉPARÉE === */
@media (max-width: 768px) {
  .otp-redirect-panel {
    padding: 20px 10px;
  }
  
  .otp-redirect-panel .alert {
    padding: 30px 20px;
  }
  
  .page-otp-login-form .card-body {
    padding: 20px;
  }
  
  .page-otp-login-form .card-header {
    padding: 20px;
  }
} 