/* ===========================
   🧾 SECCIÓN 1 – BASE GENERAL
   =========================== */

body {
  font-family: Arial, sans-serif;
  margin: 0;
  padding: 0;
  background: #fdfbfa;
  color: #222;
}

main {
  padding: 1rem;
}

/* ===========================
   🧾 SECCIÓN 2 – HEADER ADMIN
   =========================== */

header.admin-header {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  background-color: #fff;
  border-bottom: 2px solid #ddd;
}

.logo-admin {
  height: 70px;
  max-width: 180px;
  object-fit: contain;
}

.admin-title {
  font-size: 1rem;
  font-weight: bold;
  color: #7d1538;
  font-family: 'Playfair Display', serif;
  line-height: 1.2;
  flex: 1;
  text-align: left;
  margin: 0;
}

/* ===========================
   🧾 SECCIÓN 3 – FORMULAIRES
   =========================== */

form label {
  display: block;
  margin-bottom: 1rem;
}

form input,
form select,
form textarea,
form button {
  width: 100%;
  padding: 0.5rem;
  margin-top: 0.25rem;
  font-size: 1rem;
  border: 1px solid #ccc;
  border-radius: 6px;
  box-sizing: border-box;
}

form button {
  background-color: #7d1538;
  color: white;
  border: none;
  cursor: pointer;
  transition: background-color 0.3s;
}

form button:hover {
  background-color: #9b1f4a;
}

.form-section,
.filter-section,
.list-section {
  margin-bottom: 2rem;
}

.filter-section h2,
.form-section h2,
.list-section h2 {
  font-size: 1.2rem;
  margin-bottom: 1rem;
  color: #7d1538;
  font-family: 'Playfair Display', serif;
}

/* ===========================
   🧾 SECCIÓN 4 – LISTE PRODUITS (resumida)
   =========================== */

#product-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

#product-list p {
  text-align: center;
  font-style: italic;
  color: #777;
}

.product-header,
.product-line {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 6px;
  align-items: center;
}

.product-header {
  font-weight: bold;
  background: #eee;
  cursor: pointer;
}

.product-line:hover {
  background-color: #f9f9f9;
  cursor: pointer;
}

.sortable {
  cursor: pointer;
  text-decoration: underline;
  color: #7d1538;
}

/* ===========================
   🧾 SECCIÓN 5 – VUE ÉTENDUE (producto expandido)
   =========================== */

/* -------------------------------------- */
/* 📦 5.1 - Contenedor general expandido */
/* -------------------------------------- */
.product-expanded {
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 2rem;
  box-shadow: 0 4px 8px rgba(0,0,0,0.08);
  font-size: 1rem;
}
/* -------------------------------------- */
/* 📐 5.1.1 - Ajustes responsive del contenedor */
/* -------------------------------------- */
@media (min-width: 600px) {
  .product-expanded {
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
  }
}

/* -------------------------------------- */
/* 🖼️ 5.2 - Imagen y badge superpuesto */
/* -------------------------------------- */

/* 🖼️ Image Wrapper - Mobile First */

.image-wrapper {
  width: 100%;
  max-width: 100%;
  display: flex;
  justify-content: center;
  margin-bottom: 1rem;
  padding: 0 1rem;
  box-sizing: border-box;
}
/* 🖼️ Imagen responsiva */
.product-image-full {
  width: 100%;
  height: auto;
  max-width: 280px;
  border-radius: 10px;
  object-fit: contain;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}
.badge {
  position: absolute;
  top: 10px;
  left: 10px;
  padding: 0.4rem 0.8rem;
  border-radius: 6px;
  font-weight: bold;
  font-size: 0.85rem;
  z-index: 2;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}
.badge-vendu {
  background-color: #c0392b;
  color: white;
}
.badge-Reserve {
  background-color: #f5a623;
  color: black;
}

.btn-toggle-details {
  background: none;
  border: none;
  color: #555;
  font-size: 0.9rem;
  padding: 0.5rem 0;
  cursor: pointer;
  text-decoration: underline;
  font-style: italic;
  transition: color 0.2s ease;
}

.btn-toggle-details:hover {
  color: #000;
}

/* -------------------------------------- */
/* 🧱 5.3 - Bloques de texto por sección */
/* -------------------------------------- */
.block {
  background: #f9f9f9;
  border-radius: 10px;
  padding: 1rem;
  margin-bottom: 1.2rem;
}
.block h3 {
  margin-top: 0;
  margin-bottom: 0.7rem;
  font-size: 1.1rem;
  color: #444;
  border-bottom: 1px solid #ddd;
  padding-bottom: 0.4rem;
}

/* -------------------------------------- */
/* 🔘 5.4 - Botones por tipo de acción */
/* -------------------------------------- */
.block.buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.btn {
  padding: 0.5rem 1rem;
  font-size: 0.95rem;
  border: none;
  border-radius: 6px;
  cursor: pointer;
}
.btn:hover {
  opacity: 0.9;
}

.btn-Reserve {
  background-color: #f5a623;
  color: black;
}
.btn-cancel-Reserve {
  background-color: #e67e22;
  color: white;
}
.btn-vendu {
  background-color: #27ae60;
  color: white;
}
.btn-cancel-sale {
  background-color: #d35400;
  color: white;
}
.btn.modify-btn {
  background-color: #2980b9;
  color: white;
}
.btn.delete-btn {
  background-color: #e74c3c;
  color: white;
}
.btn.back-btn {
  background-color: #bdc3c7;
  color: black;
}

.btn-print-label {
  background-color: #8e44ad;
  color: white;
}

/* -------------------------------------- 
  🧾 5.5 - Détails client (Réservation / Vente) 
   -------------------------------------- */
.reservation-details,
.vente-details {
  background-color: #f6f6f6;
  border-left: 4px solid #999;
  padding: 0.75rem 1rem;
  margin-top: 1rem;
  border-radius: 5px;
}

/* ===========================
   📜 SECCIÓN 5bis – MODAL HISTÓRICO
   =========================== */

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
}

.modal-content {
  background-color: #fff;
  padding: 2rem;
  border-radius: 12px;
  width: 90%;
  max-width: 500px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.modal-header h2 {
  margin: 0;
  font-size: 1.2rem;
  color: #7d1538;
  font-family: 'Playfair Display', serif;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
}

.historique-list {
  list-style: none;
  padding-left: 0;
}

.historique-list li {
  margin-bottom: 0.75rem;
  padding: 0.5rem;
  background-color: #f6f6f6;
  border-radius: 6px;
  font-size: 0.95rem;
  color: #444;
}

.empty-historique {
  font-style: italic;
  color: #888;
  font-size: 0.95rem;
}

/* ==========================
   📚 Menú Historique (dropdown)
   ========================== */

/* Botón principal "Historique" */
.historique-btn {
  background-color: #6c5ce7;
  color: white;
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.95rem;
  margin-left: 0.5rem;
  transition: background-color 0.3s;
  font-family: 'Poppins', sans-serif;
}

.historique-btn:hover {
  background-color: #5a4fcf;
}

/* Contenedor del menú desplegable */
.historique-menu {
  display: none;
  flex-direction: column;
  position: absolute;
  background-color: #fff;
  border: 1px solid #ccc;
  border-radius: 6px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
  padding: 0.5rem 0;
  z-index: 1000;
  margin-top: 4px;
  min-width: 200px;
  font-family: 'Poppins', sans-serif;
}

/* Botones dentro del submenú */
.historique-menu button {
  background: none;
  border: none;
  text-align: left;
  padding: 0.5rem 1rem;
  width: 100%;
  font-size: 0.95rem;
  cursor: pointer;
  color: #333;
}

.historique-menu button:hover {
  background-color: #f3f3f3;
}

/* ===========================
   🗑️ SECCIÓN 5ter – MODAL DE SUPPRESSION
   =========================== */

.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1001;
}

.modal.hidden {
  display: none;
}

.modal .modal-content {
  background-color: #fff;
  padding: 2rem;
  border-radius: 10px;
  max-width: 400px;
  width: 90%;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  text-align: center;
  font-family: 'Arial', sans-serif;
}

.modal-content h2 {
  color: #c0392b;
  margin-bottom: 1rem;
  font-size: 1.3rem;
}

.modal-content p {
  color: #444;
  margin-bottom: 1.5rem;
  font-size: 1rem;
  line-height: 1.4;
}

.modal-actions {
  display: flex;
  justify-content: space-around;
  gap: 1rem;
}

.btn-delete {
  background-color: #e74c3c;
  color: white;
  border: none;
  padding: 0.6rem 1.2rem;
  border-radius: 6px;
  cursor: pointer;
  font-weight: bold;
}

.btn-delete:hover {
  background-color: #c0392b;
}

.btn-cancel {
  background-color: #aaa;
  color: white;
  border: none;
  padding: 0.6rem 1.2rem;
  border-radius: 6px;
  cursor: pointer;
}

.btn-cancel:hover {
  background-color: #888;
}

/* ===========================
   🧾 SECCIÓN 6 – RESPONSIVE
   =========================== */

@media (min-width: 600px) {
  .product-image-full {
    max-width: 320px;
    max-height: 280px;
  }
}

@media (min-width: 768px) {
  header.admin-header {
    flex-direction: row;
    justify-content: flex-start;
    align-items: center;
    text-align: left;
  }

  .logo-admin {
    height: 80px;
    max-width: 200px;
  }

  .admin-title {
    font-size: 1.5rem;
    margin-left: 1rem;
    text-align: left;
  }
}

/* ===========================
   🧾 SECCIÓN 7 – BOUTONS MODIFICATION
   =========================== */

#cancel-modification,
#back-to-product {
  display: none;
  padding: 0.5rem 1rem;
  font-size: 1rem;
  margin-top: 1rem;
  margin-right: 0.5rem;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.3s;
}

#cancel-modification {
  background-color: #aaa;
  color: white;
}

#cancel-modification:hover {
  background-color: #888;
}

#back-to-product {
  background-color: #eee;
  color: #333;
}

#back-to-product:hover {
  background-color: #ddd;
}

/* ===========================
   🟡 SECCIÓN 7bis – BOUTON ÉTAT PRODUIT
   =========================== */

.etat-btn {
  padding: 6px 10px;
  font-size: 0.85rem;
  border-radius: 4px;
  font-weight: bold;
  text-transform: uppercase;
  border: none;
  cursor: default;
  display: inline-block;
  margin: 4px 2px;
}

/* État : Disponible */
.etat-disponible {
  background-color: #d4edda;
  color: #155724;
}

/* État : Réservé */
.etat-reserve {
  background-color: #fff3cd;
  color: #856404;
}

/* État : Vendu */
.etat-vendu {
  background-color: #f8d7da;
  color: #721c24;
}

/* ===========================
   🌀 FADE IN POUR LE MENU .etat-menu
   =========================== */

.etat-menu {
  display: flex;
  flex-direction: column;
  position: absolute;
  background-color: #fff;
  border: 1px solid #ccc;
  border-radius: 6px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
  padding: 0.5rem 0;
  z-index: 1000;
  min-width: 180px;
  font-family: 'Poppins', sans-serif;
  opacity: 0;
  transform: scale(0.95);
  transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: none;
}

.etat-menu.visible {
  opacity: 1;
  transform: scale(1);
  pointer-events: auto;
}

/* ===========================
   ✅ TOAST MESSAGE (visual)
   =========================== */
.toast-message {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: #7d1538;
  color: white;
  padding: 0.75rem 1.25rem;
  border-radius: 8px;
  font-size: 0.95rem;
  opacity: 0;
  transition: opacity 0.4s ease, transform 0.4s ease;
  z-index: 1000;
}
.toast-message.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(-10px);
}

/* ===========================
   🖨️ SECCIÓN 8 – IMPRESIÓN DE ETIQUETA
   =========================== */

/* ✅ Estilo para etiqueta imprimible */
#etiquette-produit {
  position: fixed;
  top: 2rem;
  left: 2rem;
  width: calc(100% - 4rem);
  max-width: 380px;
  background-color: white;
  color: black;
  padding: 1rem;
  border: 1px solid #ccc;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  z-index: 9999;
  display: block;
}

@media print {
  body * {
    visibility: hidden;
  }
  #etiquette-produit, #etiquette-produit * {
    visibility: visible;
  }
  #etiquette-produit {
    position: absolute;
    top: 0;
    left: 0;
  }
}

/* ===========================
   🖼️ SECCIÓN 9 – PRÉVISUALISATION IMAGE
   =========================== */

/* 🖼️ Contenedor general de las imágenes previsualizadas */
.image-preview-container {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 1rem;
  justify-content: flex-start;
}

/* 📷 Contenedor individual de cada imagen */
.preview-wrapper {
  position: relative;
  width: 30vw;           /* 📱 Tamaño adaptable al ancho de pantalla */
  max-width: 100px;
  aspect-ratio: 1 / 1;   /* 🟨 Mantiene imagen cuadrada */
  border: 2px solid #ccc;
  border-radius: 5px;
  overflow: hidden;
}

/* 🔹 Imagen previsualizada */
.preview-wrapper img.image-preview {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* 🔹 Botones de acción sobre cada imagen (Eliminar / Reemplazar) */
.preview-actions {
  position: absolute;
  top: 2px;
  right: 2px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  z-index: 2;
}

/* 🔹 Estilo de los botones sobre la imagen */
.preview-actions button {
  background-color: rgba(0, 0, 0, 0.6);
  color: white;
  border: none;
  font-size: 12px;
  padding: 2px 4px;
  border-radius: 3px;
  cursor: pointer;
}
/* ===========================
   💬 SECCIÓN 10 – MODALE UNIFIÉE POUR CONFIRMATION D’ACTIONS
   =========================== */

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 1rem;
}

.modal-box {
  background-color: #fff;
  border-radius: 12px;
  padding: 1.5rem;
  width: 100%;
  max-width: 360px;
  text-align: center;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
  font-family: 'Poppins', sans-serif;
}

.modal-logo {
  width: 60px;
  height: auto;
  margin-bottom: 1rem;
}

.modal-title {
  font-size: 1.1rem;
  color: #800020;
  margin-bottom: 0.75rem;
}

.modal-message {
  font-size: 1rem;
  margin-bottom: 1.25rem;
  color: #333;
}

.modal-actions {
  display: flex;
  flex-direction: row;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

.modal-btn {
  padding: 0.6rem 1.2rem;
  border: none;
  border-radius: 6px;
  font-size: 0.95rem;
  cursor: pointer;
}

.btn-confirm {
  background-color: #800020;
  color: white;
}

.btn-cancel {
  background-color: #ccc;
  color: #333;
}