/* ===================================================================
   Éditeur Imprimerie Montandon — styles minimaux
   Tout est préfixé .imp-* pour ne pas entrer en collision avec Divi.
   =================================================================== */

/* Barre admin en bas */
.imp-admin-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #1f2937;
  color: #f9fafb;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  z-index: 99999;
  box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.15);
}
.imp-admin-bar__brand { font-weight: 600; color: #fbbc00; }
.imp-admin-bar__user  { color: #9ca3af; }
.imp-admin-bar__spacer { flex: 1; }
.imp-admin-bar__btn {
  background: #374151;
  color: #f9fafb;
  border: none;
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
}
.imp-admin-bar__btn:hover { background: #4b5563; }
.imp-admin-bar__btn--primary { background: #fbbc00; color: #1f2937; }
.imp-admin-bar__btn--primary:hover { background: #fcd34d; }
.imp-admin-bar__btn--danger:hover { background: #dc2626; }

/* Mode édition activé : pousser le contenu pour ne pas être caché */
body.imp-editing { padding-bottom: 60px; }

/* Surbrillance des blocs éditables en mode édition */
body.imp-editing [data-edit-id] {
  outline: 2px dashed transparent;
  outline-offset: 2px;
  cursor: pointer;
  transition: outline-color 0.15s;
  position: relative;
}
body.imp-editing [data-edit-id]:hover {
  outline-color: #fbbc00;
}
body.imp-editing [data-edit-id][data-edit-active="true"] {
  outline: 2px solid #fbbc00;
  outline-offset: 2px;
}

/* Indicateur du type de bloc au hover */
body.imp-editing [data-edit-id]::before {
  content: attr(data-edit-id);
  position: absolute;
  top: -22px;
  left: 0;
  background: #1f2937;
  color: #fbbc00;
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 3px;
  font-family: monospace;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 100;
  white-space: nowrap;
}
body.imp-editing [data-edit-id]:hover::before {
  opacity: 1;
}

/* Texte en édition : contenteditable activé */
body.imp-editing [data-edit-id][contenteditable="true"] {
  background: rgba(251, 188, 0, 0.08);
  outline: 2px solid #fbbc00;
}

/* Modale de login */
.imp-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100000;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
.imp-modal__panel {
  background: white;
  border-radius: 8px;
  padding: 32px;
  min-width: 360px;
  max-width: 90vw;
  max-height: 90vh;
  overflow: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}
.imp-modal__title {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 20px;
  color: #1f2937;
}
.imp-modal__field {
  margin-bottom: 16px;
}
.imp-modal__field label {
  display: block;
  font-size: 13px;
  color: #6b7280;
  margin-bottom: 6px;
}
.imp-modal__field input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  font-size: 14px;
  font-family: inherit;
  box-sizing: border-box;
}
.imp-modal__field input:focus {
  outline: none;
  border-color: #fbbc00;
  box-shadow: 0 0 0 3px rgba(251, 188, 0, 0.2);
}
.imp-modal__error {
  background: #fef2f2;
  color: #b91c1c;
  padding: 10px;
  border-radius: 4px;
  font-size: 13px;
  margin-bottom: 16px;
}
.imp-modal__actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 20px;
}
.imp-modal__btn {
  padding: 10px 18px;
  border-radius: 4px;
  border: none;
  cursor: pointer;
  font-size: 14px;
  font-family: inherit;
  font-weight: 500;
}
.imp-modal__btn--primary { background: #fbbc00; color: #1f2937; }
.imp-modal__btn--primary:hover { background: #fcd34d; }
.imp-modal__btn--secondary { background: #e5e7eb; color: #1f2937; }
.imp-modal__btn--secondary:hover { background: #d1d5db; }

/* Bibliothèque d'images (modale) */
.imp-modal__panel--lib {
  width: 800px;
  max-width: 90vw;
}
.imp-library-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
  margin: 20px 0;
  max-height: 50vh;
  overflow-y: auto;
  padding: 4px;
}
.imp-library-item {
  border: 2px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  overflow: hidden;
  background: #f9fafb;
  transition: border-color 0.15s, transform 0.15s;
}
.imp-library-item:hover {
  border-color: #fbbc00;
  transform: translateY(-2px);
}
.imp-library-item img {
  width: 100%;
  height: 120px;
  object-fit: cover;
  display: block;
}
.imp-library-item__name {
  padding: 6px 8px;
  font-size: 11px;
  color: #6b7280;
  text-align: center;
  word-break: break-all;
}

/* Zone d'upload */
.imp-upload-zone {
  border: 2px dashed #d1d5db;
  border-radius: 6px;
  padding: 20px;
  text-align: center;
  margin-bottom: 16px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.imp-upload-zone:hover, .imp-upload-zone--dragover {
  border-color: #fbbc00;
  background: rgba(251, 188, 0, 0.05);
}
.imp-upload-zone__hint {
  font-size: 13px;
  color: #6b7280;
}

/* Toast de notification */
.imp-toast {
  position: fixed;
  bottom: 80px;
  right: 20px;
  background: #1f2937;
  color: #f9fafb;
  padding: 12px 18px;
  border-radius: 4px;
  font-family: -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 14px;
  z-index: 100001;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
}
.imp-toast--visible { opacity: 1; transform: translateY(0); }
.imp-toast--success { background: #059669; }
.imp-toast--error { background: #dc2626; }

/* Lien "admin" discret en bas du site (point d'entrée du login) */
.imp-admin-link {
  display: inline-block;
  color: #999;
  font-size: 11px;
  text-decoration: none;
  margin-left: 8px;
  opacity: 0.5;
}
.imp-admin-link:hover { opacity: 1; color: #fbbc00; }
