/* Configurateur de consommables Autogènium
   Les couleurs se règlent via les variables ci-dessous (ou depuis Réglages > Configurateur). */
.agc {
  --agc-primary: #f2b705;
  --agc-primary-dark: #c99600;
  --agc-ink: #1f2328;
  --agc-muted: #6b7280;
  --agc-line: #e5e7eb;
  --agc-bg: #ffffff;
  --agc-bg-soft: #f7f7f5;
  --agc-cta: #0f172a;
  --agc-cta-hover: #fd9800;
  --agc-cta-text: #ffffff;
  --agc-danger: #b42318;
  --agc-ok: #067647;
  --agc-radius: 12px;
  --agc-font: inherit;
  font-family: var(--agc-font);
  color: var(--agc-ink);
  line-height: 1.45;
  box-sizing: border-box;
}
.agc *, .agc *::before, .agc *::after { box-sizing: inherit; }
.agc button { font: inherit; color: inherit; cursor: pointer; -webkit-appearance: none; appearance: none; }
.agc select, .agc input, .agc textarea { color: var(--agc-ink); }
.agc h2, .agc h3, .agc h4 { margin: 0; line-height: 1.2; }
.agc p { margin: 0 0 .75rem; }
.agc-muted { color: var(--agc-muted); font-size: .92em; }

/* En-tête */
.agc-head { margin-bottom: 1.25rem; }
.agc-head h2 { font-size: 1.6rem; margin-bottom: .35rem; }

/* Grille principale */
.agc-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(320px, 1fr); grid-template-areas: "stage panel" "list panel"; grid-template-rows: max-content 1fr; gap: 1.5rem; align-items: start; }
.agc-stage { grid-area: stage; }
.agc-panel { grid-area: panel; }
.agc-list { grid-area: list; }
@media (max-width: 900px) { .agc-grid { grid-template-columns: 1fr; grid-template-areas: "stage" "panel" "list"; grid-template-rows: auto; } }
@media (max-width: 480px) { .agc-fields { grid-template-columns: 1fr; } }

/* Scène : image + hotspots */
.agc-stage { position: relative; background: var(--agc-bg-soft); border: 1px solid var(--agc-line); border-radius: var(--agc-radius); padding: .75rem; }
.agc-stage-inner { position: relative; width: 100%; }
.agc-stage img.agc-frame { display: block; width: 100%; height: auto; user-select: none; -webkit-user-drag: none; }
.agc-overlay { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; transition: opacity .4s; }
.agc-overlay.is-ready { opacity: 1; }
.agc-hotspot { fill: var(--agc-primary); fill-opacity: 0; stroke: var(--agc-primary-dark); stroke-opacity: 0; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; cursor: pointer; transition: fill-opacity .18s ease, stroke-opacity .18s ease; outline: none; }
.agc-hotspot:hover, .agc-hotspot:focus-visible, .agc-hotspot.is-hover { fill-opacity: .13; stroke-opacity: .75; filter: drop-shadow(0 2px 7px rgba(201, 150, 0, .32)); }
.agc-hotspot.is-active { fill-opacity: .2; stroke-opacity: 1; stroke-width: 2.5; }
.agc-stage-inner.is-focusing .agc-frame { filter: saturate(.55) brightness(1.04); transition: filter .25s; }
.agc-frame { transition: filter .25s; }
.agc-marker { pointer-events: none; opacity: 0; transition: opacity .18s; }
.agc-marker circle { fill: var(--agc-primary); stroke: #fff; stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.agc-marker.is-on { opacity: 1; }
.agc-pulse { fill: none; stroke: var(--agc-primary-dark); stroke-width: 2; stroke-opacity: .8; vector-effect: non-scaling-stroke; pointer-events: none; opacity: 0; }
.agc-overlay.is-ready .agc-pulse { animation: agc-pulse 1.8s ease-out 2; }
@keyframes agc-pulse { 0% { opacity: .55; } 60% { opacity: .15; } 100% { opacity: 0; } }
.agc-tip { position: absolute; z-index: 5; pointer-events: none; background: rgba(31,35,40,.94); color: #fff; padding: .45rem .7rem; border-radius: 10px; font-size: .82rem; line-height: 1.35; max-width: 250px; transform: translate(-50%, -118%) scale(.96); transform-origin: 50% 100%; opacity: 0; transition: opacity .15s ease, transform .15s ease; white-space: normal; box-shadow: 0 6px 18px rgba(0,0,0,.22); backdrop-filter: blur(2px); }
.agc-tip.is-visible { opacity: 1; transform: translate(-50%, -118%) scale(1); }
.agc-tip::after { content: ''; position: absolute; left: 50%; bottom: -5px; width: 10px; height: 10px; background: inherit; transform: translateX(-50%) rotate(45deg); border-radius: 2px; }
.agc-tip strong { display: block; color: var(--agc-primary); font-size: .88rem; margin-bottom: .1rem; }
.agc-stage-tools { display: flex; justify-content: space-between; align-items: center; gap: .5rem; margin-top: .5rem; flex-wrap: wrap; }
.agc-legend { display: flex; flex-wrap: wrap; gap: .4rem; }
.agc-chip { border: 1px solid var(--agc-line); background: var(--agc-bg); color: var(--agc-ink); border-radius: 999px; padding: .4rem .85rem; font-size: .88rem; line-height: 1.2; transition: background .15s, border-color .15s, box-shadow .15s; }
.agc-chip:hover { border-color: var(--agc-primary-dark); box-shadow: inset 0 0 0 100px rgba(242,183,5,.12); }
.agc-chip.is-active { border-color: var(--agc-primary-dark); background: var(--agc-primary); color: var(--agc-ink); font-weight: 600; }
.agc-link { background: none; border: none; color: var(--agc-muted) !important; text-decoration: underline; font-size: .85rem; padding: .25rem; }
.agc-link:hover { color: var(--agc-ink); }

/* Panneau de configuration */
.agc-panel { background: var(--agc-bg); border: 1px solid var(--agc-line); border-radius: var(--agc-radius); padding: 1.25rem; position: sticky; top: 90px; box-shadow: 0 6px 24px rgba(0,0,0,.05); }
@media (max-width: 900px) { .agc-panel { position: static; } }
.agc-panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: .75rem; margin-bottom: 1rem; padding-bottom: .75rem; border-bottom: 3px solid var(--agc-primary); }
.agc-panel-head h3 { font-size: 1.2rem; }
.agc-panel-empty { text-align: center; padding: 1.5rem .5rem; color: var(--agc-muted); }
.agc-panel-empty .agc-icon { font-size: 2.2rem; display: block; margin-bottom: .5rem; }
.agc-badge { display: inline-block; background: var(--agc-primary); color: var(--agc-ink); border-radius: 999px; padding: .15rem .6rem; font-size: .8rem; font-weight: 600; white-space: nowrap; }

/* Champs */
.agc-fields { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem 1rem; }
.agc-field { display: flex; flex-direction: column; gap: .3rem; }
.agc-field.is-wide { grid-column: 1 / -1; }
.agc-field label { font-size: .88rem; font-weight: 600; }
.agc-field label .agc-unit { font-weight: 400; color: var(--agc-muted); }
.agc-field label .agc-req { color: var(--agc-danger); }
.agc-field input[type=text], .agc-field input[type=number], .agc-field select, .agc-field textarea {
  width: 100%; padding: .55rem .7rem; border: 1px solid #cfd4dc; border-radius: 8px; background: #fff; font: inherit; color: inherit; margin: 0;
}
.agc-field input:focus, .agc-field select:focus, .agc-field textarea:focus { outline: 2px solid var(--agc-primary); outline-offset: 1px; border-color: var(--agc-primary-dark); }
.agc-field textarea { min-height: 70px; resize: vertical; }
.agc-field.has-error input, .agc-field.has-error select, .agc-field.has-error textarea { border-color: var(--agc-danger); }
.agc-field .agc-help { font-size: .8rem; color: var(--agc-muted); }
.agc-field .agc-error { font-size: .8rem; color: var(--agc-danger); }
.agc-help-btn { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; border-radius: 50%; border: 1px solid var(--agc-muted); color: var(--agc-muted); font-size: .7rem; margin-left: .35rem; background: none; vertical-align: middle; }

/* Toggle Oui/Non */
.agc-toggle { display: inline-flex; border: 1px solid #cfd4dc; border-radius: 8px; overflow: hidden; width: max-content; }
.agc-toggle button { padding: .45rem .9rem; border: none; background: #fff; color: var(--agc-muted); }
.agc-toggle button.is-on { color: var(--agc-ink); }
.agc-toggle button.is-on { background: var(--agc-primary); color: var(--agc-ink); font-weight: 600; }

/* Choix illustré */
.agc-choice { display: block; }
.agc-radio-img { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: .5rem; }
@media (max-width: 420px) { .agc-radio-img { grid-template-columns: repeat(auto-fill, minmax(86px, 1fr)); } }
.agc-choice-card { position: relative; border: 1px solid #cfd4dc; border-radius: 12px; background: #fff; padding: .45rem .3rem .4rem; display: flex; flex-direction: column; align-items: center; gap: .3rem; font-size: .75rem; line-height: 1.2; color: var(--agc-ink); text-align: center; min-height: 86px; justify-content: center; transition: border-color .15s, box-shadow .15s, background .15s; }
.agc-choice-card svg { width: 48px; height: 26px; stroke: var(--agc-ink); stroke-width: 2.4; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.agc-choice-card img { width: 100%; max-width: 88px; height: 34px; object-fit: cover; border-radius: 6px; display: block; }
.agc-choice-card:hover { border-color: var(--agc-primary-dark); box-shadow: 0 2px 10px rgba(0,0,0,.07); }
.agc-choice-card.is-on { border: 2px solid var(--agc-primary-dark); background: #fffdf3; font-weight: 600; padding: calc(.45rem - 1px) calc(.3rem - 1px) calc(.4rem - 1px); }
.agc-choice-name { display: block; }
.agc-choice-badge { display: inline-block; background: var(--agc-bg-soft); border: 1px solid var(--agc-line); color: var(--agc-muted); border-radius: 999px; padding: .05rem .4rem; font-size: .68rem; font-weight: 600; white-space: nowrap; }
.agc-choice-i { position: absolute; top: 4px; right: 4px; width: 20px; height: 20px; border-radius: 50%; background: rgba(31,35,40,.72); color: #fff; font-size: .72rem; font-style: italic; font-weight: 700; font-family: Georgia, serif; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: background .15s; }
.agc-choice-i:hover { background: var(--agc-ink); }
@media (hover: hover) and (pointer: fine) { .agc-choice-i { opacity: .55; } .agc-choice-card:hover .agc-choice-i { opacity: 1; } }

/* Fiche produit sous la grille de choix */
.agc-optinfo { display: none; margin-top: .6rem; }
.agc-optinfo.is-on { display: block; animation: agc-in .2s ease-out; }
.agc-optinfo-in { position: relative; display: flex; gap: .7rem; align-items: flex-start; background: var(--agc-bg-soft); border: 1px solid var(--agc-line); border-radius: 10px; padding: .7rem; }
.agc-optinfo-in > img { width: 110px; height: 70px; object-fit: cover; border-radius: 8px; flex: none; }
.agc-optinfo-in > img.is-plan { width: 120px; height: 120px; object-fit: contain; background: #fff; border: 1px solid var(--agc-line); }
@media (max-width: 480px) { .agc-optinfo-in { flex-direction: column; } .agc-optinfo-in > img { width: 100%; height: 86px; } .agc-optinfo-in > img.is-plan { width: 100%; height: 180px; } }
.agc-optinfo-txt { min-width: 0; }
.agc-optinfo-ttl { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; margin-bottom: .25rem; }
.agc-optinfo-txt p { font-size: .82rem; color: var(--agc-muted); margin: 0 0 .4rem; }
.agc-optinfo-x { position: absolute; top: .4rem; right: .4rem; background: none; border: none; color: var(--agc-muted); font-size: .9rem; line-height: 1; padding: .2rem; }
.agc-optinfo-x:hover { color: var(--agc-ink); }
.agc-btn-sm { padding: .4rem .8rem; font-size: .82rem; }

/* Schéma d'aide */
.agc-schema { grid-column: 1 / -1; border: 1px dashed var(--agc-line); border-radius: 8px; overflow: hidden; }
.agc-schema summary { cursor: pointer; padding: .5rem .75rem; font-size: .88rem; font-weight: 600; background: var(--agc-bg-soft); }
.agc-schema img { display: block; width: 100%; height: auto; }
.agc-schema p { padding: .5rem .75rem; font-size: .8rem; color: var(--agc-muted); margin: 0; }

/* Boutons */
.agc-actions { display: flex; gap: .6rem; flex-wrap: wrap; margin-top: 1.1rem; }
.agc-btn { border: none; border-radius: 999px; padding: .7rem 1.4rem; font-weight: 600; text-decoration: none; transition: transform .1s, background .15s, box-shadow .15s, color .15s; }
.agc-btn:active { transform: translateY(1px); }
.agc-btn-primary { background: var(--agc-primary); color: var(--agc-ink) !important; }
.agc-btn-primary:hover { background: var(--agc-primary-dark); }
.agc-btn-ghost { background: transparent; border: 1px solid var(--agc-line); color: var(--agc-ink) !important; }
.agc-btn-ghost:hover { border-color: var(--agc-ink); }
.agc-btn-dark { background: var(--agc-cta); color: var(--agc-cta-text) !important; box-shadow: 0 2px 10px rgba(15,23,42,.18); }
.agc-btn-dark:hover, .agc-btn-dark:focus-visible { background: var(--agc-cta-hover); color: var(--agc-cta-text) !important; box-shadow: 0 4px 14px rgba(253,152,0,.35); }
.agc-btn[disabled] { opacity: .5; cursor: not-allowed; }
.agc-btn-lg { padding: .9rem 1.6rem; font-size: 1.05rem; }

/* Liste de sélection */
.agc-list { border: 1px solid var(--agc-line); border-radius: var(--agc-radius); background: var(--agc-bg); }
.agc-list-head { display: flex; align-items: center; justify-content: space-between; padding: .9rem 1.1rem; border-bottom: 1px solid var(--agc-line); }
.agc-list-head h3 { font-size: 1.1rem; display: flex; align-items: center; gap: .6rem; }
.agc-list-empty { padding: 1.25rem 1.1rem; color: var(--agc-muted); }
.agc-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; gap: .75rem 1rem; align-items: center; padding: .8rem 1.1rem; border-bottom: 1px solid var(--agc-line); animation: agc-in .25s ease-out; }
.agc-row:last-of-type { border-bottom: none; }
@keyframes agc-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.agc-row-num { width: 26px; height: 26px; border-radius: 50%; background: var(--agc-primary); color: var(--agc-ink); font-weight: 700; font-size: .8rem; display: flex; align-items: center; justify-content: center; }
.agc-row-main strong { display: block; }
.agc-row-main span { font-size: .88rem; color: var(--agc-muted); }
.agc-row-qty { font-weight: 600; white-space: nowrap; }
.agc-row-tools { display: flex; gap: .35rem; }
.agc-row-tools button { border: 1px solid var(--agc-line); background: #fff; border-radius: 6px; padding: .3rem .55rem; font-size: .82rem; }
.agc-row-tools button:hover { border-color: var(--agc-ink); }
.agc-row-tools button.agc-del:hover { border-color: var(--agc-danger); color: var(--agc-danger); }
.agc-row.is-editing { background: #fff8dc; }
@media (max-width: 600px) { .agc-row { grid-template-columns: auto minmax(0, 1fr); } .agc-row-qty, .agc-row-tools { grid-column: 2; } }
.agc-list-foot { padding: 1rem 1.1rem; display: flex; justify-content: flex-end; gap: .6rem; flex-wrap: wrap; background: var(--agc-bg-soft); border-radius: 0 0 var(--agc-radius) var(--agc-radius); }

/* Formulaire de contact & confirmation */
.agc-contact .agc-fields { margin-top: .5rem; }
.agc-check { display: flex; gap: .5rem; align-items: flex-start; font-size: .85rem; }
.agc-check input { margin-top: .2rem; }
.agc-hp { position: absolute; left: -9999px; opacity: 0; height: 0; overflow: hidden; }
.agc-recap { font-size: .88rem; margin: .5rem 0 1rem; padding: .6rem .8rem; background: var(--agc-bg-soft); border-radius: 8px; }
.agc-recap li { margin: .15rem 0; }
.agc-alert { padding: .7rem .9rem; border-radius: 8px; font-size: .9rem; margin-bottom: .75rem; }
.agc-alert-error { background: #fef3f2; color: var(--agc-danger); border: 1px solid #fecdca; }
.agc-success { text-align: center; padding: 1.5rem .5rem; }
.agc-success .agc-icon { font-size: 3rem; display: block; margin-bottom: .5rem; color: var(--agc-ok); }
.agc-success h3 { margin-bottom: .5rem; }
.agc-spin { display: inline-block; width: 14px; height: 14px; border: 2px solid rgba(0,0,0,.25); border-top-color: var(--agc-ink); border-radius: 50%; animation: agc-spin .7s linear infinite; vertical-align: middle; margin-right: .4rem; }
@keyframes agc-spin { to { transform: rotate(360deg); } }
.agc-flash { animation: agc-flash .6s; }
@keyframes agc-flash { 0% { box-shadow: 0 0 0 0 var(--agc-primary); } 100% { box-shadow: 0 0 0 14px transparent; } }

/* Guide statique sous le configurateur (contenu lisible par les moteurs de recherche) */
.agc-guide { margin-top: 2.5rem; }
.agc-guide-h { font-size: 1.5rem; margin-bottom: .5rem; }
.agc-guide-intro { color: var(--agc-muted); max-width: 70ch; }
.agc-guide-bloc { margin-top: 2rem; }
.agc-guide-bloc > h3, .agc-guide-bloc > h4 { font-size: 1.2rem; padding-bottom: .4rem; border-bottom: 3px solid var(--agc-primary); display: inline-block; margin-bottom: .6rem; }
.agc-guide-chapo { margin-bottom: .3rem; }
.agc-guide-regle { color: var(--agc-muted); font-size: .92em; max-width: 70ch; }
.agc-guide-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; margin-top: 1rem; }
.agc-guide-item { border: 1px solid var(--agc-line); border-radius: var(--agc-radius); padding: .9rem; background: var(--agc-bg); }
.agc-guide-item img { width: 100%; height: 90px; object-fit: cover; border-radius: 8px; margin-bottom: .6rem; display: block; }
.agc-guide-item h4, .agc-guide-item h5, .agc-guide-item h6 { font-size: 1rem; margin: 0 0 .35rem; }
.agc-guide-item p { font-size: .88rem; color: var(--agc-muted); margin: .35rem 0 0; }
.agc-guide-item .agc-choice-badge { margin-bottom: .2rem; }
.agc-guide-sub { margin: 1.4rem 0 -.2rem; font-size: .95rem; }

/* Confirmation flottante après un ajout */
.agc-flashmsg { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 16px); z-index: 9999;
  background: #0f172a; color: #fff; padding: .7rem 1.1rem; border-radius: 999px; font-size: .92rem; font-weight: 600;
  box-shadow: 0 8px 26px rgba(0,0,0,.26); opacity: 0; pointer-events: none; transition: opacity .2s ease, transform .2s ease;
  max-width: calc(100vw - 32px); text-align: center; }
.agc-flashmsg.is-on { opacity: 1; transform: translate(-50%, 0); }
@media (prefers-reduced-motion: reduce) { .agc-flashmsg { transition: none; } }
