// src/styles/ProductCarousel.scss
.product-carousel {
  margin: 15px 0;
  padding: 15px 0;

  .product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    padding: 10px;
    overflow-x: auto;
    scroll-behavior: smooth;

    // Hide scrollbar but keep functionality
    &::-webkit-scrollbar {
      display: none;
    }
    -ms-overflow-style: none;
    scrollbar-width: none;
  }

  .product-card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;

    &:hover {
      transform: translateY(-5px);
      box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    }

    .product-image {
      width: 100%;
      height: 160px;
      object-fit: cover;
      border-bottom: 1px solid #eee;
    }

    .product-title {
      font-size: 14px;
      font-weight: 600;
      margin: 10px;
      color: #333;
      // Limit to 2 lines
      display: -webkit-box;
      -webkit-line-clamp: 2;
      -webkit-box-orient: vertical;
      overflow: hidden;
    }

    .product-price {
      font-size: 16px;
      font-weight: 700;
      color: #1976d2;
      margin: 5px 10px;
    }

    .product-link {
      display: inline-block;
      padding: 8px 15px;
      margin: 10px;
      background-color: #1976d2;
      color: white;
      text-decoration: none;
      border-radius: 4px;
      text-align: center;
      transition: background-color 0.3s ease;

      &:hover {
        background-color: #1565c0;
      }
    }
  }

  // Navigation buttons
  .carousel-nav {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 10px;

    button {
      width: 30px;
      height: 30px;
      border-radius: 50%;
      border: none;
      background-color: #1976d2;
      color: white;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;

      &:disabled {
        background-color: #ccc;
        cursor: not-allowed;
      }

      &:hover:not(:disabled) {
        background-color: #1565c0;
      }
    }
  }
}

// Responsive adjustments
@media (max-width: 480px) {
  .product-carousel {
    .product-grid {
      grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }

    .product-card {
      .product-image {
        height: 120px;
      }

      .product-title {
        font-size: 13px;
      }

      .product-price {
        font-size: 14px;
      }

      .product-link {
        padding: 6px 12px;
        font-size: 13px;
      }
    }
  }
}

// Loading skeleton animation
@keyframes shimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

.product-loading {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}