
:root {
  --primary-color: #FF6B35;  /* Vibrant orange */
  --secondary-color: #004E89;  /* Deep navy blue */
  --accent-color: #00A896;  /* Teal */
  --neutral-100: #F8F9FA;
  --neutral-800: #2D3142;
  --gradient-primary: linear-gradient(135deg, var(--primary-color) 0%, #FF8E53 100%);
  --shadow-color: rgba(0, 78, 137, 0.15);
  --base-padding: 1.5rem;
  --transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

* {
  font-family: 'Montserrat', sans-serif;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  touch-action: manipulation;
}

body {
  background: linear-gradient(150deg, var(--neutral-100), #ffffff);
  font-family: 'Montserrat', sans-serif;
  color: var(--neutral-800);
  line-height: 1;
  overscroll-behavior: contain;
  scroll-behavior: smooth;
}

.main-content {
  max-width: 1400px;
  margin: 0 auto;
  padding: 3rem var(--base-padding);
  opacity: 0;
  animation: contentFadeIn 1s ease forwards;
}

@keyframes contentFadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.products-section h1 {
  font-size: 4rem;
  text-align: center;
  margin-bottom: 2.5rem;
  position: relative;
  color: var(--secondary-color);
  text-shadow: 0 2px 4px var(--shadow-color);
  perspective: 1000px;
}

.products-section h1 span {
  display: inline-block;
  animation: titleFloat 3s ease-in-out infinite;
}

@keyframes titleFloat {
  0%, 100% { transform: translateY(0) rotateX(0); }
  50% { transform: translateY(-10px) rotateX(10deg); }
}

.products-section h1::after {
  content: '';
  display: block;
  width: 30vw;
  height: 4px;
  background: var(--gradient-primary);
  position: absolute;
  left: 50%;
  bottom: -2rem;
  transform: translateX(-50%);
  border-radius: 2px;
  box-shadow: 0 2px 8px var(--primary-color);
}

.product-categories {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  margin: 2rem 0;
  padding-bottom: 0.5rem;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
}

.category-btn {
  --button-shadow: 0 7px 15px var(--shadow-color);
  background: var(--neutral-100);
  border: 2px solid var(--secondary-color);
  border-radius: 50px;
  padding: 1.2rem 2.5rem;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
  scroll-snap-align: center;
  transform-style: preserve-3d;
}

.category-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: var(--gradient-primary);
  transition: left 0.4s ease;
  z-index: -1;
}

.category-btn:hover::before {
  left: 0;
}

.category-btn.active {
  background: var(--secondary-color);
  color: white;
  border-color: var(--primary-color);
  transform: translateY(-3px) scale(1.05);
  box-shadow: 0 8px 20px var(--shadow-color);
}

.products-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 3rem;
  padding: 2rem;
  position: relative;
}

.product-card {
  background: white;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 8px 25px var(--shadow-color);
  transition: var(--transition);
  position: relative;
  cursor: pointer;
  transform-style: preserve-3d;
  will-change: transform;
}

.product-card:hover {
  transform: translateY(-10px) rotateX(5deg) rotateY(5deg);
  box-shadow: 0 15px 30px var(--shadow-color);
}

.product-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--gradient-primary);
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: -1;
}

.product-card img {
  width: 100%;
  height: 280px;
  object-fit: cover;
  transition: transform 0.4s ease, filter 0.3s ease;
  clip-path: polygon(0 0, 100% 0, 100% 90%, 0 100%);
}

.product-card:hover img {
  transform: scale(1.05) translateY(-5px);
  filter: saturate(1.2);
}

.product-card h3 {
  font-size: 1.6rem;
  margin: 1.5rem;
  color: var(--secondary-color);
  position: relative;
}

.product-card h3::after {
  content: '';
  position: absolute;
  bottom: -0.5rem;
  left: 0;
  width: 40px;
  height: 3px;
  background: var(--primary-color);
  transition: width 0.3s ease;
}

.product-card:hover h3::after {
  width: 80px;
}

.price {
  font-size: 1.6rem;
  color: var(--primary-color);
  font-weight: 700;
  margin: 0 1.5rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.price::before {
  content: '➤';
  color: var(--accent-color);
  font-size: 1.2rem;
}

/* Advanced Animations */
@keyframes cardEntrance {
  from {
    opacity: 0;
    transform: translateY(50px) rotateX(-15deg);
  }
  to {
    opacity: 1;
    transform: translateY(0) rotateX(0);
  }
}

.product-card {
  animation: cardEntrance 0.8s ease forwards;
  animation-delay: calc(var(--index) * 0.1s);
  opacity: 0;
}

@keyframes gradientFlow {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.products-section h1::after {
  background: linear-gradient(
    90deg,
    var(--primary-color),
    var(--accent-color),
    var(--secondary-color)
  );
  background-size: 300% 300%;
  animation: gradientFlow 6s ease infinite;
}

/* Hover Particle Effect */
.product-card:hover::after {
  content: '';
  position: absolute;
  top: -20%;
  left: -20%;
  width: 140%;
  height: 140%;
  background: radial-gradient(circle at 50% 50%, 
    rgba(255,107,53,0.1) 0%,
    rgba(255,107,53,0.05) 30%,
    transparent 70%
  );
  pointer-events: none;
  animation: particleSpread 0.6s ease-out;
}

@keyframes particleSpread {
  from { transform: scale(0); opacity: 1; }
  to { transform: scale(1); opacity: 0; }
}

/* Responsive Design */
@media (max-width: 768px) {
  .products-section h1 {
    font-size: 3rem;
    animation: none;
  }
  
  .product-card {
    animation: cardEntrance 0.6s ease forwards;
  }
  
  .category-btn {
    padding: 1rem 2rem;
    font-size: 1.1rem;
  }
}

/* Mobile-First Responsive Additions */
@media (max-width: 1200px) {
    .products-section h1 {
      font-size: 2.5rem;
    }
  
    .products-container {
      grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
      gap: 2rem;
    }
  }
  
  @media (max-width: 992px) {
    .main-content {
      padding: 2rem 1.5rem;
    }
  
    .products-section h1 {
      font-size: 3rem;
      line-height: 1.2;
    }
  
    .product-categories {
      gap: 0rem;
      padding-bottom: 1rem;
      -webkit-overflow-scrolling: touch;
            justify-content: flex-start;
      margin: 1.5rem -1rem;
      padding: 0 1rem 1rem;
    }
  
    .category-btn {
      padding: 1rem 2rem;
      font-size: 1.1rem;
      flex-shrink: 0;
    }
  
    .product-card img {
      height: 220px;
    }
  }
  
  @media (max-width: 768px) {
    .products-section {
      padding: 2rem 1rem;
    }
  
    .products-section h1 {
      font-size: 2.5rem;
      margin-bottom: 2rem;
    }
  
    .products-section h1::after {
      width: 60vw;
      bottom: -1.5rem;
    }
  
    .products-container {
      grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
      padding: 1rem;
      gap: 1.5rem;
    }
  
    .product-card {
      border-radius: 12px;
    }
  
    .product-card h3 {
      font-size: 1.4rem;
      margin: 1rem;
    }
  
    .product-card p {
      margin: 1rem;
      font-size: 0.95rem;
    }
  
    .price {
      font-size: 1.4rem;
      margin: 0 1rem 1rem;
    }
  }
  
  @media (max-width: 576px) {
    .main-content {
      padding: 1.5rem 1rem;
    }
  
    .products-section h1 {
      font-size: 2.2rem;
    }
  
    .product-categories {
      justify-content: flex-start;
      margin: 1.5rem -1rem;
      padding: 0 1rem 1rem;
    }
  
    .category-btn {
      padding: 0.8rem 1.5rem;
      font-size: 1rem;
    }
  
    .products-container {
      grid-template-columns: 1fr;
      gap: 1.2rem;
    }
  
    .product-card img {
      height: 200px;
      clip-path: polygon(0 0, 100% 0, 100% 92%, 0 100%);
    }
  
    .product-card:hover {
      transform: translateY(-5px);
    }
  }
  
  /* Touch Device Specific Styles */
  @media (hover: none) and (pointer: coarse) {
    .product-card {
      transition: transform 0.2s ease;
    }
  
    .product-card:active {
      transform: translateY(-3px) scale(0.98);
    }
  
    .category-btn {
      border-width: 1.5px;
    }
  
    .product-card::before,
    .product-card::after {
      display: none;
    }
  
    .products-section h1::after {
      animation: none;
    }
  }
  
  /* Landscape Mobile Optimization */
  @media (max-height: 500px) and (orientation: landscape) {
    .main-content {
      padding: 1rem;
    }
  
    .products-section h1 {
      font-size: 2rem;
      margin-bottom: 1.5rem;
    }
  
    .product-card img {
      height: 150px;
    }
  }
  
  /* Enhanced Scroll Behavior */
  .product-categories {
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE */
  }
  
  .product-categories::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
  }
  
  /* Mobile Menu Compatibility */
  .main-content {
    padding-top: calc(70px + 1rem); /* Header height compensation */
  }
  
  @media (max-width: 768px) {
    .main-content {
      padding-top: calc(60px + 1rem);
    }
  }

  /* Add to machinery.css */
.search-container {
    max-width: 800px;
    margin: 2rem auto;
    position: relative;
  }
  
  .ai-search-box {
    position: relative;
    background: var(--neutral-100);
    border-radius: 50px;
    box-shadow: 0 5px 15px var(--shadow-color);
    overflow: hidden;
  }
  
  #aiSearch {
    width: 100%;
    padding: 1.5rem 2rem;
    border: none;
    background: transparent;
    font-size: 1.1rem;
    color: var(--neutral-800);
  }
  
  #aiSearch:focus {
    outline: none;
  }
  
  .ai-search-btn {
    position: absolute;
    right: 0;
    top: 0;
    height: 100%;
    padding: 0 2rem;
    border: none;
    background: var(--gradient-primary);
    color: white;
    cursor: pointer;
    transition: var(--transition);
  }
  
  .search-suggestions {
    position: absolute;
    width: 100%;
    background: white;
    border-radius: 15px;
    margin-top: 0.5rem;
    box-shadow: var(--shadow);
    max-height: 300px;
    overflow-y: auto;
    display: none;
  }
  
  .search-suggestion-item {
    padding: 1rem 2rem;
    cursor: pointer;
    transition: var(--transition);
  }
  
  .search-suggestion-item:hover {
    background: var(--neutral-100);
  }
  
  .no-results-card {
    background: var(--neutral-100);
    padding: 2rem;
    border-radius: 15px;
    text-align: center;
    margin: 2rem 0;
  }
  
  .online-search-btn {
    background: var(--gradient-primary);
    color: white;
    border: none;
    padding: 0.8rem 2rem;
    border-radius: 30px;
    cursor: pointer;
    margin-top: 1rem;
    transition: var(--transition);
  }
  
  .online-search-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
  }

  /* Image Zoom Modal */
.image-modal {
  display: none;
  position: fixed;
  z-index: 2000;
  padding-top: 60px;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background: rgba(0, 0, 0, 0.9);
  animation: fadeIn 0.3s ease-in-out;
}

.image-modal img {
  display: block;
  margin: auto;
  max-width: 90%;
  max-height: 80vh;
  border-radius: 10px;
  box-shadow: 0 8px 25px var(--shadow-color);
}

.close-modal {
  position: absolute;
  top: 20px;
  right: 40px;
  color: white;
  font-size: 35px;
  font-weight: bold;
  cursor: pointer;
  transition: var(--transition);
}

.close-modal:hover {
  color: var(--primary-color);
}

.modal-caption {
  text-align: center;
  margin-top: 20px;
}

.call-btn {
  background: var(--gradient-primary);
  color: white;
  padding: 0.8rem 2rem;
  border-radius: 50px;
  text-decoration: none;
  font-size: 1.2rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: var(--transition);
}

.call-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px var(--shadow-color);
}

/* Modal Animation */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
