/**
 * Forja do Mago – Smart Conversions
 * Bundle UI — Fase 4
 *
 * MUDANÇA v4: Adicionado estilo .fsc-bundle__product-variation
 *             para exibir o nome da variação abaixo do preço.
 *
 * Paleta (partilhada com o banner da Fase 2):
 *   --fsc-bg:     #0d0f14   fundo escuro
 *   --fsc-gold:   #c9a84c   dourado principal
 *   --fsc-amber:  #e8c96a   dourado claro
 *   --fsc-red:    #e84040   urgência
 *   --fsc-border: #2a3548   bordas
 *   --fsc-text:   #d0dcea   texto
 *   --fsc-muted:  #7a8fa8   texto secundário
 */

/* ============================================================
   VARIÁVEIS
============================================================ */
#fsc-bundle-box {
  --fsc-bg:        #0d0f14;
  --fsc-surface:   #13171f;
  --fsc-gold:      #c9a84c;
  --fsc-amber:     #e8c96a;
  --fsc-red:       #e84040;
  --fsc-green:     #3df5a0;
  --fsc-border:    #2a3548;
  --fsc-text:      #d0dcea;
  --fsc-muted:     #7a8fa8;
  --fsc-radius:    10px;
  --fsc-font:      -apple-system, "Segoe UI", sans-serif;
  --fsc-shadow:    0 4px 32px rgba(0, 0, 0, .55), 0 0 0 1px rgba(201, 168, 76, .12);
}

/* ============================================================
   BOX BASE
============================================================ */
#fsc-bundle-box {
  background: var(--fsc-bg);
  border: 1px solid var(--fsc-border);
  border-top: 2px solid var(--fsc-gold);
  border-radius: var(--fsc-radius);
  box-shadow: var(--fsc-shadow);
  font-family: var(--fsc-font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--fsc-text);
  margin-top: 28px;
  overflow: hidden;

  /* Animação de entrada */
  opacity: 0;
  transform: translateY(12px);
  transition: opacity .4s ease, transform .4s cubic-bezier(.16, 1, .3, 1);
}

#fsc-bundle-box.fsc-bundle--visible {
  opacity: 1;
  transform: translateY(0);
}

/* ============================================================
   HEADER
============================================================ */
.fsc-bundle__header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--fsc-border);
  background: var(--fsc-surface);
  position: relative;
}

.fsc-bundle__icon {
  font-size: 26px;
  flex-shrink: 0;
  filter: drop-shadow(0 0 6px rgba(201, 168, 76, .5));
}

.fsc-bundle__title {
  font-size: 16px;
  font-weight: 700;
  color: var(--fsc-amber);
  margin: 0 0 2px;
  text-shadow: 0 0 16px rgba(201, 168, 76, .2);
  letter-spacing: .015em;
}

.fsc-bundle__subtitle {
  font-size: 13px;
  color: var(--fsc-muted);
  margin: 0;
}

.fsc-bundle__subtitle strong {
  color: var(--fsc-amber);
}

.fsc-bundle__badge {
  position: absolute;
  top: 14px;
  right: 16px;
  background: linear-gradient(135deg, #c9a84c, #e8c96a);
  color: #0d0f14;
  font-size: 12px;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: 20px;
  letter-spacing: .06em;
  box-shadow: 0 2px 10px rgba(201, 168, 76, .35);
}

/* ============================================================
   GRID DE PRODUTOS
============================================================ */
.fsc-bundle__products {
  display: flex;
  align-items: flex-start;
  gap: 0;
  padding: 20px 20px 16px;
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--fsc-border) transparent;
}

.fsc-bundle__products::-webkit-scrollbar {
  height: 4px;
}
.fsc-bundle__products::-webkit-scrollbar-track { background: transparent; }
.fsc-bundle__products::-webkit-scrollbar-thumb {
  background: var(--fsc-border);
  border-radius: 2px;
}

.fsc-bundle__sep {
  font-size: 22px;
  font-weight: 300;
  color: var(--fsc-gold);
  padding: 20px 8px 0;
  flex-shrink: 0;
  align-self: flex-start;
}

.fsc-bundle__product {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  flex: 1;
  min-width: 90px;
  max-width: 130px;
  gap: 6px;
}

.fsc-bundle__product-link {
  display: block;
  text-decoration: none;
}

.fsc-bundle__img-wrap {
  position: relative;
  width: 80px;
  height: 80px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--fsc-border);
  background: var(--fsc-surface);
  transition: border-color .2s, transform .2s;
}

.fsc-bundle__product-link:hover .fsc-bundle__img-wrap {
  border-color: var(--fsc-gold);
  transform: scale(1.04);
}

.fsc-bundle__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Tag "Este produto" */
.fsc-bundle__tag {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(201, 168, 76, .85);
  color: #0d0f14;
  font-size: 9px;
  font-weight: 700;
  text-align: center;
  padding: 2px 0;
  letter-spacing: .04em;
}

.fsc-bundle__product-name {
  font-size: 11px;
  color: var(--fsc-muted);
  margin: 0;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  max-width: 100%;
}

.fsc-bundle__product-price {
  font-size: 12px;
  font-weight: 600;
  color: var(--fsc-text);
  margin: 0;
}

.fsc-bundle__product-price .woocommerce-Price-amount {
  color: inherit;
}

/* ── VARIAÇÃO (v4): exibido abaixo do preço ──────────────── */
.fsc-bundle__product-variation {
  font-size: 10px;
  color: var(--fsc-gold);
  margin: 2px 0 0;
  line-height: 1.3;
  font-weight: 500;
  opacity: 0.85;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
  max-width: 100%;
  letter-spacing: 0.02em;
}

/* ============================================================
   FOOTER: PRICING + CTA
============================================================ */
.fsc-bundle__footer {
  padding: 0 20px 20px;
  border-top: 1px solid var(--fsc-border);
  padding-top: 16px;
  background: var(--fsc-surface);
}

/* Linha de preços */
.fsc-bundle__pricing {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin-bottom: 14px;
}

.fsc-bundle__total-original {
  font-size: 15px;
  color: var(--fsc-muted);
  text-decoration: line-through;
  text-decoration-color: var(--fsc-red);
}

.fsc-bundle__arrow {
  color: var(--fsc-muted);
  font-size: 13px;
}

.fsc-bundle__total-discount {
  font-size: 22px;
  font-weight: 800;
  color: var(--fsc-amber);
  text-shadow: 0 0 16px rgba(201, 168, 76, .3);
  letter-spacing: -.01em;
}

.fsc-bundle__savings {
  font-size: 12px;
  color: var(--fsc-green);
  font-weight: 600;
  background: rgba(61, 245, 160, .08);
  border: 1px solid rgba(61, 245, 160, .2);
  border-radius: 20px;
  padding: 2px 10px;
}

/* Botão CTA */
.fsc-bundle__btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px 24px;
  border: none;
  border-radius: var(--fsc-radius);
  cursor: pointer;

  background: linear-gradient(135deg, #c9a84c 0%, #e8c96a 50%, #c9a84c 100%);
  background-size: 200% 100%;
  color: #0d0f14;

  font-size: 15px;
  font-weight: 700;
  letter-spacing: .04em;

  transition:
    background-position .35s ease,
    transform .15s ease,
    box-shadow .15s ease;
  box-shadow: 0 4px 20px rgba(201, 168, 76, .35);

  position: relative;
  overflow: hidden;
}

.fsc-bundle__btn:hover:not(:disabled) {
  background-position: 100% 0;
  transform: translateY(-1px);
  box-shadow: 0 6px 28px rgba(201, 168, 76, .5);
}

.fsc-bundle__btn:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: 0 2px 10px rgba(201, 168, 76, .3);
}

.fsc-bundle__btn:disabled {
  cursor: not-allowed;
  opacity: .75;
}

/* Spinner (hidden por padrão) */
.fsc-bundle__btn-spinner {
  display: none;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(13, 15, 20, .3);
  border-top-color: #0d0f14;
  border-radius: 50%;
  animation: fsc-spin .7s linear infinite;
  flex-shrink: 0;
}

.fsc-bundle__btn--loading .fsc-bundle__btn-text::before {
  content: "Adicionando...";
}
.fsc-bundle__btn--loading .fsc-bundle__btn-text {
  font-size: 0; /* Esconde o texto original */
}
.fsc-bundle__btn--loading .fsc-bundle__btn-text::before {
  font-size: 15px;
}

.fsc-bundle__btn--loading .fsc-bundle__btn-spinner {
  display: block;
}

@keyframes fsc-spin {
  to { transform: rotate(360deg); }
}

/* Disclaimer */
.fsc-bundle__disclaimer {
  font-size: 11px;
  color: var(--fsc-muted);
  text-align: center;
  margin: 10px 0 0;
  line-height: 1.4;
}

/* Mensagem de erro */
.fsc-bundle__error {
  font-size: 12px;
  color: var(--fsc-red);
  text-align: center;
  margin: 8px 0 0;
  padding: 6px 12px;
  background: rgba(232, 64, 64, .08);
  border: 1px solid rgba(232, 64, 64, .2);
  border-radius: 6px;
}

/* ============================================================
   SHIMMER SKELETON (loading state)
============================================================ */
#fsc-bundle-box.fsc-bundle--loading {
  pointer-events: none;
}

.fsc-bundle__shimmer {
  padding: 20px;
}

@keyframes fsc-shimmer {
  0%   { background-position: -400px 0; }
  100% { background-position:  400px 0; }
}

.fsc-bundle__shimmer-line,
.fsc-bundle__shimmer-card {
  background: linear-gradient(90deg,
    var(--fsc-surface) 25%,
    #1e2535 50%,
    var(--fsc-surface) 75%
  );
  background-size: 800px 100%;
  animation: fsc-shimmer 1.4s ease-in-out infinite;
  border-radius: 6px;
}

.fsc-bundle__shimmer-line {
  height: 14px;
  margin-bottom: 20px;
}

.fsc-bundle__shimmer-line--title {
  width: 65%;
  height: 18px;
}

.fsc-bundle__shimmer-line--btn {
  height: 46px;
  border-radius: var(--fsc-radius);
  margin-top: 16px;
}

.fsc-bundle__shimmer-products {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 0;
}

.fsc-bundle__shimmer-card {
  flex: 1;
  min-width: 80px;
  height: 110px;
  border-radius: 8px;
}

.fsc-bundle__shimmer-plus {
  color: var(--fsc-border);
  font-size: 20px;
  flex-shrink: 0;
}

/* ============================================================
   RESPONSIVO — MOBILE
============================================================ */
@media (max-width: 600px) {
  .fsc-bundle__header {
    padding: 14px 14px 12px;
  }

  .fsc-bundle__icon {
    font-size: 22px;
  }

  .fsc-bundle__title {
    font-size: 14px;
  }

  .fsc-bundle__products {
    padding: 14px 14px 12px;
    gap: 0;
  }

  .fsc-bundle__product {
    min-width: 75px;
    max-width: 100px;
  }

  .fsc-bundle__img-wrap {
    width: 68px;
    height: 68px;
  }

  .fsc-bundle__sep {
    padding: 16px 4px 0;
    font-size: 18px;
  }

  .fsc-bundle__footer {
    padding: 14px 14px 16px;
  }

  .fsc-bundle__total-discount {
    font-size: 18px;
  }

  .fsc-bundle__btn {
    font-size: 14px;
    padding: 12px 18px;
  }

  .fsc-bundle__badge {
    font-size: 10px;
    padding: 2px 8px;
  }
}

/* ============================================================
   ACESSIBILIDADE — Movimento reduzido
============================================================ */
@media (prefers-reduced-motion: reduce) {
  #fsc-bundle-box {
    transition: opacity .2s ease;
  }

  .fsc-bundle__shimmer-line,
  .fsc-bundle__shimmer-card {
    animation: none;
    background: var(--fsc-surface);
  }

  .fsc-bundle__btn-spinner {
    animation-duration: 1.2s;
  }
}
