/* =================================================
   RESET / BASE
================================================= */
* {
  box-sizing: border-box;
}

body {
  font-family: Arial, sans-serif;
  background: #f5f5f5;
  margin: 0;
  padding: 16px;
}

h1 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 2rem;
  margin-bottom: 16px;
  color: #222;
}

.actu-wrapper {
  display: inline-flex;
}

input, button {
  font-family: inherit;
  font-size: 1rem;
}

/* =================================================
   AJOUT RAYON
================================================= */
.add-rayon {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

#nouveau-rayon {
  flex: 1;
  padding: 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
}

/* =================================================
   RAYONS
================================================= */
.rayon {
  background: #fff;
  border-radius: 6px;
  margin-bottom: 12px;
  padding: 8px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.rayon-header {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.rayon-header h2 {
  flex: 1;
  margin: 0;
  font-size: 1.2rem;
  user-select: none;
}

/* Drag handle */
.btn-deplacer-rayon {
  cursor: grab;
  font-size: 1.2rem;
  background: none;
  border: none;
  padding: 0 4px;
  color: #666;
}

.btn-deplacer-rayon:active {
  cursor: grabbing;
}

/* Collapse */
.rayon.collapsed .produits-container,
.rayon.collapsed .rayon-footer {
  display: none;
}


/* =================================================
   PRODUITS
================================================= */
.rayon-content {
  margin-top: 8px;
}

.produit {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
}

.produit input[type="checkbox"] {
  cursor: pointer;
  width: 18px;
  height: 18px;
  accent-color: #666;
}

.produit-nom {
  flex: 1;
  cursor: pointer;
}

.produit-nom[contenteditable="true"] {
  outline: none;
  background: #eef;
  border-radius: 4px;
  padding: 2px 4px;
}

/* Produit coché */
.produit.checked .produit-nom,
.produit.produit-coche .produit-nom {
  text-decoration: line-through;
  opacity: 0.6;
}

/* =================================================
   INPUT AJOUT PRODUIT
================================================= */
.add-produit {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}

.add-produit input {
  flex: 1;
  padding: 6px;
  border: 1px solid #ccc;
  border-radius: 4px;
}

/* =================================================
   CROIX DE SUPPRESSION (RAYONS & PRODUITS)
================================================= */
.btn-supprimer-rayon,
.btn-supprimer-produit {
  background: none;
  border: none;
  width: 28px;
  height: 28px;
  padding: 4px;
  cursor: pointer;
  position: relative;
  opacity: 0;
  transition: opacity 0.2s;
}

/* Apparition contrôlée par JS */
.rayon-actions.show .btn-supprimer-rayon,
.produit-actions.show .btn-supprimer-produit {
  opacity: 1;
}

/* Dessin de la croix */
.btn-supprimer-rayon::before,
.btn-supprimer-rayon::after,
.btn-supprimer-produit::before,
.btn-supprimer-produit::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 18px;
  height: 2px;
  background: #666;
}

.btn-supprimer-rayon::before,
.btn-supprimer-produit::before {
  transform: translate(-50%, -50%) rotate(45deg);
}

.btn-supprimer-rayon::after,
.btn-supprimer-produit::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

.btn-supprimer-rayon:hover::before,
.btn-supprimer-rayon:hover::after,
.btn-supprimer-produit:hover::before,
.btn-supprimer-produit:hover::after {
  background: #000;
}

/* =================================================
   ZONES ACTIONS (pour JS)
================================================= */
.rayon-actions,
.produit-actions {
  display: flex;
  align-items: center;
}

/* =================================================
   DRAG & DROP VISUEL
================================================= */
.rayon.dragging {
  opacity: 0.7;
  background: #eef;
  box-shadow: 0 4px 8px rgba(0,0,0,0.2);
  border: 1px dashed #ccc;
}

/* =================================================
   LOADER
================================================= */
.loader {
  position: fixed;
  inset: 0;
  background: rgba(245,245,245,0.9);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 999;
}

.loader.hidden {
  display: none;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #ccc;
  border-top-color: #333;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loader p {
  margin-top: 12px;
  font-size: 0.9rem;
  color: #333;
}

/* =================================================
   ACTUALISATION ICONE
================================================= */
.actualisation-ico {
  width: 30px;
  height: 30px;
  cursor: pointer;
}
  @keyframes rotation {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.actualisation-ico.spin {
  animation: rotation 0.5s linear;
}