/**
 * Wireframe — studio carte crédit cadeau Up (fiche produit bulk).
 */

#product #main.cev-bulk-card-studio .product-page__stack--gallery .cev-card-studio {
  width: 100%;
  max-width: 100%;
}

#product #main.cev-bulk-card-studio .product-order-total-container {
  margin-top: 1rem;
}

#product #main.cev-bulk-card-studio .product-page__stack--gallery {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

#product #main.cev-bulk-card-studio .product-page__stack--tabs-bulk-studio {
  display: flex;
  justify-content: center;
  width: 100%;
  margin-top: 0.25rem;
}

#product #main.cev-bulk-card-studio .product-page__stack--tabs-bulk-studio .tabs {
  width: 100%;
  max-width: min(100%, 460px);
  box-sizing: border-box;
  margin: 0;
  padding: 24px 16px;
  border: 1px solid rgba(26, 26, 26, 0.12);
  background: #fff;
  border-radius: var(--border-radius-type, 16px);
  box-shadow: none;
}

#product #main.cev-bulk-card-studio .product-page__stack--tabs-bulk-studio .nav-tabs,
#product #main.cev-bulk-card-studio .product-page__stack--tabs-bulk-studio .tab-content,
#product #main.cev-bulk-card-studio .product-page__stack--tabs-bulk-studio #product-details,
#product #main.cev-bulk-card-studio .product-page__stack--tabs-bulk-studio .product-details-layout,
#product #main.cev-bulk-card-studio .product-page__stack--tabs-bulk-studio .product-features--aggregator,
#product #main.cev-bulk-card-studio .product-page__stack--tabs-bulk-studio .data-sheet--aggregator {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

/* Onglet Détails de la carte : trait rouge seul, aligné sur le tableau */
#product #main.cev-bulk-card-studio .product-page__stack--tabs-bulk-studio .nav-tabs {
  padding: 0;
  margin: 0;
  border: none !important;
  border-bottom: none !important;
}

#product #main.cev-bulk-card-studio .product-page__stack--tabs-bulk-studio .nav-tabs .nav-item {
  margin: 0;
}

#product #main.cev-bulk-card-studio .product-page__stack--tabs-bulk-studio .nav-tabs .nav-link {
  padding: 0 0 0.35rem;
  margin: 0;
  background: transparent !important;
  color: var(--text-color, #222) !important;
  border: none !important;
  border-radius: 0 !important;
}

#product #main.cev-bulk-card-studio .product-page__stack--tabs-bulk-studio .nav-tabs .nav-link.active,
#product #main.cev-bulk-card-studio .product-page__stack--tabs-bulk-studio .nav-tabs .nav-link.js-product-nav-active,
#product #main.cev-bulk-card-studio .product-page__stack--tabs-bulk-studio .nav-tabs .nav-link.js-product-nav-active:hover,
#product #main.cev-bulk-card-studio .product-page__stack--tabs-bulk-studio .nav-tabs .nav-link.js-product-nav-active:focus {
  background: transparent !important;
  color: var(--text-color, #222) !important;
  border: none !important;
  border-bottom: 3px solid var(--primary-color) !important;
  border-radius: 0 !important;
}

#product #main.cev-bulk-card-studio .product-page__stack--tabs-bulk-studio .tab-content {
  padding: 0;
  margin-top: 0.75rem;
}

@media (min-width: 1025px) {
  #product #main.cev-bulk-card-studio .product-page__stack--gallery .cev-card-studio {
    position: sticky;
    top: 1rem;
    z-index: 2;
  }
}

.cev-card-studio {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.85rem;
}

.cev-card-studio__preview-wrap,
.cev-card-studio__picker,
.cev-card-studio__message {
  width: 100%;
  max-width: min(100%, 460px);
}

.cev-card-studio__preview-wrap {
  border-radius: var(--border-radius-type, 8px);
  overflow: visible;
}

.cev-card-studio__preview {
  position: relative;
  border-radius: var(--border-radius-type, 8px);
  overflow: hidden;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
  background: #fff;
  aspect-ratio: 16 / 10;
}

.cev-card-studio__preview-bg {
  display: block;
  width: 100%;
  height: 100%;
  /* cover : remplit le cadre studio (comme DTR) — pas de bandes blanches. */
  object-fit: cover;
  object-position: center;
}

.cev-card-studio__preview-title {
  position: absolute;
  left: 50%;
  z-index: 1;
  max-width: 88%;
  margin: 0;
  padding: 0;
  transform: translate(-50%, -50%);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
  line-height: 1;
  pointer-events: none;
  opacity: 0.38;
}

.cev-card-studio__preview-title--bravo {
  top: 41%;
  color: #fff;
  font-family: Arial, Helvetica, sans-serif;
  font-size: clamp(1.28rem, 4.8vw, 2.05rem);
  font-weight: 700;
  letter-spacing: 0.02em;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
}

.cev-card-studio__preview-title--felicitations {
  top: 30.5%;
  color: #ffdea0;
  font-family: Georgia, 'Times New Roman', serif;
  font-size: clamp(1.12rem, 4.15vw, 1.78rem);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.12), 0 2px 8px rgba(0, 0, 0, 0.18);
}

.cev-card-studio__preview-title--felicitations::after {
  content: '';
  position: absolute;
  left: 50%;
  top: calc(100% + 0.22em);
  width: min(68%, 9.5rem);
  height: 2px;
  transform: translateX(-50%);
  background: linear-gradient(90deg, transparent, rgba(255, 201, 92, 0.55) 12%, rgba(255, 201, 92, 0.55) 88%, transparent);
}

.cev-card-studio__preview-title--you_are_the_best {
  top: 41%;
  color: #fff;
  font-family: Arial, Helvetica, sans-serif;
  font-size: clamp(1.02rem, 3.85vw, 1.65rem);
  font-weight: 700;
  letter-spacing: 0.01em;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
}

.cev-card-studio__preview-title.is-hidden {
  display: none;
}

.cev-card-studio__preview-message-zone {
  position: absolute;
  left: 50%;
  top: 53%;
  bottom: 7%;
  z-index: 2;
  width: 70%;
  max-width: 70%;
  transform: translateX(-50%);
  pointer-events: none;
}

/* Visuel importé : zone message centrée (plus large). */
.cev-card-studio__preview.is-custom .cev-card-studio__preview-message-zone {
  width: 78%;
  max-width: 78%;
}

.cev-card-studio__preview-message-zone.is-lines-4 {
  top: 52%;
}

.cev-card-studio__preview-message-zone.is-lines-5 {
  top: 51%;
  bottom: 6%;
}

/* Applat sous le message — uniquement Félicitations + visuel importé.
   crédit cadeau / Bravo : pas d’encadrement (MGFT-38 retour métier). */
.cev-card-studio__preview-message-bg {
  position: absolute;
  inset: 0;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.36);
  display: none !important;
  opacity: 0;
  transition: opacity 0.15s ease;
  pointer-events: none;
}

.cev-card-studio__preview.has-message.is-felicitations .cev-card-studio__preview-message-bg,
.cev-card-studio__preview.has-message.is-custom .cev-card-studio__preview-message-bg {
  display: block !important;
  opacity: 1;
}

/* Filet de sécurité : jamais d’applat hors Félicitations / custom */
.cev-card-studio__preview:not(.is-felicitations):not(.is-custom) .cev-card-studio__preview-message-bg {
  display: none !important;
  opacity: 0 !important;
  background: transparent !important;
}

.cev-card-studio__preview-message {
  position: relative;
  z-index: 1;
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0.55em 0.7em;
  text-align: center;
  color: #fff;
  font-size: clamp(0.82rem, 1.9vw, 0.98rem);
  font-weight: 600;
  line-height: 1.28;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.55);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  min-height: 1.2em;
  overflow: hidden;
}

/* Sans applat : ombre plus légère pour ne pas mimer un encadrement */
.cev-card-studio__preview:not(.is-felicitations):not(.is-custom) .cev-card-studio__preview-message {
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.45);
}

.cev-card-studio__preview-message.is-lines-2 {
  font-size: clamp(0.8rem, 1.85vw, 0.95rem);
  line-height: 1.27;
}

.cev-card-studio__preview-message.is-lines-3 {
  font-size: clamp(0.78rem, 1.75vw, 0.9rem);
  line-height: 1.25;
}

.cev-card-studio__preview-message.is-lines-4 {
  font-size: clamp(0.74rem, 1.65vw, 0.86rem);
  line-height: 1.23;
}

.cev-card-studio__preview-message.is-lines-5 {
  font-size: clamp(0.7rem, 1.55vw, 0.8rem);
  line-height: 1.2;
}

.cev-card-studio__preview-message:empty {
  display: none;
}

.cev-card-studio__thumbs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.55rem;
  width: 100%;
}

@media (max-width: 575px) {
  .cev-card-studio__thumbs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.cev-card-studio__thumb {
  appearance: none;
  border: 2px solid transparent;
  border-radius: 8px;
  padding: 0.25rem;
  background: #fff;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  text-align: center;
}

.cev-card-studio__thumb:hover {
  border-color: rgba(0, 137, 123, 0.45);
}

.cev-card-studio__thumb.is-active {
  border-color: var(--primary-color, #00897b);
  box-shadow: 0 0 0 1px var(--primary-color, #00897b);
}

.cev-card-studio__thumb img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  object-position: center;
  background: #fff;
  border-radius: 4px;
}

/* Legacy upload thumb (si encore présent). */
.cev-card-studio__thumb--upload img {
  object-fit: contain;
}

/* CMC-16-CARD-LIB — Importer thumb + modal bibliothèque */
.cev-card-studio-library-modal.modal {
  --bs-modal-border-radius: 0.85rem;
  --bs-modal-zindex: 1060;
  z-index: 1060;
  opacity: 1;
}

.cev-card-studio-library-modal.modal.fade,
.cev-card-studio-library-modal.modal.fade.show {
  opacity: 1;
  transition: none;
}

.cev-card-studio-library-modal.modal:not(.show) {
  display: none;
}

.cev-card-studio-library-modal.modal.show {
  display: block;
  opacity: 1;
}

.cev-card-studio-library-modal__dialog {
  max-width: min(40rem, calc(100vw - 1.5rem));
  margin: 1.75rem auto;
  opacity: 1;
  transform: none;
}

.cev-card-studio-library-modal__surface {
  background: #fff;
  border: 0;
  border-radius: 0.85rem;
  box-shadow: 0 1rem 2.5rem rgba(26, 26, 26, 0.22);
  overflow: hidden;
  color: #1a1a1a;
}

.cev-card-studio-library-modal__header {
  align-items: flex-start;
  padding: 1.25rem 1.25rem 0.75rem;
  background: #fff;
}

.cev-card-studio-library-modal__body {
  padding: 0.5rem 1.25rem 1.35rem;
  background: #fff;
}

.cev-card-studio-library-modal__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(7.5rem, 1fr));
  gap: 0.85rem;
}

.cev-card-studio-library-modal__item {
  position: relative;
  margin: 0;
  border-radius: 0.65rem;
  overflow: hidden;
  background: #f7f4f8;
  box-shadow: inset 0 0 0 1px rgba(26, 26, 26, 0.08);
  aspect-ratio: 16 / 10;
}

.cev-card-studio-library-modal__item.is-selected {
  box-shadow:
    inset 0 0 0 2px var(--cev-dash-nav-active-bg, var(--color-loulou-950, #59064d)),
    0 0 0 1px var(--cev-dash-nav-active-bg, var(--color-loulou-950, #59064d));
}

.cev-card-studio-library-modal__select {
  display: block;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.cev-card-studio-library-modal__select:focus-visible {
  outline: 2px solid var(--cev-dash-nav-active-bg, var(--color-loulou-950, #59064d));
  outline-offset: -2px;
}

.cev-card-studio-library-modal__select img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  padding: 0.35rem;
  box-sizing: border-box;
  background: #fff;
}

.cev-card-studio-library-modal__delete {
  position: absolute;
  top: 0.4rem;
  right: 0.4rem;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: #7a1f1f;
  box-shadow: 0 1px 4px rgba(26, 26, 26, 0.18);
  cursor: pointer;
}

.cev-card-studio-library-modal__delete:hover,
.cev-card-studio-library-modal__delete:focus-visible {
  background: #fff;
  color: #b42318;
}

.cev-card-studio-library-modal__delete .material-icons {
  font-size: 1.15rem;
  line-height: 1;
}

.cev-card-studio-library-modal__empty {
  margin: 0 0 0.85rem;
}

.cev-card-studio-library-modal__actions {
  clear: both;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.65rem;
}

.cev-card-studio-library-modal__import-btn {
  min-width: min(100%, 16rem);
  padding: 0.55rem 1.25rem;
  font-weight: 600;
}

.cev-card-studio-library-modal__actions .form-text {
  max-width: 32rem;
  text-align: center;
}

.cev-card-studio-library-modal__guest-notice {
  margin: 0.35rem 0 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--bs-secondary-color, #6b7280);
  font-size: 0.875rem;
  line-height: 1.45;
  text-align: center;
  max-width: 32rem;
}

.cev-card-studio-library-modal__actions--guest {
  margin-top: 0.25rem;
}

.cev-card-studio-library-modal__login-link {
  display: inline;
  margin-left: 0.25rem;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 0.12em;
  color: #1a1a1a;
}

.cev-card-studio-library-modal__login-link:hover,
.cev-card-studio-library-modal__login-link:focus-visible {
  color: #000;
  text-decoration-thickness: 2px;
}

.cev-card-studio-library-modal__import-btn[disabled],
.cev-card-studio-library-modal__import-btn.is-at-limit,
.cev-card-studio-library-modal__actions .btn[disabled] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
  cursor: not-allowed;
  pointer-events: none;
  background: #c4c4c4 !important;
  border-color: #c4c4c4 !important;
  color: #fff !important;
  box-shadow: none !important;
}

/* Backdrop au-dessus du FO produit (quantité, sticky, etc.) */
body.modal-open .modal-backdrop.show {
  z-index: 1055;
}

/* Modales au-dessus du backdrop (sinon clics bloqués sur Confirmer / Annuler) */
body.modal-open .cev-card-studio-library-modal.modal,
body.modal-open .cev-bulk-confirm-modal.modal {
  z-index: 1060;
}

/* Importer — glyph prune #59064d, fond lavande rayé, bordure dashed (fiche produit + wizard). */
.cev-card-studio__thumb-visual.cev-card-studio__thumb-visual--action {
  display: flex !important;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 3.25rem;
  aspect-ratio: 16 / 10;
  padding: 0;
  box-sizing: border-box;
  background:
    linear-gradient(160deg, rgba(89, 6, 77, 0.06), rgba(89, 6, 77, 0.02)),
    repeating-linear-gradient(
      -45deg,
      transparent,
      transparent 5px,
      rgba(89, 6, 77, 0.035) 5px,
      rgba(89, 6, 77, 0.035) 6px
    ),
    #f7f4f8;
  border: 1px dashed rgba(89, 6, 77, 0.28);
  border-radius: 0.35rem;
  color: var(--cev-dash-nav-active-bg, var(--color-loulou-950, #59064d));
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.cev-card-studio__thumb--import:hover .cev-card-studio__thumb-visual--action,
.cev-card-studio__thumb--import:focus-visible .cev-card-studio__thumb-visual--action {
  background:
    linear-gradient(160deg, rgba(89, 6, 77, 0.1), rgba(89, 6, 77, 0.04)),
    #f3eef4;
  border-color: rgba(89, 6, 77, 0.45);
  box-shadow: inset 0 0 0 1px rgba(89, 6, 77, 0.08);
}

.cev-card-studio__thumb--import.is-active .cev-card-studio__thumb-visual--action {
  border-style: solid;
  border-color: var(--cev-dash-nav-active-bg, var(--color-loulou-950, #59064d));
  color: var(--cev-dash-nav-active-bg, var(--color-loulou-950, #59064d));
  background:
    linear-gradient(160deg, rgba(89, 6, 77, 0.14), rgba(89, 6, 77, 0.05)),
    #f3eef4;
}

.cev-card-studio__thumb--import .cev-card-studio__import-glyph {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  line-height: 0;
  margin: 0;
  /* Optical nudge: stack sits above the badge in the glyph */
  transform: translateY(6%);
}

.cev-card-studio__thumb--import .cev-card-studio__import-glyph-svg {
  display: block;
  width: 2.35rem;
  height: 2.35rem;
  margin: 0;
  overflow: visible;
}

.cev-card-studio__import-glyph-back,
.cev-card-studio__import-glyph-mid {
  fill: rgba(89, 6, 77, 0.12);
  stroke: currentColor;
  stroke-width: 1.4;
}

.cev-card-studio__import-glyph-front {
  fill: #fff;
  stroke: currentColor;
  stroke-width: 1.6;
}

.cev-card-studio__import-glyph-image {
  fill: rgba(89, 6, 77, 0.35);
}

.cev-card-studio__import-glyph-sun {
  fill: rgba(89, 6, 77, 0.45);
}

.cev-card-studio__import-glyph-badge {
  fill: var(--cev-dash-nav-active-bg, var(--color-loulou-950, #59064d));
  stroke: #fff;
  stroke-width: 2;
}

.cev-card-studio__import-glyph-arrow {
  fill: none;
  stroke: #fff;
  stroke-width: 2.1;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.cev-card-studio__thumb--import[aria-disabled='true'] {
  opacity: 0.55;
  cursor: not-allowed;
}

/* Aperçu principal : même rendu que les presets (remplit le cadre 16:10, pas de bandes blanches). */
.cev-card-studio__preview.is-custom .cev-card-studio__preview-bg {
  object-fit: cover;
  object-position: center;
}

.cev-card-studio__thumb-visual {
  position: relative;
  display: block;
  container-type: inline-size;
}

.cev-card-studio__thumb-title {
  position: absolute;
  left: 50%;
  z-index: 2;
  max-width: 88%;
  transform: translate(-50%, -50%);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
  line-height: 1;
  pointer-events: none;
  opacity: 0.38;
}

.cev-card-studio__thumb-title--bravo {
  top: 41%;
  color: #fff;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 7.2cqi;
  font-weight: 700;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
}

.cev-card-studio__thumb-title--felicitations {
  top: 30.5%;
  color: #ffdea0;
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 5.6cqi;
  font-weight: 700;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.18);
}

.cev-card-studio__thumb-title--you_are_the_best {
  top: 41%;
  color: #fff;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 5cqi;
  font-weight: 700;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
}

.cev-card-studio__thumb-label {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.72rem;
  line-height: 1.2;
  color: #444;
}

/* Même typo que les sous-titres droite (.cev-section-title) — tout le libellé en gras */
#product #main.cev-bulk-card-studio .cev-card-studio__message-title.cev-section-title,
.cev-card-studio__message-title.cev-section-title {
  display: block;
  margin: 0 0 0.5rem !important;
  font-size: 0.85rem !important;
  font-weight: 700 !important;
  color: var(--cev-text, #232323) !important;
  line-height: 1.3;
  text-align: left;
}

.cev-card-studio__message {
  margin-top: 1rem;
  margin-bottom: 1.25rem;
}

.cev-card-studio__message-input {
  width: 100%;
  resize: vertical;
  min-height: 4.5rem;
  max-height: 8.5rem;
}

.cev-card-studio__message-input::placeholder {
  color: #9aa3ab;
  font-style: italic;
}

.cev-card-studio__message-counter {
  margin: 0.45rem 0 0;
  font-size: 0.75rem;
  font-weight: 400;
  color: #6c868e;
  text-align: left;
  line-height: 1.35;
}

.cev-card-studio__message-counter.is-near-limit {
  color: #b35c00;
}

.cev-card-studio__message-counter.is-at-limit {
  color: #d9414f;
  font-weight: 600;
}

/* Masquer message + upload legacy dans le formulaire droit */
#product #main.cev-bulk-card-studio .cev-card-fields .cev-form-group:has(#message),
#product #main.cev-bulk-card-studio .cev-card-fields .cev-form-group:has(#customImage),
#product #main.cev-bulk-card-studio .cev-card-fields .cev-form-group:has(#customImageInput),
#product #main.cev-bulk-card-studio .cev-card-fields .cev-form-group:has(.cev-image-upload-container) {
  display: none !important;
}
