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

.error,
.loading-initial,
.no-more {
  text-align: center;
  padding: 60px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #697777;
  font-family: "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.no-items {
  text-align: center;
  padding: 80px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-family: "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

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

  h3 {
    font-size: var(--font-size-2xl, 1.25rem);
    font-weight: var(--font-weight-bold, 700);
    color: #1e3c38;
    margin: 0 0 8px 0;
  }

  p {
    font-size: var(--font-size-md, 0.9375rem);
    color: #697777;
    margin: 0 0 24px 0;
    max-width: 340px;
    line-height: 1.5;
  }

  .no-items-btn {
    display: inline-flex;
    align-items: center;
    padding: 10px 28px;
    background: #497671;
    color: white;
    border-radius: var(--radius-lg, 13px);
    font-family: "DM Sans", sans-serif;
    font-size: var(--font-size-md, 0.9375rem);
    font-weight: var(--font-weight-semibold, 600);
    text-decoration: none;
    transition: background 0.2s ease, transform 0.15s ease;

    &:hover {
      background: #3d635f;
      transform: translateY(-1px);
    }
  }
}

.error button {
  margin-top: 20px;
  padding: 10px 24px;
  background: #497671;
  color: white;
  border: none;
  border-radius: var(--radius-sm, 8px);
  cursor: pointer;
  font-size: var(--font-size-lg, 1rem);
  font-family: "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-weight: var(--font-weight-medium, 500);
  transition: all 0.2s ease;

  &:hover {
    background: #3a5f5b;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(73, 118, 113, 0.3);
  }
}

.items-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 30px;
  margin-bottom: 40px;
  width: 100%;
}

.item-card {
  width: 100%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);

  &:hover {
    transform: translateY(-4px);

    .item-image {
      box-shadow: 0 6px 8px 0 rgba(0, 0, 0, 0.2);
    }

    .item-details {
      box-shadow: 0 6px 8px 0 rgba(0, 0, 0, 0.2);
    }
  }
}

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

.item-image {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  border: 1px solid #d3dad9;
  border-radius: 13px 13px 0 0;
  box-shadow: 0 3px 4px 0 rgba(0, 0, 0, 0.15);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f0f0f0;

  img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: white;
    padding: 12px;
    transition: transform 0.3s ease, opacity 0.3s ease;
  }

  &:hover img {
    transform: scale(1.05);
  }
}

.discount-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  background: #ff4757;
  color: white;
  padding: 6px 12px;
  border-radius: 20px;
  font-weight: var(--font-weight-semibold, 600);
  font-size: var(--font-size-base, 0.875rem);
  font-family: "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  z-index: 1;
}

.item-details {
  width: 100%;
  border: 1px solid #d3dad9;
  border-top: none;
  border-radius: 0 0 13px 13px;
  padding: 12px 16px;
  box-shadow: 0 3px 4px 0 rgba(0, 0, 0, 0.15);
  background: #f5f3f9;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: background 0.3s ease;
}

.item-name {
  font-family: "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-weight: var(--font-weight-semibold, 600);
  font-size: clamp(14px, 1.4vw, 18px);
  color: #1e3c38;
  margin: 0;
  line-height: 1.3;
  display: -webkit-box;
  line-clamp: 2;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  min-height: calc(2 * 1.3em);
}

.item-rating {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--font-size-sm, 0.8125rem);
  color: #697777;
  font-family: "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

  .rating-stars {
    color: #ffa502;
    font-weight: var(--font-weight-semibold, 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: var(--font-size-sm, 0.8125rem);
  font-family: "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.discounted-price,
.current-price {
  font-size: clamp(16px, 1.6vw, 22px);
  font-weight: var(--font-weight-bold, 700);
  color: #497671;
  font-family: "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.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: #497671;
      }

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

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

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

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

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

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #d3dad9;
  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;
}

// Skeleton loading cards (shimmer/animation owned by shared app-skeleton)
.skeleton-card {
  pointer-events: none;

  .item-image {
    display: block;
    aspect-ratio: 1 / 1;
  }

  .item-details app-skeleton {
    display: block;
    margin-bottom: var(--space-sm, 8px);
  }

  .skeleton-btn {
    display: block;
    border-radius: 0 0 13px 13px;
    margin-top: -1px;
  }
}

// Responsive
@media (max-width: 1200px) {
  .items-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 24px;
  }
}

@media (max-width: 992px) {
  .items-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
  }
}

@media (max-width: 768px) {
  .items-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
  }

  .item-name {
    font-size: clamp(12px, 3vw, 16px);
  }

  .discounted-price,
  .current-price {
    font-size: clamp(14px, 3.5vw, 18px);
  }

  .item-details {
    padding: 10px 12px;
  }
}

@media (max-width: 480px) {
  .category-container {
    padding: 12px;
  }

  .items-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  .item-details {
    padding: 8px 10px;
  }

  .item-card:hover {
    transform: translateY(-2px);
  }

  .add-to-cart-btn {
    padding: 10px;
    font-size: var(--font-size-sm, 0.8125rem);
  }
}
