/* Listing Cards */
.listing-card {
  transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
  border: 1px solid rgba(0, 0, 0, 0.05);
  overflow: hidden;
}

.listing-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.1) !important;
  text-decoration: none;
}

.listing-card .card-img-top {
  transition: transform 0.3s ease-in-out;
}

.listing-card-img {
  object-fit: contain !important;
}

.listing-card:hover .card-img-top {
  transform: scale(1.05);
}

/* Seller avatar + verification badge overlay */
.listing-card .seller-avatar {
  top: 0.5rem;
  left: 0.5rem;
}

/* High-contrast "Promoted" badge (override bg-warning/text-dark) */
.promoted-badge {
  background-color: #b54708 !important; /* darker amber for better contrast */
  color: #ffffff !important;
}

/* Review Cards */
.reviews-container {
  display: grid;
  gap: 1rem;
}

.review-card {
  transition: transform 0.2s ease-in-out;
  border: 1px solid rgba(0, 0, 0, 0.05);
}

.review-card:hover {
  transform: translateY(-2px);
}

.skip-to-content-link {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  z-index: 1050;
  padding: 0.5rem 1rem;
  background: var(--bs-primary);
  color: #fff;
  border-radius: 0.375rem;
  transform: translateY(-150%);
  transition: transform 0.2s ease;
}

.skip-to-content-link:focus {
  transform: translateY(0);
  outline: none;
  box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.35);
}

/* Empty States */
.empty-state {
  padding: 3rem 1rem;
  text-align: center;
  background-color: #f8f9fa;
  border-radius: 0.5rem;
}

.empty-state i {
  font-size: 3rem;
  opacity: 0.5;
  margin-bottom: 1rem;
}

/* Responsive adjustments */
@media (max-width: 767.98px) {
  .listing-card .card-body {
    padding: 1rem !important;
  }
  
  .reviews-container {
    grid-template-columns: 1fr;
  }
}

.listing-thumb {
  width: 100%;
}

/* Masonry grid for home listings (apply to both legacy #listingContainer and .masonry-grid) */
#listingContainer,
.masonry-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-auto-rows: 10px;
  grid-auto-flow: dense;
  gap: 0.75rem;
}

#listingContainer > :not(#sentinel),
.masonry-item {
  margin-bottom: 0;
  grid-row-end: span 40;
}

#listingContainer #sentinel {
  height: 1px;
  grid-column: 1 / -1;
}

@media (max-width: 991.98px) {
  #listingContainer,
  .masonry-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 767.98px) {
  #listingContainer,
  .masonry-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 575.98px) {
  #listingContainer,
  .masonry-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
  }
  #listingContainer > *,
  .masonry-item {
    margin-bottom: 0;
  }
}
@media (max-width: 575.98px) {
  .listing-card .seller-avatar img { width: 28px; height: 28px; }
  .listing-card .promoted-badge { font-size: .65rem; padding: .2em .45em; }
  .listing-card .seller-avatar {
    top: 0.1rem;
    left: 0.1rem;
    margin: 0;
  }
}

/* Dark mode support */
[data-bs-theme="dark"] {
  .listing-card,
  .review-card {
    background-color: var(--bs-dark-bg-subtle);
    border-color: var(--bs-border-color);
  }
  
  .empty-state {
    background-color: var(--bs-dark-bg-subtle);
  }
}
.btn.wz-ai-glow {
  background-color: rgba(var(--bs-primary-rgb, 13, 110, 253), 0.08) !important;
  box-shadow: 0 0 0 0.25rem rgba(var(--bs-primary-rgb, 13, 110, 253), 0.25) !important;
  animation: wz-ai-glow-pulse 1.6s ease-in-out infinite !important;
  will-change: box-shadow, background-color, border-color, transform;
}

.btn.wz-ai-glow:disabled,
.btn.wz-ai-glow[disabled] {
  animation: none !important;
  box-shadow: none !important;
}

.btn.wz-ai-glow:focus-visible {
  animation: none !important;
}

/* Floating strict-mode CTA */
.floating-post-button {
  position: fixed;
  right: 12px;
  bottom: 90px; /* leave room for the blue FAB + nav */
  z-index: 1050;
  max-width: calc(100vw - 24px);
}

.floating-post-button .btn {
  white-space: nowrap;
}

.floating-post-button .small {
  max-width: 200px;
  line-height: 1.2;
  color: var(--bs-body-color);
  background-color: rgba(var(--bs-body-color-rgb, 33, 37, 41), 0.12);
  padding: 2px 6px;
  border-radius: 999px;
  display: inline-block;
}

/* Mobile: make it compact */
@media (max-width: 576px) {
  .floating-post-button {
    right: 4px;
    bottom: 60px;
  }

  .floating-post-button .btn {
    font-size: 0.8rem;
    padding: 3px 6px;
  }

  /* keep helper text readable but compact */
  .floating-post-button .small {
    font-size: 0.65rem;
    max-width: 170px;
    padding: 2px 5px;
  }
}

/* Keep scroll FAB lower to avoid overlap */
.scroll-top-btn {
  bottom: 20px;
}

@keyframes wz-ai-glow-pulse {
  0%,
  100% {
    background-color: rgba(var(--bs-primary-rgb, 13, 110, 253), 0.08);
    border-color: rgba(var(--bs-primary-rgb, 13, 110, 253), 0.65);
    box-shadow: 0 0 0 0.25rem rgba(var(--bs-primary-rgb, 13, 110, 253), 0.25);
    transform: translateY(0);
  }
  50% {
    background-color: rgba(var(--bs-primary-rgb, 13, 110, 253), 0.16);
    border-color: rgba(var(--bs-primary-rgb, 13, 110, 253), 0.95);
    box-shadow: 0 0 0 0.6rem rgba(var(--bs-primary-rgb, 13, 110, 253), 0.38);
    transform: translateY(-1px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .btn.wz-ai-glow {
    animation: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  html:focus-within {
    scroll-behavior: auto;
  }

  .carousel,
  .carousel-item,
  .toast,
  .modal,
  .offcanvas {
    transition: none !important;
  }
}

/* Accessible focus and tap targets (US-UX-009) */
:root {
  --wz-focus-ring-color: rgba(13, 110, 253, 0.45);
  --wz-focus-ring-offset: 3px;
}

:where(a, button, [role="button"], .btn, .nav-link, .dropdown-item, .list-group-item-action, .page-link):focus-visible {
  outline: 2px solid var(--bs-primary);
  outline-offset: var(--wz-focus-ring-offset);
  box-shadow: 0 0 0 0.25rem var(--wz-focus-ring-color);
  text-decoration: none;
}

:where(a.btn, .btn, .dropdown-item, .list-group-item-action, .nav-link, .page-link) {
  min-height: 2.75rem;
  display: inline-flex;
  align-items: center;
}

.dropdown-item,
.list-group-item-action,
.page-link {
  padding-top: 0.75rem;
  padding-bottom: 0.75rem;
}

@media (max-width: 575.98px) {
  :where(.btn, .dropdown-item, .list-group-item-action, .nav-link, .page-link) {
    min-height: 2.75rem;
  }
}

.location-truncate {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  max-width: 16ch;
  vertical-align: middle;
}

.location-truncate span {
  display: inline-block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.location-truncate-lg {
  max-width: 28ch;
}

.location-truncate-sm {
  max-width: 16ch;
}

@media (max-width: 575.98px) {
  .location-truncate {
    max-width: 22ch;
  }

  .location-truncate-sm {
    max-width: 18ch;
  }
}

.shop-banner-placeholder {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 0.5rem;
  width: 100%;
  aspect-ratio: 4 / 1;
  border: 2px dashed var(--bs-border-color);
  border-radius: 0.75rem;
  background: rgba(13, 110, 253, 0.04);
  color: var(--bs-secondary);
  text-align: center;
  padding: 1.5rem;
  cursor: pointer;
  transition: border-color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}

.shop-banner-placeholder i {
  font-size: 1.75rem;
  opacity: 0.8;
}

.shop-banner-placeholder strong {
  font-size: 1rem;
  color: var(--bs-secondary);
}

.shop-banner-placeholder span {
  color: var(--bs-secondary);
  font-size: 0.875rem;
}

.shop-banner-placeholder:focus-visible,
.shop-banner-placeholder:hover {
  border-color: var(--bs-primary);
  background: rgba(13, 110, 253, 0.08);
  box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.15);
  outline: none;
  text-decoration: none;
}

@media (max-width: 575.98px) {
  .shop-banner-placeholder {
    aspect-ratio: auto;
    min-height: 180px;
  }
}

.back-to-top {
  position: fixed;
  right: 1.5rem;
  bottom: 1.5rem;
  width: 3rem;
  height: 3rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bs-primary);
  color: #fff;
  text-decoration: none;
  box-shadow: 0 0.5rem 1.5rem rgba(13, 110, 253, 0.35);
  opacity: 0;
  pointer-events: none;
  transform: translateY(15px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 1010;
}

.back-to-top:focus-visible,
.back-to-top:hover {
  color: #fff;
  text-decoration: none;
  box-shadow: 0 0.5rem 1.75rem rgba(13, 110, 253, 0.45);
}

body.show-back-to-top .back-to-top {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

@media (max-width: 575.98px) {
  .back-to-top {
    right: 1rem;
    bottom: 4.5rem;
  }
}
