/* static/css/auth.css - Styles pour les pages d'authentification */

/* Container principal */
.auth-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: calc(100vh - 300px);
  padding: 2rem 1rem;
  background: var(--bg-page);
}

.auth-card {
  background: var(--bg-main);
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  padding: 2.5rem;
  width: 100%;
  max-width: 480px;
  border: 1px solid var(--btn-border);
}

/* Header */
.auth-header {
  text-align: center;
  margin-bottom: 2rem;
}

.auth-header h1 {
  color: var(--text-main);
  font-size: 2rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.auth-header p {
  color: #666;
  font-size: 1rem;
  margin: 0;
}

/* Alertes */
.auth-alerts {
  padding: 1rem;
  border-radius: 8px;
  margin-bottom: 1.5rem;
  font-weight: 500;
  text-align: center;
}

.auth-alerts.success {
  background: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.auth-alerts.error {
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

.auth-alerts.info {
  background: #d1ecf1;
  color: #0c5460;
  border: 1px solid #bee5eb;
}

/* Bouton Google */
.auth-google {
  margin-bottom: 1.5rem;
}

.btn-google {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 0.875rem 1.5rem;
  background: #fff;
  color: #333;
  border: 2px solid #ddd;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
}

.btn-google:hover:not(:disabled) {
  background: #f8f9fa;
  border-color: #bbb;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.btn-google:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-google svg {
  flex-shrink: 0;
}

.google-status {
  text-align: center;
  font-size: 0.875rem;
  margin-top: 0.5rem;
  color: #666;
}

.google-status.error {
  color: #dc3545;
}

/* Séparateur */
.auth-separator {
  position: relative;
  text-align: center;
  margin: 1.5rem 0;
}

.auth-separator::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--btn-border);
}

.auth-separator span {
  background: var(--bg-main);
  color: #666;
  padding: 0 1rem;
  font-size: 0.875rem;
  position: relative;
  z-index: 1;
}

/* Formulaire */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}


.form-row input {
  width: 100%;
  box-sizing: border-box;
}

.form-group {
  display: flex;
  flex-direction: column;
}

.form-group label {
  color: var(--text-main);
  font-weight: 500;
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
}

.form-group input {
  padding: 0.875rem;
  border: 2px solid var(--btn-border);
  border-radius: 8px;
  font-size: 1rem;
  background: var(--bg-main);
  color: var(--text-main);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-group input:focus {
  outline: none;
  border-color: #007acc;
  box-shadow: 0 0 0 3px rgba(0, 122, 204, 0.1);
}

.form-group input.readonly-field {
  background: #f8f9fa;
  cursor: not-allowed;
  opacity: 0.7;
}

.field-help {
  color: #666;
  font-size: 0.8rem;
  margin-top: 0.25rem;
}

/* Checkbox personnalisée */
.form-group-checkbox {
  flex-direction: row;
  align-items: flex-start;
  gap: 0;
}

.checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  cursor: pointer;
  font-size: 0.875rem;
  line-height: 1.4;
  color: var(--text-main);
}

.checkbox-label input[type="checkbox"] {
  display: none;
}

.checkmark {
  width: 20px;
  height: 20px;
  border: 2px solid var(--btn-border);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
  background: var(--bg-main);
  transition: all 0.2s ease;
}

.checkbox-label input[type="checkbox"]:checked + .checkmark {
  background: #007acc;
  border-color: #007acc;
}

.checkbox-label input[type="checkbox"]:checked + .checkmark::after {
  content: '✓';
  color: white;
  font-size: 14px;
  font-weight: bold;
}

.checkbox-label a {
  color: #007acc;
  text-decoration: none;
}

.checkbox-label a:hover {
  text-decoration: underline;
}

/* Boutons */
.btn-primary {
  background: #007acc;
  color: white;
  border: none;
  padding: 0.875rem 1.5rem;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.btn-primary:hover:not(:disabled) {
  background: #0056a0;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 122, 204, 0.3);
}

.btn-primary:disabled {
  background: #ccc;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-secondary {
  background: var(--btn-bg);
  color: var(--btn-text);
  border: 2px solid var(--btn-border);
  padding: 0.75rem 1.25rem;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-secondary:hover:not(:disabled) {
  background: var(--btn-hover-bg);
  transform: translateY(-1px);
}

.btn-danger {
  background: #dc3545;
  color: white;
  border: none;
  padding: 0.75rem 1.25rem;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-danger:hover:not(:disabled) {
  background: #c82333;
}

.btn-small {
  padding: 0.5rem 0.875rem;
  font-size: 0.8rem;
  border-radius: 6px;
}

/* Liens */
.auth-links {
  text-align: center;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--btn-border);
}

.auth-links p {
  margin: 0.5rem 0;
  color: #666;
  font-size: 0.875rem;
}

.auth-links a {
  color: #007acc;
  text-decoration: none;
  font-weight: 500;
}

.auth-links a:hover {
  text-decoration: underline;
}

.link-secondary {
  color: #666 !important;
}

/* Responsive */
@media (max-width: 640px) {
  .auth-card {
    padding: 2rem 1.5rem;
    margin: 1rem;
  }
  
  .form-row {
    grid-template-columns: 1fr;
  }
  
  .auth-header h1 {
    font-size: 1.75rem;
  }
}

/* États de validation */
.form-group input:invalid:not(:placeholder-shown) {
  border-color: #dc3545;
}

.form-group input:valid:not(:placeholder-shown) {
  border-color: #28a745;
}

/* Animation de chargement */
.btn-spinner {
  font-size: 1rem;
  animation: spin 1s linear infinite;
}

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

/* Thème sombre */
:root.theme-dark .auth-card {
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

:root.theme-dark .btn-google {
  background: var(--bg-secondary);
  color: var(--text-main);
  border-color: var(--btn-border);
}

:root.theme-dark .btn-google:hover:not(:disabled) {
  background: var(--btn-hover-bg);
}

:root.theme-dark .form-group input.readonly-field {
  background: var(--bg-secondary);
}

/* ============ VALIDATION MOT DE PASSE ============ */
.password-requirements {
  margin-top: 0.5rem;
  padding: 0.75rem;
  background: var(--bg-page);
  border-radius: 6px;
  border: 1px solid var(--btn-border);
}

.password-requirements .requirement {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.25rem 0;
  color: #666;
  font-size: 0.85rem;
  transition: all 0.2s ease;
}

.password-requirements .requirement .indicator {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  font-size: 12px;
  font-weight: bold;
  transition: all 0.2s ease;
}

.password-requirements .requirement.valid {
  color: #28a745;
  font-weight: 500;
}

.password-requirements .requirement.valid .indicator {
  color: #28a745;
}

.password-requirements .requirement.invalid {
  color: #dc3545;
}

.password-requirements .requirement.invalid .indicator {
  color: #dc3545;
}

/* Barre de force */
.password-strength-bar {
  margin-top: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.strength-bar {
  flex: 1;
  height: 6px;
  background: #e0e0e0;
  border-radius: 3px;
  overflow: hidden;
}

.strength-fill {
  height: 100%;
  width: 0%;
  transition: all 0.3s ease;
  border-radius: 3px;
}

.strength-text {
  font-size: 0.85rem;
  font-weight: 600;
  min-width: 80px;
  text-align: right;
}

/* États des champs */
.form-group input.valid {
  border-color: #28a745 !important;
  background: rgba(40, 167, 69, 0.05);
}

.form-group input.invalid {
  border-color: #dc3545 !important;
  background: rgba(220, 53, 69, 0.05);
}

.form-group input.valid:focus {
  box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.15);
}

.form-group input.invalid:focus {
  box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.15);
}

/* Animation de validation */
@keyframes checkmark {
  0% { transform: scale(0) rotate(45deg); }
  50% { transform: scale(1.2) rotate(45deg); }
  100% { transform: scale(1) rotate(45deg); }
}

.requirement.valid .indicator {
  animation: checkmark 0.3s ease;
}

/* Theme sombre */
:root.theme-dark .password-requirements {
  background: var(--bg-secondary);
}

:root.theme-dark .form-group input.valid {
  background: rgba(40, 167, 69, 0.1);
}

:root.theme-dark .form-group input.invalid {
  background: rgba(220, 53, 69, 0.1);
}

/* Fix pour les labels dans les form-row */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  width: 100%;
  box-sizing: border-box;
}

.form-row .form-group {
  min-width: 0;
  overflow: visible; /* Permet au label de ne pas être coupé */
}

.form-row .form-group label {
  display: block !important;
  width: 100%;
  margin-bottom: 0.5rem;
  overflow: visible !important;
  position: relative;
  z-index: 1;
}

.form-row .form-group input {
  width: 100%;
  box-sizing: border-box;
}

/* Fix spécifique pour les checkbox avec liens */
.checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  line-height: 1.5;
}

.checkbox-label .checkmark {
  margin-top: 2px; /* Aligne mieux avec le texte */
  flex-shrink: 0;
}

.checkbox-label a {
  color: #007acc;
  text-decoration: underline;
  display: inline;
}

.checkbox-label a:hover {
  color: #0056a0;
}