/**
 * Página de detalhe do produto - Layout moderno estilo Magalu
 * Hierarquia clara, buy-box em destaque, tabs para informações
 */

.product-detail-page {
  padding-bottom: 2rem;
}

.pdp-migalha {
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

/* ========== Layout 2 colunas ========== */
.pdp-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  align-items: start;
  margin-bottom: 2.5rem;
}

@media (max-width: 991px) {
  .pdp-layout {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
}

/* ========== Galeria ========== */
.pdp-gallery {
  position: sticky;
  top: 1rem;
}

@media (max-width: 991px) {
  .pdp-gallery {
    position: static;
  }
}

.product-gallery {
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid #e8edf3;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.product-gallery__main {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: #fafbfc;
}

.product-gallery__img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  transition: opacity 0.2s ease;
}

.product-gallery__thumbs {
  display: flex;
  gap: 8px;
  padding: 12px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-top: 1px solid #e8edf3;
}

.product-gallery__thumb {
  flex: 0 0 64px;
  width: 64px;
  height: 64px;
  padding: 4px;
  border: 2px solid transparent;
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.product-gallery__thumb:hover {
  border-color: #cbd5e1;
}

.product-gallery__thumb.is-active {
  border-color: var(--primary, #5a8fd4);
  box-shadow: 0 0 0 1px var(--primary, #5a8fd4);
}

.product-gallery__thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* ========== Buy box ========== */
.pdp-buy {
  position: sticky;
  top: 1rem;
}

@media (max-width: 991px) {
  .pdp-buy {
    position: static;
  }
}

.buy-box {
  background: #fff;
  border-radius: 12px;
  padding: 1.5rem 1.75rem;
  border: 1px solid #e8edf3;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

.buy-box__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.buy-box__title {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.35;
  margin: 0;
  color: #334155;
  flex: 1;
  min-width: 0;
}

.buy-box__wishlist {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  text-decoration: none;
  color: inherit;
  transition: background 0.2s ease, box-shadow 0.2s ease;
  touch-action: manipulation;
  cursor: pointer;
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
}

.buy-box__wishlist:hover {
  background: #f8fafc;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.buy-box__wishlist svg {
  width: 22px;
  height: 22px;
}

.buy-box__wishlist.ativado svg path {
  fill: #dc2626;
}

.buy-box__price {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-bottom: 1.5rem;
}

.buy-box__price .price-from {
  font-size: 1rem;
  font-weight: 600;
  text-decoration: line-through;
  color: #c62828;
}

.buy-box__price .price-pix--large {
  font-size: 2rem;
  font-weight: 800;
  line-height: 1.15;
  color: #1e293b;
}

.buy-box__price .price-pix--large small {
  font-size: 0.9rem;
  font-weight: 600;
}

.buy-box__price .price-installments {
  font-size: 1rem;
  opacity: 0.85;
  color: #475569;
}

/* ========== Variantes (chips) ========== */
.buy-box__variants {
  margin-bottom: 1.5rem;
}

.variant-group {
  margin-bottom: 1rem;
}

.variant-group:last-child {
  margin-bottom: 0;
}

.variant-group__label {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  color: #475569;
  margin-bottom: 0.5rem;
}

.variant-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.variant-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.5rem 1rem;
  border: 2px solid #e2e8f0;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 500;
  color: #475569;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, color 0.2s;
}

.variant-chip:hover {
  border-color: #cbd5e1;
  background: #f8fafc;
}

.variant-chip input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.variant-chip.is-selected,
.variant-chip:has(input:checked) {
  border-color: var(--primary, #5a8fd4);
  background: rgba(90, 143, 212, 0.08);
  color: var(--primary, #5a8fd4);
}

.buy-box__no-grade {
  margin-bottom: 1.5rem;
  color: #94a3b8;
  font-size: 0.85rem;
}

/* ========== CTA ========== */
.buy-box__form {
  margin-bottom: 1.25rem;
}

.buy-box__cta {
  width: 100%;
  padding: 1rem 1.5rem;
  font-size: 1.1rem;
  font-weight: 700;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: none;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.1s;
}

.buy-box__cta:hover {
  opacity: 0.95;
}

.buy-box__cta:active {
  transform: scale(0.99);
}

/* ========== Linha de confiança ========== */
.buy-box__trust {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 1rem 0;
  border-top: 1px solid #f1f5f9;
  font-size: 0.85rem;
  color: #64748b;
}

.trust-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.trust-item i {
  font-size: 0.9rem;
  color: #94a3b8;
}

/* ========== CEP (placeholder) ========== */
.buy-box__cep {
  padding-top: 1rem;
  border-top: 1px solid #f1f5f9;
}

.cep-label {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  color: #475569;
  margin-bottom: 0.5rem;
}

.cep-input-wrap {
  display: flex;
  gap: 8px;
  margin-bottom: 0.35rem;
  align-items: center;
}

.cep-input {
  flex: 1;
  padding: 0.6rem 0.75rem;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 0.95rem;
}

.cep-input:disabled {
  background: #f8fafc;
  color: #94a3b8;
  cursor: not-allowed;
}

.cep-btn {
  padding: 0.6rem 1rem;
  border: 1px solid var(--primary, #5a8fd4);
  border-radius: 8px;
  background: var(--primary, #5a8fd4);
  color: #fff;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
}

.cep-btn:hover:not(:disabled) {
  opacity: 0.9;
}

.cep-btn:disabled {
  background: #f8fafc;
  color: #94a3b8;
  border-color: #e2e8f0;
  cursor: not-allowed;
}

.cep-btn-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}

.cep-loading {
  flex-shrink: 0;
}

/* Lista de fretes no buy-box */
.buy-box__cep .lstFrete {
  margin: 0.75rem 0 0;
  border-radius: 8px;
  overflow: hidden;
  list-style: none;
  padding: 0;
}

.buy-box__cep .lstFrete li {
  background: #f8fafc;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.6rem 0.75rem;
  font-size: 0.9rem;
  border-bottom: 1px solid #f1f5f9;
}

.buy-box__cep .lstFrete li:last-child {
  border-bottom: none;
}

.buy-box__cep .lstFrete li:nth-of-type(2n) {
  background: #f1f5f9;
}

.buy-box__cep .lstFrete li .load {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  margin-right: 0.5rem;
}

.buy-box__cep .lstFrete li .load svg {
  width: 100%;
  height: 100%;
  color: #64748b;
}

.buy-box__cep .lstFrete li span small {
  display: block;
  color: #64748b;
  font-size: 0.8em;
}

.buy-box__cep .lstFrete li.frete-gratis strong {
  color: var(--primary, #0b4d8f);
}

.buy-box__cep .lstFrete li.frete-indisponivel {
  opacity: 0.7;
}

.cep-hint {
  font-size: 0.8rem;
  color: #94a3b8;
}

/* ========== Tabs ========== */
.pdp-tabs {
  margin-top: 2rem;
  background: #fff;
  border-radius: 12px;
  border: 1px solid #e8edf3;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.pdp-tabs__headers {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  border-bottom: 1px solid #e8edf3;
  padding: 0 1rem;
}

.pdp-tabs__tab {
  padding: 1rem 1.25rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: #64748b;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}

.pdp-tabs__tab:hover {
  color: #334155;
}

.pdp-tabs__tab.is-active {
  color: var(--primary, #5a8fd4);
  border-bottom-color: var(--primary, #5a8fd4);
}

.pdp-tabs__panels {
  padding: 1.5rem;
}

.pdp-tabs__panel {
  display: none;
}

.pdp-tabs__panel.is-active {
  display: block;
}

.pdp-panel-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0 0 1rem;
  color: #334155;
}

.pdp-descricao {
  font-size: 0.95rem;
  line-height: 1.6;
  color: #475569;
}

.pdp-ficha {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.pdp-ficha th,
.pdp-ficha td {
  padding: 0.6rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid #f1f5f9;
}

.pdp-ficha th {
  font-weight: 600;
  color: #64748b;
  width: 180px;
}

.pdp-ficha td {
  color: #334155;
}

/* Produtos relacionados */
.pdp-related {
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
}

@media (max-width: 575px) {
  .buy-box {
    padding: 1.25rem;
  }
  .buy-box__title {
    font-size: 1.25rem;
  }
  .buy-box__price .price-pix--large {
    font-size: 1.65rem;
  }
}
