/* هدر */

.search-box {
  position: relative;
  flex: 1;
  max-width: 500px;
  margin: 0 1rem;
  font-family: inherit;
}

.search-box input {
  width: 100%;
  padding: 14px 50px 14px 20px;
  border: none;
  border-radius: 1.5rem;
  background: var(--dark);
  color: var(--light);
  font-size: 1rem;
  font-family: inherit;
  outline: none;
  box-shadow: 0px 0px 12px 2px #000000a2;
}

.search-box input::placeholder {
  color: #999;
}

input:-internal-autofill-selected {
  background-color: var(--deep);
}

.search-icon {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  width: 24px;
  height: 24px;
  color: var(--light);
}

/* کانتینر */
.explore-container {
  max-width: 1200px;
  margin: 110px auto 40px;
  padding: 0 16px;
  display: grid;
  gap: 20px;
}

.mini-toast {
  position: fixed;
  right: 20px;
  bottom: 80px;
  background: #222;
  color: #fff;
  padding: 8px 12px;
  border-radius: 8px;
  opacity: 0;
  transform: translateY(6px);
  transition: all .25s;
  z-index: 9999;
}

.mini-toast.show {
  opacity: 1;
  transform: translateY(0);
}

.mini-toast.err {
  background: #b00020;
}

/* موبایل */
@media (max-width: 767px) {
  .explore-container {
    grid-template-columns: 1fr 1fr;
    padding: 0 16px;
    gap: 20px;
  }

  .explore-item {
    flex-direction: column;
    text-align: center;
    padding: 18px;
  }

  .item-image {
    display: inline;
    aspect-ratio: 1 / 1;
    width: 100%;
    object-fit: cover;
    margin-bottom: 16px;
    border-radius: 14px;
    font-size: 3.5rem;
    order: -1;
  }

  .item-details {
    width: 100%;
    padding: 0;
  }

  .item-name,
  .item-price {
    text-align: right;
    width: 100%;
  }

  .item-header {
    justify-content: flex-start;
    width: 100%;
  }

  .item-actions {
    display: flex;
    gap: 14px;
    margin-top: 16px;
    width: 100%;
  }

  .wishlist-btn {
    background-color: #000000;
    color: var(--light);
    width: 56px;
    height: 56px;
    font-weight: 400;
  }

  .add-to-cart-btn {
    flex: 1;
  }
}

/* کارت اصلی */
.explore-item {
  background: var(--dark);
  border-radius: 15px;
  padding: 20px;
  display: flex;
  gap: 20px;
  box-shadow: 0 5px 20px rgba(0, 0, 0, .1);
  transition: all .3s ease;
}

.explore-item:hover {
  box-shadow: 0 8px 30px rgba(0, 0, 0, .15);
  transform: translateY(-2px);
}

.item-image {
  background: linear-gradient(135deg, var(--greenlight), var(--primary));
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: bold;
  flex-shrink: 0;
  font-size: 2.5rem;
  aspect-ratio: 3 / 4;
}

.item-details {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.item-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
}

.item-name {
  text-align: right;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--light);
}

.item-price {
  font-size: 1.2rem;
  color: var(--primary);
  font-weight: bold;
}

/* دکمه‌ها */
.wishlist-btn {
  background: var(--red);
  color: white;
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: .3s;
}

.wishlist-btn svg {
  width: 26px;
  height: 26px;
  fill: none;
  stroke: white;
  stroke-width: 18.3px;
}

.wishlist-btn.active svg {
  fill: white;
  stroke: none;
}

.wishlist-btn:hover {
  background: #c4452a;
  transform: scale(1.08);
}

.add-to-cart-btn {
  background: var(--primary);
  color: white;
  border: none;
  padding: 14px 16px;
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: .3s;
  width: 100%;
  height: 40px;
  font-family: inherit;
}

.add-to-cart-btn:hover {
  background: #3a9a85;
  transform: translateY(-2px);
  box-shadow: 0 5px 20px rgba(71, 181, 158, .3);
}

.add-to-cart-btn svg {
  width: 22px;
  height: 22px;
}

/* تبلت */
@media (min-width: 768px) {
  .explore-container {
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    padding: 0 20px;
  }

  /* FIX: تایپو "explore-item" بدون نقطه تصحیح شد */
  .explore-item {
    display: flex;
    flex-direction: row;
    background: var(--dark);
    border-radius: 15px;
    padding: 20px;
    gap: 20px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, .1);
    transition: all .3s ease;
    line-height: 1.5rem;
  }

  .explore-item:hover {
    box-shadow: 0 8px 30px rgba(0, 0, 0, .15);
    transform: translateY(-4px);
  }

  .item-image {
    width: 110px;
    height: 110px;
    min-width: 110px;
    border-radius: 12px;
    font-size: 3rem;
    background: linear-gradient(135deg, var(--greenlight), var(--primary));
    flex-shrink: 0;
  }

  .item-details {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
  }

  .item-name {
    text-align: right;
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--light);
  }

  .item-price {
    font-size: 1.3rem;
    color: var(--primary);
    font-weight: bold;
  }

  .item-actions {
    display: flex;
    gap: 10px;
    margin-top: auto;
  }

  .wishlist-btn {
    width: 40px;
    height: 40px;
    background: var(--red);
    border-radius: 14px;
    padding: 8px;
    flex-shrink: 0;
  }

  .wishlist-btn svg {
    width: 28px;
    height: 28px;
    fill: none;
    stroke: white;
    stroke-width: 18.3px;
  }

  .wishlist-btn.active svg {
    fill: white;
    stroke: none;
  }

  /* FIX: font-size از 0.6rem به 0.85rem افزایش یافت */
  .add-to-cart-btn {
    flex: 1;
    padding: 14px 16px;
    border-radius: 14px;
    font-size: 0.85rem;
    background: var(--primary);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
  }

  .add-to-cart-btn:hover {
    background: #3a9a85;
  }
}

/* دسکتاپ */
@media (min-width: 1024px) {
  .explore-container {
    grid-template-columns: repeat(3, 1fr);
  }

  .explore-item {
    display: flex;
    flex-direction: row;
    background: var(--dark);
    border-radius: 15px;
    padding: 20px;
    gap: 20px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, .1);
    transition: all .3s ease;
    line-height: 1.5rem;
  }

  .explore-item:hover {
    box-shadow: 0 8px 30px rgba(0, 0, 0, .15);
    transform: translateY(-4px);
  }

  .item-image {
    width: 110px;
    height: 110px;
    min-width: 110px;
    border-radius: 12px;
    font-size: 3rem;
    background: linear-gradient(135deg, var(--greenlight), var(--primary));
    flex-shrink: 0;
  }

  .item-details {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
  }

  .item-name {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--light);
  }

  .item-price {
    font-size: 1.3rem;
    color: var(--primary);
    font-weight: bold;
  }

  .item-actions {
    display: flex;
    gap: 10px;
    margin-top: auto;
  }

  .wishlist-btn {
    width: 40px;
    height: 40px;
    background: var(--red);
    border-radius: 14px;
    padding: 8px;
    flex-shrink: 0;
  }

  .wishlist-btn svg {
    width: 28px;
    height: 28px;
    fill: none;
    stroke: white;
    stroke-width: 18.3px;
  }

  .wishlist-btn.active svg {
    fill: white;
    stroke: none;
  }

  /* FIX: font-size از 0.6rem به 0.85rem افزایش یافت */
  .add-to-cart-btn {
    flex: 1;
    padding: 14px 16px;
    border-radius: 14px;
    font-size: 0.85rem;
    background: var(--primary);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
  }

  .add-to-cart-btn:hover {
    background: #3a9a85;
  }
}

/* ================================
   Explore Page Background
   ================================ */

body.explore-page {
  min-height: 100vh;
  background-image:
    url('/images/explore-bg-desktop.webp'),
    linear-gradient(
      135deg,
      rgba(30, 50, 35, 1) 0%,
      rgba(25, 40, 30, 1) 20%,
      rgba(20, 35, 28, 1) 40%,
      rgba(15, 30, 25, 1) 60%,
      rgba(10, 20, 18, 1) 100%
    );
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: fixed;
  position: relative;
}

/* FIX: z-index از -1 به 0 تغییر یافت تا محتوا در iOS کلیک‌پذیر باشد */
body.explore-page::before {
  content: "";
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  z-index: 0;
  pointer-events: none;
}

@media (max-width: 767px) {
  body.explore-page {
    background-image:
      url('/images/explore-bg-mobile.webp'),
      linear-gradient(
        135deg,
        rgba(30, 50, 35, 1) 0%,
        rgba(25, 40, 30, 1) 20%,
        rgba(20, 35, 28, 1) 40%,
        rgba(15, 30, 25, 1) 60%,
        rgba(10, 20, 18, 1) 100%
      );
    background-size: cover;
    background-position: top center;
    background-attachment: scroll;
  }
}

@media (min-width: 768px) and (max-width: 1023px) {
  body.explore-page {
    background-image:
      url('/images/explore-bg-tablet.webp'),
      linear-gradient(
        135deg,
        rgba(30, 50, 35, 1) 0%,
        rgba(25, 40, 30, 1) 20%,
        rgba(20, 35, 28, 1) 40%,
        rgba(15, 30, 25, 1) 60%,
        rgba(10, 20, 18, 1) 100%
      );
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
  }
}

@media (min-width: 1024px) {
  body.explore-page {
    background-image:
      url('/images/explore-bg-desktop.webp'),
      linear-gradient(
        135deg,
        rgba(30, 50, 35, 1) 0%,
        rgba(25, 40, 30, 1) 20%,
        rgba(20, 35, 28, 1) 40%,
        rgba(15, 30, 25, 1) 60%,
        rgba(10, 20, 18, 1) 100%
      );
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
  }
}

/* ================================
   Explore Skeleton Loading
   ================================ */

.explore-skeleton {
  max-width: 1200px;
  margin: 20px auto 40px;
  padding: 0 16px;
  display: grid;
  gap: 20px;
}

.skeleton-card {
  background: var(--dark);
  border-radius: 15px;
  padding: 20px;
  display: flex;
  /* FIX: gap از 70px به 20px کاهش یافت */
  gap: 20px;
  box-shadow: 0 5px 20px rgba(0, 0, 0, .1);
  animation: skeleton-fade 1.2s infinite ease-in-out;
}

.skeleton-card::before {
  content: "";
  width: 110px;
  height: 110px;
  min-width: 110px;
  border-radius: 12px;
  background: linear-gradient(90deg, #333 25%, #444 37%, #333 63%);
  background-size: 400% 100%;
  animation: skeleton-loading 1.2s infinite;
}

.skeleton-card::after {
  content: "";
  flex: 1;
  height: 80px;
  border-radius: 10px;
  background: linear-gradient(90deg, #333 25%, #444 37%, #333 63%);
  background-size: 400% 100%;
  animation: skeleton-loading 1.2s infinite;
}

.load-more-btn {
  display: none;
  margin: 20px auto 40px;
  padding: 14px 26px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 12px;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 200;
  cursor: pointer;
  transition: .3s;
  box-shadow: 0 5px 20px rgba(0, 0, 0, .15);
}

.load-more-btn:hover {
  background: #3a9a85;
  transform: translateY(-2px);
}

@keyframes skeleton-loading {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

@keyframes skeleton-fade {
  0% { opacity: .7; }
  50% { opacity: 1; }
  100% { opacity: .7; }
}

@media (max-width: 767px) {
  .explore-skeleton {
    grid-template-columns: 1fr 1fr;
  }

  .skeleton-card {
    flex-direction: column;
    padding: 18px;
    /* FIX: gap در موبایل override شد */
    gap: 12px;
  }

  .skeleton-card::before {
    width: 100%;
    aspect-ratio: 3/4;
    height: auto;
  }

  .skeleton-card::after {
    width: 100%;
    height: 60px;
  }
}

@media (min-width: 768px) {
  .explore-skeleton {
    grid-template-columns: 1fr 1fr;
  }

  .skeleton-card::before {
    aspect-ratio: 1/1;
  }

  .load-more-btn {
    display: block;
  }
}

@media (min-width: 1024px) {
  .explore-skeleton {
    grid-template-columns: repeat(3, 1fr);
  }

  .load-more-btn {
    display: block;
  }
}
