<style>
    html, body {
      height: 100%;
    }
    main {
      height: 100%;
      overflow-y: auto;
      -webkit-overflow-scrolling: touch;
      padding-top: 80px;
    }
   body {
    font-family: 'Noto Sans Khmer', 'Poppins', 'Khmer Sangam MN', sans-serif;
    background-color: #f9f9f9;
    margin: 0;
  }

   input[type="text"] {
      font-family: 'Khmer OS', 'Noto Sans Khmer', sans-serif;
      font-size: 16px; /* Prevent zoom on mobile */
      padding: 0.375rem 0.5rem;
    }
    input.form-control.border-primary:focus {
      box-shadow: none;
      border-color: #0d6efd;
    }
    @media (min-width: 768px) {
      main {
        padding-top: 90px;
      }
    }
    .navbar {
      background-color: #ffffff;
      padding: 1rem 1rem; /* vertical only */
      border-bottom: 1px solid #dfe6e9;
    }

    /* Custom toggler to fix padding and size */
  .custom-toggler {
    padding: 0;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none solid #87CEFA !important;
  }
    .navbar-brand {
      font-family: 'Poppins', sans-serif;
      font-weight: 600;
      font-size: 1.25rem;
      display: flex;
      align-items: center;
      gap: 0.5rem;
      color: #222;
      text-decoration: none;
    }
    .navbar-brand img {
      height: 50px;
      width: auto;
    }
    .nav-link {
      color: #444;
      font-weight: 500;
      font-size: 0.95rem;
      padding: 0.5rem;
      transition: 0.2s;
    }
    .nav-link:hover {
      color: #0d6efd;
      text-decoration: none;
    }
    .nav-link.active {
      color: #0d6efd;
      font-weight: 600;
      border-bottom: 2px solid #0d6efd;
    }
     .navbar-toggler:focus {
    outline: none;
   box-shadow: none;
   }

 .navbar-toggler:focus-visible {
   outline: 2px dashed #0d6efd; /* or any soft style */
   }
    .offcanvas {
      width: 250px !important;
      border-radius: 0;
    }
    .offcanvas .nav-link {
      padding: 0.5rem 0.75rem;
      color: #222;
    }
    .zoom-on-hover:hover {
      transform: scale(1.01);
      transition: transform 0.2s ease-in-out;
    }
    .badge {
      font-size: 0.7rem;
    }
    .btn-outline-primary:hover {
      background-color: #0d6efd;
      color: #fff;
      box-shadow: 0 4px 12px rgba(13, 110, 253, 0.3);
    }
    #quantity {
       font-size: 16px;
      border: 1px solid #0d6efd;
      border-radius: 0.375rem;
      transition: box-shadow 0.2s ease;
      text-align: center;
    }
    #quantity:focus {
      border-color: #0a58ca;
      box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
      outline: none;
    }
    #app-toast.toast {
      display: inline-block;
      width: auto !important;
      max-width: 100%;
      padding-left: 0.75rem;
      padding-right: 0.75rem;
      white-space: nowrap;
    }
    #app-toast .toast-body {
      padding-left: 0;
      padding-right: 0;
    }
    .card-custom-border {
      border: 1px solid #CFE2FF;
      border-radius: 0 !important;
    }
    .card {
      box-shadow: none;
      transition: box-shadow 0.3s ease, transform 0.3s ease;
      will-change: transform, box-shadow;
      }

      .card:hover {
        box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
        transform: translateY(-3px);
      }

      .image-wrapper {
        aspect-ratio: 1 / 1;
        position: relative;
        overflow: hidden;
        border-radius: 0.5rem;
        background-color: #fff;
      }

      .image-wrapper img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        object-position: center;
        display: block;
        opacity: 0;
        transition: opacity 0.3s ease-in-out, transform 0.3s ease;
        will-change: opacity, transform;
      }

      .image-wrapper.loaded img {
        opacity: 1;
      }

      .card:hover .image-wrapper img {
        transform: scale(1.05);
      }

      .image-wrapper::after {
        content: "";
        position: absolute;
        inset: 0;
        background: rgba(0, 0, 0, 0);
        transition: background 0.3s ease;
        border-radius: 0 !important;
        pointer-events: none;
      }

      .card:hover .image-wrapper::after {
        background: rgba(0, 0, 0, 0.1);
      }

      .image-spinner {
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        z-index: 2;
      }

      .image-wrapper.loaded .image-spinner {
        display: none;
      }

      /* disable product.blade hover */
      body.no-card-hover .card:hover {
    box-shadow: none !important;
    transform: none !important;
    cursor: default !important;
  }

  .card {
    text-align: left; /* make card content start from left */
  }
  /* Card product name */
  .product-title {
      font-family: 'KhmerSiemreap', 'Noto Sans Khmer', 'Poppins', Arial, sans-serif;
      font-weight: 500;
      font-size: 1.4rem;
      line-height: 1.4;
      color: #222;

      text-align: left;         /* left-aligned */
      width: 100%;              /* full width */
      white-space: normal;
      overflow: hidden;
      text-overflow: ellipsis;
      display: -webkit-box;
      -webkit-line-clamp: 2;    /* max 2 lines */
      -webkit-box-orient: vertical;
      margin-bottom: 0.25rem;
  }

  /* Price pills */
  .price {
      background-color: #198754; /* green */
      color: #fff;
      font-weight: 600;
      padding: 4px 10px;
      border-radius: 20px;      /* pill shape */
      font-size: 1rem;
      line-height: 1.2;
      display: inline-block;
  }

  .price-separator {
      font-weight: 500;
      font-size: 0.75rem;
      color: #444;
      padding: 0 2px;           /* close together */
  }

  .stock {
      font-size: 1rem;
      font-weight: 500;
      white-space: nowrap;       /* prevent wrap */
  }

  /* Responsive adjustments */
  @media (max-width: 576px) {
      .product-title {
          font-size: 1rem;
          line-height: 1.3;
      }
      .price {
          font-size: 0.75rem;
          padding: 4px 7px;
      }
      .price-separator {
          font-size: 0.7rem;
          padding: 0 2px;
      }
      .stock {
          font-size: 0.85rem;
      }
  }


     /* modal */
    .overlay {
      position: fixed;
      top: 0; left: 0;
      width: 100%; height: 100%;
      background: rgba(0, 0, 0, 0.5);
      display: flex;
      justify-content: center;
      align-items: center;
      z-index: 9999;
      opacity: 0;
      visibility: hidden;
      transition: opacity 0.3s ease, visibility 0.3s ease;
    }

    .overlay.show {
      opacity: 1;
      visibility: visible;
    }

    /* Popup container */
    .popup {
      background: #ffffff;
      padding: 24px 20px;
      width: 320px;
      border-radius: 14px;
      text-align: center;
      font-family: 'Noto Sans Khmer', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
      box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
      transform: translateY(-20px);
      transition: transform 0.3s ease;
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 16px; /* tighter, consistent vertical spacing */
    }
    .overlay.show .popup {
      transform: translateY(0);
    }

    /* Icon styling */
    .popup-icon {
      font-size: 36px;
      animation: popIn 0.3s ease;
      line-height: 1;
    }
    .icon-error   { color: #dc3545; } /* Red */
    .icon-success { color: #198754; } /* Green */
    .icon-warning { color: #ffc107; } /* Yellow */
    .icon-info    { color: #0dcaf0; } /* Light Blue */

    @keyframes popIn {
      0% { transform: scale(0.7); opacity: 0; }
      100% { transform: scale(1); opacity: 1; }
    }

    /* Message */
    .popup p {
      font-size: 18px;
      color: #555;
      margin: 0;
      line-height: 1.4;
      text-align: center;
    }


    /* Button */
    .popup button {
      background: #007AFF;
      color: #fff;
      padding: 6px 16px;
      font-size: 15px;
      border: none;
      border-radius: 8px;
      cursor: pointer;
      transition: background 0.3s ease;
    }

    .popup button:hover {
      background: #005fcc;
    }
    /* Carousel Indicators (Dots) */
    .carousel-indicators button {
      background-color: black;     /* Inactive dots */
      opacity: 0.6;
      width: 10px;
      height: 10px;
      border-radius: 50%;
      border: none;
      margin: 0 4px;
      transition: all 0.3s ease;
    }

    .carousel-indicators .active {
      background-color: black;     /* Active dot */
      opacity: 1;
    }
    .spinner-placeholder {
    z-index: 2;
      }
      .actual-image {
        z-index: 1;
      }
    /* Carousel Arrows (Black SVGs) */
    .carousel-control-prev-icon {
      background-image: url('data:image/svg+xml;utf8,<svg fill="black" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"><path d="M11 1L3 8l8 7V1z"/></svg>');
        }

        .carousel-control-next-icon {
          background-image: url('data:image/svg+xml;utf8,<svg fill="black" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"><path d="M5 1l8 7-8 7V1z"/></svg>');
        }
        .fade-transition {
            transition: opacity 0.4s ease-in-out;
        }

        .variant-option {
              width: 60px !important;
              cursor: pointer;
              position: relative;
              text-align: center;
              transition: transform 0.2s;
          }

          .variant-thumb {
              width: 60px;
              height: 60px;
              object-fit: cover;
              border-radius: 12px;
              transition: transform 0.2s, box-shadow 0.2s, filter 0.2s;
          }

          .variant-thumb:hover {
              transform: scale(1.08);
              box-shadow: 0 4px 4px rgba(0,0,0,0.2);
          }

          /* Dim image if out-of-stock */
          .variant-thumb.out-of-stock {
              opacity: 0.6;
              filter: brightness(0.7);
          }

          /* Out-of-stock overlay */
        .out-overlay {
            background-color: #ff4d4f; /* bright red */
            color: #fff;
            font-weight: 600;
            font-size: 12px;
            padding: 3px 10px;
            border-radius: 999px; /* pill shape */
            white-space: nowrap;
            pointer-events: none;
            box-shadow: 0 1px 4px rgba(0,0,0,0.2);

            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            text-align: center;

            /* Remove hover/pulse animation */
            animation: none;
        }

        /* Image hover effect for normal variants only */
        .variant-thumb:not(.out-of-stock) {
            transition: transform 0.2s, box-shadow 0.2s;
            border-radius: 12px;
        }
        .variant-thumb:not(.out-of-stock):hover {
            transform: scale(1.05);
            box-shadow: 0 2px 6px rgba(0,0,0,0.2);
        }

        /* Grayscale out-of-stock images */
        .variant-thumb.out-of-stock {
            opacity: 0.5;
            filter: grayscale(10%);
        }

        /* Variant container spacing */
        .variant-images {
            gap: 2px;
        }

        /* Responsive adjustments */
        @media (max-width: 576px) {
            .variant-option {
                width: 50px !important;
            }
            .variant-thumb {
                width: 50px !important;
                height: 50px !important;
            }
            .out-overlay {
                font-size: 12px;
                padding: 2px 8px;
            }
            .variant-option .small {
                font-size: 11px;
            }
        }
        #cartBtn {
        width: 40px;
        height: 40px;
        padding: 0;
        border: none;
        background: transparent;
        display: flex;
        align-items: center;
        justify-content: center;
        position: relative;
      }
      #cartBtn .bi-bag {
        font-size: 1.3rem;
        color: #000; /* or use a theme color */
      }

      #cart-count {
      background-color: #ffc107;/* or pick one above */
      color: #000;

      display: inline-flex;
      align-items: center;
      justify-content: center;

      width: 18px;
      height: 18px;
      font-size: 0.65rem;
      font-weight: 600;

      padding: 0;
      line-height: 1;

      border-radius: 50%;
      border: 1px solid #fff;
      box-shadow: 0 0 2px rgba(0, 0, 0, 0.2);
    }
    /* Hidden state */
    .hidden {
      display: none;
    }      /* End modal */

/* Category container scroll */
.category-scroll {
    padding-top: 1rem;
    overflow-x: auto;
    overflow-y: visible;
    padding-left: 0.75rem;
    padding-right: 0.75rem;
    padding-bottom: 0.5rem;
    scrollbar-width: thin;
    scrollbar-color: #ccc transparent;
}

.category-scroll::-webkit-scrollbar {
    height: 6px;
}

.category-scroll::-webkit-scrollbar-thumb {
    background-color: #ccc;
    border-radius: 4px;
}

.category-scroll::-webkit-scrollbar-track {
    background: transparent;
}


.category-item:hover {
    color: #007bff;
    transform: translateY(-2px);
    z-index: 10;
}

/* Icon inside category */
.category-icon {
    max-width: 60px;
    max-height: 60px;
    object-fit: contain;
    border-radius: 8px;
}


    .breadcrumb-bar {
      border-bottom: 1px solid #ddd;
      padding-bottom: 0.75rem;
      margin-bottom: 1.5rem;
    }

    .breadcrumb-item + .breadcrumb-item::before {
      content: "›";
      color: #6c757d;
      padding: 0 0.5rem;
      font-weight: 600;
    }
    .breadcrumb a:hover {
      text-decoration: underline;
    }
    .breadcrumb .badge {
      font-weight: 500;
      text-transform: uppercase;
    }
    .pagination-container {
      display: flex;
      justify-content: center;
      margin: 1rem 0 20px 0; /* top: 1rem, right: 0, bottom: 80px, left: 0 */
    }

    .pagination-numbers {
      display: flex;
      flex-wrap: wrap;
      gap: 0.4rem;
      list-style: none;
      padding-left: 0;
      margin: 0;
    }
    .pagination .page-link {
      padding: 0.45rem 0.75rem !important;
      font-size: 0.95rem !important;
      min-width: 2.4rem;
      text-align: center;
      border-radius: 0.375rem;
      border: 1px solid #ddd;
      color: #222;
      background-color: white;
      transition: background-color 0.2s ease, color 0.2s ease;
    }
    .pagination .page-item.active .page-link {
      background-color: #0d6efd !important;
      color: white !important;
      border-color: #0d6efd !important;
      font-weight: 600;
    }
    .pagination .page-item.disabled .page-link {
      pointer-events: none;
      color: #aaa !important;
      background-color: #f9f9f9 !important;
      border-color: #ddd !important;
    }
    .pagination .page-link:hover:not(.disabled):not(.active) {
      background-color: #e7f1ff;
      border-color: #0d6efd;
      color: #0d6efd;
      text-decoration: none;
    }
    @media (max-width: 576px) {
        .pagination .page-link {
          padding: 0.25rem 0.5rem !important;
          font-size: 0.85rem !important;
          min-width: auto;
        }

        #cart-toast {
          font-size: 0.82rem;
          padding: 0.45rem 0.75rem;
          max-width: 90vw;
        }

        #cartDrawer {
          width: 80vw !important;
          max-width: 100vw;
          height: 100dvh !important;
          border-radius: 0 !important;
          overflow: hidden;
        }

        #cartDrawer .offcanvas-body {
          height: calc(100dvh - 56px);
          overflow-y: auto;
          padding: 1rem;
        }
      } /* ✅ CLOSE THIS MEDIA BLOCK */

      @keyframes bump {
        0% { transform: scale(1); }
        20% { transform: scale(1.3); }
        50% { transform: scale(0.95); }
        100% { transform: scale(1); }
      }

      /* Global styles */
      .container {
        max-width: 1440px;
        margin: 0 auto;
        padding-left: 0.75rem;
        padding-right: 0.75rem;
      }

      @media (min-width: 768px) {
        .container {
          padding-left: 2rem;
          padding-right: 2rem;
        }
        .product-image-wrapper {
          max-width: 600px; /* or 350px */

        }
        #cartDrawer {
          width: 100vw !important;
        }
      }

      @media (min-width: 1200px) {
        .container {
          padding-left: 2.5rem;
          padding-right: 2.5rem;
        }
      }

     /* Shop breadcrumb header */
.shop-breadcrumb {
    padding: 1rem 1.5rem;          /* more space around */
    background-color: #f8f9fa;     /* light background */
    border-radius: 10px;           /* rounded edges */
    margin-bottom: 1.5rem;         /* space below header */
}

.shop-breadcrumb .breadcrumb-item a {
    font-size: 1.5rem;             /* bigger link text */
    font-weight: 600;               /* semi-bold */
    color: #212529;                 /* dark text */
}

.shop-breadcrumb .breadcrumb-item.active {
    font-size: 1.5rem;             /* match link size */
    font-weight: 500;
    color: #6c757d;                 /* muted color for active */
}

.shop-breadcrumb .breadcrumb-item + .breadcrumb-item::before {
    content: "›";                  /* breadcrumb divider */
    font-size: 1.4rem;             /* bigger divider */
    color: #6c757d;
    padding: 0 0.5rem;
}

/* Responsive: slightly smaller on mobile */
@media (max-width: 576px) {
    .shop-breadcrumb {
        padding: 0.75rem 1rem;
    }
    .shop-breadcrumb .breadcrumb-item a,
    .shop-breadcrumb .breadcrumb-item.active {
        font-size: 1.2rem;
    }
    .shop-breadcrumb .breadcrumb-item + .breadcrumb-item::before {
        font-size: 1.2rem;
    }
}

  </style>
