/* ============================================================
   detalhes.php — estilos da página de detalhe do produto
   ============================================================ */

/* --- Modal galeria --- */
.galeria-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px;
}
.galeria-item {
  cursor: pointer;
  border-radius: 6px;
  overflow: hidden;
  border: 2px solid transparent;
  transition: border-color .15s, transform .15s;
}
.galeria-item:hover {
  border-color: #0d6efd;
  transform: scale(1.02);
}
.galeria-item img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
  background: #f7f7f7;
  display: block;
}

/* --- Foto principal --- */
#fotoPrincipal {
  width: 100%;
  max-height: 520px;
  object-fit: contain;
  border-radius: 8px;
  background: #f7f7f7;
  transition: opacity .25s;
}

/* --- Lista de cores --- */
.cores-wrapper { position: relative; }

#listaCores {
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #ccc transparent;
}
#listaCores::-webkit-scrollbar { width: 4px; }
#listaCores::-webkit-scrollbar-thumb { background: #ccc; border-radius: 4px; }

.cor-item {
  cursor: pointer;
  border-radius: 0;
  border-left: 4px solid transparent;
  transition: background .15s;
}
.cor-item.active {
  border-left-color: #000;
  background: #850422 !important;
  font-weight: 600;
}

.cor-swatch {
  width: 44px;
  height: 44px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid #dee2e6;
  flex-shrink: 0;
}
.cor-swatch-placeholder {
  width: 44px;
  height: 44px;
  border-radius: 4px;
  background: #e9ecef;
  border: 1px solid #dee2e6;
  flex-shrink: 0;
}

/* Indicador de scroll — fade gradiente no fundo da lista */
.cores-scroll-hint {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 56px;
  background: linear-gradient(to bottom, transparent, rgba(255,255,255,.96));
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 6px;
  pointer-events: none;
  transition: opacity .25s;
}
.cores-scroll-hint span {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .6px;
  text-transform: uppercase;
  color: #555;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* --- Cards de tamanho --- */
.size-panel { display: none; }
.size-panel.active { display: flex; }

.card-tamanho {
  min-width: 150px;
  border: 1px solid #dee2e6;
  border-radius: 8px;
  overflow: hidden;
  text-align: center;
}
.card-tamanho .card-header {
  background: #850422 !important;
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  padding: 6px;
}
.card-tamanho .card-body {
  padding: 10px 8px;
  font-size: 12px;
}

/* --- Controles de quantidade --- */
.qty-group {
  display: flex;
  align-items: stretch;
  justify-content: center;
  margin: 8px 0;
  border: 1.5px solid #dee2e6;
  border-radius: 6px;
  overflow: hidden;
}
.qty-group input {
  flex: 1;
  min-width: 0;
  width: 44px;
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  padding: 5px 2px;
  border: none;
  border-left: 1px solid #dee2e6;
  border-right: 1px solid #dee2e6;
  outline: none;
  background: #fff;
}
.qty-btn {
  width: 32px;
  border: none;
  background: #f8f9fa;
  color: #444;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
  transition: background .15s, color .15s;
}
.qty-btn:hover  { background: #212529; color: #fff; }
.qty-btn:active { background: #000;    color: #fff; }

/* Badge de disponibilidade (estoque futuro) */
.badge-disponibilidade {
  display: block;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 4px;
  margin: -4px 0 6px;
  border-radius: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.badge-disp-futuro {
  background: #cff4fc;
  color: #055160;
}
.badge-disp-pronta {
  background: #d1e7dd;
  color: #0f5132;
}

.retorno-qtd {
  font-size: 10px;
  color: #198754;
  min-height: 14px;
  display: block;
}
.total-item {
  font-weight: 700;
  font-size: 13px;
}

/* Mantém o controle bloqueado durante a gravação da quantidade. */
.qty-group.is-loading { position: relative; cursor: wait; }
.qty-group.is-loading input { color: transparent; }
.qty-group.is-loading::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 16px;
  height: 16px;
  margin: -8px 0 0 -8px;
  border: 2px solid #dee2e6;
  border-top-color: #850422;
  border-radius: 50%;
  animation: qty-loading .7s linear infinite;
  pointer-events: none;
}
.qty-btn:disabled { opacity: .5; cursor: wait; background: #f8f9fa; color: #444; }
@keyframes qty-loading { to { transform: rotate(360deg); } }
