/* Global Setup */
body {
  background-color: #f4f4f4;
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, sans-serif;
  margin: 0;
  padding: 0;
}

/* 2 Side Space / Centered Layout Container */
.main-wrapper {
  background: #f4f4f4;
  padding: 20px 0;
  max-width: 1400px;
  margin: 0 auto;
}

/* Sidebar Styling */
.sidebar {
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.sidebar-container {
  position: sticky;
  top: 15px;
}

/* Flex Grid Container */
.product-grid-container {
  display: flex;
  flex-wrap: wrap;
  margin-left: -6px;
  margin-right: -6px;
}

/* 5 Cards per row (Desktop / Large screen) */
.product-grid-item {
  padding-left: 6px;
  padding-right: 6px;
  margin-bottom: 12px;
  width: 20%; /* Exactly 5 cards per row */
  box-sizing: border-box;
}

/* Fixed Equal Card Design */
.product-card {
  border: none;
  border-radius: 12px;
  background: #ffffff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  height: 380px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease;
}

.product-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.1);
}

/* Full Image Wrapper */
.img-wrapper {
  height: 190px;
  min-height: 190px;
  width: 100%;
  background: #f8f9fa;
  position: relative;
  overflow: hidden;
  border-top-left-radius: 12px;
  border-top-right-radius: 12px;
}

.card-img-top {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Card Body Area */
.card-body {
  padding: 10px 12px 12px 12px;
  display: flex;
  flex-direction: column;
  flex: 1;
  justify-content: space-between;
}

.card-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: #333;
  line-height: 1.3;
  height: 2.6em;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  margin-bottom: 4px;
}

/* Product Description Styling - Strictly 2 Lines Only */
.card-description {
  font-size: 0.75rem;
  color: #666666;
  line-height: 1.3em;
  height: 2.6em;
  max-height: 2.6em;
  overflow: hidden;
  margin-bottom: 6px;

  word-break: break-word;
  overflow-wrap: break-word;

  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.product-meta-tags {
  font-size: 0.72rem;
  margin-bottom: 4px;
}

.badge-stock {
  font-size: 0.68rem;
  font-weight: 600;
}

.badge-in {
  color: #28a745;
}
.badge-low {
  color: #fd7e14;
}
.badge-out {
  color: #dc3545;
}

.price-tag {
  font-size: 0.95rem;
  font-weight: 700;
  color: #0d6efd;
  margin-bottom: 8px;
}

.price-currency {
  font-size: 0.75rem;
  font-weight: 700;
  margin-right: 2px;
}

/* Action Group: Order Button & Wishlist Button Side-by-Side */
.action-group {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  margin-top: auto;
}

/* Order Now Button */
.btn-order {
  background: linear-gradient(45deg, #20c997, #28a745);
  color: #ffffff;
  border: none;
  border-radius: 20px;
  padding: 6px 8px;
  font-size: 0.72rem;
  font-weight: 600;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  text-transform: uppercase;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.btn-order:hover {
  background: linear-gradient(45deg, #1baa80, #218838);
  color: #ffffff;
}

.btn-order:disabled,
.btn-order.disabled {
  background: #e0e0e0;
  color: #999999;
  cursor: not-allowed;
}

/* Wishlist Button Right Beside Order Button */
.btn-wishlist-icon {
  width: 30px;
  height: 30px;
  min-width: 30px;
  border-radius: 4px;
  background: #ffffff;
  border: 1px solid #333333;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #333333;
  padding: 0;
  cursor: pointer;
  font-size: 0.8rem;
  transition: all 0.2s ease;
}

.btn-wishlist-icon:hover {
  border-color: #ff4757;
  color: #ff4757;
}

.btn-wishlist-icon.added {
  border-color: #ff4757;
  background-color: #ff4757;
  color: #ffffff;
}

/* Responsive Rules */
@media (max-width: 1199.98px) {
  .product-grid-item {
    width: 25%;
  }
}

@media (max-width: 899.98px) {
  .product-grid-item {
    width: 33.333%;
  }
}

/* Mobile View: Exactly 2 Cards per row */
@media (max-width: 767.98px) {
  .main-wrapper {
    padding: 10px;
  }

  .product-grid-item {
    width: 50%;
  }

  .product-card {
    height: 360px;
  }

  .sidebar {
    position: fixed;
    left: -100%;
    top: 0;
    width: 280px;
    height: 100vh;
    z-index: 1040;
    transition: left 0.3s ease;
    border-radius: 0;
  }

  .sidebar.active {
    left: 0;
  }
}

/* Floating Right Sidebar */
.floating-widget {
  position: fixed;
  right: 5px;
  top: 75%;
  transform: translateY(-50%);
  background: #ffffff;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
  display: flex;
  flex-direction: column;
  z-index: 1080;
  padding: 20px 5px;
  width: 85px;
  border: 1px solid #eaeaea;
}

.widget-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 15px 4px;
  color: #333333;
  text-decoration: none;
  transition: all 0.3s ease;
  border-bottom: 1px solid #f0f0f0;
}

.widget-item:last-child {
  border-bottom: none;
}

.widget-item i {
  font-size: 1.2rem;
  margin-bottom: 4px;
  color: #444444;
}

.widget-item span {
  font-size: 0.65rem;
  text-align: center;
  line-height: 1.1;
  font-weight: 500;
}

.widget-item:hover {
  background-color: #f8f9fa;
  color: #0d6efd;
}

.widget-item:hover i {
  color: #0d6efd;
}

/* Back to Top specific display control */
.back-to-top-item {
  display: none;
  opacity: 0;
  transition:
    opacity 0.3s ease,
    visibility 0.3s ease;
}

.back-to-top-item.show {
  display: flex;
  opacity: 1;
}

/* Mobile Responsive: */
@media (max-width: 1250px) {
  .floating-widget {
    right: 8px;
    width: 44px;
    border-radius: 8px;
  }

  .widget-item {
    padding: 10px 0;
  }

  .widget-item i {
    font-size: 1.2rem;
    margin-bottom: 0;
  }

  .widget-item span {
    display: none !important;
  }
}
