/**
 * Plaque pilote - front-office configurator block.
 *
 * Styling for the plate personalisation block rendered on the product page
 * (views/templates/hook/configurator.tpl). Only present when the product
 * is plaque-enabled (see PlaquePilote::hookActionFrontControllerSetMedia).
 */

.pp-block {
  margin: 24px 0;
  padding: 18px 20px;
  border: 1px solid #e3e3e3;
  border-radius: 8px;
  background: #fafafa;
  font-size: 0.95rem;
  position: relative;
}

.pp-block * {
  box-sizing: border-box;
}

/* Hidden working canvas (Fabric.js renders the plate offscreen). */
.pp-canvas-hidden {
  display: none !important;
}

.pp-zone {
  margin-bottom: 18px;
}

.pp-zone-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 10px;
  color: #222;
  text-transform: uppercase;
}

.pp-etape {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #52656b;
  color: #fff;
  font-size: 0.85rem;
  font-weight: 700;
  flex: 0 0 26px;
}

/* --- Lines (pilot / co-pilot) --- */
.pp-ligne {
  position: relative;
  padding: 12px 12px 4px;
  border: 1px solid #e8e8e8;
  border-radius: 6px;
  background: #fff;
  margin-bottom: 14px;
}

.pp-sup-ligne {
  position: absolute;
  top: 8px;
  right: 8px;
  border: none;
  background: transparent;
  color: #c0392b;
  font-size: 1.1rem;
  cursor: pointer;
  line-height: 1;
  padding: 4px 6px;
  z-index: 2;
}

/* --- Flags and icons galleries --- */
.pp-drapeaux,
.pp-icones {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pp-drapeau,
.pp-icone {
  width: 48px;
  height: 36px;
  border: 2px solid #ddd;
  border-radius: 4px;
  background-color: #fff;
  background-position: 50% 50%;
  background-size: contain;
  background-repeat: no-repeat;
  cursor: pointer;
  transition: transform 0.1s ease;
}

.pp-icone {
  width: 40px;
  height: 40px;
  border-radius: 50%;
}

.pp-drapeau:hover,
.pp-icone:hover {
  transform: scale(1.1);
}

.pp-drapeau.is-selected,
.pp-icone.is-selected {
  border-color: #52656b;
  box-shadow: 0 0 0 2px rgba(82, 101, 107, 0.35);
}

.pp-sans {
  position: relative;
}

.pp-sans::after {
  content: "\2715";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #aaa;
  font-size: 0.9rem;
}

/* --- Name / blood group inputs --- */
.pp-inputs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.pp-input {
  padding: 8px 10px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 0.95rem;
}

.pp-nom {
  flex: 1 1 220px;
}

.pp-gs {
  flex: 0 0 90px;
  text-align: center;
}

/* --- Font selector --- */
.pp-font-select {
  width: 100%;
  max-width: 320px;
  padding: 8px 10px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 1rem;
  background: #fff;
}

/* --- Add co-pilot button --- */
.pp-btn-copilote {
  display: inline-block;
  border: 1px solid #52656b;
  background: #52656b;
  color: #fff;
  border-radius: 4px;
  padding: 9px 16px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 16px;
}

.pp-btn-copilote:hover {
  background: #3e4d52;
}

/* --- Colour swatches --- */
.pp-couleurs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pp-couleur {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2px solid #ddd;
  cursor: pointer;
  transition: transform 0.1s ease;
}

.pp-couleur:hover {
  transform: scale(1.12);
}

.pp-couleur.is-selected {
  border-color: #52656b;
  box-shadow: 0 0 0 2px rgba(82, 101, 107, 0.35);
}

.pp-couleur-nom {
  margin-top: 8px;
  font-size: 0.85rem;
  color: #555;
}

/* --- Preview with cm dimension labels --- */
.pp-apercu-wrap {
  position: relative;
  border: 1px dashed #c5c5c5;
  border-radius: 6px;
  background: #fff
    repeating-linear-gradient(45deg, #f4f4f4 0, #f4f4f4 10px, #fff 10px, #fff 20px);
  padding: 34px 16px 16px 56px;
  overflow-x: auto;
  overflow-y: hidden;
}

#pp-apercu {
  text-align: center;
}

#pp-image {
  max-width: 100%;
  height: auto;
}

/* cm dimensions shown OUTSIDE the plate with a thin measurement line
   (comme en prod) : "10 cm" above, "1,5 cm" rotated on the left. */
.pp-cote {
  position: absolute;
  font-size: 0.8rem;
  font-weight: 600;
  color: #333;
  text-align: center;
  line-height: 1.15;
  white-space: nowrap;
}

/* largeur : au-dessus de la plaque, ligne sous le texte sur toute la largeur */
.pp-cote-largeur {
  top: 4px;
  left: 44px;
  right: 8px;
  padding-bottom: 2px;
  border-bottom: 1px solid #b9b9b9;
  transform: none;
}
.pp-cote-largeur::before { content: none; }

/* hauteur : à gauche de la plaque, tournée à 90°, ligne le long de la hauteur */
.pp-cote-hauteur {
  left: 4px;
  top: 26px;
  bottom: 10px;
  width: 1.15rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-left: 1px solid #b9b9b9;
  transform: none;
}
.pp-cote-hauteur span,
.pp-cote-hauteur {
  writing-mode: vertical-rl;
  text-orientation: mixed;
}
.pp-cote-hauteur::before { content: none; }

/* --- Price slot --- */
.pp-price-slot {
  margin-top: 12px;
  padding: 12px 14px;
  background: #f6f6f6;
  border-radius: 6px;
  font-size: 16px;
}

.pp-price-slot:empty {
  display: none;
}

.pp-price-label {
  font-weight: 600;
}

.pp-price-value {
  font-weight: 700;
  font-size: 20px;
  color: #c0392b;
}

.pp-price-ht {
  color: #777;
  font-size: 13px;
}

/* --- Responsive --- */
@media (max-width: 560px) {
  .pp-block {
    padding: 14px 12px;
  }

  .pp-nom {
    flex: 1 1 100%;
  }
}

/* Live preview promoted into the product gallery (set by front.js relocate). */
.pp-apercu-in-gallery {
  display: block;
  width: 100%;
  text-align: center;
  background: #fff;
  border-radius: 8px;
  padding: 1.5rem 1rem;
  box-shadow: 0 2px 10px rgba(0,0,0,.4);
}
.pp-apercu-in-gallery #pp-image {
  max-width: 100%;
  height: auto;
}

/* In the gallery (comme en prod): the wrapper is TRANSPARENT and centres the
   plate; only #pp-apercu is the WHITE bordered plate, displayed at its natural
   size (~380px, NOT upscaled, so the flag/icon stay crisp). The cm dimension
   labels (moved inside #pp-apercu by front.js) sit OUTSIDE the white plate, in
   white, with their measurement lines. */
.pp-apercu-wrap.pp-apercu-in-gallery {
  position: relative;
  width: 100%;
  margin: 0 0 1rem;
  padding: 26px 0 6px 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  text-align: center;
}
.pp-apercu-in-gallery #pp-apercu {
  display: inline-block;
  position: relative;
  max-width: 100%;
  line-height: 0;
  background: #ffffff;
  border: 1px solid #cfcfcf;
  border-radius: 2px;
  overflow: visible;
}
.pp-apercu-in-gallery #pp-image {
  display: block;
  width: auto;          /* natural size: crisp, not pixelated */
  max-width: 100%;
  height: auto;
}
/* dimensions in WHITE, glued just OUTSIDE the white plate edges */
.pp-apercu-in-gallery #pp-apercu .pp-cote { color: #ffffff; }
.pp-apercu-in-gallery #pp-apercu .pp-cote-largeur {
  top: -20px; left: 0; right: 0; bottom: auto;
  text-align: center;
  padding-bottom: 2px;
  border-bottom: 1px solid #ffffff;
}
/* hauteur : d'abord la taille (texte) a gauche, puis le trait a droite, puis
   le bord de la plaque. */
.pp-apercu-in-gallery #pp-apercu .pp-cote-hauteur {
  left: -22px; top: 0; bottom: 0; right: auto;
  width: 1.1rem;
  border-left: 0;
  border-right: 1px solid #ffffff;
}

/* ==================================================================
 * Charte graphique Autocollant-Tuning (sombre / rouge).
 * Le configurateur etait en theme clair (#fafafa / #52656b) : on le
 * passe en sombre. Les vignettes drapeaux/icones et la zone d'apercu
 * restent claires pour la lisibilite (drapeaux colores, plaque a texte
 * souvent noir).
 * ================================================================== */
:root { --pp-red: var(--at-red, #d1001c); }

.pp-block {
  background: #141414;
  border: 1px solid #2a2a2a;
  color: #e6e6e6;
}
.pp-zone-title { color: #ffffff; }
.pp-etape { background: var(--pp-red); }

.pp-ligne {
  background: #1c1c1c;
  border: 1px solid #2e2e2e;
}

.pp-input,
.pp-font-select {
  background: #262626;
  color: #ffffff;
  border: 1px solid #3a3a3a;
}
.pp-input::placeholder { color: #8a8a8a; }
.pp-font-select option { background: #1f1f1f; color: #fff; }

/* selections en rouge charte */
.pp-drapeau.is-selected,
.pp-icone.is-selected,
.pp-couleur.is-selected {
  border-color: var(--pp-red);
  box-shadow: 0 0 0 2px rgba(209, 0, 28, 0.45);
}

.pp-btn-copilote {
  background: var(--pp-red);
  border-color: var(--pp-red);
}
.pp-btn-copilote:hover { filter: brightness(1.12); background: var(--pp-red); }

.pp-couleur-nom { color: #bdbdbd; }

/* zone d'apercu : cadre sombre mais fond clair conserve pour voir la plaque */
.pp-apercu-wrap { border: 1px solid #2e2e2e; }
.pp-cote { color: #d1001c; }

/* bloc prix en sombre, valeur en rouge */
.pp-price-slot { background: #1c1c1c; color: #e6e6e6; }
.pp-price-value { color: var(--pp-red); }
.pp-price-ht { color: #9a9a9a; }
