:root { --card-radius: 0.75rem; /* Slightly smaller radius */
        --card-padding: 0.75rem; /* Consistent padding */
        --font-size-sm: 0.7rem; 
        --font-size-md: 0.7rem; 
        --font-size-lg: 0.9rem; 
}

body {
    font-family: 'Poppins', sans-serif;
    background-color: #f8f9fa; /* Off-white, Bootstrap's light gray */
    color: #212529; /* Bootstrap's default body color for better contrast */
}

.object-cover { object-fit: cover; }

.banner-img {
    aspect-ratio: 4 / 3; /* More rectangular on mobile to save vertical space */
    object-fit: cover;
    width: 100%;
}

@media (min-width: 768px) { /* Medium devices (tablets) and up */
    .banner-img { aspect-ratio: 16 / 9; } /* Standard widescreen for better compatibility */
}

/* Smaller carousel controls on mobile */
@media (max-width: 767.98px) {
    .carousel-control-prev-icon,
    .carousel-control-next-icon {
        width: 1.5rem;
        height: 1.5rem;
    }
}

/* --- Header Redesign --- */
.header-main .navbar {
    padding: 0.5rem 0; /* Slightly increased padding */
}

@media (min-width: 992px) { /* lg and up */
    .header-main .navbar { padding: 0.75rem 0; }
}

.navbar-nav .nav-link {
    padding: 0.5rem 1rem !important;
    font-weight: 500;
    color: #495057;
    transition: color 0.2s ease;
}

.navbar-nav .nav-link:hover {
    color: var(--bs-primary);
}

.navbar-nav .dropdown-menu {
    border-radius: 0.5rem;
    border: 1px solid #e9ecef;
    box-shadow: 0 0.5rem 1rem rgba(0,0,0,0.1);
}

/* Search bar styling */
header .form-control {
    border-radius: 2rem 0 0 2rem;
    border-right: 0;
}
header .form-control:focus {
    box-shadow: none;
    border-color: #ced4da;
}
header .input-group .btn {
    border-radius: 0 2rem 2rem 0;
}

/* Header icons */
.nav-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px; height: 40px;
    color: #495057;
    border-radius: 50%;
    transition: background-color 0.2s ease, color 0.2s ease;
}
.nav-icon:hover {
    background-color: #f1f3f5;
    color: var(--bs-primary);
}

/* Active nav link styling */
.navbar-nav .nav-link.active {
    font-weight: 600;
    color: var(--bs-primary) !important;
}

.product-card {
  border-radius: var(--card-radius);
  overflow: hidden;
  position: relative;
  transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
  background-color: #fff;
  border: 1px solid rgba(0, 0, 0, 0.08); /* Lighter, more subtle border */
}
.product-card:hover {
  transform: translateY(-5px); /* More pronounced lift */
  box-shadow: 0 1rem 2rem rgba(0, 0, 0, 0.12); /* More diffused shadow */
}
.product-thumb img {
  filter: saturate(1.05); /* Slightly more saturation */
  transition: transform 0.3s ease-in-out;
  border-top-left-radius: var(--card-radius);
  border-top-right-radius: var(--card-radius);
}
.product-card:hover .product-thumb img {
  transform: scale(1.05); /* More noticeable zoom */
}

.product-card .card-body {
  padding: 0.25rem var(--card-padding) var(--card-padding) !important;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.product-card .text-muted.small {
  font-size: var(--font-size-sm);
  margin-bottom: 0 !important;
  color: #616161 !important; /* Darker muted text for better contrast */
}

.product-card .product-title {
  margin-bottom: 0.1rem !important;
  line-height: 1.3; /* Improved readability */
  font-weight: 500 !important; /* Using a medium weight for a cleaner look */
  letter-spacing: 0.01em;
}

/* Reduce product title font size on mobile for a more compact card */
@media (max-width: 767.98px) {
  .product-card .product-title {
    font-size: 0.8rem !important;
  }
}

.product-card .fs-5 {
  font-size: var(--font-size-lg) !important; /* Adjusted offer price size */
  color: #1a73e8 !important; /* A more modern blue for offer price */
}

.product-card .text-decoration-line-through.text-muted {
  font-size: var(--font-size-sm);
  color: #a0a0a0 !important; /* Slightly more visible muted for original price */
}

.product-card .d-flex.align-items-center.gap-2.mb-3 {
  margin-bottom: 0.6rem !important; /* Slightly more space below price row */
}

.product-card .badge {
  font-size: 0.65rem; /* Slightly larger badge font */
  padding: 0.25em 0.5em; /* Adjusted badge padding */
}

.product-card .btn {
  font-size: calc(var(--font-size-sm) + 0.05rem); /* Slightly larger button font */
  padding: 0.35rem 0.6rem; /* Adjusted button padding */
}

/* --- Category Card --- */
.category-card {
  transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
  border: 1px solid rgba(0, 0, 0, 0.08);
  color: var(--bs-body-color);
}
.category-card .card-img-top {
  height: 120px;
  object-fit: cover;
  transition: filter 0.2s ease-in-out;
}
.category-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.1);
}
.category-card:hover .card-title {
    color: var(--bs-primary);
}
.category-card:hover .card-img-top {
  filter: brightness(1.05);
}
.category-card .card-body {
  padding: 0.75rem;
}

/* --- Skeleton Loading Effect --- */
@keyframes shimmer {
  100% {
    transform: translateX(100%);
  }
}

@keyframes pulse-bg {
  0% { background-color: #e9ecef; }
  50% { background-color: #e0e0e0; }
  100% { background-color: #e9ecef; }
}

.skeleton {
  position: relative;
  overflow: hidden;
  background-color: #e9ecef; /* A light gray for placeholders */
}

.skeleton::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  transform: translateX(-100%);
  background-image: linear-gradient(90deg, rgba(255, 255, 255, 0) 0, rgba(255, 255, 255, 0.6) 50%, rgba(255, 255, 255, 0) 100%);
  animation: shimmer 2s infinite;
}

/* Apply skeleton to image placeholder */
.product-card.is-loading .product-thumb {
  background-color: #e9ecef;
  animation: pulse-bg 2s infinite;
}
.product-card.is-loading .product-thumb img {
  visibility: hidden;
}

/* Style text elements as skeleton bars */
.product-card.is-loading .skeleton-text {
  color: transparent !important;
  user-select: none;
  border-radius: 0.25rem;
  background-color: #e9ecef;
  animation: pulse-bg 2s infinite;
}
.product-card.is-loading .skeleton-text::before { content: '\00a0'; /* non-breaking space */ }


/* Utilities */
.badge.bg-success-subtle { background-color: #d1fae5 !important; color:#065f46 !important; }
.badge.bg-danger-subtle { background-color: #fee2e2 !important; color:#991b1b !important; }
.badge.bg-info-subtle { background-color: #e0f2fe !important; color:#0c4a6e !important; }
.badge.bg-dark-subtle { background-color: #e9ecef !important; color:#212529 !important; }

/* Footer link focus */
footer a:focus { outline: 2px dashed #fff; outline-offset: 2px; }

.img-thumbnail.object-cover {
  border: 1px solid #dee2e6;
  border-radius: 0.5rem;
  transition: all 0.2s ease-in-out;
}

.img-thumbnail.object-cover:hover {
  border-color: #007bff; /* Bootstrap primary blue */
  box-shadow: 0 0 0 0.25rem rgba(0, 123, 255, 0.25);
}

.horizontal-scroll-container {
    overflow-x: auto;
    white-space: nowrap;
}

.horizontal-scroll-container .row {
    flex-wrap: nowrap;
}

.horizontal-scroll-container::-webkit-scrollbar {
  height: 8px;
}

.horizontal-scroll-container::-webkit-scrollbar-track {
  background: #f1f1f1;
}

.horizontal-scroll-container::-webkit-scrollbar-thumb {
  background: #888;
  border-radius: 4px;
}

.horizontal-scroll-container::-webkit-scrollbar-thumb:hover {
  background: #555;
}

/* --- Product Page Controls --- */
.offcanvas-footer {
    background-color: #fff;
    z-index: 1; /* Keep it above body content if body scrolls slightly */
    box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
}

/* --- Mobile Top Bar for Filter and Sort --- */
.mobile-top-bar {
    position: sticky;
    /* Adjust top value based on your main header's height on mobile */
    top: 56px; 
    z-index: 1028; /* Below main header, above content */
    padding: 0.75rem;
    display: flex;
    gap: 0.75rem;
    background-color: #f8f9fa; /* Match the bg-light class */
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

/* Remove bottom padding on mobile for products page as the bar is now at the top */
body.page-products {
    padding-bottom: 0 !important;
}

/* Make the "Go Back" button on the product page smaller on mobile */
@media (max-width: 767.98px) {
    .btn-back-responsive {
        padding: 0.25rem 0.5rem;
        font-size: 0.875rem;
    }
}

/* Reduce top padding on product detail page for mobile to bring "Go Back" button closer to header */
@media (max-width: 767.98px) {
    body.page-product-detail main.py-4 {
        padding-top: 0.75rem !important; /* Halve the default py-4 top padding */
    }
}

/* --- Mobile Bottom Navigation --- */
.mobile-bottom-nav {
    position: fixed;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1040;
    display: flex;
    justify-content: space-around;
    align-items: center;
    width: 95%;
    max-width: 400px;
    height: 60px;
    background-color: #ffffff;
    border-radius: 30px; /* Pill shape */
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
    padding: 0 1rem;
}

.mobile-bottom-nav .nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: #6c757d; /* Muted gray */
    font-size: 0.7rem;
    min-width: 44px; /* Touch target size */
    min-height: 44px; /* Touch target size */
    transition: color 0.2s ease;
}

.mobile-bottom-nav .nav-item i {
    font-size: 1.4rem;
    margin-bottom: 2px;
}

.mobile-bottom-nav .nav-item:hover {
    color: var(--bs-primary);
}

.mobile-bottom-nav .nav-item.active {
    color: var(--bs-primary);
    font-weight: 600;
}

/* Spacer to prevent content from being hidden by the nav bar */
.mobile-bottom-nav-spacer {
    height: 80px; /* Height of nav bar + some buffer */
}
