/* configurator.css
   Configurateur illustre, version sobre : plan de travail clair, le tacos ou
   la pizza dessines au fil des choix, recapitulatif a droite qui devient le
   ticket de commande. Prefixe cfx-. Mobile first, zones de clic 48 px.
   ========================================================================== */

.cfx { --cfx-line: rgba(255,255,255,.1); --cfx-glass: rgba(255,255,255,.05); color: #fff; }

/* --- Choix tacos / pizza ------------------------------------------------- */
.cfx__switch { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: var(--sp-6); }
.cfx__switch-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 8px 20px;
  border: 1.5px solid rgba(255,255,255,.22);
  border-radius: var(--radius-pill);
  background: transparent;
  color: rgba(255,255,255,.8);
  font-family: var(--font-body);
  font-weight: 700;
  font-size: var(--fs-sm);
  cursor: pointer;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.cfx__switch-btn svg { width: 20px; height: 20px; }
.cfx__switch-btn:hover { border-color: #fff; color: #fff; }
.cfx__switch-btn[aria-pressed="true"] { background: #fff; border-color: #fff; color: var(--color-secondary); }

/* --- Mise en page : etapes a gauche, plat + ticket a droite ---------------- */
.cfx__layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "stage" "steps" "bar" "ticket";
  gap: var(--sp-5);
  align-items: start;
}
.cfx__side  { display: contents; }
.cfx__stage { grid-area: stage; position: sticky; top: calc(var(--header-height, 76px) + 8px); z-index: 3; }
.cfx__steps { grid-area: steps; }
.cfx__bar   { grid-area: bar; }
.cfx-ticket { grid-area: ticket; }
@media (min-width: 900px) {
  .cfx__layout {
    grid-template-columns: minmax(0, 1.1fr) minmax(360px, .9fr);
    grid-template-areas: "steps side" "bar side";
    gap: var(--sp-5) var(--sp-7);
  }
  /* la colonne de droite (plat + ticket) suit le defilement d'un bloc */
  .cfx__side {
    display: flex;
    flex-direction: column;
    gap: var(--sp-5);
    grid-area: side;
    /* collee en haut ; si elle est plus haute que l'ecran, le JS ajuste "top"
       pour qu'on puisse atteindre le bas du ticket en defilant */
    position: sticky;
    top: calc(var(--header-height, 76px) + 12px);
  }
  .cfx__stage { position: static; }
  .cfx__scene { max-height: 250px; }
}

/* --- Scene (le plat sur le plan de travail) ------------------------------ */
.cfx__stage {
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #E7DFD3;
  box-shadow: 0 20px 50px rgba(0,0,0,.4);
}
.cfx__scene { position: relative; aspect-ratio: 4 / 3; max-height: 200px; margin: 0 auto; }
.cfx__scene svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.cfx__stage { flex-shrink: 0; }
.cfx__caption {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  background: #fff;
  color: var(--color-secondary);
}
.cfx__caption-name { font-family: var(--font-display); font-size: var(--fs-lg); text-transform: uppercase; letter-spacing: .02em; line-height: 1.1; }
.cfx__caption-sub { color: #6B5D57; font-size: var(--fs-xs); margin-top: 2px; }
.cfx__caption-price { font-family: var(--font-price); font-size: var(--fs-xl); font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* Animations SVG : ingredients et fumee (discretes) */
.cfx-topping { transform-box: fill-box; transform-origin: center; animation: cfx-drop 420ms var(--ease-out) both; }
.cfx-topping.is-leaving { animation: cfx-lift 220ms var(--ease) both; }
@keyframes cfx-drop { from { opacity: 0; transform: translateY(-10px) scale(1.06); } to { opacity: 1; transform: none; } }
@keyframes cfx-lift { to { opacity: 0; transform: translateY(-6px); } }
.cfx-drizzle { stroke-dasharray: 600; stroke-dashoffset: 600; animation: cfx-draw 800ms var(--ease-out) forwards; }
@keyframes cfx-draw { to { stroke-dashoffset: 0; } }
.cfx-baked { opacity: 0; transition: opacity 1.6s ease; }
.cfx__stage.is-done .cfx-baked { opacity: 1; }
.cfx-smoke { opacity: 0; }
.cfx__stage.is-cooking .cfx-smoke { transform-box: fill-box; transform-origin: 50% 100%; animation: cfx-smoke 2.6s ease-out infinite; }
@keyframes cfx-smoke {
  0%   { opacity: 0; transform: translateY(0) scale(.5); }
  25%  { opacity: .35; }
  100% { opacity: 0; transform: translateY(-150px) translateX(var(--sx, 0px)) scale(1.8); }
}

/* --- Etapes --------------------------------------------------------------- */
.cfx__steps { display: flex; flex-direction: column; gap: var(--sp-4); }
.cfx-step {
  border-top: 1px solid rgba(255,255,255,.14);
  padding: var(--sp-4) 0 var(--sp-3);
}
.cfx-step__head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 4px; }
.cfx-step__title { font-family: var(--font-display); font-size: var(--fs-xl); text-transform: uppercase; letter-spacing: .02em; color: #fff; }
.cfx-step__state { font-size: var(--fs-xs); color: rgba(255,255,255,.55); white-space: nowrap; }
.cfx-step.is-complete .cfx-step__state { color: var(--color-accent); }
.cfx-step__hint { color: rgba(255,255,255,.6); font-size: var(--fs-sm); margin-bottom: var(--sp-3); min-height: 1.4em; }
.cfx-step__options { display: flex; flex-wrap: wrap; gap: 8px; }
.cfx-opt {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding: 8px 16px;
  border: 1.5px solid rgba(255,255,255,.22);
  border-radius: var(--radius-pill);
  background: transparent;
  color: #fff;
  font-family: inherit;
  font-weight: 600;
  font-size: var(--fs-sm);
  cursor: pointer;
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease), color var(--dur) var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.cfx-opt:hover:not(:disabled) { border-color: #fff; }
.cfx-opt:disabled { opacity: .35; cursor: not-allowed; }
.cfx-opt[aria-pressed="true"] { background: #fff; border-color: #fff; color: var(--color-secondary); }
.cfx-opt__check { display: none; font-weight: 800; }
.cfx-opt[aria-pressed="true"] .cfx-opt__check { display: inline; }
.cfx-opt__price { font-family: var(--font-price); font-size: var(--fs-xs); color: rgba(255,255,255,.6); }
.cfx-opt[aria-pressed="true"] .cfx-opt__price { color: #6B5D57; }

/* --- Barre de validation ------------------------------------------------- */
.cfx__bar {
  position: sticky;
  bottom: 10px;
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 10px 10px 18px;
  border-radius: var(--radius-md);
  background: rgba(22,16,13,.94);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,.14);
  box-shadow: 0 16px 40px rgba(0,0,0,.4);
}
.cfx__bar-total { display: flex; flex-direction: column; line-height: 1.1; min-width: 0; }
.cfx__bar-label { font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .1em; color: rgba(255,255,255,.55); }
.cfx__bar-price { font-family: var(--font-price); font-size: var(--fs-2xl); font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.cfx__bar-missing { font-size: var(--fs-xs); color: rgba(255,255,255,.6); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cfx__bar .btn { margin-left: auto; min-height: 50px; }
.cfx__bar .btn:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }
.cfx__reset { background: none; border: 0; color: rgba(255,255,255,.6); font: inherit; font-size: var(--fs-sm); text-decoration: underline; cursor: pointer; padding: 8px; min-height: 44px; }
.cfx__reset:hover { color: #fff; }
body.cfx-in-view .floating-call,
body.cfx-in-view .back-to-top { opacity: 0 !important; pointer-events: none !important; transition: opacity var(--dur) var(--ease); }
@media (max-width: 899px) {
  /* Commande validee : le plat n'est plus collant, il se place juste au-dessus du ticket, la barre disparait */
  .cfx.is-final .cfx__layout { grid-template-areas: "steps" "stage" "ticket"; }
  .cfx.is-final .cfx__stage { position: static; }
  .cfx.is-final .cfx__bar { display: none; }
  .cfx__bar { display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; padding: 10px 12px; }
  .cfx__bar .btn { grid-column: 1 / -1; margin-left: 0; width: 100%; }
  .cfx__bar-price { font-size: var(--fs-xl); }
  .cfx__reset { justify-self: end; }
  .cfx__caption-sub { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
}

/* --- Recapitulatif / ticket (a droite) ----------------------------------- */
.cfx-ticket {
  background: #FFFDF7;
  color: #1A1310;
  border-radius: var(--radius-md);
  padding: 22px 22px 20px;
  font-family: var(--font-price);
  box-shadow: 0 20px 50px rgba(0,0,0,.35);
  position: relative;
}
.cfx-ticket__head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding-bottom: 12px; border-bottom: 2px dashed #D9CFC2; }
.cfx-ticket__title { font-family: var(--font-display); font-size: var(--fs-2xl); text-transform: uppercase; line-height: 1; }
.cfx-ticket__date { font-size: var(--fs-xs); color: #6B5D57; white-space: nowrap; }
.cfx-ticket__item { font-family: var(--font-display); font-size: var(--fs-lg); text-transform: uppercase; padding: 12px 0 6px; }
.cfx-ticket__lines { list-style: none; margin: 0; padding: 0 0 10px; border-bottom: 2px dashed #D9CFC2; }
.cfx-ticket__lines li { display: flex; justify-content: space-between; gap: 16px; padding: 5px 0; font-size: var(--fs-sm); }
.cfx-ticket__lines li span:first-child { color: #6B5D57; flex-shrink: 0; }
.cfx-ticket__lines li span:last-child { text-align: right; font-weight: 600; }
.cfx-ticket__empty { font-family: var(--font-body); font-size: var(--fs-sm); color: #6B5D57; padding: 12px 0; }
.cfx-ticket__total { display: flex; justify-content: space-between; align-items: baseline; padding: 12px 0 4px; font-weight: 700; }
.cfx-ticket__total strong { font-size: var(--fs-2xl); color: var(--color-primary); }
.cfx-ticket__say {
  margin: 12px 0 0;
  padding: 12px 14px;
  background: #FFF3D1;
  border-left: 4px solid var(--color-accent);
  border-radius: 6px;
  font-family: var(--font-body);
  font-size: var(--fs-sm);
  line-height: 1.5;
}
.cfx-ticket__say strong { display: block; font-size: var(--fs-xs); letter-spacing: .1em; text-transform: uppercase; color: #8A5200; margin-bottom: 4px; }
.cfx-ticket__info { font-family: var(--font-body); font-size: var(--fs-xs); color: #6B5D57; margin-top: 10px; line-height: 1.5; }
.cfx-ticket__actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 14px; }
.cfx-ticket__actions .btn { min-height: 48px; font-size: var(--fs-sm); padding-inline: 12px; }
.cfx-ticket__actions .btn--call { grid-column: 1 / -1; }
.cfx-ticket.is-final { outline: 3px solid var(--color-accent); outline-offset: 3px; }

@media (prefers-reduced-motion: reduce) {
  .cfx-topping, .cfx-drizzle { animation: none !important; }
  .cfx-drizzle { stroke-dashoffset: 0; }
  .cfx-baked { transition: none; }
  .cfx__stage.is-cooking .cfx-smoke { animation-duration: 1.2s; animation-iteration-count: 1; }
}
