/* =========================================
   BARRE LATERALE (SIDEBAR) MODERNISÉE
   ========================================= */

:root {
  --sidebar-width: 260px;
  --sidebar-collapsed-width: 70px;
  --sidebar-bg: #111827;
  --sidebar-hover: #1f2937;
  --sidebar-text: #9ca3af;
  --sidebar-text-active: #ffffff;
  --primary-accent: #3b82f6;
  --transition-speed: 0.3s;
}

body {
  overflow-x: hidden;
}

/* --- Structure Globale & Grid Layout --- */
.structure-globale {
  display: flex;
  min-height: 100vh;
  transition: all var(--transition-speed) ease;
}

/* Gestion du contenu principal en fonction de la sidebar */
.structure-globale.avec-barre-laterale .contenu-principal {
  flex: 1;
  margin-left: var(--sidebar-width);
  transition: margin-left var(--transition-speed) ease;
  width: calc(100% - var(--sidebar-width));
}

/* Mode Plein écran (ex: page de login) */
.structure-globale.plein-ecran .contenu-principal {
  width: 100%;
  margin-left: 0;
}

/* --- Sidebar Container --- */
.barre-laterale-admin {
  width: var(--sidebar-width);
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  z-index: 1000;
  box-shadow: 4px 0 15px rgba(0, 0, 0, 0.25);
  transition: width var(--transition-speed) ease;
  overflow-x: hidden;
  /* Cache le contenu qui dépasse lors de la réduction */
}

/* --- Checkbox Hack Logic (Toggle) --- */
/* Quand la checkbox est cochée (sidebar réduite) */
#sidebar-toggle:checked~.barre-laterale-admin {
  width: var(--sidebar-collapsed-width);
}

/* Ajustement du contenu principal quand sidebar réduite */
/* Note: On utilise :has() si supporté, sinon on compte sur le fait que la structure HTML met l'input avant */
#sidebar-toggle:checked~.barre-laterale-admin+.contenu-principal,
body:has(#sidebar-toggle:checked) .contenu-principal {
  margin-left: var(--sidebar-collapsed-width);
  width: calc(100% - var(--sidebar-collapsed-width));
}

/* Masquer les textes quand réduit */
#sidebar-toggle:checked~.barre-laterale-admin .texte-lien,
#sidebar-toggle:checked~.barre-laterale-admin .base-logo-text,
#sidebar-toggle:checked~.barre-laterale-admin .titre-barre {
  opacity: 0;
  pointer-events: none;
  display: none;
}

/* Centrer les icônes quand réduit */
#sidebar-toggle:checked~.barre-laterale-admin .icone-wrapper {
  margin-right: 0;
}

#sidebar-toggle:checked~.barre-laterale-admin .entete-barre {
  justify-content: center;
  padding: 10px;
}

#sidebar-toggle:checked~.barre-laterale-admin .logo-wrapper {
  display: none;
}

#sidebar-toggle:checked~.barre-laterale-admin .toggle-btn {
  margin: 0;
}

/* --- Header Sidebar --- */
.entete-barre {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px;
  height: 70px;
  border-bottom: 1px solid #1f2937;
}

.logo-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
  overflow: hidden;
  white-space: nowrap;
}

.logo-barre {
  width: 32px;
  height: 32px;
}

.titre-barre {
  font-size: 18px;
  font-weight: 700;
  color: white;
  letter-spacing: 0.5px;
}

.toggle-btn {
  cursor: pointer;
  color: var(--sidebar-text);
  padding: 5px;
  border-radius: 4px;
  transition: 0.2s;
}

.toggle-btn:hover {
  color: white;
  background: rgba(255, 255, 255, 0.1);
}

/* --- Navigation & Links --- */
.navigation-principale {
  flex: 1;
  overflow-y: auto;
  padding: 10px 0;
}

.liste-liens {
  list-style: none;
  padding: 0;
  margin: 0;
}

.liste-liens li {
  margin-bottom: 2px;
}

.barre-laterale-admin a {
  display: flex;
  align-items: center;
  padding: 12px 20px;
  text-decoration: none;
  color: var(--sidebar-text);
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s ease;
  border-left: 3px solid transparent;
  white-space: nowrap;
  overflow: hidden;
}

.barre-laterale-admin a:hover {
  background: var(--sidebar-hover);
  color: white;
  padding-left: 25px;
  /* Petit effet de glissement */
}

/* Annuler l'effet de glissement quand réduit pour éviter que ça bouge bizarrement */
#sidebar-toggle:checked~.barre-laterale-admin a:hover {
  padding-left: 20px;
  background: var(--sidebar-hover);
}

.barre-laterale-admin a.active {
  background: rgba(59, 130, 246, 0.1);
  border-left-color: var(--primary-accent);
  color: var(--sidebar-text-active);
}

.icone-wrapper {
  width: 24px;
  min-width: 24px;
  /* Fixe la largeur pour que l'icône ne s'écrase pas */
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 12px;
  font-size: 18px;
}

/* --- Footer Sidebar (Déconnexion) --- */
.pied-barre {
  border-top: 1px solid #1f2937;
  margin-top: auto;
  padding-top: 5px;
}

.lien-deconnexion {
  color: #ef4444 !important;
  /* Rouge pour déconnexion */
}

.lien-deconnexion:hover {
  background: rgba(239, 68, 68, 0.1) !important;
  border-left-color: #ef4444 !important;
}

/* --- Responsive (Mobile) --- */
@media (max-width: 768px) {
  .structure-globale.avec-barre-laterale .contenu-principal {
    margin-left: 0;
    width: 100%;
  }

  /* Sur mobile, la sidebar est masquée par défaut (transform) ou réduite */
  .barre-laterale-admin {
    transform: translateX(-100%);
  }

  /* Quand on check, on affiche la sidebar (menu burger style) */
  #sidebar-toggle:checked~.barre-laterale-admin {
    width: var(--sidebar-width);
    transform: translateX(0);
  }

  /* Overlay quand le menu est ouvert sur mobile (optionnel mais recommandé) */
  #sidebar-toggle:checked~.contenu-principal::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
  }

  /* Bouton toggle flottant visible uniquement sur mobile si besoin, 
       ou on utilise celui dans le header principal s'il y en a un.
       Ici, on suppose que l'utilisateur peut cliquer sur le label quelque part. 
       Si le label est DANS la sidebar, il faut un autre bouton externe pour l'ouvrir.
    */
}


/* GESTION DE COMMANDES */

.filter-card {
  border: 1px solid #ddd;
  border-radius: 2px;

  box-shadow: rgba(99, 99, 99, 0.2) 0px 2px 8px 0px;
  width: 100%;
  max-width: 100%;
  margin: 10px auto;

  font-size: 14px;
}

.filter-card-header {
  background-color: #f8f9fa;
  border-left: 4px solid #111827;
  padding: 8px 12px;
  margin: 12px 12px 5px 14px;
  border-radius: 4px;
  text-transform: none !important;
}

.filter-card-body {
  padding: 16px;
}

.filter-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.form-group {
  flex: 1 1 200px;
  min-width: 150px;
}

.filter-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;

}

.admin-produit-success-container {
  display: flex;
  gap: 10px;

}

.filter-actions button {
  border-radius: 1px;
  cursor: pointer;
  color: white;
  font-size: 14px;
  text-transform: none !important;

}

.select2-results__option--highlighted {
  background-color: #6995b1 !important;
  color: #fff !important;
}


.select2-container--default {
  width: 100% !important;
  min-width: 230px;
  font-size: 13px;
}


.select2-container--default .select2-selection--single {
  height: 48px !important;
}

.select2-container--default .select2-search--dropdown .select2-search__field {
  height: 35px !important;

}

.select2-container--default .select2-selection--single .select2-selection__rendered {
  line-height: 40px !important;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
}

.btn-apply {

  background-color: #2d2d2d !important;
}

.btn-clear {
  background-color: #ff9149 !important;
}

.btn-apply:hover {
  background-color: #2d2d2d !important;
}

.btn-clear:hover {
  background-color: #e07f3d !important;
}

.dataTables_filter input {
  height: 32px !important;
}

.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.modal-content {
  background: #fff;
  padding: 25px 20px;
  width: 450px;
  max-width: 95%;
  border-radius: 12px;
  position: relative;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
  font-family: 'Inter', sans-serif;
  color: #111827;
}

.modal-media {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;

  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1100;
  animation: fadeInMedia 0.3s ease;
}

@keyframes fadeInMedia {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}


.modal-media-contenu {
  background: #fff;
  padding: 25px 25px;
  width: 900px;
  max-width: 95%;
  max-height: 90%;
  min-height: 500px;
  overflow-y: auto;
  border-radius: 14px;
  position: relative;
  box-shadow: 0 5px 25px rgba(0, 0, 0, 0.35);
  font-family: 'Inter', sans-serif;
  color: #111827;
}


.modal-media-fermer {
  position: absolute;
  top: 12px;
  right: 15px;
  font-size: 26px;
  cursor: pointer;
  color: #555;
}

.modal-media-fermer:hover {
  color: #000;
}

.modal-media-corps {
  margin-top: 40px;
}

.close {
  position: absolute;
  top: 10px;
  right: 15px;
  cursor: pointer;
  font-size: 28px;
  font-weight: bold;
  color: #555;
  transition: 0.2s;
}

.close:hover {
  color: #000;
}

.modal-body {
  margin-top: 20px;
}

.qrcode-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 20px;
}

.qrcode {
  width: 120px;
  height: 120px;
  margin-bottom: 10px;
  background: #eee;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: #888;
  border-radius: 8px;
}

.order-number {
  font-weight: bold;
  margin-bottom: 15px;
}

.items-list {
  max-height: 200px;
  overflow-y: auto;
  margin-bottom: 20px;
  border-top: 1px solid #eee;
  border-bottom: 1px solid #eee;
  padding: 10px 0;
}

.items-list div {
  padding: 5px 0;
  border-bottom: 1px dotted #ccc;
  font-size: 14px;
}

.items-list div:last-child {
  border-bottom: none;
}

.btn-print {
  background-color: #2d2d2d;
  color: white;
  border: none;
  padding: 10px 15px;
  cursor: pointer;
  font-size: 14px;
  width: 100%;
  transition: 0.2s;
}

.btn-print:hover {
  background-color: #444;
}

.filepond--item {
  width: 150px;
  height: 150px;
  max-width: 300px;
  max-height: 300px;
  min-width: 150px;
  min-height: 150px;
}


/* GESTION DE PRODUITS */

.btn-detail {
  background-color: #000;
  transition: background-color 0.3s;
}

.btn-detail:hover {
  background-color: #222;
}

.btn-detail a {
  all: unset;
  cursor: pointer;
  text-decoration: none;
}


.filter-card-header-prod {
  width: 100%;
  background-color: #f8f9fa;
  border-left: 4px solid #111827;
  padding: 8px 12px;
  margin: 12px 12px 5px 4px;
  border-radius: 4px;
  text-transform: none !important;
}

.conteneur {
  padding: 16px;
}

.carte {
  border: 1px solid #ccc;
  border-radius: 2px;
  margin-bottom: 16px;
  box-shadow: rgba(60, 64, 67, 0.3) 0 1px 2px, rgba(60, 64, 67, 0.15) 0 1px 3px 1px;
}

.entete-carte {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px;
  border-bottom: 1px solid #ccc;
}

.carte-error {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-right: 15px;
}

.corps-carte {
  display: flex;
}

.barre-laterale {
  width: 25%;
  border-right: 1px solid #ccc;
  background-color: #fafafa;
  font-family: Arial, sans-serif;
}

.element-barre {
  padding: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
}

.element-barre:hover {
  background-color: #f5f5f5;
}

.element-barre.actif {
  background-color: #e2e8f0;
  font-weight: bold;
}

.contenu {
  flex: 1;
  padding: 16px;
  min-height: 350px;
}

.etiquette-formulaire {
  display: block;
  margin-bottom: 4px;
  font-weight: 500;
}

.champ-saisie {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
  margin-bottom: 12px;
}

.lien {
  color: #1d4ed8;
  text-decoration: none;
  display: inline-block;
  margin-top: 8px;
}

.options-radio {
  display: flex;
  gap: 16px;
  margin-top: 4px;
}

.inputs-dimensions {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.inputs-dimensions .petite {
  flex: 1;
  min-width: 60px;
  max-width: 100px;
}

.zone-editeur {
  padding: 16px;
  border-top: 1px solid #ccc;
  min-height: 160px;
}

.editeur {
  width: 100%;
  resize: none;
}


.admin-inventory {
  max-width: 600px;
  margin: 20px auto;
  font-family: Arial, sans-serif;
}

.admin-inventory h2 {
  text-align: center;
  margin-bottom: 15px;
}

.add-variant {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: baseline;
}

.add-variant input,
.add-variant select {
  flex: 1;
  padding: 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
  min-width: 80px;
}


.add-variant span {
  color: #fff;
  background-color: black;
  cursor: pointer;
  white-space: nowrap;
}

.delete-btn {
  background-color: #dc3545;
  color: #fff;
  cursor: pointer;
}

.delete-btn:hover {
  background-color: #a71d2a;
}

.zone-planification {
  margin-top: 12px;
}

.ligne-planification {
  display: flex;
  gap: 20px;
  align-items: center;
}

.ligne-categorie {
  display: flex;
  gap: 20px;
  align-items: center;
}

.bloc-champ {
  display: flex;
  flex-direction: column;
}

.lien-fermeture {
  white-space: nowrap;
  margin-top: 20px;
}

.btn-ajout {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 50px;
  height: 40px;
  background-color: #111827;
  color: #fff;
  border-radius: 5%;

  font-size: 18px;
}

.btn-ajout:hover,
.btn-ajout:focus {
  background-color: #222;
  color: #fff;
  text-decoration: none;
  outline: none;
  transform: none;
}



@media (max-width: 992px) {
  .corps-carte {
    flex-direction: column;
  }

  .barre-laterale {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid #ccc;
    display: flex;
    overflow-x: auto;
  }

  .element-barre {
    flex: 1;
    text-align: center;
    white-space: nowrap;
  }

  .contenu {
    width: 100%;
  }
}

@media (max-width: 576px) {
  .conteneur {
    padding: 8px;
  }

  .carte {
    border-radius: 6px;
  }

  .corps-carte {
    flex-direction: column;
  }

  .element-barre {
    text-align: left;
    border-bottom: 1px solid #eee;
  }

  .ligne-formulaire {
    flex-direction: column;
    align-items: flex-start;
  }

  .champ-saisie {
    width: 100%;
  }

  .inputs-dimensions {
    flex-direction: column;
    gap: 4px;
  }

  .inputs-dimensions .petite {
    width: 100%;
    max-width: none;
  }

  .zone-editeur {
    height: auto;
  }
}

/* Bouton flottant */
.bouton-flottant {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 50px;
  height: 50px;
  background-color: #111827;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 2000;
  color: #fff;
  font-size: 24px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
  transition: all 0.3s ease;
}


.bouton-flottant i {
  animation: rotationIcône 5s linear infinite;
}


@keyframes rotationIcône {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}


.bouton-flottant:hover {
  background-color: #1f2937;
  transform: scale(1.1);
}


@media (max-width: 768px) {
  .bouton-flottant {
    width: 45px;
    height: 45px;
    font-size: 22px;
  }
}


@media (max-width: 480px) {
  .bouton-flottant {
    width: 40px;
    height: 40px;
    font-size: 20px;
  }
}

/* DASHBOARD */



.dashboard {

  padding: 20px;
}

.grille-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 30px;
}

.carte-stat {
  background: #fff;
  padding: 20px;
  border-radius: 12px;
  box-shadow: rgba(60, 64, 67, 0.3) 0 1px 2px, rgba(60, 64, 67, 0.15) 0 1px 3px 1px;
}

.label-stat {
  color: #777;
  margin-bottom: 8px;
}

.valeur-stat {
  font-size: 28px;
  font-weight: bold;
}


.grille-principale {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
}


.carte-admin {
  background: #fff;
  padding: 20px;
  border-radius: 12px;
  box-shadow: rgba(60, 64, 67, 0.3) 0 1px 2px, rgba(60, 64, 67, 0.15) 0 1px 3px 1px;
}

.titre-carte-admin {
  margin-bottom: 15px;
}


.zone-graphique {
  height: 250px;
  background: #eef1f6;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.placeholder-admin {
  color: #999;
}


.table-commandes {
  width: 100%;
  border-collapse: collapse;
}

.table-commandes th,
.table-commandes td {
  padding: 10px 0;
  text-align: left;
}

.table-commandes th {
  color: #888;
  font-weight: normal;
}

.lien-plus {
  display: inline-block;
  margin-top: 10px;
  color: #3b82f6;
  text-decoration: none;
}

.valeur-grand {
  font-size: 42px;
  font-weight: bold;
}

.produit {
  display: flex;
  gap: 15px;
  align-items: center;
}

.image-produit {
  width: 60px;
  height: 60px;
  background: #ddd;
  border-radius: 10px;
}

.nom-produit {
  font-weight: bold;
}

.quantite-produit {
  color: #777;
}

.champ-couleur {
  width: 100%;
  min-height: 42px;
  padding: 4px 6px;
  font-size: 14px;
  box-sizing: border-box;
  border: 1px solid #ccc;
  border-radius: 6px;
}

/* --- Password Toggle --- */
.password-wrapper {
  position: relative;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 15px;
  transform: translateY(-50%);
  cursor: pointer;
  color: var(--accent-color);
  font-size: 14px;
  user-select: none;
  font-weight: 500;
  background: none !important;
  border: none !important;
  padding: 0 !important;
  margin: 0 !important;
  z-index: 5;
  text-transform: none !important;
  box-shadow: none !important;
}

.password-toggle:hover {
  color: var(--dark-color);
}