/* ============ MARKETPLACE PAGE ============ */

.marketplace-page main.main-content {
  background: #f8f9fa;
  min-height: 100vh;
  padding: 0;
}

/* Hero Section */
/* Note: style.css defines `.marketplace-page .marketplace-hero` with a blue gradient.
   We override it here (this file is loaded after style.css). */
.marketplace-page .marketplace-hero {
  background: transparent;
  color: inherit;
  padding: 0;
  text-align: center;
  margin-bottom: 40px;
}

.marketplace-hero--image {
  line-height: 0;
}

.marketplace-hero-image {
  width: 100%;
  height: clamp(160px, 22vw, 300px);
  display: block;
  object-fit: cover;
  object-position: center;
  background: transparent;
}

.marketplace-hero h1 {
  font-size: 42px;
  font-weight: 800;
  margin-bottom: 12px;
  letter-spacing: -1px;
}

.marketplace-hero p {
  font-size: 18px;
  opacity: 0.95;
}

/* Marketplace search (shared by desktop + marketplace.mobile.php) */
.marketplace-page .m-search-wrap {
  margin: -10px 0 18px;
}

.marketplace-page .m-search {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  width: 100%;
}

/* Autocomplete JS wraps the input in `.bmz-autocomplete-wrap`; allow it to grow */
.marketplace-page .m-search .bmz-autocomplete-wrap {
  flex: 1;
  min-width: 0;
}

.marketplace-page .m-search .bmz-autocomplete-wrap input[type="text"],
.marketplace-page .m-search .bmz-autocomplete-wrap input[type="search"] {
  width: 100%;
}

@media (min-width: 992px) {

  /* Let the marketplace search stretch wider than the default container. */
  .marketplace-page .m-search-wrap .container {
    max-width: 1400px;
  }
}

.marketplace-page .m-search input[type="text"],
.marketplace-page .m-search input[type="search"] {
  flex: 1;
  min-width: 0;
  height: 42px;
  padding: 10px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #fff;
  color: #0f172a;
  font-size: 14px;
  outline: none;
}

.marketplace-page .m-search input[type="text"]:focus,
.marketplace-page .m-search input[type="search"]:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.marketplace-page .m-search button {
  height: 42px;
  padding: 0 16px;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  background: linear-gradient(120deg, #2563eb 0%, #1e40af 100%);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.marketplace-page .m-search button:hover {
  filter: brightness(1.03);
}

.marketplace-page .m-search button:active {
  transform: translateY(1px);
}

/* Category Sections */
.category-section {
  background: white;
  padding: 32px 0;
  margin-bottom: 20px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.category-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  padding: 16px 20px;
  background: linear-gradient(90deg, #cc0605 0%, #ff1a1a 100%);
  border-radius: 0;
}

.category-header h2 {
  font-size: 24px;
  font-weight: 700;
  color: white;
  margin: 0;
}

.category-header .see-all {
  color: white;
  font-weight: 600;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  transition: opacity 0.3s;
}

.category-header .see-all:hover {
  opacity: 0.9;
}

/* Products Scroll Container */
.products-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0 20px 16px 20px;
}

.products-scroll::-webkit-scrollbar {
  height: 8px;
}

.products-scroll::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 10px;
}

.products-scroll::-webkit-scrollbar-thumb {
  background: #888;
  border-radius: 10px;
}

.products-scroll::-webkit-scrollbar-thumb:hover {
  background: #555;
}

.products-container {
  display: flex;
  gap: 16px;
  min-width: min-content;
}

/* Product Item */
.product-item {
  flex: 0 0 160px;
  background: white;
  border-radius: 8px;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition: all 0.3s;
  border: 1px solid #e0e0e0;
  display: flex;
  flex-direction: column;
}

.product-item:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
  border-color: #3b82f6;
}

.product-image {
  position: relative;
  overflow: hidden;
  height: 140px;
  background: #f5f5f5;
}

.product-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s;
}

.product-item:hover .product-image img {
  transform: scale(1.05);
}

.discount-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background: #ff6b35;
  color: white;
  padding: 4px 8px;
  border-radius: 4px;
  font-weight: 700;
  font-size: 12px;
}

/* Product Info */
.product-info {
  padding: 12px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.product-info h3 {
  font-size: 12px;
  font-weight: 600;
  margin: 0 0 8px 0;
  color: #1f2937;
  line-height: 1.4;
  display: -webkit-box;
  line-clamp: 2;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.product-rating {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 8px;
  font-size: 11px;
}

.product-rating .stars {
  color: #fbbf24;
}

.product-rating .stars i {
  font-size: 10px;
}

.product-rating .rating-value {
  color: #6b7280;
}

.product-price {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: auto;
  flex-wrap: wrap;
  overflow: hidden;
}

.product-price .price-current,
.product-price .current-price {
  font-weight: 700;
  color: #059669;
  font-size: 12px;
}

.product-price .price-original,
.product-price .original-price {
  font-size: 10px;
  color: #9ca3af;
  text-decoration: line-through;
}

.product-price .discount-badge {
  background: #fca5a5;
  color: #7f1d1d;
  padding: 2px 5px;
  border-radius: 4px;
  font-size: 9px;
  font-weight: 700;
}

/* ============ MOBILE MARKETPLACE (marketplace.mobile.php) ============ */
.marketplace-mobile .marketplace-hero {
  padding: 0;
  background: transparent;
  border-bottom: none;
  color: inherit;
  margin-bottom: 0;
}

.marketplace-mobile .marketplace-hero-image {
  width: 100%;
  height: clamp(150px, 30vw, 240px);
  display: block;
  object-fit: cover;
  object-position: center;
  background: transparent;
}

.marketplace-mobile .m-search-wrap {
  margin: 0 0 12px;
  padding: 12px 0 0;
}

.marketplace-mobile .m-search {
  margin-top: 12px;
}

.marketplace-mobile .m-search button {
  background: linear-gradient(120deg, #2563eb 0%, #1e40af 100%);
}

.marketplace-mobile .m-section {
  padding: 16px 0;
}

.marketplace-mobile .category-header {
  margin-bottom: 16px;
}

.marketplace-mobile .category-header h2 {
  font-size: 16px;
}

.marketplace-mobile .category-header .see-all {
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.marketplace-mobile .m-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.marketplace-mobile .m-card {
  position: relative;
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  overflow: hidden;
  transition: all 0.3s;
}

.marketplace-mobile .m-card a {
  display: block;
  text-decoration: none;
  color: inherit;
}

.marketplace-mobile .m-img {
  position: relative;
  height: 130px;
  background: #f5f5f5;
  overflow: hidden;
}

.marketplace-mobile .m-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.marketplace-mobile .m-discount {
  position: absolute;
  top: 8px;
  right: 8px;
  background: #ff6b35;
  color: #fff;
  font-weight: 700;
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 4px;
}

.marketplace-mobile .m-info {
  padding: 10px 10px 12px;
}

.marketplace-mobile .m-title {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  color: #111827;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 32px;
}

.marketplace-mobile .m-meta {
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.marketplace-mobile .m-stars {
  display: flex;
  gap: 2px;
  color: #fbbf24;
  font-size: 10px;
}

.marketplace-mobile .m-rev {
  font-size: 11px;
  color: #6b7280;
}

.marketplace-mobile .m-sold {
  margin-top: 4px;
  font-size: 11px;
  color: #9ca3af;
}

.marketplace-mobile .m-price {
  margin-top: 8px;
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.marketplace-mobile .m-price .now {
  font-weight: 900;
  color: #111827;
  font-size: 13px;
}

.marketplace-mobile .m-price .was {
  color: #9ca3af;
  font-size: 11px;
  text-decoration: line-through;
}

.marketplace-mobile .m-cart {
  position: absolute;
  bottom: 12px;
  right: 12px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #007BFF;
  border: none;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
  cursor: pointer;
}

.marketplace-mobile .m-cart:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.marketplace-mobile .m-cart i {
  font-size: 16px;
}

.marketplace-mobile .m-flash-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 10px;
}

.marketplace-mobile .m-flash-title h3 {
  margin: 0;
  font-size: 13px;
  color: #1e3a8a;
}

.marketplace-mobile .countdown-timer {
  color: #ff6b35;
  font-weight: 900;
  font-size: 13px;
}

.marketplace-mobile .skeleton {
  position: relative;
  overflow: hidden;
  background: #f3f4f6;
}

.marketplace-mobile .skeleton::after {
  content: "";
  position: absolute;
  top: 0;
  left: -60%;
  width: 60%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.65), transparent);
  animation: shimmer 1.1s infinite;
}

@keyframes shimmer {
  0% {
    left: -60%;
  }

  100% {
    left: 110%;
  }
}

.marketplace-mobile .sk-img {
  height: 130px;
  border-radius: 10px 10px 0 0;
}

.marketplace-mobile .sk-body {
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.marketplace-mobile .sk-line {
  height: 12px;
  border-radius: 8px;
}

.marketplace-mobile .sk-line.wide {
  width: 92%;
}

.marketplace-mobile .sk-line.mid {
  width: 72%;
}

.marketplace-mobile .sk-line.small {
  width: 48%;
}

.marketplace-mobile .m-empty {
  background: #fff;
  border: 1px dashed #e5e7eb;
  border-radius: 12px;
  padding: 14px;
  color: #6b7280;
  font-size: 13px;
}

/* No Products */
.no-products {
  text-align: center;
  padding: 60px 20px;
}

.no-products p {
  font-size: 18px;
  color: #6b7280;
}

/* ============ RESPONSIVE ============ */
@media (max-width: 768px) {
  .marketplace-hero h1 {
    font-size: 28px;
  }

  .marketplace-hero p {
    font-size: 14px;
  }

  .category-header {
    padding: 12px 16px;
    margin-left: -12px;
    margin-right: -12px;
    border-radius: 0;
  }

  .category-header h2 {
    font-size: 18px;
  }

  .category-header .see-all {
    font-size: 12px;
  }

  .products-scroll {
    padding: 0 16px 12px 16px;
  }

  .marketplace-page .m-search-wrap {
    margin: -8px 0 16px;
  }

  .marketplace-page .m-search {
    gap: 8px;
    padding: 9px;
  }

  .marketplace-page .m-search input[type="text"],
  .marketplace-page .m-search input[type="search"],
  .marketplace-page .m-search button {
    height: 40px;
  }

  .products-container {
    gap: 12px;
  }

  .product-item {
    flex: 0 0 140px;
  }

  .product-image {
    height: 120px;
  }

  .product-info {
    padding: 10px;
  }

  .product-info h3 {
    font-size: 11px;
    margin-bottom: 6px;
  }
}