*,
*::before,
*::after {
  padding: 0;
  margin: 0;
  box-sizing: border-box;
}

body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  margin: 0px;
  padding: 0px;
}

main {
  max-width: 100vw;
  height: fit-content;
}

#navBar {
  position: fixed;
  display: flex;
  width: 100%;
  height: 3.6rem;
  background-color: #262626;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.4rem;
  box-shadow: 0px 1px 2px 0px #262626e8;
  z-index: 100;
}

#companyNameLogo {
  display: inline-flex;
  width: fit-content;
  flex-direction: row;
  align-items: center;
  margin: 0px;
}

#logoImage {
  display: inline-block;
  height: 3.6rem;
  width: auto;
  margin-right: 1rem;
}

#companyName {
  font-family: "Chakra Petch", sans-serif;
  font-weight: 400;
  font-style: normal;
  font-size: 2rem;
  color: #fff;
}

#companyName {
  display: inline-block;
  font-size: 2rem;
}

.search-container {
  display: block;
  padding: 0;
  width: 50vw;
  justify-self: center;
}

#searchBar {
  display: inline-flex;
  width: 100%;
  height: 2.4rem;
  padding: 0px;
  border-radius: 8px;
  justify-content: flex-start;
}

#btnS {
  width: 8%;
  height: 2.4rem;
  padding: 0px;
  margin: 0px;
  background-color: #ff9710;
  border: none;
  border-top-right-radius: 8px;
  border-bottom-right-radius: 8px;
}

#btnS:hover {
  cursor: pointer;
  background-color: #ff771c;
}

#inputSearch {
  width: 92%;
  border: none;
  border-top-left-radius: 8px;
  border-bottom-left-radius: 8px;
  font-size: 1.1rem;
  align-self: center;
  background-color: #f1f1f1f5;
  color: #000;
  height: 2.4rem;
  padding-left: 1rem;
}

#inputSearch::placeholder {
  color: #424141;
  font-size: 0.9rem;
  padding-left: 0.8rem;
}

#inputSearch:focus {
  outline: none;
  border: none;
}

#searchButton {
  height: 2rem;
  width: auto;
  align-self: center;
}

#addToCart {
  display: block;
  border: none;
  margin: none;
  outline: none;
  background-color: #262626;
  align-self: center;
}

#addToCartImg {
  display: inline-block;
  height: 3.4rem;
  width: auto;
  justify-self: flex-end;
  background-color: #262626;
  margin-right: 0.6rem;
  margin-left: 0px;
  padding: 0.1rem;
  border: none;
  outline: none;
  border-radius: 1rem;
  z-index: -1;
}

#itemCount {
  position: fixed;
  border: none;
  padding: 0;
  margin: 0;
  color: white;
  top: 1.5rem;
  padding-left: 1.35rem;
  font-size: 1.2rem;
  font-weight: 600;
  font-family: Arial, Helvetica, sans-serif;
}

#addToCart {
  cursor: pointer;
}

#addToCartImg:hover {
  background-color: #ff6219;
}

#hamburger-icon {
  display: none;
}

#product-filters {
  padding-top: 10vh;
  width: fit-content;
  margin: 0rem auto;
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-evenly;
  background: #fff;
}

.products-category1,
.products-price,
.products-sorting {
  margin: 0rem 1rem;
  border: 1px solid #eeeeee;
  border-radius: 0px;
}

#fCat,
#fPrice,
#sPrice {
  text-align: center;
  font-size: 0.9rem;
  color: #474747;
  margin: 3px 0px;
}

.f-btn {
  padding: 4px 7px;
  margin: 9px;
  border: 1px solid #b9d9eb;
  background-color: #f3fbff;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  color: black;
}

.f-btn:hover {
  cursor: pointer;
  background-color: #0567a0b0;
  color: white;
}

.f-btn.selected {
  background-color: #0567a0;
  color: white;
}

.clear-Filters {
  display: inline-block;
  width: max-content;
  height: max-content;
  align-self: flex-end;
  margin-bottom: 10px;
}

.clearFilters {
  background-color: #0678ba;
  color: #fff;
  padding: 7px 10px;
  border-radius: 5px;
  border: 1px solid #035a8c;
  transition: 2ms ease-out;
}

.clearFilters:hover {
  cursor: pointer;
  transform: scale(1.04);
}

#products-grid {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  grid-auto-rows: minmax(14rem, 1fr);
  gap: 1.2rem 1rem;
  padding: 1rem;
  justify-content: space-evenly;
  text-align: center;
}

#products-grid > .pdiv {
  width: 240px;
  background-color: #fbfcfd;
  border: 1.1px solid lightgrey;
  border-radius: 6px;
  box-shadow: 0px 1px 6px #dedede;
  padding: 10px;
  box-sizing: border-box;
  transition:
    transform 0.3s ease,
    box-shadow 0.3s ease;
  margin: auto;
}

#products-grid > .pdiv:hover {
  transform: translateY(-4px);
  box-shadow: 0px 1px 3px 0px #7d8d9bc9;
}

#products-grid > .pdiv > img {
  display: block;
  width: 100%;
  height: 9rem;
  object-fit: contain;
  margin: 5px auto;
}

#products-grid > .pdiv > .pname {
  font-family: Verdana, Geneva, Tahoma, sans-serif;
  font-size: 0.9rem;
  font-weight: 500;
  height: 2.2rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow-y: hidden;
  overflow-x: hidden;
  padding-bottom: 0px;
  margin-bottom: 5px;
}

#products-grid > .pdiv > .pcatg {
  font-size: 0.8rem;
  font-weight: 600;
  color: #555353;
  margin: 0;
}

#products-grid > .pdiv > .pprice {
  font-size: 0.9rem;
  font-weight: 700;
  color: #025484;
  margin: 0;
}

.pdiv > .p-btns {
  display: flex;
  justify-content: space-evenly;
  gap: 0.4rem;
  margin-top: 0.5rem;
}

.pdiv > .p-btns > .pbtn {
  background-image: linear-gradient(
    180deg,
    #faa930 20%,
    #ff9710 55%,
    #ff771c 100%
  );
  border: 1px solid #9f9d9d;
  border-radius: 5px;
  width: 5.2rem;
  padding-top: 4px;
  padding-bottom: 4px;
  font-size: 12px;
  font-weight: 500;
  color: #fff;
  cursor: pointer;
  transition:
    background-color 0.3s ease,
    font-weight 0.3s ease;
}

.pdiv > .p-btns > .pbtn:hover {
  background-color: #ff6219;
  font-weight: 700;
}

.noProdFound {
  display: block;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  font-size: 2.1rem;
  margin-top: 10%;
  color: #252424;
  text-align: center;
  margin-left: auto;
  margin-right: auto;
  align-self: center;
  grid-column: 1/7;
}

#cartDialog {
  position: relative; /* keep this */
  top: 4rem;
  left: 48%;
  width: 50%;
  height: 82%;
  max-height: 500px;
  border: 2px solid #bbbdbe;
  border-radius: 3px;
  outline: none;
  background-color: #fff;
  box-shadow: -3px 2px 15px 0px #9b999981;
}

#productsInCartContainerDiv {
  padding: 0;
  margin: 0px;
  width: 98%;
  height: 92%;
  max-height: 440px;
  overflow-y: scroll;
}

.cartDiv {
  box-sizing: border-box;
  display: grid;
  width: 98%;
  height: 140px;
  grid-template-columns: 140px 1fr 1fr 110px;
  grid-template-rows: repeat(3, 1fr);
  margin: 0px 1rem;
  padding: 10px 0px;
}

#closeCart {
  position: absolute; /* ⭐ key */
  display: block;
  bottom: 0px;
  width: 100%;
  text-align: center;
  height: 2rem;
  background-color: #fff;
  color: #ff771c;
  border: none;
  font-family: Verdana, Geneva, Tahoma, sans-serif;
  font-size: 1.5rem;
  font-weight: 500;
  cursor: pointer;
}

#closeCart:hover {
  color: #fff;
  background-color: #ff6219;
}

#placeOrder {
  position: absolute; /* ⭐ key */
  display: block;
  bottom: 2rem;
  width: 100%;
  padding: 5px 0px;
  text-align: center;
  height: fit-content;
  background-color: #fff;
  color: #13b60d;
  border: 1px solid #13b60d;
  font-family: Verdana, Geneva, Tahoma, sans-serif;
  font-size: 1.5rem;
  font-weight: 500;
  cursor: pointer;
}

#placeOrder:hover {
  background-color: #28a023;
  color: #fff;
}

.disabled-btn {
  pointer-events: none;
  opacity: 0.6; /* optional */
}

.cartProdImg {
  height: 120px;
  width: 86px;
  image-rendering: optimizeQuality;
  object-fit: contain;
  grid-column: 1/2;
  grid-row: 1/3;
}

.cartProdName {
  display: inline-block;
  width: 90%;
  grid-column: 2/4;
  grid-row: 1/2;
}

.prodQuantity {
  grid-column: 2/3;
  grid-row: 2/3;
}

.removeItem {
  grid-column: 3/4;
  grid-row: 2/3;
  cursor: pointer;
  font-size: 14px;
  color: #ff771c;
  display: inline-block;
}

.priceText {
  grid-column: 4/5;
  grid-row: 1/2;
  text-align: center;
  font-size: 12px;
  color: #424141;
}

.cartProdPrice {
  grid-column: 4/5;
  grid-row: 2/3;
  text-align: center;
  font-size: 1.2rem;
}

.qtyMinus,
.qtyPlus {
  width: 20px;
  height: 20px;
  background-color: #f2f2f2;
  color: black;
  border-radius: 2px;
  border: 1px solid #d3d2d2;
  outline: none;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
}

#hRuler {
  color: #e7e5e5;
  background-color: #e7e5e5;
  grid-column: 1/5;
  grid-row: 3/3;
  width: 100%;
  height: 2px;
  border: none;
}

#toast {
  width: fit-content;
  position: fixed;
  margin: 0rem auto;
  top: 3.8rem;
  right: 0.5vw;
  background-color: #059c00;
  color: white;
  padding: 0.2rem 0.4rem;
  border-radius: 0.8rem;
  border: 1px solid white;
  opacity: 0;
  transform: translateY(-3rem);
  translate:
    all 0.4s ease,
    background-color 0s;
  font-size: 1rem;
  font-weight: 600;
  word-spacing: 0.2rem;
}

#toast.showAdded::before {
  display: inline-block;
  content: url("");
  background-image: url("assets/checkmark.png");
  width: 1.6rem;
  height: 1.6rem;
  background-repeat: no-repeat;
  background-size: cover;
  margin: 0px 10px 0px 0px;
  padding: 0;
}

#toast.showAdded {
  transform: translateY(0rem);
  opacity: 1;
  background-color: #059c00;
}

#toast.showAlready::before {
  display: inline-block;
  content: url("");
  background-image: url("assets/checkmark.png");
  width: 1.6rem;
  height: 1.6rem;
  background-repeat: no-repeat;
  background-size: cover;
  margin: 0px 10px 0px 0px;
  padding: 0;
}

#toast.showAlready {
  background-color: #ff9710;
  transform: translateY(0rem);
  opacity: 1;
}

/* mobile breakpoint */
@media (max-width: 768px) {
  #navBar {
    width: 100vw;
    height: 3rem;
    display: flex;
    justify-content: space-between;
    margin: 0em;
    padding: 0em;
    position: fixed;

    z-index: 1000;
  }

  #hamburger-icon {
    display: inline-block;
    width: 2.7rem;
    height: 2.7rem;
    padding: 0.2rem;
    margin: 0px;
    justify-self: flex-start;
  }

  #companyNameLogo {
    display: inline-flex;
    width: max-content;
    justify-self: flex-start;
    justify-content: flex-start;
    height: 3rem;
    padding: 0em;
    margin: 0em;
    align-items: center;
  }

  #logoImage {
    display: inline-block;
    height: 70%;
    width: auto;
    margin: 0em;
    padding: 0em;
  }

  #companyName {
    font-size: 1.2rem;
    margin-left: 0.3em;
  }

  .search-container {
    position: fixed;
    top: 3rem;
    left: 0px;
    width: 100vw;
    height: 4.5rem;
    background-color: #fff;
    z-index: 100;
    padding: 0px;
    margin: 0px;
  }

  .search-container.hide {
    display: none;
  }

  #searchBar {
    width: 100vw;
    display: flex;
    position: fixed;
    top: 4rem;
    justify-content: center;
    z-index: 1200;
    text-align: center;
  }

  #searchBar.hide {
    display: none;
  }

  #inputSearch {
    width: 60vw;
    padding: 0.2rem;
  }

  #inputSearch::placeholder {
    font-size: 0.7rem;
  }

  #inputSearch.hide {
    display: none;
  }

  #btnS {
    width: 2.5rem;
  }

  #btnS.hide {
    width: 2.2rem;
    height: 2.2rem;
    border-radius: 50%;
    border: none;
  }

  #searchButton {
    height: 1.6rem;
    width: auto;
  }

  #overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 900;
  }

  #overlay.active {
    opacity: 1;
    pointer-events: auto;
  }

  #addToCart {
    height: 100%;
  }

  #addToCartImg {
    height: 2.8rem;
    width: auto;
  }

  #itemCount {
    display: inline;
    position: fixed;
    top: 1.04rem;
    right: 1.61rem;
    font-size: 1.1rem;
    font-weight: 500;
  }

  #product-filters {
    display: flex;
    flex-direction: column;
    text-align: left;
    position: fixed;
    height: 94vh;
    justify-content: space-around;
    align-items: center;
    top: 3rem;
    width: 11rem;
    background-color: #262626;
    z-index: 1000;
    padding: 0px;
    margin: 0px;
    transform: translateX(-104%);
    box-shadow: 2px 0 15px rgba(0, 0, 0, 0.3);
    border-bottom: 2px solid #ececec;
    transition: transform 0.45s cubic-bezier(0.25, 0.8, 0.25, 1);
  }

  #product-filters.visible {
    transform: translateX(0);
  }

  .products-category1 {
    display: flex;
    flex-direction: column;
    height: max-content;
    width: 8.5rem;
    border: none;
    gap: 0.8rem;
    padding: 0px;
    margin: 0px;
  }

  .products-price {
    display: flex;
    width: 8.5rem;
    flex-direction: column;
    height: max-content;
    border: none;
    gap: 0.5rem;
    padding: 0;
    margin: 0;
  }

  .products-sorting {
    display: flex;
    flex-direction: column;
    width: 8.5rem;
    height: max-content;
    border: none;
    gap: 0.6rem;
    padding: 0;
    margin: 0;
  }

  .clear-Filters {
    margin: 1rem auto;
  }

  #fCat,
  #fPrice,
  #sPrice {
    text-align: center;
    font-size: 1rem;
    color: #f8f8f8;
    margin: 0.9rem 0rem;
  }

  .f-btn {
    margin: 0px auto;
    border: 1px solid #b9d9eb;
    background-color: #f3fbff;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 500;
    color: black;
    width: 90%;
    padding: 0.3rem 0.2rem;
  }

  #products-grid {
    padding: 1rem 0.8rem;
    justify-content: space-evenly;
    text-align: center;
    padding-top: 7.6rem;
  }

  #products-grid > .pdiv {
    width: 220px;
    padding: 8px 5px;
  }

  #products-grid > .pdiv:hover {
    transform: translateY(-4px);
    box-shadow: 0px 1px 3px 0px #7d8d9bc9;
  }

  #products-grid > .pdiv > img {
    display: block;
    width: 100%;
    height: 7.8rem;
    object-fit: contain;
    margin: 5px auto;
  }

  #products-grid > .pdiv > .pname {
    font-size: 0.8rem;
    font-weight: 500;
    height: 2.1rem;
  }

  #products-grid > .pdiv > .pcatg {
    font-size: 0.76rem;
  }

  #products-grid > .pdiv > .pprice {
    font-size: 0.88rem;
  }

  .pdiv > .p-btns {
    display: flex;
    justify-content: space-evenly;
    gap: 0.4rem;
    margin-top: 0.5rem;
  }

  .pdiv > .p-btns > .pbtn {
    width: 5rem;
    padding-top: 3px;
    padding-bottom: 3px;
    font-size: 11px;
    font-weight: 500;
  }

  #cartDialog {
    top: 10vh;
    border-radius: 0px;
    border: none;
    box-shadow: 0 -8px 25px rgba(0, 0, 0, 0.12);
    position: fixed;
    left: 5%;
    width: 90%;
    height: 75vh;
    max-height: fit-content;
  }

  #productsInCartContainerDiv {
    max-height: calc(90vh - 120px);
    padding-bottom: 120px;
    -webkit-overflow-scrolling: touch;
  }

  .cartDiv {
    grid-template-columns: 80px 1fr auto;
    grid-template-rows: auto auto auto;
    height: auto;
    gap: 8px;
    padding: 14px 12px;
    margin: 0;
    width: 100%;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  }

  .cartProdImg {
    width: 80px;
    height: 80px;
    grid-column: 1 / 2;
    grid-row: 1 / 3;
    border-radius: 4px;
  }

  .cartProdName {
    grid-column: 2 / 3;
    grid-row: 1 / 2;
    font-size: 0.95rem;
    font-weight: 600;
    width: 100%;
  }

  .cartProdPrice {
    grid-column: 3 / 4;
    grid-row: 1 / 2;
    font-weight: 700;
    font-size: 1rem;
    text-align: right;
  }

  .priceText {
    display: none;
  }

  .prodQuantity {
    grid-column: 2 / 3;
    grid-row: 2 / 3;
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .qtyMinus,
  .qtyPlus {
    width: 32px;
    height: 32px;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .removeItem {
    grid-column: 3 / 4;
    grid-row: 2 / 3;
    align-self: center;
    text-align: right;
    padding: 8px;
  }

  #hRuler {
    display: none;
  }

  #placeOrder {
    bottom: 52px;
    height: 52px;
    font-size: 1.1rem;
    border: none;
    background-color: #13b60d;
    color: #fff;
  }

  #closeCart {
    bottom: 0;
    height: 52px;
    font-size: 1rem;
    background-color: #f5f5f5;
    color: #666;
  }

  .noProdFound {
    font-size: 1.3rem;
    padding: 40px 20px;
  }
}
