:root {
  --bg-container: rgb(86, 230, 16);
  --card-bg: #ffffff;
  --text-dark: #333333;
  --text-muted: #777777;
  --accent: #007bff;
  --danger: #dc3545;
  --radius: 10px;
  --spacing: 1rem;
  --shadow: rgba(0, 0, 0, 0.1);
  --field-height: 44px;
}

/* Box sizing global et reset basique */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* Corps de page */
body {
  font-family: 'Segoe UI', Arial, sans-serif;
  background: linear-gradient(135deg, #e2ffe9, #c0f7e0);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* Conteneur principal */
.container {
  background: var(--bg-container);
  padding: 2rem;
  border-radius: var(--radius);
  width: 100%;
  max-width: 420px;
  box-shadow: 0 8px 20px var(--shadow);
  animation: fadeIn 0.5s ease;
}

/* Formulaire en carte */
form {
  background: var(--card-bg);
  padding: 2rem;
  margin-top: 1rem;
  border-radius: var(--radius);
  box-shadow: 0 4px 16px var(--shadow);
}

/* Titre */
h2 {
  color: white;
  text-align: center;
  font-size: 1.6rem;
  margin-bottom: 1rem;
}

/* Groupe de champs */
.form-group {
  margin-bottom: 1rem;
  text-align: left;
}

/* Champs form-control */
.form-group input,
.form-group select,
.form-group textarea,
input.form-control {
  width: 100%;
  height: var(--field-height);
  font-size: 0.95rem;
  padding: 0 1rem;
  border: 1px solid #ccc;
  border-radius: 6px;
  transition: border-color 0.3s;
}

.form-group input:focus,
input.form-control:focus {
  border-color: var(--accent);
  outline: none;
}

/* Bouton principal */
button[type="submit"] {
  width: 100%;
  height: var(--field-height);
  background-color: #357ae8;
  color: white;
  border: none;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.3s;
}

button[type="submit"]:hover {
  background-color: #43A047;
}

/* Liens */
.register-link,
.forgot-password {
  text-align: center;
  margin-top: 1rem;
  font-size: 0.95rem;
}

.register-link a,
.forgot-password a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

.register-link a:hover,
.forgot-password a:hover {
  text-decoration: underline;
}

/* Logo circulaire */
.logo-box {
  background: #fff;
  width: 120px;
  height: 120px;
  margin: 0 auto 1.5rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  box-shadow: 0 4px 12px var(--shadow);
  transition: box-shadow 0.4s ease, transform 0.4s ease;
  animation: pulseIn 0.6s ease forwards;
}

.logo-box:hover {
  box-shadow: 0 0 20px rgba(0, 123, 255, 0.5);
  transform: scale(1.05);
}

.logo {
  width: 100%;
  height: auto;
  object-fit: cover;
  border-radius: 50%;
}

/* Message container unique */
#message-container {
  margin-top: 1rem;
}

/* Cartes de messages */
.alert-card {
  background: #fff;
  border-left: 6px solid var(--accent);
  box-shadow: 0 3px 12px rgba(0,0,0,0.08);
  padding: 0.75rem 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  position: relative;
  font-size: 0.9rem;
  animation: fadeIn 0.4s ease;
}

.alert-card.success { border-left-color: #28a745; color: #28a745; }
.alert-card.error   { border-left-color: #dc3545; color: #dc3545; }
.alert-card.warning { border-left-color: #ffc107; color: #ffc107; }

.close-alert {
  position: absolute;
  top: 8px;
  right: 12px;
  font-size: 1.2rem;
  color: #777;
  cursor: pointer;
  background: none;
  border: none;
}

/* Alertes de tentative */
.alert-warning.mt-3 {
  background-color: #fff8e5;
  border: 1px solid #ffe8a1;
  padding: 1rem 1.25rem;
  border-radius: 6px;
  color: #856404;
  font-size: 1rem;
  font-weight: 500;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  max-width: 480px;
  margin: 1rem auto;
  animation: fadeAlert 0.4s ease;
}

@keyframes fadeAlert {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Validation visuelle */
input.is-invalid,
select.is-invalid,
textarea.is-invalid {
  border-color: var(--danger);
  background-color: #fff5f5;
}

input.is-invalid:focus,
select.is-invalid:focus,
textarea.is-invalid:focus {
  border-color: var(--danger);
  box-shadow: 0 0 0 0.2rem rgba(220,53,69,0.25);
}

.invalid-feedback {
  display: block;
  font-size: 0.875rem;
  color: var(--danger);
  margin-top: 0.25rem;
}

/* Barre linéaire animée */
.attempt-visual {
  background: #fef8e5;
  border: 1px solid #ffeeba;
  padding: 1rem;
  border-radius: 6px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.05);
  max-width: 420px;
  margin: auto 0 1rem 0;
}

.risk-bar {
  position: relative;
  background-color: #e9ecef;
  border-radius: 6px;
  overflow: hidden;
  height: 12px;
}

.progress-bar {
  transition: width 0.5s ease-in-out;
  position: relative;
}

.attempt-label {
  position: absolute;
  top: -22px;
  right: 6px;
  font-size: 0.75rem;
  color: var(--text-dark);
  background: #fff;
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.07);
  pointer-events: none;
}

/* Segments pour progression en 5 blocs */
.attempt-segments {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  max-width: 420px;
  margin: 0 auto 1rem auto;
}

.segment {
  flex: 1;
  height: 12px;
  background-color: #e9ecef;
  border-radius: 4px;
  transition: background-color 0.4s ease;
}

.segment.safe    { background-color: #28a745; }
.segment.partial { background-color: #ffc107; }
.segment.failed  { background-color: #dc3545; }

/* Animations génériques */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes pulseIn {
  from {
    opacity: 0;
    transform: scale(0.8);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Responsive */
@media (max-width: 480px) {
  .container {
    padding: 1rem;
    margin: 2rem 1rem;
  }
  h2 {
    font-size: 1.4rem;
  }
  input, button, .progress, .segment {
    font-size: 0.95rem;
  }
  form {
    padding: 1.5rem;
  }
}


