/* =========================================================================
   Imprenta Pro · Editor de álbumes de fotos
   Usa la base de personalizer.css (pasos, tarjetas, ticket) y la caja de
   revisión de magazine.css, y añade tamaños, bandeja de fotos y simulador.
   ========================================================================= */

.ipc-app.ipa-app { grid-template-columns: minmax(0, 1fr) minmax(300px, 400px); }
/* El lienzo no debe ensanchar la columna: la pista implícita sería min-content. */
.ipa-app .ipc-main { grid-template-columns: minmax(0, 1fr); }
.ipa-app .ipc-main > *, .ipa-stage { min-width: 0; }

/* ---------- borrador ---------- */
.ipa-draft {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 12px;
  padding: 12px 16px;
  border-radius: var(--ipro-radius-lg);
  background: #fff8d6;
  border: 1px solid #f1dc7c;
  font-size: 14px;
}
.ipa-draft p { flex: 1 1 260px; font-weight: 600; }

/* ---------- tipo ---------- */
.ipa-card-desc { color: var(--ipro-ink-soft); font-size: 13px; line-height: 1.35; }

/* ---------- tamaños ---------- */
.ipa-formats { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 8px; }
.ipa-format {
  display: grid;
  justify-items: center;
  align-content: start;
  gap: 2px;
  padding: 10px 8px 9px;
  border: 1.5px solid var(--ipro-line);
  border-radius: var(--ipro-radius);
  background: var(--ipro-sheet);
  text-align: center;
}
.ipa-format:hover { border-color: var(--ipro-line-strong); }
.ipa-format.is-active { border-color: var(--ipro-ink); background: var(--ipro-paper); box-shadow: inset 0 0 0 1px var(--ipro-ink); }
.ipa-format strong { font-family: var(--ipro-mono); font-size: 13.5px; }
.ipa-format small { color: var(--ipro-ink-soft); font-size: 12px; line-height: 1.25; }
.ipa-format-icon { display: grid; place-items: center; width: 40px; height: 40px; margin-bottom: 4px; }
.ipa-format-icon i { display: block; border-radius: 2px; background: #fff; box-shadow: inset 0 0 0 1.5px var(--ipro-ink), 2px 2px 0 var(--ipro-paper-2); }
.ipa-format.is-active .ipa-format-icon i { background: var(--ipro-yellow); }
.ipa-format-icon i.is-dashed { width: 30px; height: 22px; background: transparent; box-shadow: none; border: 1.5px dashed var(--ipro-ink); }
.ipa-custom { margin-top: 14px; }

/* ---------- papel y páginas ---------- */
.ipa-papers { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.ipa-paper { grid-template-columns: 44px minmax(0, 1fr); }
.ipa-paper-swatch { grid-row: 1 / 3; width: 44px; height: 52px; border-radius: 4px; box-shadow: inset 0 0 0 1px rgba(22, 22, 26, .14), 3px 3px 0 -1px #ddd6c8; }
.ipa-paper-swatch--gloss { background: linear-gradient(135deg, #fff 0 30%, #e8eef4 42%, #fff 54%, #f2f2f2 100%); }
.ipa-paper-swatch--matte { background: #f6f4ef; }
.ipa-paper-swatch--silk { background: linear-gradient(135deg, #fbfaf7 0 40%, #efece4 60%, #fbfaf7 100%); }
.ipa-paper-swatch--art { background: radial-gradient(circle at 30% 30%, rgba(0, 0, 0, .05) 1px, transparent 1.5px) 0 0 / 5px 5px, #f7f1e3; }
.ipa-pages-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-top: 16px; }
.ipa-pages-label { font-weight: 700; }
.ipa-pages-row small { color: var(--ipro-ink-soft); font-size: 13px; }

/* ---------- fotos ---------- */
.ipa-tray-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 6px 12px; margin: 14px 0 8px; font-size: 13.5px; font-weight: 600; color: var(--ipro-ink-soft); }
.ipa-tray { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 8px; max-height: 290px; overflow-y: auto; padding: 2px; }
.ipa-tray:empty { display: none; }
.ipa-photo { position: relative; aspect-ratio: 1; border-radius: 8px; background: var(--ipro-paper-2); overflow: hidden; }
.ipa-app .ipa-photo-pick { display: block; width: 100%; height: 100%; padding: 0; border: 0; background: none; cursor: grab; }
.ipa-photo-pick canvas, .ipa-photo-pick img { display: block; width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.ipa-photo:hover .ipa-photo-pick { opacity: .85; }
.ipa-photo.is-used { box-shadow: 0 0 0 2px var(--ipro-ok); }
.ipa-photo.is-error { box-shadow: 0 0 0 2px var(--ipro-error); }
.ipa-photo.is-error .ipa-photo-pick { opacity: .4; }
.ipa-photo-bar { position: absolute; left: 6px; right: 6px; bottom: 6px; height: 4px; border-radius: 4px; background: rgba(255, 255, 255, .8); display: none; }
.ipa-photo.is-busy .ipa-photo-bar { display: block; }
.ipa-photo-bar i { display: block; height: 100%; width: 0; border-radius: 4px; background: var(--ipro-cyan); transition: width .2s ease; }
.ipa-photo-badge { position: absolute; left: 4px; top: 4px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px; background: var(--ipro-ok); color: #fff; font-size: 11px; font-weight: 800; line-height: 18px; text-align: center; pointer-events: none; }
.ipa-photo-badge:empty { display: none; }
.ipa-photo.is-error .ipa-photo-badge { background: var(--ipro-error); }
.ipa-app .ipa-photo-remove { position: absolute; right: 3px; top: 3px; width: 22px; height: 22px; padding: 0; border: 0; border-radius: 50%; background: rgba(22, 22, 26, .72); color: #fff; font-size: 15px; line-height: 22px; opacity: 0; transition: opacity .12s ease; }
.ipa-photo:hover .ipa-photo-remove, .ipa-photo-remove:focus-visible, .ipa-photo.is-error .ipa-photo-remove { opacity: 1; }
@media (hover: none) { .ipa-app .ipa-photo-remove { opacity: 1; } }

/* ---------- simulador ---------- */
.ipa-editor { padding-bottom: 18px; }
.ipa-editor-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 12px; }
.ipa-editor-head p { color: var(--ipro-ink-soft); font-size: 14px; margin-top: 2px; max-width: 52ch; }
.ipa-stage {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 300px;
  padding: 12px;
  border-radius: var(--ipro-radius);
  background:
    radial-gradient(circle at 1px 1px, rgba(22, 22, 26, .09) 1px, transparent 1.5px) 0 0 / 14px 14px,
    var(--ipro-paper-2);
  overflow: hidden;
}
.ipa-stage.is-preview { background: radial-gradient(ellipse at 50% 40%, #f7f4ee 0, #e4ddcf 70%, #d9d1c1 100%); }
.ipa-stage canvas { display: block; max-width: 100%; touch-action: none; outline: 0; cursor: pointer; }
.ipa-stage.is-preview canvas { cursor: default; }
.ipa-stage canvas.is-dragging { cursor: grabbing; }
.ipa-stage canvas:focus-visible { box-shadow: 0 0 0 3px var(--ipro-cyan); }
.ipa-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: rgba(22, 22, 26, .78);
  color: #fff;
  font-size: 24px;
  line-height: 1;
  box-shadow: 0 6px 16px -6px rgba(0, 0, 0, .5);
}
.ipa-app .ipa-nav { color: #fff; }
.ipa-nav:hover { background: var(--ipro-ink); }
.ipa-nav:disabled { opacity: .25; cursor: default; }
.ipa-nav--prev { left: 10px; }
.ipa-nav--next { right: 10px; }
.ipa-caption { margin: 10px 0 0; text-align: center; font-family: var(--ipro-mono); font-size: 12.5px; color: var(--ipro-ink-soft); }

.ipa-tools { display: grid; gap: 12px; margin-top: 14px; padding: 14px; border-radius: var(--ipro-radius); background: var(--ipro-paper); }
.ipa-tool { display: grid; gap: 6px; }
.ipa-tool--row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 16px; }
.ipa-tool-label, .ipa-field > span:first-child { font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--ipro-ink-soft); }
.ipa-layouts { display: flex; flex-wrap: wrap; gap: 6px; }
.ipa-layout { display: grid; place-items: center; min-width: 52px; min-height: 52px; padding: 4px; border: 1.5px solid var(--ipro-line); border-radius: 8px; background: #fff; }
.ipa-layout:hover { border-color: var(--ipro-line-strong); }
.ipa-layout.is-active { border-color: var(--ipro-ink); box-shadow: inset 0 0 0 1px var(--ipro-ink); }
.ipa-layout svg { display: block; }
.ipa-layout rect { fill: #cfc8b8; }
.ipa-layout .ipa-layout-page { fill: #fff; stroke: var(--ipro-line-strong); stroke-width: .8; }
.ipa-layout.is-active rect:not(.ipa-layout-page) { fill: var(--ipro-cyan); }
.ipa-layout line { stroke: var(--ipro-ink); stroke-width: 1.4; stroke-linecap: round; }
.ipa-field { display: grid; gap: 5px; }
.ipa-field--grow { flex: 1 1 200px; }
.ipa-field input[type="text"] { width: 100%; padding: 9px 11px; border: 1.5px solid var(--ipro-line-strong); border-radius: 8px; background: #fff; font-size: 15px; }
.ipa-field input[type="text"]:focus { border-color: var(--ipro-ink); outline: 0; }
.ipa-colors { display: flex; flex-wrap: wrap; gap: 6px; }
.ipa-color { position: relative; width: 30px; height: 30px; padding: 0; border: 0; border-radius: 50%; background: var(--sw); box-shadow: inset 0 0 0 1.5px rgba(22, 22, 26, .3), 0 0 0 2px #fff; cursor: pointer; }
.ipa-color.is-active { box-shadow: inset 0 0 0 1.5px rgba(22, 22, 26, .3), 0 0 0 2px #fff, 0 0 0 4px var(--ipro-ink); }
.ipa-color--pick { background: conic-gradient(#e0007a, #ffd400, #1f7a4d, #00a0dc, #6b3fa0, #e0007a); }
.ipa-color--pick.is-active { background: var(--sw); }
.ipa-color--pick input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; border: 0; padding: 0; }
.ipa-cell-tools .ipc-zoom { min-width: 180px; }
.ipa-cell-tools .ipc-dpi { margin-top: 0; }

.ipa-strip { display: flex; gap: 8px; margin-top: 12px; padding: 4px 2px 8px; overflow-x: auto; scrollbar-width: thin; }
.ipa-thumb canvas { display: block; height: 56px; width: auto; }
.ipa-app .ipa-thumb { cursor: pointer; }
.ipa-thumb::after { display: none; }
.ipa-thumb.is-warn::after, .ipa-thumb.is-error::after { display: block; }

/* ---------- revisión ---------- */
.ipa-review { order: 0; }

/* ---------- estrecho ---------- */
@container (max-width: 860px) {
  .ipc-app.ipa-app { grid-template-columns: minmax(0, 1fr); }
  .ipa-app .ipa-review { order: 1; }
  .ipa-app .ipc-main { order: 0; }
}
@media (max-width: 600px) {
  .ipa-stage { min-height: 0; padding: 8px 8px 52px; }
  .ipa-nav { top: auto; bottom: 8px; transform: none; width: 36px; height: 36px; font-size: 20px; }
  .ipa-nav--prev { left: calc(50% - 44px); }
  .ipa-nav--next { right: calc(50% - 44px); }
  .ipa-formats { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
  .ipa-tools { padding: 12px 10px; }
}
