/* =========================================================
   wizard.css - Print Price Pro (Wizard)
   ========================================================= */

/* ------------------------------
   Container
--------------------------------*/
.wizard-container {
  max-width: 1440px;
  margin: 40px auto;
  padding: 20px 30px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  font-family: "Istok Web", Arial, sans-serif;
  color: #333;
}
.wizard-container h2 {
  font-size: 1.5rem;
  margin-bottom: 8px;
  color: #1a1a1a;
}
.wizard-container p {
  font-size: 0.95rem;
  margin-bottom: 20px;
  color: #555;
}
.wizard-container .muted {
  color: #6b7280;
  margin-top: -8px;
}

/* ------------------------------
   Progress Bar
--------------------------------*/
.wizard-progress {
  margin-bottom: 30px;
}
.progress-bar-container {
  width: 100%;
  background-color: #e0e0e0;
  border-radius: 10px;
  margin-bottom: 10px;
}
.progress-bar-fill {
  height: 8px;
  background-color: #0073aa;
  border-radius: 10px;
  width: 16.66%;
  transition: width 0.3s ease;
}
.progress-steps {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  color: #555;
}
.progress-step {
  text-align: center;
}
.progress-step.active {
  font-weight: bold;
  color: #0073aa;
}

/* ------------------------------
   Steps
--------------------------------*/
.wizard-step {
  display: none;
  animation: fadeIn 0.4s ease-in-out;
}
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Fallback: si no hay JS, muestra el primer paso */
.wizard-step:first-of-type {
  display: block;
}

/* ------------------------------
   Labels & Inputs
--------------------------------*/
.wizard-step label {
  display: block;
  margin-bottom: 14px;
  font-size: 0.95rem;
  color: #222;
}
.wizard-step input[type="text"],
.wizard-step input[type="number"],
.wizard-step select {
  width: 100%;
  padding: 10px 12px;
  margin-top: 6px;
  border: 1px solid #ccc;
  border-radius: 8px;
  font-size: 0.95rem;
  transition: border-color 0.2s, box-shadow 0.2s;
  background: #fff;
  color: #111;
}
.wizard-step input:focus,
.wizard-step select:focus {
  border-color: #0073aa;
  box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.15);
  outline: none;
}

/* ------------------------------
   Buttons / Navigation
--------------------------------*/
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 42px;
  padding: 0 16px;
  border: 0;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s, opacity 0.15s;
}
.btn[disabled] {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-next,
.btn-prev {
  padding: 10px 18px;
  border: none;
  border-radius: 8px;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}
.btn-next,
.btn-primary {
  background: #111;
  color: #fff;
}
.btn-next:hover,
.btn-primary:hover {
  filter: brightness(0.95);
  transform: translateY(-1px);
}
.btn-prev,
.btn-secondary {
  background: #f3f3f3;
  color: #333;
}
.btn-prev:hover,
.btn-secondary:hover {
  background: #e0e0e0;
}

.wizard-nav {
  margin-top: 20px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.wizard-actions {
  position: sticky;
  bottom: 12px;
  display: flex;
  gap: 10px;
  margin-top: 12px;
}
.wizard-actions .btn {
  flex: 1;
  height: 48px;
  border-radius: 12px;
  font-weight: 800;
  letter-spacing: 0.2px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  cursor: pointer;
}

/* ------------------------------
   Loader & Results
--------------------------------*/
#wizard-loader {
  text-align: center;
  font-size: 1rem;
  font-weight: 500;
  color: #0073aa;
}
#wizard-results {
  margin-top: 30px;
}

/* =========================================================
   PRESETS — grid + cards + preview
   ========================================================= */
.preset-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 24px;
  align-items: start;
}
.preset-aside {
  position: sticky;
  top: 110px;
}
.preset-preview .book-cover {
  width: 100%;
  padding-top: 66%;
  border-radius: 14px;
  background: #f6f7f9 no-repeat center/cover;
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.06);
}

.preset-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

/* Responsive */
@media (max-width: 1024px) {
  .preset-layout {
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 16px;
  }
  .wizard-layout {
    grid-template-columns: 1fr;
  }
  .wizard-aside {
    order: 2;
    margin-top: 8px;
  }
  .preset-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }
  .wizard-aside .preset-preview-card {
    top: 72px;
  }
}
@media (max-width: 768px) {
  .preset-layout {
    grid-template-columns: 1fr;
  }
  .preset-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .preset-aside {
    order: -1;
    position: static;
  }
}
@media (max-width: 640px) {
  .wizard-container {
    padding: 15px 20px;
  }
  .wizard-nav,
  .wizard-actions {
    flex-direction: column;
    gap: 10px;
  }
  .btn-next,
  .btn-prev,
  .btn {
    width: 100%;
  }
}

/* Accesibilidad para radios ocultos */
.sr-only {
  position: absolute !important;
  clip: rect(1px, 1px, 1px, 1px);
  height: 1px;
  width: 1px;
  overflow: hidden;
}

/* Cards */
.preset-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px;
  border: 1px solid #e6e8ec;
  border-radius: 14px;
  background: #fff;
  cursor: pointer;
  transition: transform 0.08s, box-shadow 0.15s, border-color 0.15s;
  text-align: left;
}
.preset-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
}
.preset-card:focus-visible {
  outline: 2px solid #111;
  outline-offset: 2px;
}
.preset-ico {
  width: 48px;
  height: 48px;
  object-fit: contain;
}
.preset-title {
  font-size: 16px;
  font-weight: 800;
  margin: 0;
}
.preset-meta {
  margin: 0;
  padding: 0;
  list-style: none;
  color: #4a5568;
  font-size: 12px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.preset-meta li {
  background: #f5f6f8;
  border-radius: 999px;
  padding: 4px 8px;
}
.preset-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  background: #ffe04b;
  color: #1a1a1a;
  border-radius: 10px;
  padding: 2px 6px;
  font-size: 11px;
  font-weight: 800;
}
.preset-check {
  position: absolute;
  inset: auto 10px 10px auto;
  background: #111;
  color: #fff;
  border-radius: 999px;
  line-height: 1;
  padding: 5px 7px;
  font-weight: 900;
  opacity: 0;
  transform: scale(0.9);
  transition: 0.15s;
}

/* Selección por radio */
input[name="wizard_preset"]:checked + .preset-card {
  border-color: #111;
  box-shadow: 0 0 0 3px rgba(17, 17, 17, 0.1);
}
input[name="wizard_preset"]:checked + .preset-card .preset-check {
  opacity: 1;
  transform: none;
}

/* Selección por clase JS */
.preset-card.selected,
.preset-card.is-selected {
  border-color: #111;
  box-shadow: 0 0 0 3px rgba(17, 17, 17, 0.1);
}
.preset-card.selected .preset-check,
.preset-card.is-selected .preset-check {
  opacity: 1;
  transform: none;
}

/* Preview */
.preset-preview {
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 12px;
  padding: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
  background: #fff;
}
.book-mockup {
  position: relative;
  width: 160px;
  height: 120px;
  margin: 4px 0 8px;
}
.book-cover {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, #cfd4ff, #e9ecff);
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}
.book-spine {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 10px;
  background: rgba(0, 0, 0, 0.08);
  border-top-left-radius: 6px;
  border-bottom-left-radius: 6px;
}
.preview-specs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 12px;
  color: #4a5568;
}
.preview-specs span {
  background: #f5f6f8;
  border-radius: 999px;
  padding: 4px 8px;
}

/* Mockup basado en imagen (si lo usas desde JS) */
.preset-preview .mockup-figure {
  margin: 4px 0 8px;
  max-width: 560px;
}
.preset-preview .mockup-img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 12px;
  background: #f6f7f9;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

.preset-card svg {
  width: 48px;
  height: 48px;
  color: #111;
  display: block;
}

/* ===== Wizard layout: main + aside (preview) ===== */
.wizard-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 24px;
  align-items: start;
}
.wizard-main {
  min-width: 0;
}
.wizard-aside {
  position: relative;
}
.wizard-aside .preset-preview-card {
  position: sticky;
  top: 96px;
  background: #fff;
  border: 1px solid #e9ecef;
  border-radius: 16px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.06);
  padding: 14px;
}
.preset-preview-card .preview-thumb {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 12px;
  display: block;
  background: #f6f7f9;
  border: 1px solid #eef1f5;
}
.preset-preview-card .preview-meta {
  font-size: 13px;
  line-height: 1.4;
  color: #556;
  padding-top: 8px;
}

/* Espacio entre grid y preview */
.preset-layout,
.wizard-step {
  margin-bottom: 16px;
}

/* ===== Wizard offers ===== */
.wizard-offers {
  margin-top: 12px;
}
.offer-card {
  display: block;
  min-height: 56px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid #e0e0e0;
  margin-bottom: 10px;
  cursor: pointer;
}
.offer-card.best {
  background: #e74c3c;
  color: #fff;
}
.offer-card.other {
  background: #e8f3f8;
  color: #223548;
}
.offer-card.active {
  outline: 2px solid #2e7d32;
}
.offer-main {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.offer-name {
  flex: 1;
  min-width: 0;
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.offer-cost {
  font-size: 18px;
  font-weight: 900;
}
.offer-days {
  font-size: 12px;
  opacity: 0.9;
}
.offer-tag {
  margin-left: auto;
  padding: 2px 6px;
  font-size: 10px;
  text-transform: uppercase;
  border-radius: 6px;
}
.offer-tag.best {
  background: #ffeb3b;
  color: #000;
}
.offer-tag.other {
  background: #7f8c8d;
  color: #fff;
}

/* Breakdown toggle */
.offer-toggle {
  margin-top: 8px;
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 8px;
  padding: 6px 10px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}
.offer-card.best .offer-toggle {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.28);
}
.offer-card.other .offer-toggle {
  background: rgba(255, 255, 255, 0.7);
  color: #223548;
  border-color: rgba(0, 0, 0, 0.06);
}
.offer-details[hidden] {
  display: none !important;
}
.offer-details {
  margin-top: 8px;
  border-radius: 8px;
  padding: 8px;
}
.offer-card.best .offer-details {
  background: rgba(255, 255, 255, 0.15);
}
.offer-card.other .offer-details {
  background: #fff;
}

/* Breakdown table */
.offer-lines {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.offer-lines th {
  text-align: left;
  font-weight: 700;
  padding: 6px 6px 6px 4px;
}
.offer-lines td {
  text-align: right;
  padding: 6px 4px;
}
.offer-lines tfoot th,
.offer-lines tfoot td {
  border-top: 2px solid rgba(0, 0, 0, 0.15);
  padding-top: 8px;
  font-weight: 800;
}
.offer-card.best .offer-details .offer-lines th,
.offer-card.best .offer-details .offer-lines td {
  color: #fff;
}
.offer-card.best .offer-details .offer-lines tfoot th,
.offer-card.best .offer-details .offer-lines tfoot td {
  border-top-color: rgba(255, 255, 255, 0.45);
}

/* CTA */
.choose-offer {
  margin-top: 8px;
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 10px;
  padding: 10px 12px;
  font-weight: 800;
  width: 100%;
  text-align: center;
}
.offer-card.best .choose-offer {
  background: transparent;
  color: #fff;
  border-color: rgba(255, 255, 255, 0.35);
}
.offer-card.other .choose-offer {
  background: transparent;
  color: #223548;
  border-color: rgba(0, 0, 0, 0.12);
}

/* Error box */
.wizard-error .err-inner {
  background: #fdecea;
  color: #a61b1b;
  border: 1px solid #f5c2c7;
  border-radius: 10px;
  padding: 12px;
}

/* Loading / Error UI del bpe-frontend */
.bpe-loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(255, 255, 255, 0.8);
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 9999;
}
.bpe-spinner {
  border: 4px solid rgba(0, 0, 0, 0.1);
  border-radius: 50%;
  border-top: 4px solid #3498db;
  width: 30px;
  height: 30px;
  animation: spin 1s linear infinite;
  margin-bottom: 10px;
}
@keyframes spin {
  0% {
    transform: rotate(0);
  }
  100% {
    transform: rotate(360deg);
  }
}
.bpe-loading-message {
  font-family: Arial, sans-serif;
  font-size: 16px;
  color: #333;
}
.bpe-error-container {
  position: fixed;
  top: 20px;
  right: 20px;
  max-width: 400px;
  z-index: 10000;
  display: none;
}
.bpe-error-message {
  background-color: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
  border-radius: 4px;
  padding: 15px;
  margin-bottom: 10px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  position: relative;
}
.bpe-error-close {
  position: absolute;
  top: 5px;
  right: 10px;
  font-size: 20px;
  font-weight: bold;
  cursor: pointer;
}
.bpe-error-title {
  font-weight: bold;
  margin-bottom: 5px;
}
.bpe-error-text {
  font-size: 14px;
}