/* ═══════════════════════════════════════════════════════════
   Dynamic Grid Search — Busca Avançada
   Mobile-first, 5-col desktop grid, domain-scoped
   ═══════════════════════════════════════════════════════════ */

/* ── Domain toggle pills ── */
.dgs-domain-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: 2px;
}
.dgs-domain-tabs::-webkit-scrollbar { display: none; }

.dgs-domain-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 14px;
  border-radius: 20px;
  border: 1.5px solid #ddd;
  background: #fff;
  color: #666;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.3px;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.2s ease;
}
.dgs-domain-btn:hover {
  border-color: #999;
  color: #333;
}
.dgs-domain-btn.active {
  color: #fff;
  border-color: transparent;
}
.dgs-domain-svg {
  width: 14px;
  height: 14px;
  object-fit: contain;
  vertical-align: -1px;
}

/* ── Search input ── */
.dgs-search-row {
  display: flex;
  gap: 10px;
}
.dgs-input {
  font-size: 1rem;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1.5px solid rgba(98,0,234,0.2);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.dgs-input:focus {
  border-color: #6200ea;
  box-shadow: 0 0 0 3px rgba(98,0,234,0.1);
}
.dgs-search-btn {
  border-radius: 10px;
  padding: 10px 20px;
  font-weight: 600;
  background: linear-gradient(135deg, #6200ea, #aa00ff);
  border: none;
}

/* ── Mode toggle (Normal / Canônica) ── */
.dgs-mode-toggle {
  display: flex;
  align-items: center;
}
.dgs-mode-toggle .btn-group .btn.active {
  background: #6200ea;
  border-color: #6200ea;
  color: #fff;
}
.dgs-mode-hint {
  font-size: 0.72rem;
  color: #999;
}

/* ── Filters row ── */
.dgs-filter-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.dgs-filter-count {
  font-size: 0.65rem;
  background: #6200ea;
  color: #fff;
  border-radius: 10px;
  padding: 1px 6px;
  margin-left: 4px;
}
.dgs-sort-wrap select {
  border-radius: 8px;
  font-size: 0.8rem;
}

/* ── Filters panel ── */
.dgs-filters-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
@media (min-width: 768px) {
  .dgs-filters-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 1200px) {
  .dgs-filters-grid { grid-template-columns: repeat(4, 1fr); }
}

.dgs-filter-group {
  border: 1px solid #eee;
  border-radius: 8px;
  padding: 8px 10px;
}
.dgs-filter-group-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #666;
  margin-bottom: 6px;
}
.dgs-filter-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.78rem;
  padding: 2px 0;
  cursor: pointer;
}
.dgs-filter-item input[type="checkbox"] {
  accent-color: #6200ea;
}
.dgs-filter-values {
  max-height: 200px;
  overflow-y: auto;
}
.dgs-filter-search {
  font-size: 0.75rem;
  border-radius: 6px;
  padding: 4px 8px;
}
.dgs-filter-search-more {
  margin-top: 4px;
}
.dgs-filter-search-more a {
  font-size: 0.7rem;
}

/* ── Product grid (mobile-first) ── */
.dgs-product-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
@media (min-width: 576px) {
  .dgs-product-grid { gap: 14px; }
}
@media (min-width: 768px) {
  .dgs-product-grid { grid-template-columns: repeat(3, 1fr); gap: 16px; }
}
@media (min-width: 992px) {
  .dgs-product-grid { grid-template-columns: repeat(4, 1fr); gap: 20px; }
}
@media (min-width: 1200px) {
  .dgs-product-grid { grid-template-columns: repeat(5, 1fr); gap: 24px; }
}

/* ── Card entry animation ── */
@keyframes dgsCardEnter {
  from { opacity: 0; transform: translateY(24px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.dgs-card-enter {
  animation: dgsCardEnter 0.35s ease-out forwards;
  opacity: 0;
}
.dgs-card-enter:nth-child(5n+1) { animation-delay: 0ms; }
.dgs-card-enter:nth-child(5n+2) { animation-delay: 60ms; }
.dgs-card-enter:nth-child(5n+3) { animation-delay: 120ms; }
.dgs-card-enter:nth-child(5n+4) { animation-delay: 180ms; }
.dgs-card-enter:nth-child(5n+5) { animation-delay: 240ms; }

/* ── Skeleton loader ── */
.dgs-skeleton-card {
  background: #f0f0f0;
  border-radius: 12px;
  overflow: hidden;
}
.dgs-skeleton-img {
  width: 100%;
  padding-top: 139%;
  background: linear-gradient(90deg, #f0f0f0 25%, #e8e8e8 37%, #f0f0f0 63%);
  background-size: 200% 100%;
  animation: dgsShimmer 1.4s infinite;
}
.dgs-skeleton-text {
  height: 12px;
  margin: 10px 12px 0;
  border-radius: 4px;
  background: linear-gradient(90deg, #f0f0f0 25%, #e8e8e8 37%, #f0f0f0 63%);
  background-size: 200% 100%;
  animation: dgsShimmer 1.4s infinite;
}
.dgs-skeleton-text.short { width: 60%; margin-bottom: 12px; }

@keyframes dgsShimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── Search card: allow suggest to overflow, disable hover transform ── */
.dgs-search-card {
  overflow: visible !important;
  position: relative;
  z-index: 10;
}
.dgs-search-card:hover {
  transform: none !important;
  box-shadow: 0 10px 40px -10px rgba(49, 0, 122, 0.06) !important;
}

/* ── Autosuggest dropdown ── */
.dgs-suggest-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 1060;
  background: #fff;
  border: 1px solid rgba(98,0,234,0.15);
  border-top: none;
  border-radius: 0 0 10px 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
  max-height: 320px;
  overflow-y: auto;
}
.dgs-suggest-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: background 0.1s;
}
.dgs-suggest-item:hover, .dgs-suggest-item.active {
  background: rgba(98,0,234,0.06);
}
.dgs-suggest-item img {
  width: 32px;
  height: 44px;
  object-fit: contain;
  border-radius: 3px;
  flex-shrink: 0;
}
.dgs-suggest-name { font-weight: 500; }
.dgs-suggest-type {
  font-size: 0.65rem;
  color: #999;
  margin-left: auto;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ── Set autocomplete in filter panel ── */
.dgs-set-filter-wrap {
  margin-bottom: 10px;
}
.dgs-set-suggest {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 1060;
  background: #fff;
  border: 1px solid #ddd;
  border-top: none;
  border-radius: 0 0 8px 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  max-height: 240px;
  overflow-y: auto;
}
.dgs-set-suggest-item {
  padding: 6px 10px;
  font-size: 0.78rem;
  cursor: pointer;
  transition: background 0.1s;
}
.dgs-set-suggest-item:hover { background: rgba(98,0,234,0.06); }
.dgs-set-suggest-item.disabled { opacity: 0.5; cursor: default; }
.dgs-set-suggest-code {
  font-weight: 700;
  font-size: 0.65rem;
  text-transform: uppercase;
  color: #6200ea;
  letter-spacing: 0.5px;
}
.dgs-set-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}
.dgs-set-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 8px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: rgba(98,0,234,0.1);
  color: #6200ea;
  border-radius: 12px;
}
.dgs-set-chip-remove {
  border: none;
  background: none;
  color: #6200ea;
  font-size: 0.85rem;
  cursor: pointer;
  padding: 0 2px;
  line-height: 1;
}
.dgs-set-chip-remove:hover { color: #d00; }

/* ── Card action buttons (hover overlay) ── */
.dgs-btn-group {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  opacity: 0;
  transition: opacity 0.2s ease;
  z-index: 5;
  background: rgba(0,0,0,0.45);
  backdrop-filter: blur(4px);
  padding: 6px 12px;
  border-radius: 24px;
}
.product-thumb:hover .dgs-btn-group,
.product-thumb:focus-within .dgs-btn-group {
  opacity: 1;
}
.dgs-btn-action {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255,255,255,0.92);
  border: 1px solid rgba(0,0,0,0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #555;
  font-size: 1.05rem;
  transition: all 0.15s ease;
  text-decoration: none;
  padding: 0;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}
.dgs-btn-action:hover {
  background: #6200ea;
  color: #fff;
  border-color: #6200ea;
  box-shadow: 0 4px 12px rgba(98,0,234,0.3);
  text-decoration: none;
}
.dgs-btn-action:hover .dgs-action-svg {
  filter: brightness(0) invert(1);
}
.dgs-action-svg {
  width: 16px;
  height: 16px;
  max-width: 16px;
  max-height: 16px;
  object-fit: contain;
  transition: filter 0.15s;
}

/* Mobile: show buttons always (no hover on touch) */
@media (max-width: 767px) {
  .dgs-btn-group {
    opacity: 1;
    bottom: 6px;
    gap: 5px;
    padding: 4px 8px;
  }
  .dgs-btn-action {
    width: 35px;
    height: 35px;
    font-size: 0.9rem;
  }
  .dgs-action-svg { width: 15px; height: 15px; }
}

/* ── Set icon in card name ── */
.dgs-set-icon {
  width: 16px;
  height: 16px;
  object-fit: contain;
  vertical-align: -2px;
  margin-right: 3px;
  opacity: 0.8;
}

/* ── Load more ── */
#dgs-load-more {
  border-radius: 10px;
  font-weight: 600;
  letter-spacing: 0.3px;
}

/* ── Results info ── */
.dgs-results-info {
  min-height: 24px;
}
