/* ==================================================
   ESTE CSS SE BORRA CUANDO IMPORTES EL GLOBAL
   Porque ya existe en shared/css/pikit-ui.css
================================================== */

:root {
  --pink: #ff6fae;
  --blue: #64b5ff;
  --ink: #2d3445;
  --paper: #fffaf1;
  --card: rgba(255, 255, 255, 0.88);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 20% 10%, rgba(255, 111, 174, .12), transparent 28%),
    radial-gradient(circle at 90% 20%, rgba(100, 181, 255, .16), transparent 32%),
    linear-gradient(135deg, #fff8e8, #fffdf8);
}

.card {
  background: var(--card);
  border: 1px solid rgba(100, 181, 255, .25);
  border-radius: 24px;
  padding: 18px;
  margin-bottom: 16px;
  box-shadow: 0 12px 30px rgba(45, 52, 69, .08);
}

.upload-box {
  border: 2px dashed rgba(100, 181, 255, .65);
  background: rgba(100, 181, 255, .08);
  border-radius: 22px;
  min-height: 150px;
  display: grid;
  place-items: center;
  text-align: center;
  cursor: pointer;
  gap: 4px;
}

.main-btn {
  width: 100%;
  border: 0;
  border-radius: 22px;
  padding: 18px;
  background: linear-gradient(135deg, var(--pink), #ff8fc2);
  color: white;
  font-size: 1.15rem;
  font-weight: 900;
  box-shadow: 0 12px 24px rgba(255,111,174,.32);
}

.main-btn:disabled {
  opacity: .45;
  box-shadow: none;
}

.pikit-helper {
  font-size: 0.85rem;
  text-align: center;
  color: var(--pikit-text-muted);
}

.pikit-text-muted {
  color: var(--pikit-text-muted);
}

.pikit-text-center {
  text-align: center;
}

/* ==================================================
   CSS DE LA APP: FOTOS INFANTILES
   Esto NO debería ir al global porque es propio
   de esta herramienta
================================================== */

:root {
  --cut: rgba(120, 120, 120, 0.35);
}

.app-shell {
  width: min(960px, 100%);
  margin: 0 auto;
  padding: 18px;
}

.hero {
  display: flex;
  justify-content: space-between;
  align-items: center;
  overflow: hidden;
}

.eyebrow {
  color: var(--pink);
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  margin: 0 0 4px;
}

h1,
h2 {
  margin: 0;
}

h1 {
  font-size: clamp(2rem, 8vw, 4rem);
  color: var(--blue);
  line-height: .95;
}

h2 {
  font-size: 1.1rem;
  margin-bottom: 12px;
}

.subtitle {
  margin-bottom: 0;
  max-width: 34rem;
}

.leaf {
  font-size: 3rem;
  filter: drop-shadow(0 5px 8px rgba(0,0,0,.12));
}

.upload-icon {
  font-size: 2.5rem;
}

.image-count {
  color: var(--pink);
  font-weight: 800;
}

.thumbs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.thumb {
  width: 54px;
  height: 66px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid rgba(45,52,69,.12);
  cursor: pointer;
}

.helper-text {
  margin-top: 10px;
  text-align: center;
  font-size: 0.85rem;
  color: var(--pikit-text-muted, #8b8091);
}

.toggle-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.option {
  border: 2px solid rgba(45,52,69,.1);
  border-radius: 20px;
  padding: 14px;
  display: grid;
  gap: 4px;
  cursor: pointer;
  background: white;
}

.option input {
  display: none;
}

.option.selected {
  border-color: var(--pink);
  box-shadow: 0 0 0 4px rgba(255,111,174,.12);
}

.option-icon {
  font-size: 1.8rem;
}

.option small,
.note,
.print-warning {
  color: var(--pikit-text-soft, #687086);
}

.note {
  font-size: .9rem;
}

.preview-sheet {
  width: min(100%, 340px);
  aspect-ratio: 216 / 279;
  margin: 0 auto;
  background: white;
  border: 1px solid rgba(45,52,69,.18);
  box-shadow: 0 8px 20px rgba(45,52,69,.12);
  padding: 10px;
  display: flex;
  flex-direction: column;
}

.preview-sheet.bottom {
  justify-content: flex-end;
}

.preview-row {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  border-top: 1px dotted var(--cut);
  border-left: 1px dotted var(--cut);
}

.preview-cell {
  aspect-ratio: 25 / 30;
  border-right: 1px dotted var(--cut);
  border-bottom: 1px dotted var(--cut);
  overflow: hidden;
}

.preview-cell img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.print-warning {
  text-align: center;
  font-size: .9rem;
}

.print-area {
  display: none;
}

/* ==================================================
   IMPRESIÓN
================================================== */

@page {
  size: letter portrait;
  margin: 0;
}

@media print {
  body {
    background: white;
  }

  .app-shell {
    display: none;
  }

  .print-area {
    display: block;
  }

  .sheet {
    width: 216mm;
    height: 279mm;
    page-break-after: always;
    position: relative;
    overflow: hidden;
    background: white;
  }

  .safe-area {
    position: absolute;
    left: 8mm;
    right: 8mm;
    top: 5mm;
    bottom: 5mm;
    display: flex;
    flex-direction: column;
  }

  .safe-area.bottom {
    justify-content: flex-end;
  }

  .photo-row {
    display: grid;
    grid-template-columns: repeat(8, 25mm);
    width: 200mm;
    border-left: .2pt dotted var(--cut);
    border-top: .2pt dotted var(--cut);
  }

  .photo-cell {
    width: 25mm;
    height: 30mm;
    overflow: hidden;
    border-right: .2pt dotted var(--cut);
    border-bottom: .2pt dotted var(--cut);
  }

  .photo-cell img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
  }
}

.crop-modal {
  position: fixed;
  inset: 0;
  z-index: 999;
  padding: 18px;
  background: rgba(23, 23, 47, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
}

.crop-panel {
  width: min(420px, 100%);
  background: var(--pikit-card-solid, #fffdf8);
  border-radius: var(--pikit-radius-lg, 24px);
  padding: 16px;
  box-shadow: 0 20px 45px rgba(23, 23, 47, 0.22);
}

.crop-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.crop-head strong {
  font-size: 1.1rem;
}

#closeCropBtn {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 999px;
  background: white;
  color: var(--pikit-text-soft, #5f566f);
  font-size: 1.5rem;
  font-weight: 900;
}

.crop-frame {
  position: relative;
  width: min(250px, 80vw);
  aspect-ratio: 25 / 30;
  margin: 16px auto;
  overflow: hidden;
  background: white;
  border: 1px dotted var(--cut);
  border-radius: 12px;
  touch-action: none;
}

.crop-frame img {
  position: absolute;
  left: 50%;
  top: 50%;
  max-width: none;
  max-height: none;
  user-select: none;
  pointer-events: none;
  transform-origin: center;
}

#cropModal.pikit-hidden {
  display: none !important;
}

.crop-zoom {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 16px;
}

.crop-zoom button {
  width: 52px;
  height: 52px;
  border: 0;
  border-radius: 16px;

  background: white;
  color: var(--pikit-pink-dark);

  font-size: 1.8rem;
  font-weight: 900;

  box-shadow: 0 6px 16px rgba(40, 20, 60, 0.08);

  cursor: pointer;
}

.crop-zoom button:active {
  transform: scale(0.96);
}

.crop-zoom {
  display: flex !important;
  justify-content: center;
  gap: 12px;
  margin: 12px 0 16px;
}

#zoomInBtn,
#zoomOutBtn {
  width: 52px !important;
  height: 52px !important;
  border: 0 !important;
  border-radius: 16px !important;
  background: white !important;
  color: var(--pikit-pink-dark, #ec3d8d) !important;
  font-size: 1.8rem !important;
  font-weight: 900 !important;
  box-shadow: 0 6px 16px rgba(40, 20, 60, 0.12) !important;
}

#zoomInBtn:active,
#zoomOutBtn:active {
  transform: scale(0.96);
}

.remove-bg-btn {
  width: 100%;
  margin: 0 0 12px;
}

.preview-cell,
.photo-cell {
  position: relative;
  overflow: hidden;
}

.preview-cell img,
.photo-cell img {
  display: block;
}

.preview-cell,
.photo-cell {
  position: relative;
  overflow: hidden;
}

.photo-fill {
  width: 100%;
  height: 100%;
  background-repeat: no-repeat;
  background-position: center;
}

.print-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transform-origin: center;
}

/* Fix encuadre fotos infantiles: preview y print usan el mismo centro/zoom que el modal */
.preview-cell,
.photo-cell {
  position: relative;
  overflow: hidden;
}

.preview-cell .photo-fill,
.photo-cell .print-photo {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 100%;
  height: 100%;
  object-fit: cover;
  max-width: none;
  max-height: none;
  transform-origin: center;
}
