/* ═══════════════════════════════════════════════════════════════
   JF Constructor · Modo compacto + efectos 2026
   Capa posterior a editorial-v2.css
   ═══════════════════════════════════════════════════════════════ */

:root {
  --jf-builder-topbar-h: 66px;
  --jf-builder-gap: 12px;
}

/* ── MODO APP: al empezar, el constructor ocupa el viewport ─── */
body.jf-builder-started {
  height: 100svh;
  overflow: hidden;
  overscroll-behavior: none;
}
body.jf-builder-started .jf-landing { display: none !important; }
body.jf-builder-started #configurador.jf-flow {
  display: flex !important;
  height: 100svh;
  min-height: 0;
  flex-direction: column;
  overflow: hidden;
}

/* ── TOPBAR COMPACTA ─────────────────────────────────────────── */
.jf-builder-topbar {
  flex: 0 0 var(--jf-builder-topbar-h);
  min-height: var(--jf-builder-topbar-h);
  padding-block: 8px;
  gap: 18px;
}
.jf-builder-brand { min-width: 180px; }
.jf-builder-brand__mark {
  width: 36px;
  height: 36px;
  border-radius: 10px;
}
.jf-builder-progress__labels { margin-bottom: 5px; }
.jf-builder-progress__track {
  position: relative;
  height: 5px;
}
.jf-builder-progress__fill {
  position: relative;
  overflow: hidden;
}
.jf-builder-progress__fill::after {
  content: "";
  position: absolute;
  inset: 0;
  width: 42%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.72), transparent);
  transform: translateX(-140%) skewX(-18deg);
  animation: jfProgressSheen 2.35s ease-in-out infinite;
}
@keyframes jfProgressSheen {
  0%, 38% { transform: translateX(-140%) skewX(-18deg); }
  72%, 100% { transform: translateX(350%) skewX(-18deg); }
}
.jf-builder-total {
  min-width: 114px;
  padding: 6px 11px;
  transition: transform .28s cubic-bezier(.2,.9,.2,1), background .28s ease;
}
.jf-builder-total.is-updated {
  transform: scale(1.065) rotate(-1deg);
  background: var(--jf-fiesta);
}
.jf-builder-mobile-steps-open { display: none; }

/* ── WORKSPACE COMPACTO ─────────────────────────────────────── */
.jf-builder-layout {
  flex: 1 1 auto;
  min-height: 0;
  width: min(100%, 1560px);
  padding: var(--jf-builder-gap);
  grid-template-columns: 220px minmax(0, 1fr);
  gap: var(--jf-builder-gap);
  overflow: hidden;
}
.jf-builder-sidebar {
  position: relative;
  top: auto;
  height: 100%;
  min-height: 0;
  padding: 10px;
  border-radius: 19px;
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(124,137,90,.48) transparent;
}
.jf-builder-sidebar__title { margin: 2px 6px 7px; }
.jf-builder-steps { gap: 2px; }
.jf-builder-step {
  min-height: 39px;
  padding: 4px 7px;
  grid-template-columns: 29px minmax(0,1fr) 14px;
  gap: 7px;
  border-radius: 10px;
}
.jf-builder-step__number {
  width: 28px;
  height: 28px;
  font-size: 10px;
}
.jf-builder-step strong { font-size: 11px; }
.jf-builder-step small { display: none; }
.jf-builder-step.is-active small {
  display: block;
  font-size: 8px;
  animation: jfSoftReveal .25s ease both;
}
.jf-builder-selection {
  margin-top: 9px;
  padding: 11px;
  border-radius: 14px;
}
.jf-builder-selection__head { margin-bottom: 7px; }
.jf-builder-selection__rows { gap: 4px; }
.jf-builder-selection__row { font-size: 9px; }

.jf-builder-main,
.jf-flow-wrap {
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.jf-box.active {
  position: relative;
  isolation: isolate;
  height: 100%;
  min-height: 0;
  max-height: 100%;
  overflow: auto;
  overscroll-behavior: contain;
  padding: clamp(18px, 2vw, 28px);
  border-radius: 22px;
  scrollbar-width: thin;
  scrollbar-color: rgba(124,137,90,.48) transparent;
  animation: none;
}
.jf-box.active::-webkit-scrollbar,
.jf-builder-sidebar::-webkit-scrollbar { width: 8px; }
.jf-box.active::-webkit-scrollbar-thumb,
.jf-builder-sidebar::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 999px;
  background: rgba(124,137,90,.42);
  background-clip: padding-box;
}
.jf-box.active::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: .72;
  background: radial-gradient(420px circle at var(--jf-pointer-x, 82%) var(--jf-pointer-y, 12%), rgba(199,209,155,.17), transparent 58%);
  transition: opacity .3s ease;
}
.jf-box.active.jf-enter-forward { animation: jfStepForward .42s cubic-bezier(.2,.75,.2,1) both; }
.jf-box.active.jf-enter-back { animation: jfStepBack .42s cubic-bezier(.2,.75,.2,1) both; }
@keyframes jfStepForward {
  from { opacity:0; transform:translateX(34px) scale(.988); filter:blur(3px); }
  to { opacity:1; transform:none; filter:none; }
}
@keyframes jfStepBack {
  from { opacity:0; transform:translateX(-28px) scale(.992); filter:blur(3px); }
  to { opacity:1; transform:none; filter:none; }
}
@keyframes jfSoftReveal { from{opacity:0;transform:translateY(-2px)} to{opacity:1;transform:none} }

.jf-box-head {
  max-width: 760px;
  margin-bottom: 17px;
}
.jf-box-head span { margin-bottom: 8px; }
.jf-box-head h2 {
  margin-bottom: 7px;
  font-size: clamp(1.75rem, 2.5vw, 2.75rem);
  line-height: 1;
}
.jf-box-head p {
  font-size: 13px;
  line-height: 1.48;
}
.jf-box-actions { margin-top: 13px; }

/* ── PASOS INICIALES MÁS BAJOS ─────────────────────────────── */
.jf-tejido-grid { gap: 12px; }
.jf-tejido-card {
  display: grid;
  grid-template-columns: minmax(135px,.72fr) minmax(0,1.28fr);
  min-height: 190px;
}
.jf-tejido-card img {
  width: 100%;
  height: 100%;
  min-height: 190px;
  object-fit: cover;
}
.jf-tejido-card-body {
  padding: 18px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.jf-tejido-card-body strong { font-size: 20px; }
.jf-tejido-card-body small { margin-top: 7px; font-size: 12px; }
.jf-tejido-badge { margin-top: 12px; }

.jf-options-grid { gap: 10px; }
.jf-choice {
  padding: 17px 16px;
  border-radius: 16px;
}
.jf-choice strong { font-size: 15px; }
.jf-choice small { margin-top: 6px; font-size: 11px; }
.jf-choice.selected::before,
.jf-choice.active::before {
  top: 10px;
  right: 10px;
  width: 24px;
  height: 24px;
  animation: jfSelectedPop .42s cubic-bezier(.2,1.35,.2,1) both;
}
@keyframes jfSelectedPop { from{transform:scale(.2) rotate(-30deg);opacity:0} to{transform:none;opacity:1} }

/* Color + tallas en paralelo en escritorio */
#box-2.active {
  display: grid !important;
  grid-template-columns: minmax(0,.88fr) minmax(360px,1.12fr);
  grid-template-rows: auto minmax(0,1fr);
  gap: 14px 18px;
  align-items: start;
}
#box-2.active > .jf-box-head { grid-column: 1 / -1; margin-bottom: 0; }
#box-2.active > #jf-colors-grid { grid-column: 1; align-content: start; }
#box-2.active > .jf-tallas-wrap { grid-column: 2; margin: 0; }
#jf-colors-grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
.color-choice { min-height: 62px; padding: 12px; }
.jf-tallas-wrap { padding: 16px; border-radius: 18px; }
.jf-tallas-head { margin-bottom: 11px; }
.jf-tallas-grid { gap: 7px; }
.jf-talla-item { padding: 7px; }
.jf-tallas-total { margin-top: 11px; }

/* Cantidad centrada y corta */
#box-3.active .jf-qty-slider-wrap {
  max-width: 780px;
  margin-inline: auto;
  padding: 24px clamp(22px,4vw,48px);
}
#box-3.active .jf-box-head,
#box-3.active .jf-box-actions { max-width: 780px; margin-inline: auto; }
.jf-qty-display { font-size: clamp(3rem,6vw,5.2rem); }

/* Diseño: header más corto y paneles controlados */
#box-zonas.active {
  grid-template-columns: minmax(330px,.76fr) minmax(460px,1.24fr);
  gap: 12px;
}
#box-zonas.active > .jf-box-head { margin-bottom: 0; }
#box-zonas.active > .jf-design-config-panel { grid-column: 1; min-width: 0; }
#box-zonas.active > .jf-mockup-final-block {
  grid-column: 2;
  grid-row: 2;
  position: sticky;
  top: 0;
}
.jf-design-config-panel { min-width: 0; }
.jf-zone-topbar { margin-bottom: 8px; }
.jf-zone-topbar-note { font-size: 11px; }
.jf-zone-group { margin-bottom: 10px; }
.jf-zone-group h3 { margin-bottom: 7px; font-size: 12px; }
.jf-zone-card { min-height: 66px; padding: 11px; }
.jf-zone-config { padding: 13px; }
.jf-zone-summary { margin-top: 10px; padding: 12px; }
.jf-mockup-box { padding: 12px; }
.jf-mockup-box-head { margin-bottom: 9px; }
.jf-mockup-box-head h2 { font-size: 20px; }
.jf-mockup-box-head p { font-size: 11px; }
.jf-mockup-toolbar { gap: 5px; }
.jf-view-btn { min-height: 33px; padding: 0 9px; font-size: 9px; }
.jf-mockup-stage { min-height: min(430px, calc(100svh - 285px)); }
.jf-mobile-design-tabs { display: none; }

/* Pack en una sola línea cuando haya espacio */
#box-pack.active .jf-pack-grid {
  grid-template-columns: repeat(4,minmax(0,1fr));
  gap: 10px;
}
.jf-pack-item { border-radius: 17px; }
.jf-pack-image { height: 135px; }
.jf-pack-top,
.jf-pack-controls { padding-inline: 13px; }
.jf-pack-colors { padding-inline: 13px; gap: 5px; }
.jf-pack-color-btn { width: 19px; height: 19px; }
.jf-pack-actions { margin-top: 13px; }

/* Regalo horizontal */
#box-regalo.active .jf-pack-grid { max-width: 820px; }
#box-regalo.active .jf-pack-item {
  display: grid;
  grid-template-columns: 250px minmax(0,1fr);
  align-items: center;
}
#box-regalo.active .jf-pack-image { height: 220px; grid-row: 1 / span 3; }

/* Resumen más denso */
#box-9.active .jf-summary-mini-box {
  display: grid;
  grid-template-columns: repeat(2,minmax(0,1fr));
  gap: 1px 22px;
  padding: 18px;
}
#box-9.active .jf-summary-total-row,
#box-9.active .jf-summary-highlight-row,
#box-9.active .jf-sum-custom-detail,
#box-9.active .jf-tallas-warning { grid-column: 1 / -1; }

/* ── EFECTOS DE INTERACCIÓN ─────────────────────────────────── */
@media (hover:hover) and (pointer:fine) {
  .jf-fx-tilt {
    --jf-rx: 0deg;
    --jf-ry: 0deg;
    transform: perspective(900px) rotateX(var(--jf-rx)) rotateY(var(--jf-ry)) translateY(var(--jf-lift,0));
    transform-style: preserve-3d;
    will-change: transform;
  }
  .jf-fx-tilt:hover { --jf-lift: -3px; }
  .jf-fx-tilt > * { transform: translateZ(0); }
}
.jf-fx-ripple {
  position: absolute;
  z-index: 8;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  pointer-events: none;
  background: rgba(199,209,155,.52);
  transform: translate(-50%,-50%) scale(0);
  animation: jfRipple .6s ease-out forwards;
}
@keyframes jfRipple { to{transform:translate(-50%,-50%) scale(15);opacity:0} }

.jf-step-burst {
  position: fixed;
  z-index: 1200;
  width: 1px;
  height: 1px;
  pointer-events: none;
}
.jf-step-burst i {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--jf-fiesta);
  animation: jfBurst .58s cubic-bezier(.1,.7,.25,1) forwards;
  transform: rotate(var(--a)) translateX(0) scale(1);
}
.jf-step-burst i:nth-child(even) { background: var(--jf-olive-light); }
@keyframes jfBurst {
  to { transform: rotate(var(--a)) translateX(38px) scale(.15); opacity:0; }
}

/* ── PANEL DE PASOS MÓVIL ───────────────────────────────────── */
.jf-steps-sheet-overlay {
  position: fixed;
  inset: 0;
  z-index: 1600;
  display: grid;
  align-items: end;
  padding: 12px;
  pointer-events: none;
  opacity: 0;
  background: rgba(24,25,22,.52);
  backdrop-filter: blur(5px);
  transition: opacity .28s ease;
}
.jf-steps-sheet-overlay.is-open { pointer-events: auto; opacity: 1; }
.jf-steps-sheet {
  max-height: min(78svh,680px);
  overflow: auto;
  padding: 14px;
  border-radius: 24px 24px 18px 18px;
  background: var(--jf-paper-light);
  box-shadow: 0 28px 70px rgba(24,25,22,.32);
  transform: translateY(calc(100% + 18px));
  transition: transform .4s cubic-bezier(.2,.9,.2,1);
}
.jf-steps-sheet-overlay.is-open .jf-steps-sheet { transform: translateY(0); }
.jf-steps-sheet__head {
  position: sticky;
  top: -14px;
  z-index: 2;
  padding: 8px 4px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--jf-paper-light);
}
.jf-steps-sheet__head strong { font-size: 16px; }
.jf-steps-sheet__close {
  width: 38px;
  height: 38px;
  border: 1px solid var(--jf-border);
  border-radius: 50%;
  background: #fff;
}
.jf-sheet-step {
  width: 100%;
  min-height: 54px;
  margin-top: 6px;
  padding: 8px 10px;
  border: 1px solid var(--jf-border);
  border-radius: 14px;
  display: grid;
  grid-template-columns: 38px minmax(0,1fr) 20px;
  gap: 10px;
  align-items: center;
  color: var(--jf-muted);
  background: #fff;
  text-align: left;
}
.jf-sheet-step span:first-child {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--jf-paper);
  font-family: Georgia,serif;
  font-size: 11px;
}
.jf-sheet-step strong,
.jf-sheet-step small { display:block; }
.jf-sheet-step strong { color:var(--jf-black);font-size:12px; }
.jf-sheet-step small { margin-top:2px;font-size:9px; }
.jf-sheet-step.is-active { border-color:var(--jf-fiesta);background:rgba(215,101,71,.07); }
.jf-sheet-step.is-done span:first-child { background:var(--jf-olive-light);color:var(--jf-black); }
.jf-sheet-step:disabled { opacity:.43; }

/* ── TABLET ─────────────────────────────────────────────────── */
@media (max-width: 1180px) {
  .jf-builder-layout { grid-template-columns: 198px minmax(0,1fr); }
  #box-2.active { grid-template-columns: 1fr; }
  #box-2.active > * { grid-column: 1 !important; }
  #box-pack.active .jf-pack-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
}

/* ── MÓVIL: interfaz específica, no desktop encogido ───────── */
@media (max-width: 900px) {
  :root { --jf-builder-topbar-h: 58px; --jf-builder-gap: 0px; }

  .jf-builder-topbar {
    min-height: var(--jf-builder-topbar-h);
    padding: 7px 9px;
    grid-template-columns: auto minmax(0,1fr) auto;
    grid-template-rows: 1fr;
    gap: 8px;
  }
  .jf-builder-brand { min-width: 0; }
  .jf-builder-brand > div:last-child { display:none; }
  .jf-builder-brand__mark { width:36px;height:36px; }
  .jf-builder-progress { grid-column:auto;grid-row:auto; }
  .jf-builder-progress__labels { margin:0 0 5px; }
  .jf-builder-progress__labels strong {
    display:block;
    max-width:100%;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
    font-size:11px;
  }
  .jf-builder-progress__labels span { display:none; }
  .jf-builder-top-actions { gap:5px; }
  .jf-builder-top-actions #jfBuilderBack,
  .jf-builder-top-actions .jf-builder-help { display:none; }
  .jf-builder-mobile-steps-open {
    width:36px;
    height:36px;
    padding:0;
    display:grid;
    place-items:center;
    border:1px solid var(--jf-border);
    border-radius:10px;
    background:#fff;
    font-size:16px;
  }
  .jf-builder-total {
    min-width:76px;
    padding:5px 7px;
    border-radius:9px;
  }
  .jf-builder-total small { display:none; }
  .jf-builder-total strong { font-size:12px; }

  .jf-builder-layout {
    height: calc(100svh - var(--jf-builder-topbar-h));
    padding: 0;
    display:block;
  }
  .jf-builder-main { height:100%; }
  .jf-mobile-stepbar { display:none !important; }

  .jf-box.active {
    height:100%;
    padding: 15px 14px 92px;
    border:0;
    border-radius:0;
    box-shadow:none;
    background:linear-gradient(180deg,rgba(255,255,255,.82),rgba(250,248,243,.92));
  }
  .jf-box-head { margin-bottom:13px; }
  .jf-box-head span { margin-bottom:6px;font-size:8px; }
  .jf-box-head h2 { font-size:clamp(1.65rem,8vw,2.25rem);margin-bottom:6px; }
  .jf-box-head p { font-size:12px;line-height:1.42; }

  .jf-builder-mobile-dock {
    left:7px;
    right:7px;
    bottom:max(7px,env(safe-area-inset-bottom));
    min-height:58px;
    padding:6px 7px;
    border-radius:15px;
    grid-template-columns:40px minmax(0,1fr) auto 40px;
    gap:7px;
  }
  .jf-mobile-back,
  .jf-mobile-steps-btn {
    width:38px;
    height:38px;
    border:1px solid rgba(255,255,255,.13);
    border-radius:10px;
    display:grid;
    place-items:center;
    color:#fff;
    background:rgba(255,255,255,.06);
  }
  .jf-mobile-dock-copy small { font-size:7px; }
  .jf-mobile-dock-copy strong { margin-top:2px;font-size:11px; }
  .jf-mobile-dock-total { font-size:13px; }

  /* Material: tarjetas tipo lista */
  .jf-tejido-grid { grid-template-columns:1fr;gap:9px; }
  .jf-tejido-card {
    grid-template-columns:104px minmax(0,1fr);
    min-height:126px;
    border-radius:16px;
  }
  .jf-tejido-card img { min-height:126px;height:126px; }
  .jf-tejido-card-body { padding:12px 13px; }
  .jf-tejido-card-body strong { font-size:17px; }
  .jf-tejido-card-body small {
    margin-top:4px;
    display:-webkit-box;
    -webkit-line-clamp:2;
    -webkit-box-orient:vertical;
    overflow:hidden;
    font-size:10px;
  }
  .jf-tejido-badge { margin-top:7px;font-size:9px; }

  /* Calidad lista compacta */
  #box-1 .jf-options-grid { grid-template-columns:1fr;gap:8px; }
  #box-1 .jf-choice { min-height:92px;padding:14px; }
  #box-1 .jf-choice strong { padding-right:32px; }

  /* Colores: dos columnas; tallas densas */
  #box-2.active { display:block !important; }
  #jf-colors-grid { grid-template-columns:repeat(2,minmax(0,1fr)) !important;gap:7px; }
  .color-choice { min-height:56px;padding:9px; }
  .jf-tallas-wrap { margin-top:10px;padding:12px; }
  .jf-tallas-grid { grid-template-columns:repeat(3,minmax(0,1fr));gap:6px; }
  .jf-talla-item { padding:6px; }
  .jf-talla-label { font-size:10px; }
  .jf-talla-qty { min-height:34px; }

  #box-3.active .jf-qty-slider-wrap { padding:19px 14px; }
  .jf-qty-display { font-size:3.4rem; }

  /* Diseño con pestañas: Configurar / Vista previa */
  #box-zonas.active { display:block !important; }
  #box-zonas.active > .jf-box-head { margin-bottom:10px; }
  .jf-mobile-design-tabs {
    position:sticky;
    top:-15px;
    z-index:30;
    margin:0 -14px 10px;
    padding:8px 14px;
    display:grid;
    grid-template-columns:1fr 1fr;
    gap:6px;
    background:rgba(250,248,243,.94);
    backdrop-filter:blur(14px);
    border-bottom:1px solid var(--jf-border);
  }
  .jf-mobile-design-tab {
    min-height:40px;
    border:1px solid var(--jf-border);
    border-radius:11px;
    color:var(--jf-muted);
    background:#fff;
    font-size:10px;
    font-weight:900;
    letter-spacing:.05em;
    text-transform:uppercase;
  }
  .jf-mobile-design-tab.is-active { color:#fff;border-color:var(--jf-fiesta);background:var(--jf-fiesta); }
  #box-zonas[data-mobile-design-view="config"] .jf-mockup-final-block { display:none; }
  #box-zonas[data-mobile-design-view="preview"] .jf-design-config-panel { display:none; }
  #box-zonas .jf-mockup-final-block { position:static !important; }
  .jf-mockup-stage { min-height:330px; }
  .jf-zone-grid { grid-template-columns:repeat(2,minmax(0,1fr)) !important; }
  .jf-zone-card { min-height:60px; }

  #box-pack.active .jf-pack-grid { grid-template-columns:1fr; }
  .jf-pack-item {
    display:grid;
    grid-template-columns:115px minmax(0,1fr);
    align-items:start;
  }
  .jf-pack-image { height:100%;min-height:155px;grid-row:1 / span 4; }
  .jf-pack-top { padding-top:12px; }
  .jf-pack-colors,.jf-pack-controls { padding-bottom:10px; }

  #box-regalo.active .jf-pack-item {
    grid-template-columns:115px minmax(0,1fr);
  }
  #box-regalo.active .jf-pack-image { height:100%;min-height:165px; }

  #box-9.active .jf-summary-mini-box { grid-template-columns:1fr;padding:13px; }
  #box-9.active .jf-summary-mini-box > * { grid-column:1; }

  .jf-floating-wa { bottom:76px !important; }
}

@media (max-width: 420px) {
  .jf-tallas-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .jf-builder-total { min-width:69px; }
  .jf-builder-progress__labels strong { font-size:10px; }
}

@media (prefers-reduced-motion: reduce) {
  .jf-builder-progress__fill::after { display:none; }
  .jf-fx-tilt { transform:none !important; }
  .jf-step-burst { display:none !important; }
}
