/* ---------- Smooth Scroll ---------- */
html {
  scroll-behavior: smooth;
}

/* ---------- General ---------- */
body {
  background-color: #f9f9fb;
  font-family: "Segoe UI", Roboto, sans-serif;
  color: #333;
  margin: 0;
  padding: 0;
}

/* ---------- Navbar ---------- */
.navbar {
  background-color: #fff;
  box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}
.navbar .form-control {
  border-radius: 50px;
  border: 1px solid #ddd;
  max-width: 180px;       /* fixed width */
  font-size: 0.85rem;
  padding: 0.25rem 0.6rem;
  transition: all 0.3s ease;
  background-color: #f7f7f7;
}
.navbar .form-control:focus {
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  background-color: #fff;
  border-color: #007bff;
  max-width: 180px;       /* keep same width on focus */
}
.navbar-brand .logo-img {
  max-height: 50px;
}

/* ---------- Product Cards ---------- */
#grid .card {
  border: none;
  border-radius: 12px;
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
  cursor: pointer;
  background-color: #fff;
  height: 100%;
  position: relative;
}
#grid .card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 20px rgba(0,0,0,0.12);
}
#grid .card-img-top {
  height: 180px;
  object-fit: contain;
  background-color: #fff;
  padding: 10px;
}

/* ---------- Multi-Image Indicator ---------- */
.card-multi-image {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(0,0,0,0.6);
  color: #fff;
  font-size: 0.85rem;
  padding: 4px 8px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 4px;
  z-index: 5;
}
.card-multi-image i {
  font-style: normal;
}

/* ---------- Card Body ---------- */
.card-body {
  padding: 1rem;
}
.card-title {
  font-weight: 600;
  font-size: 0.95rem;
}
.card-body small {
  font-size: 0.8rem;
  color: #666;
}
.card-body .fw-bold {
  color: #007bff;
}

/* ---------- Buttons ---------- */
.btn-primary, .btn-outline-primary, .btn-success {
  border-radius: 50px;
  font-weight: 500;
  padding: 0.35rem 0.8rem;
  transition: all 0.2s;
}
.btn-primary:hover, .btn-success:hover, .btn-outline-primary:hover {
  transform: translateY(-2px);
  opacity: 0.9;
}

/* ---------- Modal / Product Detail ---------- */
.modal-content {
  border-radius: 15px;
  overflow: hidden;
}
#productModal .carousel-inner img {
  border-radius: 12px;
  max-height: 400px;
  object-fit: contain;
}

/* ---------- Modal Carousel Arrows ---------- */
#productModal .carousel-control-prev,
#productModal .carousel-control-next {
  width: 40px;
  height: 40px;
  top: 50%;
  transform: translateY(-50%);
  background-color: rgba(0,0,0,0.6);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
#productModal .carousel-control-prev:hover,
#productModal .carousel-control-next:hover {
  background-color: rgba(0,0,0,0.85);
}
#productModal .carousel-control-prev-icon,
#productModal .carousel-control-next-icon {
  filter: invert(1);
  width: 20px;
  height: 20px;
}

/* ---------- Modal Buttons ---------- */
#productModal #addToCart,
#productModal #quickWhatsApp {
  width: 48%;
  margin-top: 10px;
}
#productModal .input-group {
  margin-bottom: 15px;
}

/* ---------- Cart Panel ---------- */
#cartPanel .offcanvas-body > div {
  background-color: #fff;
  border-radius: 12px;
  padding: 10px;
  margin-bottom: 10px;
  box-shadow: 0 6px 15px rgba(0,0,0,0.08);
}
#cartPanel .input-group input {
  width: 40px;
}

/* ---------- Badges ---------- */
.badge.bg-success {
  background-color: #28a745 !important;
}
.badge.bg-danger {
  background-color: #dc3545 !important;
}

/* ---------- Footer ---------- */
footer {
  background-color: #fff;
  color: #555;
  font-size: 0.9rem;
}
footer a {
  color: #555;
  transition: all 0.2s;
  margin: 0 5px;
}
footer a:hover {
  color: #007bff;
  transform: translateY(-2px);
}

/* ---------- Pagination ---------- */
#pagination button {
  margin: 0 3px;
  border-radius: 50%;
  width: 36px;
  height: 36px;
}
#pagination .btn-primary {
  background-color: #007bff;
  border-color: #007bff;
}
#pagination .btn-outline-primary {
  border-color: #007bff;
  color: #007bff;
}

/* ---------- Responsive Cards ---------- */
@media (max-width: 992px) {
  #grid .card-img-top {
    height: 160px;
  }
}
@media (max-width: 768px) {
  #grid .card-img-top {
    height: 140px;
  }
}
@media (max-width: 480px) {
  #grid .card-img-top {
    height: 120px;
  }
}

/* ---------- Mobile Navbar Stack ---------- */
@media (max-width: 576px) {
  .navbar .container {
    flex-direction: column;
    align-items: center;
    gap: 10px;
  }
  .navbar .d-flex {
    flex-direction: row; /* search + cart side by side */
    justify-content: center;
    width: 100%;
    gap: 10px;
  }
  .navbar .form-control {
    max-width: 150px;
    flex-grow: 1;
  }
  #cartFab {
    width: auto;
  }
}

#cartPanel .offcanvas-body .d-flex {
  align-items: center;
}

#cartPanel .btn {
  min-width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

#cartPanel span {
  min-width: 30px;
  text-align: center;
  font-weight: 500;
}

/* ----- Classy Navbar ----- */
.classy-navbar {
  font-family: "Segoe UI", Roboto, sans-serif;
  font-size: 0.95rem;
}
.classy-navbar .nav-link {
  color: #333 !important;
  margin: 0 10px;
  transition: color 0.2s ease;
}
.classy-navbar .nav-link:hover {
  color: #007bff !important;
}
.classy-navbar .logo-img {
  max-height: 45px;
}
.classy-search {
  border-radius: 30px;
  padding: 0.35rem 1rem;
  border: 1px solid #ddd;
  font-size: 0.85rem;
}
.classy-search:focus {
  border-color: #007bff;
  box-shadow: 0 0 5px rgba(0,123,255,0.3);
}

.classy-footer {
  background: #f1f3f5;   /* soft grey, slightly darker than white */
  color: #444;
  font-size: 0.9rem;
}
.classy-footer h6 {
  font-size: 1rem;
  margin-bottom: 1rem;
}
.classy-footer a {
  transition: color 0.2s ease;
}
.classy-footer a:hover {
  color: #007bff;
}
.classy-footer .text-muted {
  color: #666 !important;
}

@media (max-width: 991px) {
  #cartFab {
    margin-left: 5px;
  }
}

/* WhatsApp FAB - Normalized & Fixed Positioning */
#whatsappFab {
  position: fixed;
  z-index: 1055; /* Ensure it's above a typical Bootstrap navbar (z-index 1040) */
  /* Consistent Size */
  width: 60px;
  height: 60px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 5px 15px rgba(0,0,0,0.3);
  cursor: pointer;
  background-color: #25D366;
  color: white;
  font-size: 28px;
  transition: all 0.3s ease;
  /* Default position (mobile/small screen) - bottom right */
  bottom: 20px;
  right: 20px;
  left: auto;
  top: auto;
}

/* === Navbar Lag Fix (smooth collapse on mobile) === */
.navbar-collapse {
  transition: height 0.25s ease, opacity 0.25s ease;
  will-change: height;
}

.navbar-toggler:focus {
  outline: none;
  box-shadow: none;
}

/* Enable GPU acceleration to reduce lag during collapse */
.navbar {
  transform: translateZ(0);
}

/* Make offcanvas or overlay transitions smoother */
.offcanvas-backdrop {
  transition: opacity 0.2s ease !important;
}

/* ---------- Product card redesign ---------- */
.product-card {
  border-radius: 14px;
  overflow: hidden;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.product-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 10px 30px rgba(13,18,30,0.12);
}

.product-image-wrap { position: relative; padding: 12px; background: linear-gradient(180deg, #fff, #fbfbff); }
.product-image {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 10px;
  background-size: cover;
  background-position: center;
  box-shadow: 0 6px 18px rgba(10,16,30,0.06);
}


/* action button overlay on image (desktop) */
.image-actions {
  position: absolute;
  inset: 0;
  z-index: 5;
  gap: 10px;
  transition: opacity 0.18s ease, transform 0.18s ease;
  opacity: 0;
  pointer-events: none;
}
.product-card:hover .image-actions { opacity: 1; pointer-events: auto; transform: translateY(0); }
.image-actions .add-btn {
  background: linear-gradient(90deg,#007bff,#89CFF0);
  border: none;
  color: white;
  border-radius: 999px;
  padding: 8px 14px;
  box-shadow: 0 8px 18px rgba(255,105,65,0.16);
  font-weight: 600;
}
.image-actions .add-btn i { font-size: 0.95rem; }

/* flying image animation */
.fly-image {
  position: fixed;
  background-size: cover;
  background-position: center;
  border-radius: 10px;
  z-index: 9999;
  transition: transform 0.7s cubic-bezier(.2,.8,.2,1), opacity 0.7s ease;
  pointer-events: none;
  box-shadow: 0 8px 28px rgba(13,18,30,0.16);
}

/* ensure text truncation and neat spacing */
.card-title.text-truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* responsive tweaks */
@media (max-width: 767px) {
  .image-actions { display: none !important; }
  .product-card { border-radius: 10px; }
}


/* === MOBILE NAVBAR FIX & DESIGN === */
@media (max-width: 991px) {
  /* Container flex + positioning */
  .navbar .container {
    position: relative !important; /* anchor absolute logo */
    display: flex;
    align-items: center;
    justify-content: space-between;
  }

  /* Keep toggler left, cart right */
  .navbar-toggler { 
    order: 1; 
    z-index: 1051; /* ensures clickable above logo */
  }
  #cartFab { order: 3; }

  /* Center logo correctly */
  .navbar-brand {
    position: absolute !important;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    margin: 0;
    pointer-events: none; /* avoid blocking hamburger */
  }

  /* Optional: size adjustment for small screens */
  .navbar-brand img.logo-img {
    max-height: 40px;
    width: auto;
  }

  /* ===== COLLAPSE MENU STYLING ===== */
  #navbarNav {
    position: absolute;
    top: 100%;          /* right below navbar */
    left: 0;
    width: 100%;
    background: #fff;
    border-radius: 0 0 12px 12px;
    box-shadow: 0 6px 18px rgba(0,0,0,0.12);
    padding: 15px 20px;
    z-index: 1040;
  }

  /* Navbar links spacing + border */
  #navbarNav .nav-link {
    font-size: 1rem;
    padding: 10px 0;
    border-bottom: 1px solid #eee;
  }
  #navbarNav .nav-link:last-child {
    border-bottom: none;
  }

  /* Search bar inside collapse menu */
  #navbarNav .d-flex {
    margin-top: 15px;
  }
  #navbarNav .form-control {
    width: 100%;
    max-width: none;
  }

  /* Smooth fade + slide animation */
  .navbar-collapse.collapse:not(.show) {
    display: block;
    height: 0;
    overflow: hidden;
    opacity: 0;
    transition: all 0.3s ease-in-out;
  }
  .navbar-collapse.collapse.show {
    height: auto;
    opacity: 1;
  }
}


/* Switch FAB - Normalized & Fixed Positioning */
#switchStoreBtn {
  position: fixed;
  z-index: 1054; /* below WhatsApp */
  /* Consistent Size */
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #007bff, #8fd);
  color: white;
  font-size: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px rgba(0,0,0,0.18);
  cursor: pointer;
  transition: all 0.3s ease;
  padding: 0;
  /* Default position (mobile/small screen) - bottom left */
  bottom: 20px;
  left: 20px;
  right: auto;
  top: auto;
}

/* Fix Mobile margins for 60px FABs */
@media (max-width: 767px) {
    #whatsappFab {
        bottom: 18px;
        right: 18px;
    }
    #switchStoreBtn {
        bottom: 18px;
        left: 18px;
    }
}

/* Tablet / iPad Fix (768px to 991px): FABs positioned safely in the bottom corners */
@media (min-width: 768px) and (max-width: 991px) {
    /* WhatsApp: bottom right corner, away from the navbar area */
    #whatsappFab {
        bottom: 30px; 
        right: 30px; 
        left: auto;
        top: auto;
    }
    /* Switch: bottom left corner */
    #switchStoreBtn {
        bottom: 30px; 
        left: 30px; 
        right: auto;
        top: auto;
    }
}


/* Desktop ≥992px: WhatsApp above switch on bottom-left */
@media (min-width: 992px) {
    /* WhatsApp: Top one, 90px from bottom */
    #whatsappFab {
        bottom: 90px;
        left: 20px;
        top: auto;
        right: auto;
    }

    /* Switch: Bottom one, 20px from bottom */
    #switchStoreBtn {
        bottom: 20px;
        left: 20px;
        top: auto;
        right: auto;
    }
}

/* Fade animation for switch */
#switchStoreBtn.fade-out {
  animation: fadeOut 0.42s ease forwards;
}

@keyframes fadeOut {
  to { opacity: 0; transform: scale(0.98); }
}
/* ---------- Modal Footer Buttons Enhancement ---------- */
#productModal .modal-footer {
  border-top: none;
  padding: 15px 20px;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  background: #f8f9fa;
}

#productModal .modal-footer .btn {
  min-width: 120px;
  flex: 1 1 120px; /* responsive, grow if space */
  text-align: center;
  font-weight: 600;
  border-radius: 50px;
  padding: 10px 0;
  box-shadow: 0 6px 16px rgba(0,0,0,0.12);
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}

#productModal .modal-footer .btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 20px rgba(0,0,0,0.18);
  opacity: 0.95;
}

#productModal #addToCart {
  background: linear-gradient(90deg,#007bff,#89CFF0);
  color: #fff;
  border: none;
}

#productModal #quickWhatsApp {
  background: #25D366;
  color: #fff;
  border: none;
}

#productModal #shareButton {
  background: #fff;
  border: 1px solid #ccc;
  color: #333;
  padding: 6px 12px;          /* smaller padding */
  font-size: 0.85rem;         /* smaller font */
  border-radius: 50px;        /* matches other buttons */
  width: auto;                /* shrink to content */
  flex: 0 0 auto;             /* don't grow */
  box-shadow: 0 4px 12px rgba(0,0,0,0.1); /* subtle shadow */
  margin-top: 6px;            /* small spacing under other buttons */
  text-align: center;
  transition: all 0.2s ease;
}

#productModal #shareButton:hover {
  background-color: #f1f1f1; /* subtle hover */
  transform: translateY(-2px);
  box-shadow: 0 6px 14px rgba(0,0,0,0.15);
}

#showingCount {
  display: inline-block;
  padding: 0.35rem 0.8rem;
  font-size: 0.9rem;
  font-weight: 500;
  text-align: center;
  border-radius: 50px; /* pill shape */
  box-shadow: 0 4px 15px rgba(0,0,0,0.12);
  transition: all 0.2s ease;
  position: relative;
  background: transparent;

  /* text gradient */
  background-image: linear-gradient(90deg, #007bff, #89CFF0);
  -webkit-background-clip: text;
  color: transparent;
}

#showingCount::before {
  content: "";
  position: absolute;
  inset: 0; /* cover entire button */
  border-radius: 50px; /* same pill shape */
  padding: 2px; /* border thickness */
  background: linear-gradient(90deg, #007bff, #89CFF0);
  -webkit-mask:
    linear-gradient(#fff 0 0) content-box, 
    linear-gradient(#fff 0 0);
  -webkit-mask-composite: destination-out;
  mask-composite: exclude;
  pointer-events: none;
}

#showingCount:hover {
  opacity: 0.9;
  transform: translateY(-2px);
}

#itemsPerPage {
  display: inline-block;
  background: linear-gradient(90deg, #007bff, #89CFF0); /* same gradient as showing */
  color: #fff;
  font-weight: 500;
  padding: 0.35rem 0.8rem;
  border-radius: 50px;
  font-size: 0.9rem;
  text-align: center;
  box-shadow: 0 4px 15px rgba(0,0,0,0.12);
  transition: all 0.2s ease;
}

#itemsPerPage:hover {
  opacity: 0.9;
  transform: translateY(-2px);
}

#pagination button {
  margin: 0 5px;
  padding: 0.35rem 0.8rem; /* pill shape */
  border-radius: 50px;
  font-weight: 500;
  font-size: 0.9rem;
  border: 2px solid transparent;
  background: linear-gradient(90deg, #e6f0ff, #f0f7ff); /* light gradient background */
  position: relative;
  cursor: pointer;
  transition: all 0.2s ease;
  overflow: hidden;
  color: #007bff;
}

#pagination button:hover {
  transform: translateY(-2px);
  opacity: 0.9;
  background: linear-gradient(90deg, #cce0ff, #d9edff); /* slightly darker on hover */
}

#pagination button.active {
  background: linear-gradient(90deg, #007bff, #89CFF0); /* full gradient for active */
  color: #fff !important;
  box-shadow: 0 4px 15px rgba(0,0,0,0.15);
  transform: translateY(-1px);
}
/* Current page highlight */
#pagination .active-page {
  background: linear-gradient(90deg, #007bff, #89CFF0);
  color: #fff;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  transform: translateY(-1px);
  font-weight: 600;
}

/* === Pagination Layout Fix === */
#pagination {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin-top: 16px;
  padding: 8px 0;
}

#pagination .btn {
  min-width: 36px;
  border-radius: 8px;
  transition: all 0.2s ease;
}

#pagination .btn.active-page {
  font-weight: 700;
}

/* On smaller screens, make it scroll horizontally */
@media (max-width: 480px) {
  #pagination {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
    justify-content: flex-start;
    padding-bottom: 4px;
  }
  #pagination .btn {
    flex: 0 0 auto;
  }
}

/* Make the image fill most of the button */
#switchStoreBtn img.switch-icon {
  width: 95%;       /* 80% of button width */
  height: 95%;      /* 80% of button height */
  object-fit: contain; /* keep aspect ratio */
  transition: transform 0.3s ease;
}

/* Optional: scale slightly on hover */
#switchStoreBtn:hover img.switch-icon {
  transform: scale(1.1);
}

/* Ensure button keeps its circular shape */
#switchStoreBtn {
  width: 60px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: linear-gradient(135deg, #007bff, #8fd);
  box-shadow: 0 8px 24px rgba(0,0,0,0.18);
  cursor: pointer;
  transition: all 0.3s ease;
  padding: 0; /* remove extra padding */
}

#switchStoreBtn, 
#switchStoreBtn img {
    -webkit-touch-callout: none;
    -webkit-user-drag: none;
    -webkit-user-select: none;
    user-select: none; 
}

/* Prevents mobile users from copying, saving, or dragging the logo and the switch button image */
#switchStoreBtn, 
#switchStoreBtn img,
.logo-img {
    -webkit-touch-callout: none; /* iOS Safari */
    -webkit-user-drag: none; /* Safari/Chrome (Desktop/Mobile) */
    -webkit-user-select: none; /* Chrome/Safari */
    user-select: none; /* Standard property */
}

/* --- FAB Container Visibility Toggle (Hides all FABs when the cart opens) --- */

/* Ensures smooth transition for hiding/showing */
#fabContainer {
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

/* Hiding state: invisible, non-interactive */
#fabContainer.hidden {
    opacity: 0;
    visibility: hidden;
    /* Crucial: Prevents hidden buttons from being clickable */
    pointer-events: none;
}