/* ==========================================================================
   Chambres : plan de l'internat, vivier des filles sans chambre, historique.

   Le plan est une grille de cartes qui se resserre naturellement : pas de
   largeur fixe, donc pas de défilement horizontal à 375 px (§7). Le
   glisser-déposer n'existe qu'au-dessus de 900 px ; en dessous, la sélection
   puis le dépôt au doigt donnent le même résultat avec la même API.
   ========================================================================== */

/* --- Vivier : les filles sans chambre -------------------------------------- */

.chambres__attente { position: sticky; top: calc(var(--pas) * 2); z-index: 2; }

.chambres__vivier {
  display: flex;
  flex-wrap: wrap;
  gap: calc(var(--pas) * 2);
  max-height: 12rem;
  overflow-y: auto;
}

.chambres__fille {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  min-height: var(--cible-tactile);
  padding: calc(var(--pas) * 1) calc(var(--pas) * 3);
  font: inherit;
  color: inherit;
  text-align: left;
  border: 1px solid var(--bordure);
  border-radius: var(--r-pill);
  background: var(--carte);
  cursor: grab;
  transition: background var(--duree-anim) ease, border-color var(--duree-anim) ease;
}
.chambres__fille:hover { background: var(--survol); }
.chambres__fille.est-choisie {
  background: var(--primaire);
  border-color: var(--primaire-profond);
  color: var(--sur-primaire);
}
.chambres__fille.est-portee { opacity: 0.5; cursor: grabbing; }
.chambres__fille-nom { font-size: 0.85rem; font-weight: 500; }
.chambres__fille-classe { font-size: 0.7rem; color: var(--texte-tenu); }
.chambres__fille.est-choisie .chambres__fille-classe { color: var(--sur-primaire); }

/* --- Étages et chambres ---------------------------------------------------- */

.etage { display: grid; gap: calc(var(--pas) * 2); }
.etage__titre {
  font-family: var(--police-titre);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--texte-doux);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.chambres {
  display: grid;
  gap: calc(var(--pas) * 3);
  grid-template-columns: 1fr;
}
@media (min-width: 560px)  { .chambres { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 900px)  { .chambres { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1300px) { .chambres { grid-template-columns: repeat(4, 1fr); } }

.chambre {
  display: grid;
  gap: calc(var(--pas) * 2);
  align-content: start;
  padding: calc(var(--pas) * 3);
  border: 1px solid var(--bordure);
  border-radius: var(--r-md);
  background: var(--carte-douce);
  transition: border-color var(--duree-anim) ease, background var(--duree-anim) ease;
}
.chambre.est-complete { background: var(--neutre-doux); }
.chambre.est-cible { border-style: dashed; }
.chambre.est-survolee {
  border-color: var(--primaire);
  border-style: solid;
  background: color-mix(in srgb, var(--primaire) 12%, var(--carte));
}

.chambre__entete {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: calc(var(--pas) * 2);
}
.chambre__numero { font-family: var(--police-titre); font-size: 1rem; font-weight: 700; }
.chambre__places {
  font-size: 0.75rem;
  color: var(--texte-doux);
  padding: 1px calc(var(--pas) * 2);
  border-radius: var(--r-pill);
  background: var(--carte);
}
.chambre__places--complete { color: var(--danger); }

.chambre__historique {
  display: grid;
  place-items: center;
  width: var(--cible-tactile);
  height: var(--cible-tactile);
  border: 0;
  border-radius: var(--r-pill);
  background: transparent;
  color: var(--texte-tenu);
  cursor: pointer;
}
.chambre__historique:hover { background: var(--survol); color: var(--texte); }
.chambre__historique svg { width: 1.1rem; height: 1.1rem; }

.chambre__vide { font-size: 0.85rem; color: var(--texte-tenu); font-style: italic; }
.chambre__masquees { font-size: 0.75rem; color: var(--texte-tenu); }

.chambre__occupantes { display: grid; gap: calc(var(--pas) * 1); }
.chambre__occupante {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: calc(var(--pas) * 1);
}
.chambre__occupante .chambres__fille { width: 100%; border-radius: var(--r-sm); }

.chambre__retirer {
  display: grid;
  place-items: center;
  width: var(--cible-tactile);
  height: var(--cible-tactile);
  border: 0;
  border-radius: var(--r-pill);
  background: transparent;
  color: var(--texte-tenu);
  cursor: pointer;
}
.chambre__retirer:hover { background: var(--danger-doux); color: var(--danger); }
.chambre__retirer svg { width: 0.9rem; height: 0.9rem; }

/* Bouton de dépôt au doigt : il n'apparaît qu'une fois une fille choisie. */
.chambre__poser {
  min-height: var(--cible-tactile);
  padding: 0 calc(var(--pas) * 3);
  font: inherit;
  font-size: 0.85rem;
  color: var(--sur-primaire);
  border: 0;
  border-radius: var(--r-sm);
  background: var(--primaire);
  cursor: pointer;
}
.chambre__poser:hover { background: var(--primaire-profond); }

/* --- Historique d'une chambre --------------------------------------------- */

.chambres__historique { display: grid; gap: calc(var(--pas) * 2); }
.chambres__historique li {
  display: grid;
  gap: 1px;
  padding-bottom: calc(var(--pas) * 2);
  border-bottom: 1px solid var(--bordure);
}
.chambres__historique li:last-child { border-bottom: 0; }
.chambres__historique-nom { font-weight: 500; }
.chambres__historique-dates { font-size: 0.8rem; color: var(--texte-doux); }

/* --- Impression : « qui dort où » au mur ---------------------------------- */

@media print {
  .chambres__attente,
  .barre-outils__actions,
  .chambre__historique,
  .chambre__retirer,
  .chambre__poser { display: none; }
  .chambre { break-inside: avoid; background: transparent; }
}
