/* =========================================================
   El configurador de la ficha de un PC (assets/configurador.js)

   Misma estructura que la ficha de un PC en rstech.cl: secciones
   que se despliegan, una fila de tarjetas en cada una, y el
   resumen de componentes con el total. Los colores y medidas son
   los de app.css.
   ========================================================= */

.cfg { margin-top: 26px; }
.cfg__cab { margin-bottom: 14px; }
.cfg__cab h2 { font-size: 21px; margin: 0 0 4px; }
.cfg__cab p { margin: 0; color: var(--txt-2); font-size: 13.5px; max-width: 70ch; }

/* ---- una seccion ---- */
.cfg-sec {
  border: 1.5px solid var(--linea); border-radius: var(--radio);
  background: #fff; margin-bottom: 9px; overflow: hidden;
}
.cfg-sec__cab {
  width: 100%; display: flex; align-items: center; gap: 12px; text-align: left;
  padding: 13px 16px; font: inherit; color: inherit; background: none; border: 0; cursor: pointer;
}
.cfg-sec__cab:hover { background: var(--morado-50); }
.cfg-sec__cab:focus-visible { outline: 2px solid var(--morado-claro); outline-offset: -2px; }
.cfg-sec__t { font-family: var(--f-titulo); font-weight: 700; font-size: 14px; flex-shrink: 0; min-width: 16em; }
.cfg-sec__elegido {
  flex: 1; min-width: 0; font-size: 12.8px; color: var(--txt-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cfg-sec__delta { font-size: 13px; font-weight: 700; color: var(--morado); white-space: nowrap; }
.cfg-sec__delta--incl { color: var(--verde); }
.cfg-sec__flecha { color: var(--txt-3); flex-shrink: 0; display: grid; transition: transform .2s; }
.cfg-sec--abierta .cfg-sec__flecha { transform: rotate(180deg); }
.cfg-sec__cuerpo { display: none; padding: 2px 12px 14px; }
.cfg-sec--abierta .cfg-sec__cuerpo { display: block; }

/* ---- la fila de tarjetas ---- */
.cfg-carril {
  display: grid; grid-auto-flow: column; grid-auto-columns: 158px; gap: 10px;
  overflow-x: auto; scroll-snap-type: x proximity; padding: 4px 2px 8px;
  scrollbar-width: thin;
}
.cfg-op {
  scroll-snap-align: start; display: flex; flex-direction: column; gap: 6px;
  border: 1.5px solid var(--linea); border-radius: var(--radio-s); padding: 10px; background: #fff;
  transition: border-color .15s, background .15s;
}
.cfg-op--elegida { border-color: var(--morado); background: var(--morado-50); }
.cfg-op__foto {
  height: 124px; display: grid; place-items: center; background: #fff;
  border-radius: var(--radio-s); color: var(--txt-3); overflow: hidden;
}
.cfg-op__foto img { width: 100%; height: 100%; object-fit: contain; }
.cfg-op__t {
  font-size: 12.5px; line-height: 1.3; font-weight: 600;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
  min-height: 3.9em;
}
.cfg-op__d { font-size: 11.5px; color: var(--txt-2); line-height: 1.35; }
.cfg-op__p { font-size: 13.5px; font-weight: 800; color: var(--morado); }
.cfg-op__p--incl { color: var(--verde); }
.cfg-op__p--gratis { color: var(--txt-2); font-weight: 700; }
.cfg-op__btn {
  margin-top: auto; height: 34px; border-radius: var(--radio-s);
  border: 1.5px solid var(--morado); background: #fff; color: var(--morado);
  font-weight: 700; font-size: 12.5px; display: inline-flex; align-items: center; justify-content: center; gap: 5px;
}
.cfg-op__btn:hover { background: var(--morado-50); }
.cfg-op__btn[aria-pressed="true"] { background: var(--morado); color: #fff; }
.cfg-op__btn:focus-visible { outline: 2px solid var(--morado-claro); outline-offset: 2px; }

/* ---- resumen de componentes ---- */
.cfg-res {
  margin-top: 16px; background: #fff; border-radius: var(--radio);
  box-shadow: var(--sombra); padding: 18px;
}
.cfg-res h3 { font-size: 16px; margin: 0 0 10px; }
.cfg-res__tabla { overflow-x: auto; }
.cfg-res table { width: 100%; border-collapse: collapse; font-size: 13px; }
.cfg-res th {
  text-align: left; font-size: 11px; letter-spacing: .06em; text-transform: uppercase;
  color: var(--txt-2); padding: 0 8px 7px; border-bottom: 1.5px solid var(--linea);
}
.cfg-res td { padding: 8px; border-bottom: 1px solid var(--linea); vertical-align: top; }
.cfg-res td:first-child { color: var(--txt-2); white-space: nowrap; }
.cfg-res td:last-child, .cfg-res th:last-child { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.cfg-res tr:first-child td { font-weight: 600; }
.cfg-res__cambio td { color: var(--morado); font-weight: 600; }
.cfg-res__cambio td:first-child { color: var(--morado); }
.cfg-res__pie {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; flex-wrap: wrap; margin-top: 14px;
}
.cfg-res__total {
  background: var(--morado); color: #fff; border-radius: var(--radio-s);
  padding: 11px 16px; text-align: right; min-width: 210px;
}
.cfg-res__total small { display: block; font-size: 11.5px; opacity: .85; }
.cfg-res__total b { font-size: 22px; font-family: var(--f-titulo); font-variant-numeric: tabular-nums; }
.cfg-res__total span { display: block; font-size: 11.8px; opacity: .85; margin-top: 2px; }
.cfg-res__botones { display: flex; gap: 9px; flex-wrap: wrap; }
.cfg-res__nota { font-size: 12px; color: var(--txt-2); line-height: 1.55; margin: 12px 0 0; }

/* bajo el precio de la caja de compra: cuanto queda con lo elegido */
.compra__cfg { font-size: 13px; font-weight: 700; color: var(--magenta); margin: -6px 0 12px; }

@media (max-width: 620px) {
  .cfg-sec__cab { flex-wrap: wrap; row-gap: 3px; padding: 12px 14px; }
  .cfg-sec__t { min-width: 0; flex: 1 1 auto; }
  .cfg-sec__elegido { order: 4; flex-basis: 100%; }
  .cfg-carril { grid-auto-columns: 142px; }
  .cfg-op__foto { height: 108px; }
  .cfg-res { padding: 14px; }
  .cfg-res__pie { flex-direction: column; align-items: stretch; }
  .cfg-res__total { text-align: left; }
  .cfg-res__botones .btn { flex: 1 1 100%; }
}
