/* ── Album Wizard ── v2 ─────────────────────────────────────────────────────── */

#bb-wizard-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 99999;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
#bb-wizard-overlay.active { display: flex; }

#bb-wizard-modal {
  background: #fff;
  border-radius: 20px;
  width: 100%;
  max-width: 580px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 36px 32px 28px;
  position: relative;
  box-shadow: 0 20px 60px rgba(0,0,0,.2);
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
}

/* Evitar zoom en iOS al tocar inputs de archivo */
#bb-wizard-modal input[type="file"] {
  font-size: 16px !important;
}
#bb-wizard-modal input[type="text"],
#bb-wizard-modal input[type="url"],
#bb-wizard-modal input[type="number"],
#bb-wizard-modal input[type="date"],
#bb-wizard-modal select {
  font-size: 16px;
}

#bb-wizard-close {
  position: absolute;
  top: 14px; right: 16px;
  background: none; border: none;
  font-size: 22px; cursor: pointer;
  color: #bbb; line-height: 1;
}
#bb-wizard-close:hover { color: #555; }

/* ── Cabecera ── */
.bb-wiz-header { text-align: center; margin-bottom: 24px; }
.bb-wiz-header h2 { font-size: 1.2rem; font-weight: 700; margin: 0 0 4px; color: #1a1a1a; }
.bb-wiz-step-label { font-size: .78rem; color: #bbb; margin-bottom: 12px; }

.bb-wiz-progress-track {
  background: #f0f0f0; border-radius: 999px; height: 5px; overflow: hidden;
}
.bb-wiz-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #e65c99, #f7a8d0);
  border-radius: 999px;
  transition: width .4s ease;
}

/* ── Pasos ── */
.bb-wiz-step { display: none; }
.bb-wiz-step.active { display: block; animation: bbFade .2s ease; }
@keyframes bbFade { from { opacity:0; transform:translateY(6px); } to { opacity:1; transform:translateY(0); } }

.bb-wiz-step h3 { font-size: 1rem; font-weight: 700; margin: 0 0 4px; color: #1a1a1a; }
.bb-wiz-step p.bb-hint { font-size: .82rem; color: #999; margin: 0 0 16px; }

/* ── Inputs ── */
.bb-wiz-step input[type="text"],
.bb-wiz-step input[type="url"],
.bb-wiz-step input[type="number"],
.bb-wiz-step select {
  width: 100%; border: 1.5px solid #e5e5e5; border-radius: 12px;
  padding: 12px 15px; font-size: .93rem; font-family: inherit;
  outline: none; transition: border-color .2s; box-sizing: border-box;
  margin-bottom: 10px; background: #fff;
}
.bb-wiz-step input:focus,
.bb-wiz-step select:focus { border-color: #e65c99; }

/* ── Selector de portada ── */
.bb-portada-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 10px;
  max-height: 340px;
  overflow-y: auto;
  padding: 2px;
}
.bb-portada-opt {
  background: none; border: 2px solid #e5e5e5; border-radius: 12px;
  cursor: pointer; padding: 6px; transition: border-color .2s, transform .15s;
  text-align: center;
}
.bb-portada-opt:hover { border-color: #e65c99; transform: scale(1.02); }
.bb-portada-opt.selected { border-color: #e65c99; box-shadow: 0 0 0 3px rgba(230,92,153,.15); }
.bb-portada-opt img { width: 100%; aspect-ratio: 3/4; object-fit: cover; border-radius: 8px; display: block; }
.bb-portada-opt span { font-size: .75rem; color: #666; display: block; margin-top: 5px; line-height: 1.2; }

/* ── Fecha ── */
.bb-fecha-row { display: flex; gap: 8px; }
.bb-fecha-row input[type="number"] { flex: 1; }
.bb-fecha-row select { flex: 2; }

/* ── Upload zone ── */
.bb-upload-zone {
  border: 2px dashed #e0e0e0; border-radius: 16px; padding: 26px 20px;
  text-align: center; cursor: pointer; transition: border-color .2s, background .2s;
  margin-bottom: 12px;
}
.bb-upload-zone:hover, .bb-upload-zone.dragover {
  border-color: #e65c99; background: #fff5f9;
}
.bb-upload-icon { font-size: 2rem; margin-bottom: 6px; }
.bb-upload-zone p { margin: 0 0 4px; font-size: .85rem; color: #777; }
.bb-upload-zone span { color: #e65c99; font-weight: 600; }

/* ── Contador fotos ── */
.bb-foto-counter {
  text-align: center; font-size: .82rem; color: #aaa; margin-bottom: 10px;
}
.bb-foto-counter strong { color: #e65c99; font-size: 1.1em; }

/* ── Barra de subida ── */
.bb-upload-bar-wrap {
  background: #f0f0f0; border-radius: 999px; height: 5px;
  margin-bottom: 6px; display: none; position: relative;
}
.bb-upload-bar-fill {
  height: 100%; background: #e65c99; border-radius: 999px; transition: width .3s;
}
.bb-upload-bar-label {
  font-size: .75rem; color: #aaa; text-align: center; margin-bottom: 10px;
}

/* ── Grid de fotos ── */
.bb-foto-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-auto-rows: 90px;
  gap: 10px;
  max-height: 300px;
  overflow-y: scroll;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 2px;
}
.bb-foto-thumb {
  width: 100%;
  height: 90px;
  border-radius: 10px;
  overflow: hidden;
  background: #f5f5f5;
  position: relative;
}
.bb-foto-thumb img {
  width: 100%; height: 100%;
  object-fit: cover; display: block;
}
.bb-thumb-uploading {
  position: absolute; inset: 0; background: rgba(0,0,0,.4);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: .85rem; font-weight: 700;
}
.bb-remove-foto {
  position: absolute; top: 4px; right: 4px;
  background: rgba(0,0,0,.6); color: #fff; border: none;
  border-radius: 50%; width: 22px; height: 22px; font-size: 12px;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  line-height: 1;
}

/* ── Rompecabezas preview ── */
.bb-rompe-preview {
  width: 100%; max-height: 200px; object-fit: contain;
  border-radius: 12px; margin-top: 10px; display: none;
}

/* ── Lista canciones / películas ── */
.bb-list-item { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.bb-list-num {
  width: 26px; height: 26px; background: #fce8f3; color: #e65c99;
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: .78rem; font-weight: 700; flex-shrink: 0;
}
.bb-list-item input { flex: 1; margin-bottom: 0 !important; }

/* ── Resumen ── */
.bb-resumen { background: #fafafa; border-radius: 14px; padding: 16px; font-size: .85rem; }
.bb-resumen-row {
  display: flex; gap: 8px; padding: 7px 0;
  border-bottom: 1px solid #f0f0f0;
}
.bb-resumen-row:last-child { border-bottom: none; }
.bb-resumen-key { font-weight: 600; color: #666; min-width: 110px; flex-shrink: 0; }
.bb-resumen-val { color: #333; word-break: break-all; }

/* ── Navegación ── */
.bb-wiz-nav { display: flex; gap: 10px; margin-top: 22px; }
.bb-wiz-back {
  flex: 1; padding: 12px; border: 1.5px solid #e0e0e0; border-radius: 12px;
  background: #fff; font-size: .88rem; cursor: pointer; font-family: inherit;
}
.bb-wiz-back:hover { border-color: #bbb; }
.bb-wiz-next {
  flex: 2; padding: 12px; border: none; border-radius: 12px;
  background: #e65c99; color: #fff; font-size: .95rem; font-weight: 700;
  cursor: pointer; font-family: inherit; transition: background .2s;
}
.bb-wiz-next:hover { background: #d44d88; }
.bb-wiz-next:disabled { opacity: .5; cursor: not-allowed; }

/* ── Error ── */
.bb-wiz-error {
  background: #fff0f3; border: 1px solid #ffc0cb; border-radius: 10px;
  color: #c0392b; font-size: .82rem; padding: 9px 14px; margin-top: 10px; display: none;
}
.bb-wiz-error.visible { display: block; }

/* ── Spinner ── */
.bb-spinner {
  display: inline-block; width: 14px; height: 14px;
  border: 2px solid rgba(255,255,255,.4); border-top-color: #fff;
  border-radius: 50%; animation: bbSpin .7s linear infinite;
  vertical-align: middle; margin-right: 6px;
}
@keyframes bbSpin { to { transform: rotate(360deg); } }

/* ── Spotify result ── */
.bb-cancion-wrap { margin-bottom: 12px; }
.bb-cancion-wrap .bb-list-item { margin-bottom: 4px; }

.bb-spotify-result {
  display: flex; align-items: center; gap: 8px;
  margin-left: 34px; padding: 7px 10px;
  border-radius: 10px; font-size: .8rem;
}
.bb-spotify-result img {
  width: 36px; height: 36px; border-radius: 6px; object-fit: cover; flex-shrink: 0;
}
.bb-spotify-result div { display: flex; flex-direction: column; gap: 1px; flex: 1; }
.bb-spotify-result strong { color: #1a1a1a; font-size: .82rem; }
.bb-spotify-result span { color: #888; font-size: .76rem; }

.bb-spotify-ok    { background: #f0faf4; border: 1px solid #b7e4c7; }
.bb-spotify-error { background: #fff0f0; border: 1px solid #ffc0c0; color: #c0392b; }
.bb-spotify-loading { background: #f8f8f8; border: 1px solid #e5e5e5; color: #aaa; }

.bb-spotify-check {
  color: #27ae60; font-size: 1rem; font-weight: 700; margin-left: auto; flex-shrink: 0;
}

.bb-spinner-dark {
  display: inline-block; width: 12px; height: 12px; flex-shrink: 0;
  border: 2px solid #ccc; border-top-color: #888;
  border-radius: 50%; animation: bbSpin .7s linear infinite;
}

/* ── Ocultar selector de variantes nativo de WooCommerce ── */
.bb-album-product table.variations,
.bb-album-product .woocommerce-variation-price,
.bb-album-product .woocommerce-variation-availability,
.bb-album-product .woocommerce-variation-description,
.bb-album-product .reset_variations {
  display: none !important;
}

/* ── Selector de portada en página del producto ── */
.bb-portada-selector {
  margin-bottom: 18px;
}
.bb-portada-selector h4 {
  font-size: .85rem;
  font-weight: 700;
  color: #555;
  margin: 0 0 10px;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.bb-portada-selector .bb-portada-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 8px;
}
.bb-portada-selector .bb-portada-opt {
  background: none;
  border: 2px solid #e5e5e5;
  border-radius: 10px;
  cursor: pointer;
  padding: 4px;
  transition: border-color .2s, transform .15s;
  text-align: center;
}
.bb-portada-selector .bb-portada-opt:hover {
  border-color: #e65c99;
  transform: scale(1.03);
}
.bb-portada-selector .bb-portada-opt.selected {
  border-color: #e65c99;
  box-shadow: 0 0 0 3px rgba(230,92,153,.15);
}
.bb-portada-selector .bb-portada-opt img {
  width: 100%;
  aspect-ratio: 3/4;
  object-fit: cover;
  border-radius: 7px;
  display: block;
}
.bb-portada-selector .bb-portada-opt span {
  font-size: .7rem;
  color: #888;
  display: block;
  margin-top: 4px;
  line-height: 1.2;
}
.bb-portada-hint {
  font-size: .78rem;
  color: #bbb;
  margin-top: 8px;
}

/* ── Responsive ── */
@media (max-width: 580px) {
  #bb-wizard-overlay {
    align-items: flex-end;
    padding: 0;
  }
  #bb-wizard-modal {
    padding: 22px 16px 24px;
    border-radius: 20px 20px 0 0;
    max-height: 92vh;
    height: 92vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .bb-portada-grid { grid-template-columns: repeat(2, 1fr); }
  .bb-fecha-row    { flex-wrap: wrap; }
}
