/* ============================================================
   Alcaprint Personalizador — Frontend CSS
   ============================================================ */
:root {
  --alp-accent:  #e94560;
  --alp-accent2: #ff6b8a;
  --alp-bg:      #f8f8fb;
  --alp-border:  #dde2ed;
  --alp-text:    #2c2c3e;
  --alp-muted:   #7a7a98;
  --alp-radius:  12px;
  --alp-green:   #22c55e;
}

.alp-widget {
  margin: 20px 0;
  font-family: inherit;
}

/* ── Título ─────────────────────────────────────────────── */
.alp-heading {
  font-size: .88rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--alp-text);
  margin: 0 0 10px;
}
.alp-req { color: var(--alp-accent); margin-left: 3px; }

/* ── Zona drag-drop ─────────────────────────────────────── */
.alp-dropzone {
  border: 2px dashed var(--alp-border);
  border-radius: var(--alp-radius);
  background: var(--alp-bg);
  min-height: 150px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transition: border-color .2s, background .2s, box-shadow .2s;
}
.alp-dropzone:focus-within,
.alp-dropzone.alp-drag-over {
  border-color: var(--alp-accent);
  background: #fff5f7;
  box-shadow: 0 0 0 4px rgba(233,69,96,.09);
}

/* Estado: idle (label = zona clickable completa) */
.alp-idle {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 28px 20px;
  text-align: center;
  cursor: pointer;
  width: 100%;
}
.alp-icon {
  width: 46px;
  height: 46px;
  color: var(--alp-muted);
  transition: color .2s, transform .2s;
}
.alp-dropzone:focus-within .alp-icon,
.alp-dropzone.alp-drag-over .alp-icon {
  color: var(--alp-accent);
  transform: translateY(-4px);
}
.alp-idle-title {
  font-size: .9rem;
  font-weight: 600;
  color: var(--alp-text);
}
.alp-browse-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 22px;
  background: var(--alp-accent);
  color: #fff;
  border-radius: 8px;
  font-size: .85rem;
  font-weight: 700;
  box-shadow: 0 3px 12px rgba(233,69,96,.3);
  transition: background .18s, transform .18s;
}
.alp-dropzone:focus-within .alp-browse-btn { background: #c73350; }
.alp-idle-hint {
  font-size: .75rem;
  color: var(--alp-muted);
  margin: 0;
}

/* Input nativo: oculto visualmente pero accesible y funcional */
.alp-file-hidden {
  position: absolute;
  width: 1px; height: 1px;
  opacity: 0; overflow: hidden;
  clip: rect(0,0,0,0);
  pointer-events: none;
}

/* Estado: subiendo */
.alp-uploading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 30px 20px;
  width: 100%;
}
.alp-progress-bar {
  width: 100%;
  max-width: 220px;
  height: 6px;
  background: var(--alp-border);
  border-radius: 99px;
  overflow: hidden;
}
.alp-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--alp-accent), var(--alp-accent2));
  border-radius: 99px;
  width: 0;
  animation: alp-bar 1.4s ease infinite;
}
@keyframes alp-bar {
  0%   { transform: translateX(-100%); width: 55%; }
  100% { transform: translateX(210%);  width: 55%; }
}
.alp-uploading span { font-size: .82rem; color: var(--alp-muted); }

/* Estado: imagen subida */
.alp-uploaded {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 20px;
  width: 100%;
  animation: alp-fade-in .3s ease;
}
@keyframes alp-fade-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}
.alp-thumb {
  max-width: 180px;
  max-height: 180px;
  object-fit: contain;
  border-radius: 8px;
  border: 2px solid var(--alp-green);
  box-shadow: 0 4px 16px rgba(0,0,0,.1);
}
.alp-uploaded-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.alp-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: 8px;
  border: none;
  font-size: .82rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: all .18s;
}
.alp-btn-secondary          { background: #1a1a2e; color: #fff; }
.alp-btn-secondary:hover    { background: #2e2e50; transform: translateY(-1px); color: #fff; }
.alp-btn-danger             { background: transparent; color: var(--alp-accent); border: 2px solid var(--alp-accent); }
.alp-btn-danger:hover       { background: var(--alp-accent); color: #fff; transform: translateY(-1px); }

/* ── Error ──────────────────────────────────────────────── */
.alp-error {
  margin-top: 10px;
  padding: 10px 16px;
  background: #fff1f2;
  color: #be123c;
  border: 1px solid #fecdd3;
  border-radius: 8px;
  font-size: .85rem;
}

/* ── Sección de vista previa ────────────────────────────── */
.alp-preview-section { margin-top: 4px; }

/*
 * Contenedor de la vista previa.
 * Usamos position:relative + dos img apiladas.
 * NO usamos canvas para evitar problemas de CORS.
 */
.alp-preview-container {
  position: relative;
  display: inline-block;
  max-width: 100%;
  line-height: 0;
  border-radius: var(--alp-radius);
  overflow: hidden;
  box-shadow: 0 6px 24px rgba(0,0,0,.14);
}

/* Imagen de fondo: el mockup del producto */
.alp-mockup-img {
  display: block;
  max-width: 100%;
  height: auto;
}

/* Imagen del cliente superpuesta — posición se aplica inline desde JS */
.alp-custom-img {
  position: absolute;
  object-fit: contain;
  object-position: center;
  pointer-events: none;
  /* mix-blend-mode e opacity se aplican inline desde JS */
}

.alp-preview-note {
  font-size: .74rem;
  color: var(--alp-muted);
  font-style: italic;
  margin: 6px 0 0;
}

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 480px) {
  .alp-idle    { padding: 22px 14px; }
  .alp-thumb   { max-width: 140px; max-height: 140px; }
}
