/* Page-level layout to keep footer at bottom */
html, body {
  height: 100%;
  margin: 0;
  display: flex;
  flex-direction: column;
  font-family: 'Segoe UI', Arial, sans-serif;
  background: #f4f4f4;
}

/* Header: deep blue bar */
.top-bar {
  background-color: #003366;
  color: #fff;
  padding: 1em 2em;
  position: sticky;
  top: 0;
  z-index: 1000; 
}

.top-bar h1 {
  margin: 0;
  font-size: 1.6em;
  font-weight: 700;
}

/* Breadcrumb */
.top-bar nav ul.breadcrumb {
  list-style: none;
  display: flex;
  gap: 10px;
  padding: 0;
  margin: 0.5em 0 0;
}

.top-bar nav ul.breadcrumb li a {
  color: #ffcc00;
  text-decoration: none;
}

.top-bar nav ul.breadcrumb li a:hover {
  text-decoration: underline;
}

/* Category bar*/
.category-bar {
  background-color: #2f3b52; 
  padding: 0.6em 2em;
}

.category-bar ul {
  list-style: none;
  display: flex;
  gap: 28px;
  margin: 0;
  padding: 0;
}

.category-bar a {
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  padding-bottom: 2px;
  border-bottom: 2px solid transparent;
  transition: color 0.2s, border-color 0.2s;
}

.category-bar a:hover {
  color: #ffcc00;
  border-bottom-color: #ffcc00;
}

.category-bar a.active {
  color: #ffcc00;
  border-bottom-color: #ffcc00;
}

/* Main content grows to fill space */
main {
  flex: 1;
  padding: 2em;
}

/* Product grid */
.product-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.product {
  border: 1px solid #ddd;
  border-radius: 10px;
  padding: 16px;
  background: #fff;
  text-align: center;
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.product:hover {
  transform: translateY(-4px);
  box-shadow: 0 6px 14px rgba(0,0,0,0.12);
}

.product img {
  width: 100%;
  border-radius: 8px;
  margin-bottom: 10px;
  transition: transform 0.25s ease;
}

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

.product-link .price {
  margin-top: auto;
  margin-bottom: 0;
}

.product img:hover {
  transform: scale(1.03);
}

.product h3 {
  margin: 8px 0 6px;
  font-size: 1.05em;
}

.price {
  font-weight: 700;
  color: #0077cc;
  margin-bottom: 10px;
}

.product button {
  background: #0077cc;
  color: #fff;
  border: none;
  padding: 10px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.product button:hover {
  background: #005fa3;
}

/* Shopping list drawer */
.shopping-list {
  position: fixed;
  top: 0;
  right: 0;
  width: 300px;
  height: 100%;
  background: #fafafa;
  border-left: 2px solid #d9d9d9;
  padding: 20px;
  box-shadow: -2px 0 8px rgba(0,0,0,0.12);
  display: none;
  z-index: 1100;
}

.shopping-list h2 {
  margin-top: 0;
  font-size: 1.2em;
  border-bottom: 1px solid #e5e5e5;
  padding-bottom: 10px;
}

.cart-total {
  font-weight: bold;
  font-size: 1.1em;
  color: #0077cc;
  text-align: right;
  padding: 10px 0;
  border-bottom: 2px solid #e5e5e5;
  margin-bottom: 10px;
}

.shopping-list ul {
  list-style: none;
  padding: 0;
  margin: 0 0 1em;
  max-height: 400px;
  overflow-y: auto;
}

.shopping-list li.cart-item {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  padding: 10px;
  background: #fff;
  border-radius: 6px;
  border: 1px solid #e5e5e5;
  position: relative;
}

.cart-item-img {
  width: 50px;
  height: 50px;
  object-fit: cover;
  border-radius: 4px;
  flex-shrink: 0;
}

.cart-item-details {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  font-size: 0.9em;
}

.item-name {
  font-weight: 600;
  color: #333;
  font-size: 0.95em;
}

.item-controls {
  display: flex;
  align-items: center;
  gap: 4px;
}

.qty-btn {
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid #ddd;
  background: #f5f5f5;
  color: #333;
  cursor: pointer;
  border-radius: 4px;
  font-weight: bold;
  font-size: 1.1em;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.qty-btn:hover {
  background: #0077cc;
  color: white;
  border-color: #0077cc;
}

.qty-input {
  width: 45px;
  padding: 4px 6px;
  text-align: center;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 0.9em;
}

.item-price {
  font-weight: 600;
  color: #0077cc;
  font-size: 0.85em;
}

.delete-btn {
  width: 28px;
  height: 28px;
  padding: 0;
  background: #ff4444;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-weight: bold;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.delete-btn:hover {
  background: #cc0000;
}

.shopping-list input[type="number"] {
  width: 40px;
  padding: 3px;
  font-size: 0.9em;
}

.item-price {
  font-weight: 600;
  color: #0077cc;
  font-size: 0.85em;
}

.shopping-list .checkout-btn {
  background: #28a745;
  color: #fff;
  border: none;
  padding: 12px;
  width: 100%;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s ease;
  font-weight: bold;
  margin-top: 10px;
}

.shopping-list .checkout-btn:hover {
  background: #218638;
}

/* Product details page */
.product-details {
  display: flex;
  gap: 40px;
  max-width: 900px;
  background: #fff;
  padding: 30px;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.product-image {
  flex: 1;
  min-width: 300px;
}

.product-image img {
  width: 100%;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Swiper Slider Styles */
.product-swiper {
  width: 100%;
  background: #f9f9f9;
  position: relative;
}

.swiper-wrapper {
  width: 100%;
  height: 100%;
}

.swiper-slide {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100% !important;
  height: 100% !important;
  background: #f9f9f9;
  aspect-ratio: 4 / 3;
}

.swiper-slide img {
  max-width: 70%;
  max-height: 70%;
  width: auto;
  height: auto;
  object-fit: contain;
}

.swiper-button-prev,
.swiper-button-next {
  color: #0077cc;
  background: transparent;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  transition: all 0.3s ease;
  z-index: 10;
}

.swiper-button-prev {
  left: 10px;
}

.swiper-button-next {
  right: 10px;
}

.swiper-button-prev:hover,
.swiper-button-next:hover {
  opacity: 0.7;
}

.swiper-pagination {
  bottom: 15px;
}

.swiper-pagination-bullet {
  background: rgba(255, 255, 255, 0.8);
  opacity: 0.8;
  width: 8px;
  height: 8px;
}

.swiper-pagination-bullet-active {
  background: #0077cc;
  opacity: 1;
}

.product-info {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.product-info h2 {
  margin-top: 0;
  font-size: 2em;
  margin-bottom: 15px;
}

.product-info .price {
  font-size: 1.8em;
  color: #0077cc;
  font-weight: 700;
  margin: 10px 0 20px;
}

.product-info .description {
  font-size: 1em;
  color: #555;
  line-height: 1.6;
  margin-bottom: 30px;
  flex-grow: 1;
}

.add-to-cart-btn {
  background: #0077cc;
  color: #fff;
  border: none;
  padding: 14px 24px;
  font-size: 1.1em;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s ease;
  align-self: flex-start;
}

.add-to-cart-btn:hover {
  background: #005fa3;
}

/* Mobile adjustments for product details */
@media (max-width: 768px) {
  .product-details {
    flex-direction: column;
    gap: 20px;
    padding: 20px;
  }
  
  .product-image {
    min-width: 100%;
  }
  
  .product-info h2 {
    font-size: 1.6em;
  }
}

/* Mobile adjustments */
@media (max-width: 768px) {
  .product-grid {
    grid-template-columns: 1fr;
  }
  .category-bar ul {
    gap: 16px;
    flex-wrap: wrap;
  }
  /* When JS controls visibility on mobile, ignore hover */
  .shopping-list.js-controlled:hover {
    display: none;
  }
}
