/* Module images : CSS extrait d'argon-app.css (scripts/extract_module_css.py). Feuille du module : editer ici, avec les variables de static/css/app/tokens.css. */
.image-library-item {
  background: white;
  border: 1px solid var(--mv-gray-200);
  border-radius: 12px;
  overflow: hidden;
  transition: all 0.3s ease;
  cursor: pointer;
  position: relative;
}

.image-library-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0,0,0,0.1);
  border-color: var(--mv-primary);
}

.image-library-item.selected {
  border-color: var(--mv-primary);
  box-shadow: 0 8px 25px rgba(0, 85, 255, 0.18);
  transform: translateY(-2px);
}

.image-library-item.selected::after {
  content: '\f00c';
  font-family: 'Font Awesome 5 Free';
  font-weight: 900;
  position: absolute;
  top: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--mv-primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  box-shadow: 0 4px 12px rgba(0, 85, 255, 0.35);
  z-index: 10;
}

.image-preview {
  position: relative;
  height: 140px;
  overflow: hidden;
}

.image-media {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--mv-gray-50);
}

.image-actions {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.image-library-item:hover .image-actions {
  opacity: 1;
}

.image-library-item.selected .image-actions {
  opacity: 0;
}

.image-actions .btn {
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.image-info {
  padding: 10px;
}

.image-title {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 0;
  color: var(--mv-text-heading);
  line-height: 1.2;
}

/* Image Card Styles */
.image-card {
  background: white;
  border: 1px solid var(--mv-gray-200);
  border-radius: 12px;
  overflow: hidden;
  transition: all 0.3s ease;
  cursor: pointer;
  position: relative;
}

.image-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0,0,0,0.1);
  border-color: var(--mv-primary);
}

.image-add-card {
  border: 2px dashed var(--mv-gray-300);
  background: var(--mv-gray-50);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  transition: all 0.3s ease;
}

.image-add-card:hover {
  border-color: var(--mv-primary);
  background: linear-gradient(135deg, var(--mv-primary) 0%, #825ee4 100%);
  color: white;
  transform: translateY(-2px);
}

.image-add-content {
  text-align: center;
  padding: 1rem;
}

/* === RESPONSIVE STYLES === */

/* Tablet and smaller */
@media (max-width: 768px) {

  .image-preview {
    height: 120px;
  }

  .image-info {
    padding: 8px;
  }
}

/* 🏷️ Badge compteur d'images - Design raffiné */
#aiReferencePreview .reference-img-preview .image-number {
  position: absolute;
  bottom: 3px;
  left: 3px;
  background: linear-gradient(135deg, rgba(0, 85, 255, 0.95) 0%, rgba(0, 85, 255, 0.85) 100%);
  color: white;
  border-radius: 8px;
  padding: 2px 7px;
  font-size: 9px;
  font-weight: 700;
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
  letter-spacing: 0.3px;
}

.image-library-item {
  background: white;
  border: 1px solid var(--mv-gray-200);
  border-radius: 12px;
  overflow: hidden;
  transition: all 0.3s ease;
  cursor: pointer;
  position: relative;
}

.image-library-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0,0,0,0.1);
  border-color: var(--mv-primary);
}

.image-library-item.selected {
  border-color: var(--mv-primary);
  box-shadow: 0 8px 25px rgba(0, 85, 255, 0.18);
  transform: translateY(-2px);
}

.image-library-item.selected::after {
  content: '\f00c';
  font-family: 'Font Awesome 5 Free';
  font-weight: 900;
  position: absolute;
  top: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--mv-primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  box-shadow: 0 4px 12px rgba(0, 85, 255, 0.35);
  z-index: 10;
}

.image-preview {
  position: relative;
  height: 140px;
  overflow: hidden;
}

.image-media {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--mv-gray-50);
}

.image-actions {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.image-library-item:hover .image-actions {
  opacity: 1;
}

.image-library-item.selected .image-actions {
  opacity: 0;
}

.image-actions .btn {
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.image-info {
  padding: 10px;
}

.image-title {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 0;
  color: var(--mv-text-heading);
  line-height: 1.2;
}

/* Responsive */
@media (max-width: 768px) {

  .image-preview {
    height: 120px;
  }

  .image-info {
    padding: 8px;
  }
}

/* === STYLES POUR LA CARD D'AJOUT D'IMAGE === */

.image-card {
  background: white;
  border: 1px solid var(--mv-gray-200);
  border-radius: 12px;
  overflow: hidden;
  transition: all 0.3s ease;
  cursor: pointer;
  position: relative;
}

.image-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0,0,0,0.1);
  border-color: var(--mv-primary);
}

/* Image Add Card */
.image-add-card {
  border: 2px dashed var(--mv-gray-300);
  background: var(--mv-gray-50);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  transition: all 0.3s ease;
}

.image-add-card:hover {
  border-color: var(--mv-primary);
  background: linear-gradient(135deg, var(--mv-primary) 0%, #825ee4 100%);
  color: white;
  transform: translateY(-2px);
}

.image-add-content {
  text-align: center;
  padding: 1rem;
}

.image-add-card:hover .add-icon {
  background: rgba(255,255,255,0.2);
  color: white;
}

.image-add-card:hover .add-text {
  color: white;
}

.image-add-card:hover .add-description {
  color: rgba(255,255,255,0.8);
}

/* Styles pour le positionneur d'image */
.image-positioner-overlay {
    position: absolute;
    cursor: move;
    opacity: 0.7;
    transform-origin: center center;
    transition: box-shadow 0.2s;
}

.image-positioner-overlay:hover {
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.5);
}

.image-positioner-overlay img {
    display: block;
    max-width: 400px;
    max-height: 400px;
    width: auto;
    height: auto;
    pointer-events: none;
    user-select: none;
}

.image-positioner-overlay .overlay-border {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border: 3px dashed #007bff;
    pointer-events: none;
    box-sizing: border-box;
}

.image-positioner-overlay .overlay-handles {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
}

.image-positioner-overlay .handle {
    position: absolute;
    width: 14px;
    height: 14px;
    background: #007bff;
    border: 2px solid #fff;
    border-radius: 50%;
    pointer-events: auto;
    cursor: nwse-resize;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.image-positioner-overlay .handle-nw { top: -7px; left: -7px; cursor: nwse-resize; }
.image-positioner-overlay .handle-ne { top: -7px; right: -7px; cursor: nesw-resize; }
.image-positioner-overlay .handle-sw { bottom: -7px; left: -7px; cursor: nesw-resize; }
.image-positioner-overlay .handle-se { bottom: -7px; right: -7px; cursor: nwse-resize; }

.image-positioner-overlay .rotation-handle {
    position: absolute;
    top: -40px;
    left: 50%;
    transform: translateX(-50%);
    width: 32px;
    height: 32px;
    background: #fff;
    border: 2px solid #007bff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: grab;
    pointer-events: auto;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    transition: transform 0.2s, box-shadow 0.2s;
}

.image-positioner-overlay .rotation-handle:hover {
    transform: translateX(-50%) scale(1.1);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.image-positioner-overlay .rotation-handle:active {
    cursor: grabbing;
}

.image-positioner-overlay .rotation-handle svg {
    color: #007bff;
}
#aiRetouchModal .reference-img-preview .image-number { font-size: 8px; padding: 0 3px; bottom: 1px; left: 1px; }
#imageLibraryModal.is-page-editor .image-library-item, #imageLibraryModal.is-page-editor .image-add-card { margin: 0; border: 1px solid var(--mv-gray-200); border-radius: .5rem; overflow: hidden; cursor: pointer; min-width: 0; height: 144px; min-height: 144px; }
#imageLibraryModal.is-page-editor .image-preview { height: 104px; overflow: hidden; background: var(--mv-gray-100); }
#imageLibraryModal.is-page-editor .image-media { width: 100%; height: 104px; object-fit: contain; }
#imageLibraryModal.is-page-editor .image-info { padding: .4rem .5rem; }
#imageLibraryModal.is-page-editor .image-title { margin: 0; font-size: .72rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#imageLibraryModal.is-page-editor .image-library-item.selected { border: 2px solid #315bda; box-shadow: 0 0 0 2px var(--mv-primary-100); }
#imageLibraryModal.is-page-editor .image-add-content { min-height: 132px; display: flex; flex-direction: column; align-items: center; justify-content: center; background: var(--mv-gray-50); padding: .5rem; }
#imageLibraryModal.is-page-editor .image-add-content .add-icon { font-size: 1.1rem; margin-bottom: .45rem; }
.image-library-current { display: flex; align-items: center; gap: .65rem; margin: .75rem 1rem 0; padding: .4rem .6rem; border: 1px solid var(--mv-gray-200); border-radius: .4rem; background: #fff; text-align: left; max-width: calc(100% - 2rem); font-size: .75rem; }
.image-library-current img { width: 52px; height: 40px; object-fit: contain; }
.image-library-current span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.image-library-current.selected { background: var(--mv-primary-50); border-color: #315bda; }
.image-library-selection-name { margin-right: auto; color: var(--mv-gray-500); font-size: .72rem; max-width: 40%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.image-library-load-more { grid-column: 1 / -1; justify-self: center; padding: .45rem .8rem; border: 1px solid var(--mv-gray-300); border-radius: .4rem; background: #fff; color: var(--mv-gray-600); font-size: .75rem; }
