/* product grid and cards */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1rem;
}
/* Container for all products */
.products-grid {
   display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px;
  padding: 0;
  margin: 0;
  list-style: none;
}
/* Individual product card */
.product-card {
   border: 1px solid #ddd;
  border-radius: 8px;
  overflow: hidden;
  background-color: #fff;
  display: flex;
  flex-direction: column;
  transition: box-shadow 0.2s;
}

.product-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Image wrapper and image */
.product-image-wrap {
  width: 100%;
  padding-top: 75%; /* 4:3 ratio */
  position: relative;
  overflow: hidden;
  background-color: #f5f5f5;
}

.product-image-wrap img.product-image {
  position: absolute;
  top: 0; 
  left: 0;
  width: 100%; 
  height: 100%;
  object-fit: cover;
}

.product-body {
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.product-title {
 font-size: 1.1rem;
  margin: 0 0 6px 0;
}

.product-desc {
  font-size: 0.9rem;
  color: #555;
  margin: 0 0 10px 0;
  flex-grow: 1;
}

/* Meta section */
.product-meta > div {
  margin: 4px 0;
}

.product-price {
  font-weight: bold;
  color: #333;
}

.product-stock {
  color: #2a7d2a; /* green for available stock */
}

.out-of-stock {
  color: #d32f2f; /* red for out of stock */
}

.product-button button {
  width: 100%;
  padding: 6px 0;
  background-color: #007bff;
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-weight: bold;
  transition: background-color 0.2s;
}

.product-button button:hover {
  background-color: #0056b3;
}

button.add-to-cart {
  background: #1f7a8c;
  color: #fff;
  border: none;
  padding: 0.45rem 0.7rem;
  border-radius: 6px;
  cursor: pointer;
}
button.add-to-cart:hover { opacity: 0.95; }

/* header/footer */
.site-header, .site-footer {
  padding: 1rem;
  background: #fafafa;
  border-bottom: 1px solid #eee;
}
.site-header nav a { margin-left: 1rem; color: #333; text-decoration: none; }

/* product page layout */
.product-page {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  margin-top: 2rem;
}

.product-page-imgwrap {
  flex: 1 1 300px;
  max-width: 400px;
}

.product-page-img {
  width: 100%;
  border-radius: 10px;
  object-fit: cover;
  box-shadow: 0 5px 20px rgba(0,0,0,0.1);
}

.product-page-info {
  flex: 1 1 300px;
}

.product-page-price {
  font-size: 1.5rem;
  font-weight: bold;
  margin: 0.5rem 0;
}

.product-page-desc {
  margin: 1rem 0;
  line-height: 1.4rem;
}

.product-title-link,
.product-link {
  text-decoration: none;
  color: inherit;
}

/* cart styling */
.cart-item {
  display: flex;
  align-items: center;
  margin-bottom: 1rem;
  padding: 0.75rem;
  border-bottom: 1px solid #eee;
}

.cart-item-img {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 8px;
  margin-right: 1rem;
}

.cart-item-info {
  flex: 1 1 auto;
}

.cart-item-info h3 {
  margin: 0;
  font-size: 1rem;
}

.cart-item-info p {
  margin: 0.25rem 0;
}

.cart-controls button {
  margin-right: 0.5rem;
  padding: 0.25rem 0.5rem;
  border-radius: 5px;
  border: none;
  cursor: pointer;
}

.cart-controls button:hover {
  opacity: 0.9;
}

#cart-summary {
  margin-top: 1rem;
  text-align: right;
}

#checkout-button {
  background: #1f7a8c;
  color: #fff;
  padding: 0.6rem 1rem;
  border-radius: 6px;
  cursor: pointer;
  border: none;
  font-size: 1rem;
}

#checkout-button:hover { opacity: 0.95; }

/* Admin panel */
.admin-product {
  padding: 0.5rem 0;
  border-bottom: 1px solid #eee;
}

.admin-product button {
  margin-left: 0.5rem;
  padding: 0.25rem 0.5rem;
  border-radius: 5px;
  border: none;
  cursor: pointer;
}

.admin-product button:hover {
  opacity: 0.9;
}

#product-form input, #product-form textarea, #product-form button {
  display: block;
  margin: 0.5rem 0;
  padding: 0.5rem;
  width: 100%;
  max-width: 400px;
}

