/* UXCard - configurateur « Personnaliser ma carte » (popup + page de rendu) */
/* Popup dans la nouvelle DA (13/11/2026, préprod : il faut les couleurs --or, --or-fonce, --acier, --graphite) :
   fenêtre sombre, accents or, champs de saisie clairs. Règle de contraste : sur le panneau sombre, un contrôle prend
   un voile clair et un liseré acier, son état choisi passe en clair ou en or ; jamais de gris foncé sur le sombre.
   La scène est crème pour la carte noire, sombre pour l'acier brossé (comme les vitrines de l'accueil).
   Les boutons Valider / Fermer portent les classes de bouton du thème (primary, light), posées par configurateur.js.
   La page de rendu et l'onglet « Mes profils NFC » (plus bas) gardent leur mise en forme. */

.uxp, .uxp-rendu, .uxp-profil { --uxp-rouge: #c62828; }

body.uxp-ouvert { overflow: hidden; }

.uxp[hidden] { display: none; }
.uxp button { text-align: center; }
.uxp {
  --uxp-voile: color-mix(in srgb, var(--blanc) 12%, transparent);
  --uxp-voile-fort: color-mix(in srgb, var(--blanc) 20%, transparent);
  --uxp-lisere: color-mix(in srgb, var(--acier) 55%, transparent);
  position: fixed; inset: 0; z-index: 100000;
  background: color-mix(in srgb, var(--primary-0) 78%, transparent);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  color: var(--blanc);
}
.uxp__boite {
  background: var(--graphite);
  width: min(1180px, 100%); max-height: 100%;
  overflow: hidden; border-radius: 16px;
  border: 1px solid color-mix(in srgb, var(--acier) 35%, transparent);
  box-shadow: 0 40px 120px -20px var(--primary-0), 0 0 90px -30px color-mix(in srgb, var(--or) 45%, transparent);
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
}
@media (max-width: 991px) {
  .uxp { padding: 0; }
  .uxp__boite { display: flex; flex-direction: column; height: 100%; max-height: none; overflow: auto; border: 0; border-radius: 0; }
  .uxp__boite > * { flex: none; }
}

/* ---- scène ---- */
.uxp__scene {
  --uxp-encre: var(--primary);
  --uxp-encre-douce: var(--primary-h-opa-7);
  --uxp-accent: var(--or-fonce);
  /* fond blanc pour les deux finitions (Arthur, 16/11/2026 ; avant : crème, et sombre pour l'acier) */
  background: var(--blanc);
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
  gap: 18px; padding: 56px 28px 28px; position: relative;
  color: var(--uxp-encre);
  /* fenêtre peu haute : la colonne défile comme le panneau de droite (Arthur, 16/11/2026 : « on ne peut pas scroller le
     texte à gauche ») ; centrée par les marges automatiques quand tout tient (justify-content: center couperait le haut) */
  min-height: min(560px, calc(100vh - 48px)); max-height: calc(100vh - 48px); overflow-y: auto; overscroll-behavior: contain;
}
.uxp__scene > .uxp-stage { margin-top: auto; }
.uxp__scene > :last-child { margin-bottom: auto; }
@media (max-width: 991px) { .uxp__scene { min-height: 0; max-height: none; overflow: visible; padding: 52px 16px 22px; } }

.uxp-stage { width: 100%; display: flex; justify-content: center; perspective: 1200px; touch-action: none; }
.uxp-stage__etiquette {
  position: absolute; top: 16px; left: 20px;
  font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--primary-h-opa-6);
}
.uxp .uxp-stage__etiquette {
  top: 22px; left: 28px;
  font-size: 13px; font-weight: 600; letter-spacing: .14em; color: var(--uxp-accent);
}
.uxp-carte3d {
  width: min(460px, 100%); aspect-ratio: 1.585; position: relative;
  transform-style: preserve-3d; will-change: transform;
}
.uxp-carte {
  position: absolute; inset: 0; border-radius: 14px; overflow: hidden;
  box-shadow: 0 30px 60px rgba(0, 0, 0, .6), inset 0 1px 0 rgba(255, 255, 255, .12), inset 0 -1px 0 rgba(0, 0, 0, .5);
  container-type: inline-size;
}
.uxp-carte__reflet {
  position: absolute; inset: 0; pointer-events: none; z-index: 2;
  background: linear-gradient(115deg, rgba(255,255,255,0) 30%, rgba(255,255,255,.12) 48%, rgba(255,255,255,0) 60%);
  background-size: 200% 100%; background-position: 50% 50%;
}
.uxp-carte__guide { position: absolute; pointer-events: none; z-index: 5; display: none; }
/* Bordure plutôt que fond : une bordure est calée sur un pixel entier, un fond à 50 % peut s'étaler sur deux */
.uxp-carte__guide--v { left: 50%; top: 0; bottom: 0; border-left: 1px solid; }
.uxp-carte__guide--h { top: 50%; left: 0; right: 0; border-top: 1px solid; }
.uxp-carte__couche { position: absolute; inset: 0; z-index: 3; }
.uxp-carte__nfc { position: absolute; z-index: 4; pointer-events: none; opacity: .94; }
.uxp-carte__nfc[hidden] { display: none; }
.uxp-carte__nfc svg { display: block; width: 100%; height: 100%; }

/* éléments */
.uxp-el { position: absolute; touch-action: none; user-select: none; outline: 1px dashed transparent; outline-offset: 3px; }
.uxp-stage--edition .uxp-el { cursor: grab; }
.uxp-stage--edition .uxp-el:active { cursor: grabbing; }
.uxp-el--sel { outline-color: var(--gold); }
.uxp-stage--3d .uxp-el { outline-color: transparent; pointer-events: none; }
.uxp-el__texte { display: block; white-space: pre; line-height: 1.35; padding: 2px 3px; }
.uxp-el__img { position: absolute; inset: 0; background-size: contain; background-position: center; background-repeat: no-repeat; opacity: .94; }
/* Logo gravé plein : sa silhouette, peinte dans la couleur du texte */
.uxp-el__img--logo { -webkit-mask-size: contain; mask-size: contain; -webkit-mask-position: center; mask-position: center; -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat; }
.uxp-el__placeholder {
  position: absolute; inset: 0; display: none; align-items: center; justify-content: center;
  border: 1px dashed; font-weight: 700; font-size: 3.2cqw; letter-spacing: .14em; opacity: .6;
}
.uxp-el--vide .uxp-el__placeholder { display: flex; }
.uxp-el__poignee {
  position: absolute; right: -9px; bottom: -9px; width: 14px; height: 14px; border-radius: 50%;
  background: var(--blanc); border: 2px solid var(--primary); cursor: nwse-resize; display: none; z-index: 6;
}
.uxp-el--sel .uxp-el__poignee { display: block; }
.uxp-stage--3d .uxp-el__poignee { display: none; }

/* Édition / Aperçu 3D (aussi sur la page de rendu, qui garde ces règles de base) */
.uxp__modes { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.uxp__mode {
  height: 34px; padding: 0 16px; border: 1px solid var(--primary-h-opa-2); background: var(--blanc);
  color: var(--primary-h-opa-6); font-size: 12px; border-radius: 3px; cursor: pointer;
}
.uxp__mode--actif { background: var(--primary); border-color: var(--primary); color: var(--blanc); }
.uxp__aide { font-size: 11px; color: var(--gris); text-align: center; max-width: 420px; }
.uxp__alerte { color: var(--uxp-rouge); font-size: 12px; line-height: 1.5; font-weight: 700; }

/* dans la popup : sélecteur en pilule, comme la finition de la fiche produit */
.uxp .uxp__modes {
  gap: 4px; flex-wrap: nowrap; padding: 4px; border-radius: 12px;
  background: var(--primary);
  box-shadow: 0 10px 30px -12px color-mix(in srgb, var(--primary-0) 60%, transparent);
}
.uxp .uxp__mode {
  height: 38px; padding: 0 18px; border: 0; border-radius: 9px; background: none;
  font-family: inherit; font-size: 14px; font-weight: 600; color: var(--blanc);
  transition: background .2s ease, color .2s ease;
}
.uxp .uxp__mode--actif { background: var(--or); color: var(--primary-0); }
.uxp .uxp__aide { max-width: 440px; font-size: 13px; line-height: 1.5; color: var(--uxp-encre-douce); text-wrap: pretty; }
.uxp .uxp__aide a { color: var(--uxp-encre); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
/* l'avertissement « pas de couleur » : un encart or, lisible sur la scène claire comme sur la sombre */
.uxp .uxp__alerte {
  padding: 12px 16px; border: 1px solid color-mix(in srgb, var(--or) 70%, transparent); border-radius: 10px;
  background: color-mix(in srgb, var(--or) 16%, transparent);
  font-size: 13px; font-weight: 600; line-height: 1.5; color: var(--uxp-encre);
}

/* ---- panneau ---- */
.uxp__panneau {
  padding: 28px; display: flex; flex-direction: column; gap: 18px; max-height: calc(100vh - 48px); overflow: auto;
  background: linear-gradient(180deg, color-mix(in srgb, var(--graphite), var(--blanc) 4%), var(--graphite));
  scrollbar-width: thin; scrollbar-color: var(--uxp-lisere) transparent;
}
@media (max-width: 991px) {
  .uxp__panneau { max-height: none; overflow: visible; padding: 22px 16px 28px; }
  /* bouton de fermeture flottant : blanc, lisible sur la scène claire comme sur la sombre */
  .uxp .uxp__fermer { position: fixed; top: 10px; right: 10px; z-index: 2; border-color: var(--blanc); background: var(--blanc); color: var(--primary); box-shadow: 0 4px 14px color-mix(in srgb, var(--primary-0) 35%, transparent); }
}
.uxp__entete { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.uxp__titre { font-size: var(--text-h4); margin: 0 0 6px; color: var(--blanc); }
.uxp__sous { font-size: 13px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--or); }
.uxp__fermer {
  flex: none; width: 40px; height: 40px; padding: 0; display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--uxp-lisere); border-radius: 50%; background: var(--uxp-voile); color: var(--blanc); cursor: pointer;
  transition: background .2s ease, color .2s ease;
}
.uxp__fermer:hover { background: var(--blanc); color: var(--primary); }

.uxp__champ { display: flex; flex-direction: column; gap: 8px; }
.uxp__label { font-size: 14px; font-weight: 600; color: var(--blanc); }
.uxp__label span { font-weight: 400; color: var(--primary-h-opa-2); }

/* finition, icône NFC, alignements : sélecteurs en pilule (voile clair, choix en blanc) */
.uxp__finitions, .uxp__segment {
  display: flex; gap: 4px; padding: 4px; border: 1px solid var(--uxp-lisere); border-radius: 12px; background: var(--uxp-voile);
}
.uxp__finition, .uxp__segment-btn {
  flex: 1; height: 40px; border: 0; border-radius: 9px; background: none; color: var(--blanc);
  font-family: inherit; font-size: 14px; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer;
  transition: background .2s ease, color .2s ease;
}
.uxp__finition:hover, .uxp__segment-btn:hover:not(:disabled) { background: var(--uxp-voile-fort); }
.uxp__finition--actif, .uxp__finition--actif:hover,
.uxp__segment-btn--actif, .uxp__segment-btn--actif:hover:not(:disabled) { background: var(--fond); color: var(--primary); }
.uxp__segment-btn:disabled { opacity: .4; cursor: default; }
.uxp__pastille { width: 14px; height: 14px; border-radius: 50%; border: 1px solid var(--acier); }

/* ajouter un texte, une image */
.uxp__ajouts { display: flex; gap: 10px; }
.uxp__ajout {
  flex: 1; height: 48px; border: 1px solid var(--uxp-lisere); border-radius: 10px; background: var(--uxp-voile); color: var(--blanc);
  font-family: inherit; font-size: 14px; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  cursor: pointer; position: relative; overflow: hidden;
  transition: background .2s ease, color .2s ease, border-color .2s ease;
}
.uxp__ajout svg { flex: none; color: var(--or); transition: color .2s ease; }
.uxp__ajout:hover { border-color: var(--blanc); background: var(--blanc); color: var(--primary); }
.uxp__ajout:hover svg { color: var(--or-fonce); }
.uxp__ajout input[type=file], .uxp__depot input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

/* calques */
.uxp__onglets { display: flex; flex-wrap: wrap; gap: 8px; }
.uxp__onglet {
  display: inline-flex; align-items: center; border: 1px solid var(--uxp-lisere); border-radius: 999px; overflow: hidden;
  background: var(--uxp-voile); color: var(--blanc); touch-action: none; cursor: grab; user-select: none;
}
.uxp__onglet--drag, .uxp__onglet--drag .uxp__onglet-nom { cursor: grabbing; }
.uxp__onglet--drag { opacity: .8; transform: scale(1.04); box-shadow: 0 6px 18px color-mix(in srgb, var(--primary-0) 50%, transparent); }
.uxp__onglets-aide { width: 100%; font-size: 12px; color: var(--primary-h-opa-2); }
.uxp__onglet--actif { border-color: var(--or); background: var(--or); color: var(--primary-0); }
.uxp__onglet-nom { height: 34px; padding: 0 6px 0 14px; border: 0; background: transparent; color: inherit; font-family: inherit; font-size: 13px; font-weight: 600; max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: grab; }
.uxp__onglet-x { height: 34px; width: 32px; padding: 0 4px 0 0; border: 0; background: transparent; color: inherit; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; opacity: .8; }
.uxp__onglet-x:hover { opacity: 1; }

/* réglages de l'élément choisi : champs de saisie clairs sur le panneau sombre */
.uxp__controles {
  display: flex; flex-direction: column; gap: 16px; padding: 18px;
  border: 1px solid color-mix(in srgb, var(--acier) 30%, transparent); border-radius: 12px;
  background: color-mix(in srgb, var(--blanc) 5%, transparent);
}
.uxp__vide { margin: 0; font-size: 14px; line-height: 1.5; color: var(--primary-h-opa-2); }
.uxp__centrer, .uxp__depot {
  min-height: 44px; border: 1px dashed var(--acier); border-radius: 10px; background: var(--uxp-voile); color: var(--blanc);
  font-family: inherit; font-size: 13px; font-weight: 600; line-height: 1.3; text-align: center;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  cursor: pointer; position: relative; overflow: hidden; align-self: flex-start; padding: 6px 14px;
  transition: background .2s ease;
}
.uxp__centrer:hover, .uxp__depot:hover { background: var(--uxp-voile-fort); }
.uxp__centrer svg { flex: none; color: var(--or); }
.uxp__depot { align-self: stretch; }
.uxp__textarea, .uxp__recherche {
  border: 1px solid var(--blanc); border-radius: 10px; background: var(--blanc); color: var(--primary);
  font-family: inherit; font-size: 15px;
}
.uxp__textarea { padding: 12px 14px; line-height: 1.5; resize: vertical; }
.uxp__recherche { height: 44px; padding: 0 14px; }
.uxp__textarea::placeholder, .uxp__recherche::placeholder { color: var(--primary-h-opa-7); opacity: 1; }
.uxp__textarea:focus-visible, .uxp__recherche:focus-visible { outline: 2px solid var(--or); outline-offset: 2px; }
.uxp__polices {
  display: flex; flex-direction: column; border-radius: 10px; overflow: auto; max-height: 240px; background: var(--blanc);
  scrollbar-width: thin; scrollbar-color: var(--primary-h-opa-2) transparent;
}
.uxp .uxp__police {
  text-align: left; display: flex; flex: none; align-items: center; justify-content: space-between; gap: 10px; height: 48px; padding: 0 16px;
  border: 0; border-bottom: 1px solid var(--primary-h-opa-1); background: var(--blanc); color: var(--primary); font-size: 17px; cursor: pointer;
}
.uxp__police:last-child { border-bottom: 0; }
.uxp .uxp__police--actif { border-bottom-color: var(--or); background: var(--or); color: var(--primary-0); }
.uxp .uxp__police:hover:not(.uxp__police--actif) { background: var(--fond); }
.uxp__police-aa { font-size: 11px; opacity: .6; }
.uxp__polices--resultats { max-height: 200px; }
.uxp__polices--resultats[hidden] { display: none; }
.uxp__polices-vide { padding: 12px 16px; color: var(--primary-h-opa-7); }
.uxp__grille { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.uxp__range { width: 100%; accent-color: var(--or); }

.uxp__note { margin: 0; font-size: 13px; line-height: 1.55; color: var(--primary-h-opa-2); text-wrap: pretty; }
.uxp__erreur { font-size: 14px; font-weight: 600; line-height: 1.5; color: var(--uxp-rouge); background: var(--blanc); padding: 12px 14px; border-radius: 10px; }
.uxp__erreur--info { color: var(--primary); }
/* Valider et Fermer : boutons du thème (primary, light), seulement leur place ici */
.uxp__actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: auto; }
.uxp__valider { flex: 1 1 auto; cursor: pointer; }
.uxp__valider:disabled { opacity: .6; cursor: wait; }
.uxp__secondaire { flex: none; cursor: pointer; }
.uxp button:focus-visible, .uxp label:focus-within { outline: 2px solid var(--acier); outline-offset: 2px; }

/* ---- page de rendu ---- */
.uxp-rendu { display: flex; flex-direction: column; gap: 32px; }
.uxp-rendu__scene { position: relative; background: radial-gradient(ellipse at 50% 40%, #fcfcfc 0%, #e9e9eb 78%); padding: 48px 24px 28px; border-radius: 10px; display: flex; flex-direction: column; align-items: center; gap: 18px; }
.uxp-rendu__scene .uxp-carte3d { width: min(560px, 100%); }
.uxp-rendu__grille { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 32px; }
@media (max-width: 767px) { .uxp-rendu__grille { grid-template-columns: repeat(1, minmax(0, 1fr)); } }
.uxp-rendu__bloc { background: var(--fond); padding: 20px; }
.uxp-rendu__bloc h3 { margin: 0 0 12px; font-size: var(--text-h6); }
.uxp-rendu__bloc ul { margin: 0; padding-left: 18px; }
.uxp-rendu__bloc li { margin-bottom: 6px; }
.uxp-rendu__texte { white-space: pre-line; }
.uxp-rendu__liens { display: flex; gap: 10px; flex-wrap: wrap; }
.uxp-rendu__apercu { max-width: 100%; border-radius: 10px; box-shadow: 0 20px 40px rgba(0, 0, 0, .25); }
.uxp-rendu__alerte { color: var(--uxp-rouge); font-weight: 700; }
.uxp-rendu__images { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.uxp-rendu__images a { width: 90px; font-size: 11px; color: var(--gris); word-break: break-all; text-align: center; }
.uxp-rendu__images img { width: 90px; height: 90px; object-fit: contain; background: var(--blanc); border-radius: 10px; padding: 6px; display: block; margin-bottom: 4px; }
.uxp-rendu__soustitre { margin: 20px 0 0; font-size: var(--text-h6); }
/* Historique des versions (atelier) : vignette à largeur fixe, le texte prend le reste */
.uxp-rendu__bloc .uxp-rendu__versions { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.uxp-rendu__bloc .uxp-rendu__versions li { display: flex; gap: 12px; align-items: flex-start; margin: 0; font-size: 13px; line-height: 1.6; }
.uxp-rendu__versions li > a { flex: none; width: 120px; }
.uxp-rendu__versions li > div { min-width: 0; }
.uxp-rendu__versions img { display: block; width: 100%; height: auto; border-radius: 10px; }

/* ---- page « Mes profils NFC » ---- */
.uxp-profil { display: flex; flex-direction: column; gap: 12px; max-width: 640px; }
.uxp-profil__alerte { color: var(--uxp-rouge); font-weight: 700; }
.uxp-profil__apercu img { max-width: 100%; border-radius: 10px; }
.uxp-profil__date { font-size: 12px; color: var(--gris); }
.uxp-profil__actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.uxp-profil__ancien { background: var(--fond); padding: 20px; border-radius: 10px; }
.uxp-profil__ancien h3 { margin: 0 0 12px; font-size: var(--text-h6); }
.uxp-profil__ancien img { max-width: 220px; height: auto; }
