/** Novtinis — sélecteurs de fichiers publics FR / KM / EN. */
.nt-file-picker {
  --nt-file-picker-border: #cbd5e1;
  --nt-file-picker-bg: #fff;
  --nt-file-picker-button-bg: #0f172a;
  --nt-file-picker-button-color: #fff;
  --nt-file-picker-status-color: #475569;
  position: relative;
  display: grid;
  grid-template-columns: minmax(138px, max-content) minmax(0, 1fr);
  align-items: stretch;
  width: 100%;
  min-height: 50px;
  overflow: hidden;
  border: 1px solid var(--nt-file-picker-border);
  border-radius: 15px;
  background: var(--nt-file-picker-bg);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.nt-file-picker__input {
  position: absolute !important;
  inset: 0 !important;
  z-index: 3;
  width: 100% !important;
  height: 100% !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  opacity: 0 !important;
  cursor: pointer;
}

.nt-file-picker__button,
.nt-file-picker__status {
  display: flex;
  align-items: center;
  min-width: 0;
  line-height: 1.35;
}

.nt-file-picker__button {
  justify-content: center;
  padding: 12px 15px;
  background: var(--nt-file-picker-button-bg);
  color: var(--nt-file-picker-button-color) !important;
  -webkit-text-fill-color: var(--nt-file-picker-button-color) !important;
  font-size: calc(13px + var(--nt-km-font-boost, 0px));
  font-weight: 900;
  text-align: center;
}

.nt-file-picker__status {
  padding: 11px 13px;
  color: var(--nt-file-picker-status-color) !important;
  -webkit-text-fill-color: var(--nt-file-picker-status-color) !important;
  font-size: calc(12.5px + var(--nt-km-font-boost, 0px));
  font-weight: 750;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nt-file-picker.has-selection {
  --nt-file-picker-border: #86efac;
  --nt-file-picker-bg: #f0fdf4;
  --nt-file-picker-status-color: #166534;
}

.nt-file-picker__input:focus-visible ~ .nt-file-picker__button {
  outline: 3px solid rgba(249, 115, 22, 0.32);
  outline-offset: -3px;
}

.nt-file-picker__input:disabled ~ .nt-file-picker__button,
.nt-file-picker__input:disabled ~ .nt-file-picker__status {
  opacity: 0.55;
}

/* Formulaire sombre « Ajouter un commerce ». */
.seva-add-field .nt-file-picker {
  --nt-file-picker-border: rgba(148, 163, 184, 0.42);
  --nt-file-picker-bg: rgba(15, 23, 42, 0.42);
  --nt-file-picker-button-bg: linear-gradient(135deg, #f97316, #ec4899);
  --nt-file-picker-status-color: #cbd5e1;
  box-shadow: none;
}

.seva-add-field .nt-file-picker.has-selection {
  --nt-file-picker-border: rgba(74, 222, 128, 0.65);
  --nt-file-picker-bg: rgba(20, 83, 45, 0.24);
  --nt-file-picker-status-color: #dcfce7;
}

/* Contribution menu : conserve le ton orangé existant. */
.single-menu-photo-upload-h61i .nt-file-picker {
  --nt-file-picker-border: #fdba74;
  --nt-file-picker-bg: #fff;
  --nt-file-picker-button-bg: #ea580c;
  --nt-file-picker-status-color: #7c2d12;
}

/* Fenêtre de contribution photo. */
.nt-listing-photo-picker .nt-file-picker {
  margin-top: 8px;
}

html[lang^="km"] .nt-file-picker__button,
html[lang^="km"] .nt-file-picker__status {
  letter-spacing: normal !important;
  text-transform: none !important;
  font-kerning: normal !important;
  line-height: 1.55;
}

@media (max-width: 390px) {
  .nt-file-picker {
    grid-template-columns: minmax(126px, 44%) minmax(0, 1fr);
  }

  .nt-file-picker__button {
    padding-inline: 10px;
    font-size: calc(12px + var(--nt-km-font-boost, 0px));
  }

  .nt-file-picker__status {
    padding-inline: 10px;
    font-size: calc(12px + var(--nt-km-font-boost, 0px));
  }
}

/* Aperçu immédiat des images sélectionnées, avant validation du formulaire. */
.nt-file-picker-preview {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  gap: 9px;
  width: 100%;
  margin-top: 10px;
  pointer-events: none;
}

.nt-file-picker-preview[hidden] {
  display: none !important;
}

.nt-file-picker-preview__item {
  position: relative;
  display: block;
  min-width: 0;
  overflow: hidden;
  aspect-ratio: 1 / 1;
  border: 1px solid #dbe4ee;
  border-radius: 13px;
  background: #eef2f7;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
}

.nt-file-picker-preview__image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.nt-file-picker-preview__badge {
  position: absolute;
  top: 5px;
  right: 5px;
  display: grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border: 2px solid rgba(255, 255, 255, 0.9);
  border-radius: 999px;
  background: #0f172a;
  color: #fff;
  font-size: calc(11px + var(--nt-km-font-boost, 0px));
  font-weight: 900;
  line-height: 1;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.22);
}

.seva-add-field .nt-file-picker-preview__item {
  border-color: rgba(148, 163, 184, 0.5);
  background: rgba(15, 23, 42, 0.5);
}

.nt-listing-photo-picker .nt-file-picker-preview {
  grid-template-columns: repeat(auto-fill, minmax(78px, 1fr));
}

@media (max-width: 390px) {
  .nt-file-picker-preview {
    grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
    gap: 8px;
  }
}


/* Lot 20 — bouton explicite pour compléter une sélection existante. */
.nt-file-picker__add-more {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  margin-top: 10px;
  padding: 10px 15px;
  border: 1px solid #fdba74;
  border-radius: 13px;
  background: #fff7ed;
  color: #c2410c;
  font: inherit;
  font-size: calc(12.5px + var(--nt-km-font-boost, 0px));
  line-height: 1.2;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
}

.nt-file-picker__add-more[hidden] {
  display: none !important;
}

.nt-file-picker__add-more:focus-visible {
  outline: 3px solid rgba(249, 115, 22, 0.28);
  outline-offset: 2px;
}

.seva-add-field .nt-file-picker__add-more {
  border-color: rgba(74, 222, 128, 0.58);
  background: rgba(20, 83, 45, 0.26);
  color: #bbf7d0;
  box-shadow: none;
}

html[lang^="km"] .nt-file-picker__add-more {
  line-height: 1.55;
  letter-spacing: normal;
}

/* Lot 359 C11 — réorganisation explicite après sélection. */
button.nt-file-picker__button {
  border: 0;
  font: inherit;
  cursor: pointer;
}

.nt-file-picker-preview.is-reorder-mode {
  pointer-events: auto;
}

.nt-file-picker-preview__reorder {
  position: absolute;
  inset: auto 5px 5px 5px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
  z-index: 3;
}

.nt-file-picker-preview__move {
  min-width: 0;
  min-height: 28px;
  padding: 2px 5px;
  border: 1px solid rgba(255, 255, 255, 0.92);
  border-radius: 9px;
  background: rgba(15, 23, 42, 0.86);
  color: #fff;
  font: inherit;
  font-size: 16px;
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.18);
}

.nt-file-picker-preview__move:disabled {
  opacity: 0.32;
  cursor: default;
}


/* Lot 359 C13 — en réorganisation l'ordre est instantané : pas de bouton Terminer. */
.nt-file-picker.is-reorder-mode .nt-file-picker__button[hidden] {
  display: none !important;
}
.nt-file-picker.is-reorder-mode .nt-file-picker__status {
  grid-column: 1 / -1;
  justify-content: center;
  text-align: center;
}


/* Lot 359 C15 — pendant la réorganisation, le compteur 4/6 n'a pas besoin
 * d'occuper une barre entière. Les flèches modifient déjà l'ordre en direct.
 * Ciblé sur les photos commerce + avis, donc commun owner/Novtiniseur/membre. */
.nt-file-picker.nt-file-picker--photo-selection.is-reorder-mode {
  display: none !important;
}
