body {
  background-image: url(../images/chambrebg.png);
  background-size: cover;
  background-repeat: no-repeat;
  background-position: center;
  font-family: 'Quicksand', sans-serif;
  margin: 0;
  padding-top: 40px;
  min-height: 100vh;
}
header {
  margin-bottom: 20px;;
}
header h1, header h4 {
  color: #4B3F72;
  padding-left: 40px;
}
h1, h4 {
  margin-block-start: 0 !important;
  margin-block-end: 0 !important;
}
p {
  color: #5a5a5a;
}
button {
  background-color: #fff;
  color: #4B3F72;
  border: 1px solid #4B3F72;
  border-radius: 15px;
  margin: 1em;
  padding: 1em;
}
button:hover {
  background-color: #4B3F72;
  color: #fff;
  cursor: pointer;
}

label {
  display: block;
}

select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;

  width: 100%;
  max-width: 400px;
  height: 1.5em;
  line-height: 1.5em;

  padding: 0 2.5em 0 1em;
  font-size: 1rem;

  color: #333;
  background-color: #fff;

  background-image: url('data:image/svg+xml;utf8,<svg fill="%234B3F72" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M7 10l5 5 5-5z"/></svg>');
  background-repeat: no-repeat;
  background-position: right 0.6em center;
  background-size: 1em;

  border: 1px solid #bbb;
  border-radius: 6px;
  transition: border-color 0.2s ease;

  text-align: center;
  text-align-last: center;
}
select option {
  font-size: 1.5rem;
  padding: 0.5em;
}

button:focus,
input:focus {
  outline: 2px solid #4B3F72;
  outline-offset: 2px;
}
select:hover, select:focus {
  outline: 2px solid #4B3F72;
  outline-offset: 2px;
  border-color: #4B3F72;
  cursor: pointer;
}

.container {
  max-width: 1200px;
  max-height: 100%;
  margin: 0 auto;
}

.hero-wrapper {
  position: relative;
  min-height: 100vh;
  overflow: visible;
  padding: 40px;
  box-sizing: border-box;
}

/* Texte centré à gauche */
.hero-content {
  max-width: 600px;
  z-index: 2;
  position: relative;
  left: 100px;
}

#pseudo, #mot_de_passe, #date_naissance, input[type="email"],
#email_connexion, #mot_de_passe_connexion, #prenom_bebe, #date_naissance_bebe, 
#pseudo_edit, #nouveau_mot_de_passe, #confirmer_mot_de_passe {
  width: 100%;
  max-width: 400px;
  height: 1.5em;
  border: none;
  border-radius: 6px;
  box-sizing: border-box;
}

/* Bébé en transparence aligné à droite */
.floating-baby {
  display: block;
  margin-left: auto;
  position: relative;
  bottom: 0;
  right: 2%;
  width: 400px;
  object-fit: contain;
  z-index: 1;
  pointer-events: none;
  transition: transform 0.6s ease, opacity 0.6s ease;
}

.gridBy2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-gap: 1em;
}

.form-wrapper {
  max-width: 600px;
  width: 100%;
  margin: 0 auto;
}

#inscription, #adoption, #tableau_de_bord, #connexion {
  display: none;
}

.carte-bebe {
  position: relative;
  background: #f7f4ff;
  border: 1px solid #ccc;
  border-radius: 12px;
  padding: 1rem;
  margin: 1rem 0;
  box-shadow: 0 0 8px rgba(0,0,0,0.05);
}

.carte-bebe:hover {
  transform: scale(1.01);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  transition: transform 0.2s ease, box-shadow 0.3s ease;
}

.entree-douce {
  opacity: 0;
  transform: translateY(20px);
  animation: fadeInUp 0.6s ease-out forwards;
}

.supprimer-bebe {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: none;
  border: none;
  color: crimson;
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0;
}

.supprimer-bebe:hover {
  transform: scale(1.2);
  transition: transform 0.2s ease;
}

#supprimer_utilisateur {
  background-color: #8b0000;
  color: white;
}

#supprimer_utilisateur:hover {
  background-color: #a40000;
}

.fade-out {
  animation: disparitionDouce 0.6s ease forwards;
}

#message-supprime {
  position: relative;
  top: 20px;
  left: 50%;
  background-color: #fef2f2;
  color: #b91c1c;
  padding: 0.8rem 1.2rem;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  animation: flotte 2.5s ease-out forwards;
  font-size: 0.95rem;
  z-index: 1000;
}

.toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background-color: #fef6e4;
  color: #4B3F72;
  border: 1px solid #f8d19c;
  padding: 1rem 1.5rem;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.15);
  font-size: 1rem;
  z-index: 9999;
  animation: fadeInOut 4s ease forwards;
}

.barre {
  position: relative;
  background-color: #eee;
  border-radius: 8px;
  height: 16px;
  width: 100%;
  margin-bottom: 1rem;
  overflow: hidden;
}

.niveau {
  height: 100%;
  transition: width 0.3s ease;
  border-radius: 8px;
}

.pourcentage {
  font-size: 0.75rem;
  color: #555;
  text-align: right;
  margin-top: 2px;
}

.niveau.faim { background-color: #ff6b6b; }
.niveau.energie { background-color: #1e90ff; }
.niveau.attention { background-color: #f1c40f; }

.niveau[data-val]::after {
  content: attr(data-val) "%";
  font-size: 0.7rem;
  float: right;
  margin-right: 6px;
  color: #fff;
}

.niveau.faim[data-val] { background-color: #ff7675; }
.niveau.faim[data-val="0"] { background-color: #b33939; }

.niveau.energie[data-val] { background-color: #74b9ff; }
.niveau.energie[data-val="0"] { background-color: #0984e3; }

.niveau.attention[data-val] { background-color: #ffeaa7; }
.niveau.attention[data-val="0"] { background-color: #f39c12; }

.horloge-bebe {
  font-size: 0.75rem;
  color: #666;
  text-align: right;
  margin-top: 4px;
  opacity: 0.8;
}

.rafraichissement-doux {
  animation: fadein 0.6s ease-in;
}

.icone-sommeil {
  position: absolute;
  top: 6px;
  right: 8px;
  font-size: 1.2rem;
  opacity: 0.8;
}
.etat-sommeil:empty {
  opacity: 0;
}

.carte-bebe.en-sommeil {
  background-color: #f0f0f0;
  border: 1px dashed #aaa;
  box-shadow: none;
  transition: background-color 0.6s ease, opacity 0.6s ease;
}

.bulle-saturation {
  position: absolute;
  top: -18px;
  right: -10px;
  background: #2ecc71;
  color: white;
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 0.75em;
  animation: apparition 1.2s ease-out;
  pointer-events: none;
  box-shadow: 0 0 6px rgba(0,0,0,0.2);
  z-index: 10;
}

.etat-sommeil {
  font-size: 0.85rem;
  font-style: italic;
  color: #555;
  margin-top: 0.5rem;
  text-align: right;
  opacity: 0.8;
}

#etat-synchronisation.flash {
  animation: pulse 0.8s ease-in-out;
}

.carte-bebe.en-sommeil {
  position: relative;
  animation: reve-berceur 4s ease-in-out infinite;
  background-color: #f4f0ff;
  box-shadow: 0 0 15px rgba(110, 90, 255, 0.3);
  opacity: 0.85;
  filter: saturate(70%);
  transition: background-color 0.6s ease, opacity 0.6s ease, box-shadow 0.3s ease;
}

.carte-bebe.en-sommeil .etat-sommeil {
  color: #6c5ce7;
  font-weight: bold;
}

.actions-bebe button:disabled {
  filter: grayscale(70%);
  opacity: 0.6;
  cursor: not-allowed;
}

.carte-bebe.en-sommeil .etat-sommeil {
  display: block;
}

@media (max-width: 1000px) {
  .floating-baby {
    position: relative;
    bottom: 100px;
  }
}

@media (max-width: 600px) {
  #email_connexion,
  #mot_de_passe_connexion,
  #email_edit,
  #genre_edit,
  #affinite_edit,
  button {
    width: 100%;
    max-width: 400px;
    box-sizing: border-box;
  }

  .carte-bebe button.supprimer-bebe {
    width: auto;
    max-width: none;
    display: block;
    position: absolute;
    bottom: 8px;
    right: 8px;
    padding: 0.2rem 0.5rem;
    z-index: 1;
  }

  #pseudo, #mot_de_passe, #date_naissance,
  input[type="email"],
  select {
    width: 100%;
  }

  .hero-wrapper {
    padding: 16px; /* Réduit par rapport aux 40px initiaux */
  }

  .hero-content {
    left: 0;
    padding: 1rem;
  }

  .gridBy2 {
    display: flex;
    flex-direction: column;
    gap: 1em;
  }

  .floating-baby {
    display: none;
  }
}

@media (max-width: 480px) {
  .hero-wrapper {
    padding-left: 16px;
    padding-right: 16px;
  }

  #email_connexion,
  #mot_de_passe_connexion {
    width: 100%;
    max-width: 400px;
    box-sizing: border-box;
  }
}

@media (max-width: 400px) {
  .champ {
    max-width: 100%;
    width: 100%;
  }
  .hero-wrapper {
    padding: 8px;
  }
}

@keyframes flotte {
  0% {
    opacity: 0;
    transform: translateY(10px);
  }
  10% {
    opacity: 1;
    transform: translateY(0);
  }
  90% {
    opacity: 1;
    transform: translateY(0);
  }
  100% {
    opacity: 0;
    transform: translateY(-20px);
  }
}

@keyframes fadeInUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInOut {
  0% { opacity: 0; transform: translate(-50%, -10px); }
  10% { opacity: 1; transform: translate(-50%, 0); }
  90% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -10px); }
}

@keyframes disparitionDouce {
  to {
    opacity: 0;
    transform: scale(0.95);
    height: 0;
    margin: 0;
    padding: 0;
  }
}
@keyframes fadein {
  from { opacity: 0.4; transform: scale(0.98); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes apparition {
  0% { opacity: 0; transform: translateY(10px); }
  20% { opacity: 1; transform: translateY(-2px); }
  100% { opacity: 0; transform: translateY(-12px); }
}

@keyframes pulse {
  0% { opacity: 0.5; transform: scale(0.95); }
  50% { opacity: 1; transform: scale(1); }
  100% { opacity: 0.9; transform: scale(0.97); }
}

@keyframes reve-berceur {
  0%, 100% {
    box-shadow: 0 0 12px rgba(120, 100, 255, 0.1);
  }
  50% {
    box-shadow: 0 0 25px rgba(120, 100, 255, 0.3);
  }
}