html,
body {
  height: 100%;
  margin: 0;
  display: flex;
  flex-direction: column;
}

body {
  font-family: Arial, sans-serif;
  background: #f5f5f5;
}

main {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.container {
  display: flex;
  max-width: 1400px;
  margin: 30px auto;
  gap: 20px;
  padding: 0 20px;
  flex: 1;
}

.sidebar {
  width: 250px;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 10px;
  padding: 20px;
  height: fit-content;
}

.sidebar h2 {
  font-size: 18px;
  margin-bottom: 15px;
  border-bottom: 1px solid #ddd;
  padding-bottom: 5px;
}

.category-button {
  display: block;
  background: #f9f9f9;
  border: 1px solid #ddd;
  margin-bottom: 10px;
  padding: 10px;
  border-radius: 5px;
  text-align: left;
  cursor: pointer;
  transition: background 0.3s;
}

.category-button:hover,
.category-button.active {
  background: #e0e0e0;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  flex: 1;
}

.product-card {
  border-radius: 10px;
  overflow: hidden;
  text-align: center;
  transition: transform 0.3s ease;
  min-height: 260px;
}

.product-card:hover {
  transform: translateY(-5px);
}

.product-card img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  background: #fff;
  padding: 10px;
  box-sizing: border-box;
  border: 1px solid #eee;
}

.product-card h3 {
  font-size: 16px;
  margin: 10px 0 5px;
  padding: 0 10px;
  color: #333;
}

.product-card p {
  font-size: 13px;
  color: #666;
  margin-bottom: 15px;
  padding: 0 10px;
}

.image-box {
  width: 100%;
  height: 200px;
  display: flex;
  justify-content: center;
  align-items: center;
  box-sizing: border-box;
}

.image-box img {
  max-width: 100%;
  max-height: 100%;
  object-fit: cover;
}

footer {
  background: #222;
  color: #fff;
  text-align: center;
  padding: 20px;
}

/* ====== MOBILE VIEW ====== */
@media (max-width: 991px) {
  .container {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    display: flex;
    overflow-x: auto;
    padding: 10px;
    box-sizing: border-box;
    border-radius: 10px;
    margin-bottom: 20px;
  }

  .sidebar h2 {
    display: none;
  }

  .category-button {
    flex: 1 0 auto;
    margin-right: 10px;
    white-space: nowrap;
    font-size: 14px;
    text-align: center;
    padding: 8px 12px;
  }

  .product-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  .product-grid {
    grid-template-columns: 1fr;
  }
}
