/* ===== Customizable Item Page (aligné maquette React / dashboard) ===== */
.ci-page {
  min-height: 100vh;
  background: #f8f9fa;
  padding-top: 1rem;
  padding-bottom: 96px;
}

@media (min-width: 768px) {
  .ci-page {
    padding-top: 2rem;
  }
}
.ci-wrap { max-width: 70rem; }
.ci-error { padding: 48px; text-align: center; color: #666; font-size: 15px; }
.ci-error a { color: var(--primary-600, #0284c7); }

/* Card wrapper */
.ci-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
  overflow: hidden;
}
.ci-header { padding: 14px 18px; border-bottom: 1px solid #e5e7eb; }
.ci-header__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.ci-title {
  margin: 0;
  font-size: clamp(1.35rem, 2.5vw, 1.65rem);
  font-weight: 700;
  color: #111827;
  line-height: 1.2;
}
.ci-admin-edit {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: #2563eb;
  color: #fff;
  border-radius: 8px;
  font-weight: 500;
  font-size: 14px;
  text-decoration: none;
  flex-shrink: 0;
}
.ci-admin-edit:hover { background: #1d4ed8; color: #fff; }
.ci-admin-edit svg { flex-shrink: 0; }

/* Grid : 2 colonnes — (aperçu + dimensions dessous) | (couleurs, gravure, CTA) */
.ci-grid {
  display: grid;
  grid-template-columns: minmax(260px, 320px) minmax(0, 1fr);
  gap: 28px 32px;
  padding: 20px 22px;
  align-items: start;
}

.ci-config-col {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
}

.ci-options-loading {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #9ca3af;
  font-size: 14px;
  padding: 28px 0;
  margin: 0;
}

.ci-options--left,
.ci-options--right {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

.ci-options-stack-title {
  margin: 0 0 2px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #94a3b8;
}

/* Colonne gauche : carte aperçu puis champs dimensions */
.ci-preview-col {
  display: flex;
  flex-direction: column;
  gap: 18px;
  position: sticky;
  top: 80px;
  align-self: start;
}
.ci-preview-card {
  background: #f9fafb;
  border-radius: 10px;
  padding: 8px 10px;
  border: 1px solid #e5e7eb;
  margin-bottom: 0;
}
/* Même gabarit que CustomizableItemPage React : carré, hauteur max 200px */
.ci-preview-container {
  position: relative;
  box-sizing: border-box;
  width: min(200px, 100%);
  margin: 0 auto;
  aspect-ratio: 1 / 1;
  max-height: 200px;
  overflow: hidden;
  border-radius: 10px;
  background: #f3f4f6;
}
.ci-preview-static { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.ci-preview-placeholder { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; color: #cbd5e1; }

/* Description longue (sous la carte, avant la galerie/info) */
.ci-description {
  margin-top: 1.5rem;
}
.ci-description__inner {
  background: #fff;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
  padding: 18px 18px 20px;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.06);
}
.ci-description__title {
  margin: 0 0 10px;
  font-size: 1rem;
  font-weight: 700;
  color: #111827;
}
.ci-description__body {
  margin: 0;
  font-size: 0.9375rem;
  line-height: 1.65;
  color: #4b5563;
}

/* Layer rendering (JS-injected) */
.ci-layer { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.ci-layer-mask { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none;
  -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
  -webkit-mask-size: contain; mask-size: contain;
  -webkit-mask-position: center; mask-position: center; }

/* Encarts info : styles .collier-banners / .collier-info-banner dans collier.css */
.ci-page-banners {
  margin-top: 1.25rem;
}

/* ——— Related items (same category) ——— */
.ci-related {
  margin-top: 1.5rem;
  background: #fff;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
  padding: 18px;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.06);
}

.ci-related__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.ci-related__title {
  margin: 0;
  font-size: 1rem;
  font-weight: 800;
  color: #111827;
}

.ci-related__back {
  text-decoration: none;
  color: var(--primary-600, #0284c7);
  font-weight: 700;
  font-size: 0.9rem;
}

.ci-related__back:hover {
  text-decoration: underline;
}

.ci-related__grid {
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr;
}

@media (min-width: 760px) {
  .ci-related__grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.ci-relatedCard {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 12px;
  border-radius: 10px;
  border: 2px solid #e5e7eb;
  text-decoration: none;
  background: #fff;
  color: #111827;
  transition: transform .15s, border-color .15s, box-shadow .15s;
}

.ci-relatedCard:hover {
  transform: translateY(-1px);
  border-color: var(--primary-300, #7dd3fc);
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.08);
}

.ci-relatedCard__name {
  font-weight: 700;
  font-size: 0.95rem;
  line-height: 1.2;
}

.ci-relatedCard__cta {
  color: #6b7280;
  font-weight: 800;
  font-size: 0.85rem;
  flex-shrink: 0;
}

/* Options column — hauteur homogène champs / listes / pastilles */
.ci-page {
  --ci-control-height: 44px;
  --ci-control-pad-x: 14px;
  --ci-control-fs: 14px;
  --ci-control-radius: 8px;
  --ci-control-border: 2px solid #e5e7eb;
}
@keyframes ci-spin { to { transform: rotate(360deg); } }
.ci-options-loading svg { animation: ci-spin 1s linear infinite; }

/* Option field */
.ci-field { display: flex; flex-direction: column; gap: 8px; }
.ci-field__label { font-size: 13px; font-weight: 500; color: #374151; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 6px; }
.ci-field__label-suffix { color: #4b5563; font-weight: 500; }
.ci-field__req { color: #e74c3c; }
.ci-field__err { font-size: 11px; color: #e74c3c; font-weight: 500; }

/* Color swatches */
.ci-swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.ci-swatch {
  width: 45px;
  height: 45px;
  border-radius: 15px;
  border: 2px solid #cfd6e2;
  cursor: pointer;
  position: relative;
  transition: transform .15s, border-color .15s, box-shadow .15s;
  overflow: hidden;
  padding: 0;
}
.ci-swatch:hover { transform: scale(1.06); }
.ci-swatch.is-active {
  border-color: var(--primary-600, #0284c7);
  box-shadow: 0 0 0 2px var(--primary-100, #e0f2fe);
  transform: scale(1.04);
}
.ci-swatch__check { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; pointer-events: none; }
.ci-swatch__check img { width: 18px; height: 18px; }
.ci-swatch-img { width: 100%; height: 100%; display: block; object-fit: contain; }

/* Biothane : même gabarit que .swatch / collier (image JPG, pas pastille ronde pleine) */
.ci-swatch--biothane {
  background-color: #fff;
}

/* Pill buttons (string options) */
.ci-pills { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.ci-pill {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--ci-control-height);
  padding: 0 calc(var(--ci-control-pad-x) + 2px);
  border-radius: var(--ci-control-radius);
  border: var(--ci-control-border);
  background: #fff;
  color: #374151;
  font-size: var(--ci-control-fs);
  font-weight: 500;
  font-family: inherit;
  line-height: 1.2;
  cursor: pointer;
  transition: all .15s;
}
.ci-pill:hover {
  border-color: #9ca3af;
  color: #374151;
}
.ci-pill.is-active {
  background: var(--primary-700, #0369a1);
  border-color: var(--primary-800, #075985);
  color: var(--primary-50, #f0f9ff);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

/* Finition bouclerie — aligné largeurs biothane (taupe actif, pas de gros dégradé plein) */
.ci-finition-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.ci-finition-pill {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--ci-control-height);
  padding: 0 16px;
  border-radius: var(--ci-control-radius);
  border: var(--ci-control-border);
  background: #fff;
  color: #374151;
  font-size: var(--ci-control-fs);
  font-weight: 600;
  font-family: inherit;
  text-transform: lowercase;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s;
}
.ci-finition-pill:hover { border-color: #9ca3af; }
.ci-finition-pill.is-active {
  background: var(--primary-700, #0369a1);
  border-color: var(--primary-800, #075985);
  color: var(--primary-50, #f0f9ff);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}
.ci-finition-pill.is-active:hover { border-color: var(--primary-800, #075985); }

/* Ancien style métal plein (réservé si réutilisé ailleurs) */
.ci-metal-btn { padding: 6px 16px; border-radius: 8px; border: 2px solid transparent; font-size: 13px; font-weight: 600; cursor: pointer; transition: all .15s; }
.ci-metal-btn:hover { opacity: .85; transform: translateY(-1px); }
.ci-metal-btn.is-active { border-color: #2c3e50; box-shadow: 0 0 0 2px #2c3e50; }

/* Biothane width pills (sélection taupe, comme la maquette) */
.ci-widths { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.ci-width-pill { position: relative; }
.ci-width-pill input[type="radio"] { position: absolute; opacity: 0; width: 0; height: 0; }
.ci-width-pill label {
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: var(--ci-control-height);
  padding: 0 18px;
  border-radius: var(--ci-control-radius);
  border: var(--ci-control-border);
  background: #fff;
  color: #374151;
  font-size: var(--ci-control-fs);
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s;
}
.ci-width-pill input:checked + label {
  background: var(--primary-700, #0369a1);
  border-color: var(--primary-800, #075985);
  color: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}
.ci-width-pill label:hover { border-color: #9ca3af; }
.ci-width-pill input:checked + label:hover { border-color: var(--primary-800, #075985); }

/* Select (length, etc.) */
.ci-select {
  box-sizing: border-box;
  width: 100%;
  min-height: var(--ci-control-height);
  height: var(--ci-control-height);
  padding: 0 var(--ci-control-pad-x);
  border: var(--ci-control-border);
  border-radius: var(--ci-control-radius);
  font-size: var(--ci-control-fs);
  font-family: inherit;
  line-height: 1.2;
  background: #fff;
  color: #111827;
  cursor: pointer;
  transition: border-color .15s;
}
.ci-select:focus { outline: none; border-color: var(--primary-500, #0ea5e9); }

/* Text input / number (textarea exclu : hauteur libre) */
.ci-input {
  box-sizing: border-box;
  width: 100%;
  min-height: var(--ci-control-height);
  height: var(--ci-control-height);
  padding: 0 var(--ci-control-pad-x);
  border: var(--ci-control-border);
  border-radius: var(--ci-control-radius);
  font-size: var(--ci-control-fs);
  font-family: inherit;
  line-height: 1.2;
  color: #374151;
  background: #fff;
  transition: border-color .15s;
}
textarea.ci-input {
  min-height: 5.5rem;
  height: auto;
  padding: 10px var(--ci-control-pad-x);
  line-height: 1.45;
  resize: vertical;
}
.ci-input:focus { outline: none; border-color: var(--primary-500, #0ea5e9); }
.ci-input.has-error { border-color: #e74c3c; }
.ci-input-count { font-size: 11px; color: #9ca3af; margin-top: 2px; }

/* Object select (mousquetons, etc.) */
.ci-obj-select {
  box-sizing: border-box;
  width: 100%;
  min-height: var(--ci-control-height);
  height: var(--ci-control-height);
  padding: 0 var(--ci-control-pad-x);
  border: var(--ci-control-border);
  border-radius: var(--ci-control-radius);
  font-size: var(--ci-control-fs);
  font-family: inherit;
  line-height: 1.2;
  background: #fff;
  color: #374151;
  cursor: pointer;
  transition: border-color .15s;
}
.ci-obj-select:focus { outline: none; border-color: var(--primary-500, #0ea5e9); }

/* Engraving section */
.ci-engraving { margin-top: 8px; padding-top: 14px; border-top: 1px solid #e5e7eb; }
.ci-engraving__title { font-size: 14px; font-weight: 600; color: #1f2937; display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.ci-engraving__accent { display: inline-block; width: 4px; height: 16px; background: var(--primary-600, #0284c7); border-radius: 9999px; flex-shrink: 0; }
.ci-engraving-group { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }

/* Gravure : champs nom = même logique que collier (#gravage-text + .engraving-input-shell dans collier.css) */
.ci-gravage-text-input {
  border: 0;
  outline: none;
  background: transparent;
  font-size: 14px;
  font-weight: 700;
  font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
  text-transform: uppercase;
  text-align: center;
  letter-spacing: 0.6px;
  color: inherit;
  text-shadow: none;
  padding: 0;
  margin: 0;
  width: 10em;
  max-width: 100%;
  box-sizing: border-box;
  caret-color: currentColor;
}
.ci-gravage-text-input::placeholder {
  color: inherit;
  opacity: 0.88;
}
.ci-gravage-text-input:focus::placeholder {
  color: transparent;
  opacity: 0;
}
.ci-gravage-text-input:focus { outline: none; }

.engraving-input-shell.ci-engraving-shell--error {
  border-color: #ef4444 !important;
}

.ci-gravage-count {
  font-size: 11px;
  color: #4b5563;
}

.ci-engraving-group .ci-engraving-err {
  display: block;
  margin-top: 4px;
  font-size: 11px;
  color: #e74c3c;
  font-weight: 500;
}

/* Motif section — aligné CustomizableItemPage.tsx */
.ci-motif-section { display: flex; flex-direction: column; gap: 6px; }
.ci-motif-block__label {
  display: block;
  font-weight: 500;
  margin: 0 0 2px;
  font-size: 11px;
  color: #7f8c8d;
}
.ci-motif-block__offert {
  color: #16a34a;
  font-weight: 600;
  font-size: 10px;
}
.ci-motif-sides { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ci-motif-col { min-width: 0; }
.ci-motif-col__title {
  margin: 0 0 6px;
  font-size: 11px;
  color: #6b7280;
  font-weight: 500;
}
.ci-motif-tiles { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-start; }
.ci-motif-tile {
  box-sizing: border-box;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  border: 1px solid #d1d5db;
  background: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  font: inherit;
  font-size: 18px;
  line-height: 1;
  color: #1f2937;
  transition: border-color 0.15s, background 0.15s;
}
.ci-motif-tile:hover {
  border-color: var(--primary-500, #0ea5e9);
  background: var(--primary-50, #f0f9ff);
}
.ci-motif-tile.is-active {
  border: 2px solid var(--primary-600, #0284c7);
  background: var(--primary-50, #f0f9ff);
}
.ci-motif-tile img {
  width: 26px;
  height: 26px;
  object-fit: contain;
}
.ci-motif-tile--toggle {
  background: #f9fafb;
  color: #6b7280;
  font-size: 11px;
  font-weight: 600;
}
.ci-motif-tile--toggle:hover {
  border-color: #d1d5db;
  background: #f3f4f6;
}

/* CTA — style maquette React (taupe chaud + encart crème) */
.ci-cta {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.ci-add-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 16px 22px;
  background: linear-gradient(135deg, var(--primary-500, #0ea5e9) 0%, var(--primary-700, #0369a1) 100%);
  color: var(--primary-50, #f0f9ff);
  border: none;
  border-radius: 14px;
  font-size: 16px;
  font-weight: 700;
  font-family: inherit;
  line-height: 1.25;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(2, 132, 199, 0.28);
  transition: background .2s, box-shadow .2s, opacity .2s, transform .15s;
}
.ci-add-btn:hover:not(:disabled) {
  background: linear-gradient(135deg, var(--primary-600, #0284c7) 0%, var(--primary-800, #075985) 100%);
  box-shadow: 0 4px 14px rgba(2, 132, 199, 0.35);
}
.ci-add-btn:active:not(:disabled) { transform: translateY(1px); }
.ci-add-btn:focus-visible {
  outline: 2px solid var(--primary-800, #075985);
  outline-offset: 3px;
}
.ci-add-btn:disabled {
  opacity: .55;
  cursor: not-allowed;
  box-shadow: none;
}
.ci-add-btn__icon {
  display: inline-flex;
  flex-shrink: 0;
  color: #fff;
}
.ci-add-btn__icon svg { display: block; }
.ci-add-btn__main {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: center;
  gap: 0;
  text-align: center;
}
.ci-add-btn__dash { font-weight: 700; opacity: .95; }
.ci-add-btn__price { font-weight: 700; white-space: nowrap; }

/* Mêmes couleurs / typo que .shipping-note (collier.css) */
.ci-shipping-note {
  margin: 0;
  padding: 10px;
  font-size: 12px;
  line-height: 1.45;
  color: #92400e;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 8px;
}
.ci-shipping-note strong {
  display: block;
  margin-bottom: 4px;
  font-size: inherit;
  font-weight: 700;
  color: inherit;
}
.ci-shipping-note p {
  margin: 0 0 4px;
  color: inherit;
}
.ci-shipping-note p:last-child {
  margin-bottom: 0;
}

/* Mobile : mini aperçu fixe au scroll (pas la colonne dimensions dessous) */
@media (max-width: 767px) {
  .ci-grid { grid-template-columns: 1fr; gap: 18px; padding: 16px; }
  .ci-preview-col { position: static; }
  .ci-preview-card.is-sticky {
    position: fixed;
    top: 56px;
    left: 8px;
    right: 8px;
    z-index: 15;
    max-height: 35vh;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  }
  .ci-title { font-size: 1.15rem; }
  .ci-header { padding: 12px 14px; }
}

/* Section separator */
.ci-section-sep { height: 1px; background: #f0f0f0; margin: 4px 0; }

/* Loading spinner for swatches */
.ci-swatches-loading { font-size: 12px; color: #9ca3af; font-style: italic; }

/* Validation error highlight */
.ci-field.has-error .ci-field__label { color: #e74c3c; }
.ci-field.has-error .ci-input,
.ci-field.has-error .ci-select { border-color: #e74c3c; }
