.search-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
  font-family: "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.search-header {
  margin-bottom: 40px;

  h1 {
    font-size: 2rem;
    margin-bottom: 20px;
    color: #1e3c38;
    text-align: center;
  }
}

.search-box {
  position: relative;
  max-width: 600px;
  margin: 0 auto;

  .search-input {
    width: 100%;
    padding: 16px 50px 16px 20px;
    font-size: 1.1rem;
    font-family: "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    border: 2px solid #d3dad9;
    border-radius: 13px;
    outline: none;
    transition: border-color 0.2s;

    &:focus {
      border-color: var(--primary-color);
      box-shadow: 0 0 0 3px rgba(73, 118, 113, 0.1);
    }
  }

  .search-icon {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    pointer-events: none;
  }
}

.results-count {
  text-align: center;
  margin-bottom: 24px;
  color: #1e3c38;
  font-size: 1.1rem;
}

.empty-state,
.loading-initial {
  text-align: center;
  padding: 60px 20px;
  color: #697777;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 80px 20px;

  .empty-state-icon {
    width: 90px;
    height: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f5f3f9;
    border-radius: 50%;
    margin-bottom: 20px;
  }

  p {
    font-size: 1rem;
    color: #a1b4b5;
    margin: 0;
  }
}

.no-results {
  text-align: center;
  padding: 80px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;

  .no-results-icon {
    width: 90px;
    height: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f5f3f9;
    border-radius: 50%;
    margin-bottom: 20px;
  }

  h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1e3c38;
    margin: 0 0 8px 0;
  }

  p {
    margin: 4px 0;
    color: #697777;
    font-size: 0.95rem;
  }

  .hint {
    font-size: 0.875rem;
    color: #a1b4b5;
    margin-top: 12px;
  }
}

.error {
  text-align: center;
  padding: 60px 20px;

  button {
    margin-top: 20px;
    padding: 10px 24px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 13px;
    cursor: pointer;
    font-size: 1rem;
    font-family: "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

    &:hover {
      background: var(--primary-hover);
    }

    &:focus-visible {
      outline: 2px solid var(--primary-color);
      outline-offset: 2px;
    }
  }
}

.items-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 24px;
  margin-bottom: 40px;
}

.item-card {
  background: white;
  border-radius: 13px;
  border: 1px solid #d3dad9;
  box-shadow: 0 3px 4px rgba(0, 0, 0, 0.08);
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
  display: flex;
  flex-direction: column;

  &:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
  }
}

.item-link {
  text-decoration: none;
  color: inherit;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.item-image {
  position: relative;
  width: 100%;
  padding-top: 75%;
  background: #f5f5f5;
  overflow: hidden;
  border-radius: 13px;

  img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: white;
    padding: 12px;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), filter 0.4s ease;
    filter: drop-shadow(0 2px 6px rgba(0,0,0,0.06));
  }

  &:hover img {
    transform: scale(1.06) translateY(-2px);
    filter: drop-shadow(0 12px 24px rgba(0,0,0,0.15)) brightness(1.03);
  }
}

.discount-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  background: #ef4444;
  color: white;
  padding: 6px 12px;
  border-radius: 20px;
  font-weight: 600;
  font-size: 0.9rem;
}

.item-details {
  padding: 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.item-name {
  font-size: 1.1rem;
  margin: 0;
  color: #1e3c38;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.item-rating {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  color: #1e3c38;

  .rating-stars {
    color: #497671;
    font-weight: 600;
  }
}

.item-price {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: auto;
}

.original-price {
  text-decoration: line-through;
  color: #697777;
  font-size: 0.9rem;
}

.discounted-price,
.current-price {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--primary-color);
}

.item-stock {
  .stock-bar {
    display: flex;
    gap: 4px;
    align-items: center;

    .bar-segment {
      width: 20px;
      height: 6px;
      background: #d3dad9;
      border-radius: 3px;
      transition: background 0.2s;

      &.filled.high {
        background: #2ed573;
      }

      &.filled.medium {
        background: #ffa502;
      }

      &.filled.low {
        background: #ef4444;
      }
    }
  }
}

.add-to-cart-btn {
  width: 100%;
  padding: 12px;
  background: var(--primary-color);
  color: white;
  border: none;
  border-radius: 0 0 13px 13px;
  font-size: 1rem;
  font-weight: 600;
  font-family: "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  cursor: pointer;
  transition: background 0.2s;

  &:hover {
    background: var(--primary-hover);
  }

  &:active {
    transform: scale(0.98);
  }
}

.loading-more {
  text-align: center;
  padding: 40px 20px;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #f3f3f3;
  border-top: 4px solid var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 12px;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.no-more {
  color: #697777;
  padding: 40px 20px;
  text-align: center;
}

// Skeleton loading cards
.skeleton-card {
  pointer-events: none;

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

  .skeleton-line {
    border-radius: 6px;
    background: linear-gradient(90deg, #e8e8e8 25%, #d8d8d8 50%, #e8e8e8 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
  }

  .skeleton-title {
    height: 16px;
    width: 80%;
  }

  .skeleton-rating {
    height: 12px;
    width: 50%;
  }

  .skeleton-price {
    height: 18px;
    width: 40%;
    margin-top: auto;
  }

  .skeleton-stock {
    height: 6px;
    width: 60px;
  }

  .skeleton-btn {
    height: 42px;
    background: linear-gradient(90deg, #5a8a85 25%, #497671 50%, #5a8a85 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 0 0 13px 13px;
    margin-top: -1px;
  }
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

@media (max-width: 768px) {
  .search-header h1 {
    font-size: 1.5rem;
  }

  .items-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 16px;
  }

  .item-name {
    font-size: 0.95rem;
  }

  .discounted-price,
  .current-price {
    font-size: 1.1rem;
  }
}
