/* Main Store / Study Materials Section */
main {
  background: #f4f6f9;
  padding: 2rem;
  font-family: 'Poppins', sans-serif;
}

/* Section Heading */
#study-materials h2,
#store h2,
#cart h2 {
  font-size: 1.6rem;
  font-weight: 600;
  color: #1a1a2e;
  margin-bottom: 1rem;
  text-align: center;
}

/* Results info text */
#results-info {
  font-size: 1rem;
  color: #333;
  margin-bottom: 1rem;
  text-align: center;
}

/* Product Container Grid */
#materials-container.grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: stretch;   /* equal height */
  gap: 1rem;
}

/* Product Card */
.material-card {
  flex: 0 1 260px;        /* base width */
  background: #ffffff;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 1rem;
  box-sizing: border-box;

  display: flex;
  flex-direction: column;
  justify-content: space-between; /* button at bottom */
  align-items: center;
}

/* Product Image */
.material-card img {
  max-width: 100%;
  height: 140px;
  object-fit: contain;
  margin-bottom: 0.5rem;
}

/* Sale Badge */
.sale {
  background: #e63946;
  color: #fff;
  font-weight: bold;
  font-size: 0.85rem;
  padding: 0.3rem 0.6rem;
  border-radius: 4px;
  margin-bottom: 0.5rem;
}

/* Product Title */
.material-card h3 {
  font-size: 1rem;
  font-weight: 600;
  color: #1a1a2e;
  margin: 0.5rem 0;
  text-align: center;
  word-wrap: break-word;
}

.material-card h3 a {
  color: blue;
}

.material-card h3 a:hover {
  color: #0077cc;
}

/* Category & Price */
.material-card p {
  margin: 0.3rem 0;
  font-size: 0.9rem;
  color: #555;
  text-align: center;
}

/* Buttons */
button {
  background: #1a1a2e;
  color: #fff;
  border: none;
  padding: 0.5rem 1rem;
  cursor: pointer;
  border-radius: 4px;
  font-size: 0.9rem;
  transition: background 0.3s ease;
}

button:hover {
  background: #0077cc;
}

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

/* Pagination */
#pagination {
  margin-top: 1.5rem;
  text-align: center;
}

#pagination button {
  background: #fff;
  border: 1px solid #ddd;
  color: #1a1a2e;
  margin: 0 0.3rem;
  padding: 0.4rem 0.8rem;
  border-radius: 4px;
  cursor: pointer;
}

#pagination button:hover {
  background: #0077cc;
  color: #fff;
}

#pagination button:disabled {
  background: #1a1a2e;
  color: #fff;
  cursor: default;
}

/* Cart Section */
#cart {
  margin-top: 2rem;
  background: #f9fafc;
  padding: 2rem;
  border-top: 1px solid #ddd;
}

/* Cart Items Container */
#cart-items {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: stretch;
  gap: 1rem;
}

/* Each Cart Item */
.cart-item {
  flex: 0 1 300px;
  background: #ffffff;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 1rem;
  box-sizing: border-box;

  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
}

/* Cart Item Text */
.cart-item p {
  margin: 0.5rem 0;
  font-size: 0.95rem;
  color: #333;
  text-align: center;
  word-wrap: break-word;
}

/* Cart Total */
#cart-total {
  font-size: 1.2rem;
  font-weight: bold;
  margin-top: 1rem;
  text-align: center;
}


/* Responsive Layout */
@media (max-width: 600px) {
  #materials-container.grid,
  #cart-items {
    flex-direction: column;
    align-items: center;
  }
  .material-card,
  .cart-item {
    width: 90%;
  }
}

