:root {
  --azul-profundo: #06162f;
  --azul-principal: #0d47a1;
  --azul-brillo: #42a5f5;
  --celeste-suave: #e3f2fd;
  --texto: #1f2937;
  --blanco: #ffffff;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, sans-serif;
  background:
    radial-gradient(circle at top, rgba(66, 165, 245, 0.22), transparent 35%),
    linear-gradient(135deg, #e3f2fd, #ffffff);
  color: var(--texto);
}

.splash {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at top, rgba(66, 165, 245, 0.25), transparent 32%),
    linear-gradient(145deg, #020617, #06162f 58%, #0d47a1);
  animation: splashSale 0.55s ease forwards;
  animation-delay: 1.05s;
}

.splash-card {
  text-align: center;
  color: white;
  animation: splashEntra 0.75s ease both;
}

.splash-card img {
  width: 128px;
  height: 128px;
  border-radius: 30px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.38);
}

.splash-card strong {
  display: block;
  margin-top: 16px;
  font-size: 34px;
  letter-spacing: 0.5px;
}

.splash-card span {
  display: block;
  margin-top: 8px;
  font-weight: bold;
  color: #bfdbfe;
}

@keyframes splashEntra {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes splashSale {
  to {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
  }
}

.app {
  max-width: 900px;
  margin: 0 auto;
  padding: 30px 16px;
}

.hero {
  text-align: center;
  margin-bottom: 28px;
}

.logo-img {
  width: 112px;
  height: 112px;
  border-radius: 26px;
  box-shadow: 0 18px 38px rgba(13, 71, 161, 0.28);
}

h1 {
  margin: 10px 0 8px;
  font-size: 40px;
  color: var(--azul-principal);
  letter-spacing: -0.5px;
}

.hero p {
  margin: 0 auto;
  max-width: 560px;
  font-size: 17px;
  color: #475569;
}

.card {
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(66, 165, 245, 0.18);
  border-radius: 22px;
  padding: 24px;
  box-shadow: 0 18px 45px rgba(13, 71, 161, 0.16);
  backdrop-filter: blur(8px);
}

.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 20px;
}

.tab {
  border: none;
  border-radius: 14px;
  padding: 13px;
  font-weight: bold;
  cursor: pointer;
  background: var(--celeste-suave);
  color: var(--azul-principal);
}

.tab.activo {
  background: linear-gradient(135deg, var(--azul-principal), #08306b);
  color: white;
  box-shadow: 0 10px 22px rgba(13, 71, 161, 0.22);
}

.hidden {
  display: none;
}

.card h2 {
  margin-top: 0;
  color: var(--azul-principal);
}

.upload-box {
  display: block;
  border: 2px dashed var(--azul-brillo);
  border-radius: 16px;
  padding: 28px;
  text-align: center;
  cursor: pointer;
  background: #f5fbff;
  transition: 0.2s;
  margin-bottom: 14px;
}

.upload-box.secundario {
  background: #f8fafc;
  border-color: #90caf9;
}

.upload-box:hover {
  background: var(--celeste-suave);
  transform: translateY(-1px);
}

.upload-box input {
  display: none;
}

.upload-box span {
  display: block;
  font-size: 20px;
  font-weight: bold;
  color: var(--azul-principal);
}

.upload-box small {
  display: block;
  margin-top: 8px;
  color: #666;
}

.lista {
  margin-top: 20px;
}

.item {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  gap: 8px;
  align-items: center;
  padding: 12px;
  margin-bottom: 8px;
  border-radius: 12px;
  background: #f1f5f9;
}

.item strong {
  overflow-wrap: anywhere;
}

.item small {
  display: block;
  color: #666;
  margin-top: 3px;
}

.item button {
  border: none;
  border-radius: 8px;
  padding: 7px 10px;
  cursor: pointer;
  background: #e0e7ff;
}

.item button:hover {
  background: #c7d2fe;
}

.vacio {
  padding: 18px;
  border-radius: 12px;
  text-align: center;
  color: #666;
  background: #f8fafc;
}

.campo-nombre {
  display: block;
  margin-top: 18px;
}

.campo-nombre span {
  display: block;
  margin-bottom: 7px;
  color: var(--azul-principal);
  font-weight: bold;
}

.campo-nombre b {
  color: #b91c1c;
}

.campo-nombre input {
  width: 100%;
  padding: 13px 14px;
  border: 1px solid #cbd5e1;
  border-radius: 13px;
  font-size: 15px;
  outline: none;
}

.campo-nombre input:focus {
  border-color: var(--azul-principal);
  box-shadow: 0 0 0 3px rgba(13, 71, 161, 0.12);
}

.error-nombre {
  display: block;
  margin-top: 6px;
  color: #b91c1c;
  font-size: 13px;
  font-weight: bold;
}

.btn {
  width: 100%;
  margin-top: 20px;
  padding: 15px;
  border: none;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--azul-principal), #082f6c);
  color: white;
  font-size: 17px;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 14px 24px rgba(13, 71, 161, 0.22);
}

.btn:disabled {
  background: #9ca3af;
  cursor: not-allowed;
  box-shadow: none;
}

.btn-limpiar {
  width: 100%;
  margin-top: 10px;
  padding: 13px;
  border: none;
  border-radius: 14px;
  background: #fee2e2;
  color: #991b1b;
  font-weight: bold;
  cursor: pointer;
}

.btn-limpiar:disabled {
  background: #e5e7eb;
  color: #9ca3af;
  cursor: not-allowed;
}

.estado {
  text-align: center;
  font-weight: bold;
  margin-bottom: 0;
  color: var(--azul-principal);
}

.footer {
  text-align: center;
  color: #64748b;
  font-size: 14px;
}

@media (max-width: 600px) {
  .app {
    padding: 22px 12px;
  }

  .card {
    padding: 18px;
    border-radius: 18px;
  }

  .tabs {
    grid-template-columns: 1fr;
  }

  .item {
    grid-template-columns: 1fr auto auto auto;
    gap: 6px;
  }

  .upload-box {
    padding: 22px 14px;
  }

  h1 {
    font-size: 34px;
  }
}


.btn-tomar-otra {
  width: 100%;
  margin-top: 12px;
  padding: 14px;
  border: 1px solid rgba(13, 71, 161, 0.18);
  border-radius: 14px;
  background: #e3f2fd;
  color: #0d47a1;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
}

.btn-tomar-otra:hover {
  background: #dbeafe;
}

/* =========================
   RECORTE INMEDIATO
========================= */
.modal-recorte {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  background: rgba(15, 23, 42, 0.72);
}

.modal-recorte.hidden {
  display: none;
}

.recorte-panel {
  width: min(920px, 100%);
  max-height: 96vh;
  overflow: auto;
  background: #ffffff;
  border-radius: 20px;
  padding: 14px;
  box-shadow: 0 25px 70px rgba(0, 0, 0, 0.35);
}

.recorte-header {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: center;
  margin-bottom: 10px;
}

.recorte-header h2 {
  margin: 0;
  color: #0d47a1;
}

.recorte-header p {
  margin: 3px 0 0;
  color: #64748b;
  overflow-wrap: anywhere;
  font-size: 14px;
}

.recorte-cerrar {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 12px;
  background: #f1f5f9;
  font-size: 20px;
  cursor: pointer;
}

.recorte-area {
  position: relative;
  width: 100%;
  min-height: 320px;
  max-height: 68vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 16px;
  background: #111827;
  touch-action: none;
}

.recorte-area img {
  display: block;
  max-width: 100%;
  max-height: 68vh;
  user-select: none;
  pointer-events: none;
}

.recorte-caja {
  position: absolute;
  border: 2px solid #42a5f5;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.44);
  touch-action: none;
}

.recorte-borde {
  position: absolute;
  background: rgba(66, 165, 245, 0.92);
  touch-action: none;
}

.recorte-top,
.recorte-bottom {
  left: -6px;
  right: -6px;
  height: 10px;
  cursor: ns-resize;
}

.recorte-top { top: -5px; }
.recorte-bottom { bottom: -5px; }

.recorte-left,
.recorte-right {
  top: -6px;
  bottom: -6px;
  width: 10px;
  cursor: ew-resize;
}

.recorte-left { left: -5px; }
.recorte-right { right: -5px; }

.recorte-ayuda {
  margin: 10px 4px 0;
  text-align: center;
  color: #475569;
  font-size: 14px;
}

.recorte-acciones {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
}

.btn-secundario,
.btn-aplicar {
  border: none;
  border-radius: 14px;
  padding: 14px;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
}

.btn-secundario {
  background: #f1f5f9;
  color: #334155;
}

.btn-aplicar {
  background: linear-gradient(135deg, #0d47a1, #08306b);
  color: #ffffff;
}

.btn-aplicar:disabled {
  background: #9ca3af;
  cursor: wait;
}

@media (max-width: 600px) {
  .recorte-panel {
    padding: 10px;
    border-radius: 16px;
  }

  .recorte-area {
    min-height: 360px;
    max-height: 62vh;
  }

  .recorte-area img {
    max-height: 62vh;
  }

  .recorte-acciones {
    grid-template-columns: 1fr;
  }

  .recorte-top,
  .recorte-bottom { height: 9px; }
  .recorte-left,
  .recorte-right { width: 9px; }
}
