/* =============================================================================
   Etapa 3 · temas, tapa, guías, revisión, vista previa, pedido
   ============================================================================= */

/* ---- Barra superior ------------------------------------------------------- */
/* En el celular el estado del guardado va en el menú, como una línea más */
.estado-guardado { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--fg-3); white-space: nowrap; padding: 6px 14px 10px; border-bottom: 1px solid var(--border-1); margin-bottom: 4px; }
.estado-guardado .ms { font-size: 18px; }
@media (min-width: 861px) {
    .estado-guardado { font-size: 12px; gap: 6px; padding: 0; border: none; margin: 0 4px 0 0; }
}
@media (min-width: 861px) and (max-width: 1600px) { .dato-libro, .selector-etapa span { display: none !important; } }
@media (min-width: 861px) and (max-width: 1360px) {
    .acciones-libro .btn { font-size: 0; gap: 0; padding: 0 10px; }
    .acciones-libro .btn .ms { font-size: 20px; }
    .estado-guardado span:not(.ms) { display: none; }
}

/* ---- Lomo ----------------------------------------------------------------- */
.lomo { flex-shrink: 0; display: flex; align-items: center; justify-content: center; overflow: hidden; position: relative; cursor: pointer; }
.lomo span { writing-mode: vertical-rl; transform: rotate(180deg); white-space: nowrap; line-height: 1; }
.lomo::before, .lomo::after { content: ''; position: absolute; top: 0; bottom: 0; width: 1px; background: rgba(0,0,0,.18); }
.lomo::before { left: 0; }
.lomo::after { right: 0; }
#impresion .lomo::before, #impresion .lomo::after { display: none; }

/* ---- Guías de impresión -------------------------------------------------- */
.guias { position: absolute; inset: 0; pointer-events: none; z-index: 8; }
.guia-corte { position: absolute; inset: 0; border: 0 solid rgba(255, 45, 135, .22); }
.guia-segura { position: absolute; border: 1.5px dashed #ff2d87; }
.guia-lomo { position: absolute; top: 0; bottom: 0; background: repeating-linear-gradient(45deg, rgba(255, 45, 135, .16) 0 6px, transparent 6px 12px); }
.guia-lomo.izq { right: 0; }
.guia-lomo.der { left: 0; }

/* ---- Temas ------------------------------------------------------------------ */
.grilla-temas { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 640px) { .grilla-temas.asistente { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.tarjeta-tema { border: 1px solid var(--border-1); border-radius: var(--radius-md); padding: 8px; background: var(--bg-1); cursor: pointer; display: flex; flex-direction: column; gap: 8px; text-align: left; }
.tarjeta-tema:hover { border-color: var(--border-2); background: var(--bg-2); }
.tarjeta-tema.activo { border-color: var(--brand-accent); box-shadow: 0 0 0 1px var(--brand-accent); background: var(--brand-accent-soft); }
.tema-muestra { position: relative; display: flex; aspect-ratio: 2 / 1.05; border-radius: 4px; overflow: hidden; box-shadow: 0 0 0 1px var(--border-1), var(--elev-1); }
.tema-pag { flex: 1; position: relative; display: flex; align-items: center; justify-content: center; }
.tema-pag + .tema-pag { box-shadow: inset 6px 0 8px -6px rgba(0,0,0,.18); }
.tema-pag span { font-size: 24px; line-height: 1; }
.tema-foto { position: absolute; left: 14%; top: 14%; right: 14%; bottom: 32%; background: linear-gradient(135deg, #d7dee8, #a9b8cb); }
.tema-raya { position: absolute; left: 28%; right: 28%; bottom: 15%; height: 6%; border-radius: 3px; }
.tema-sticker { position: absolute; left: 4%; bottom: 6%; width: 24%; }
.tema-info { display: flex; align-items: center; gap: 4px 6px; justify-content: space-between; min-height: 20px; flex-wrap: wrap; }
.tema-info b { font-size: 13px; font-weight: 600; }
.tema-recomendado { font-size: 10px; font-weight: 600; letter-spacing: .3px; color: var(--brand-accent); background: var(--brand-accent-soft); padding: 2px 8px; border-radius: var(--radius-full); }
.tarjeta-tema.activo .tema-recomendado { background: var(--bg-1); }

/* ---- Panel de tapa ------------------------------------------------------- */
.campo-panel { display: flex; flex-direction: column; gap: 10px; }
.campo-panel input[type=text] { height: 40px; border: 1px solid var(--border-2); border-radius: var(--radius-sm); padding: 0 12px; background: var(--bg-1); }
.campo-panel input[type=text]:focus { outline: none; border-color: var(--brand-accent); box-shadow: 0 0 0 1px var(--brand-accent); }
.casilla { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--fg-2); cursor: pointer; }
.casilla input { accent-color: var(--brand-accent); width: 16px; height: 16px; }

/* ---- Asistente: retomar ------------------------------------------------- */
.retomar { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: var(--radius-md); background: var(--brand-accent-soft); color: var(--brand-accent); }
.retomar > .ms { font-size: 28px; }
.retomar-texto { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.retomar-texto b { color: var(--fg-1); font-weight: 600; }
.retomar-texto span { color: var(--fg-2); font-size: 13px; }

/* ---- Revisión ------------------------------------------------------------ */
.revision-resumen { font-size: 13px; color: var(--fg-2); margin-bottom: 10px; }
.revision-lista { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; max-height: 46vh; overflow-y: auto; }
.revision-item { display: flex; align-items: flex-start; gap: 12px; padding: 10px 8px 10px 12px; border-radius: var(--radius-sm); background: var(--bg-2); }
.revision-icono { width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.revision-item.error .revision-icono { background: var(--status-danger-soft); color: var(--status-danger); }
.revision-item.aviso .revision-icono { background: var(--status-warning-soft); color: var(--status-warning); }
.revision-item.info .revision-icono { background: var(--brand-accent-soft); color: var(--brand-accent); }
.revision-texto { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.revision-texto b { font-size: 14px; font-weight: 600; }
.revision-texto span { font-size: 13px; color: var(--fg-2); line-height: 18px; }
.revision-ok { display: flex; gap: 14px; align-items: center; padding: 16px; border-radius: var(--radius-md); background: var(--status-success-soft); }
.revision-ok > .ms { font-size: 32px; color: var(--status-success); }
.revision-ok b { font-size: 15px; font-weight: 600; }
.revision-ok p { font-size: 13px; color: var(--fg-2); margin-top: 2px; line-height: 18px; }

/* ---- Pedido ------------------------------------------------------------- */
.pedido { display: flex; flex-direction: column; gap: 20px; }
.pedido-resumen { display: flex; flex-wrap: wrap; gap: 16px 24px; align-items: center; padding: 16px; border-radius: var(--radius-md); background: var(--bg-3); }
.pedido-tapa { box-shadow: var(--elev-3); border-radius: 1px 4px 4px 1px; flex-shrink: 0; }
.pedido-datos h3 { font: 600 20px/28px var(--font-sans); margin-bottom: 10px; }
.pedido-datos dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 16px; margin: 0; font-size: 14px; }
.pedido-datos dt { color: var(--fg-3); }
.pedido-datos dd { margin: 0; font-weight: 500; }
.pedido-listo { text-align: center; padding: 24px 12px 8px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.pedido-listo > .ms { font-size: 56px; color: var(--status-success); }
.pedido-listo h3 { font: 600 22px/28px var(--font-sans); }
.pedido-listo p { color: var(--fg-2); max-width: 480px; line-height: 21px; }

/* ---- Vista previa: un libro que se hojea --------------------------------- */
.previa { position: fixed; inset: 0; z-index: 150; background: #161616; display: flex; flex-direction: column; color: #fff; animation: aparecer var(--motion-duration-medium) var(--motion-easing-decelerate); touch-action: pan-y; }
.previa-barra { height: 56px; display: flex; align-items: center; gap: 14px; padding: 0 8px 0 16px; flex-shrink: 0; min-width: 0; }
.previa-barra b { font-weight: 600; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.previa-dato { color: #9a9a9a; font-size: 13px; display: none; }
@media (min-width: 861px) { .previa-barra { height: 64px; padding: 0 16px 0 24px; } .previa-dato { display: inline; } }
.previa-barra .relleno { flex: 1; }
.previa .btn-icono { color: #fff; }
.previa .btn-icono:hover { background: rgba(255,255,255,.1); }
.previa .btn-icono:disabled { color: #555; }
.previa-escena { flex: 1; display: flex; align-items: center; justify-content: center; perspective: 2600px; min-height: 0; }
.libro-previa { position: relative; display: flex; transform-style: preserve-3d; transition: transform .55s var(--motion-easing-standard); cursor: pointer; }
.libro-previa.cerrado-tapa { transform: translateX(-25%); }
.libro-previa.cerrado-contra { transform: translateX(25%); }
.libro-previa .mitad { flex: 1; position: relative; transform-style: preserve-3d; }
.libro-previa .mitad > .pagina { box-shadow: 0 18px 50px rgba(0,0,0,.55); }
.libro-previa .mitad.izq > .pagina::after, .libro-previa .mitad.der > .pagina::after, .hoja-que-pasa .pagina::after { content: ''; position: absolute; top: 0; bottom: 0; width: 12%; pointer-events: none; z-index: 9; }
.libro-previa .mitad.izq > .pagina::after { right: 0; background: linear-gradient(90deg, transparent, rgba(0,0,0,.16)); }
.libro-previa .mitad.der > .pagina::after { left: 0; background: linear-gradient(270deg, transparent, rgba(0,0,0,.16)); }
.hoja-que-pasa { position: absolute; inset: 0; transform-style: preserve-3d; transition: transform .75s cubic-bezier(.35, .05, .2, 1); z-index: 5; }
.hoja-que-pasa.hacia-izq { transform-origin: left center; }
.hoja-que-pasa.hacia-izq.pasando { transform: rotateY(-180deg); }
.hoja-que-pasa.hacia-der { transform-origin: right center; }
.hoja-que-pasa.hacia-der.pasando { transform: rotateY(180deg); }
.hoja-que-pasa .cara { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.hoja-que-pasa .cara.dorso { transform: rotateY(180deg); }
.previa-controles { height: 88px; display: flex; align-items: center; justify-content: center; gap: 20px; flex-shrink: 0; padding-bottom: env(safe-area-inset-bottom); }
/* En el celular se ve una página por vez: la que pasa, gira sobre su lomo */
.libro-previa.una-pagina.cerrado-tapa, .libro-previa.una-pagina.cerrado-contra { transform: none; }
.previa-indicador { font-size: 14px; color: #cfcfcf; min-width: 150px; text-align: center; }
