/* ==================================================
   CROMA DRIP
   CARRINHO COMPARTILHADO
================================================== */


/* ==================================================
   CONTADOR
================================================== */

.cart-icon {
  position: relative;
}

.cart-count {
  position: absolute;

  top: -7px;
  right: -9px;

  width: 16px;
  height: 16px;

  border-radius: 50%;

  display: none;

  align-items: center;
  justify-content: center;

  font-size: 8px;
  font-weight: 700;

  z-index: 2;
}

.header .cart-count {
  background: #fff;
  color: #000;
}

.product-header .cart-count {
  background: #111;
  color: #fff;
}

.cart-count.active {
  display: flex;
}


/* ==================================================
   OVERLAY
================================================== */

.cart-overlay {
  position: fixed;

  inset: 0;

  background:
    rgba(0, 0, 0, 0.45);

  opacity: 0;
  visibility: hidden;

  transition:
    opacity 0.3s ease,
    visibility 0.3s ease;

  z-index: 998;
}

.cart-overlay.active {
  opacity: 1;
  visibility: visible;
}


/* ==================================================
   DRAWER
================================================== */

.cart-drawer {
  position: fixed;

  top: 0;
  right: 0;

  width: min(430px, 100%);

  height: 100vh;
  height: 100dvh;

  background: #f5f5f3;
  color: #111;

  z-index: 999;

  display: flex;
  flex-direction: column;

  transform:
    translateX(100%);

  transition:
    transform 0.4s
    cubic-bezier(
      0.22,
      1,
      0.36,
      1
    );

  box-shadow:
    -20px 0 50px
    rgba(0, 0, 0, 0.12);
}

.cart-drawer.active {
  transform:
    translateX(0);
}

/* Bloqueia o scroll da página somente enquanto o drawer estiver realmente aberto */
body.cart-open:has(.cart-drawer.active) {
  overflow: hidden;
}

/* Segurança: com o carrinho fechado, a página volta a rolar normalmente */
body:not(.cart-open) {
  overflow-y: auto;
}


/* ==================================================
   HEADER DO CARRINHO
================================================== */

.cart-header {
  min-height: 95px;

  display: flex;
  align-items: center;
  justify-content: space-between;

  padding:
    25px
    28px;

  border-bottom:
    1px solid
    rgba(0, 0, 0, 0.1);
}

.cart-kicker {
  display: block;

  margin-bottom: 5px;

  font-size: 8px;
  font-weight: 500;

  letter-spacing: 2px;

  color: #777;
}

.cart-header h2 {
  font-size: 22px;
  line-height: 1;

  font-weight: 700;

  letter-spacing: -0.8px;
}

.close-cart {
  width: 36px;
  height: 36px;

  display: flex;
  align-items: center;
  justify-content: center;

  padding: 0;

  border: 0;

  background: transparent;
  color: #111;

  font-family: inherit;

  font-size: 27px;
  font-weight: 300;

  cursor: pointer;
}


/* ==================================================
   META DE FRETE GRÁTIS
================================================== */

.shipping-goal {
  padding:
    22px
    28px;

  border-bottom:
    1px solid
    rgba(0, 0, 0, 0.08);
}

.shipping-goal-text {
  display: flex;
  align-items: center;
  justify-content: space-between;

  margin-bottom: 10px;

  font-size: 9px;
  font-weight: 700;

  letter-spacing: 1px;
}

.shipping-goal-text strong {
  font-size: 10px;
}

#shippingMessage {
  margin-bottom: 12px;

  color: #555;

  font-size: 10px;
  line-height: 1.5;
}

#shippingMessage.achieved {
  color: #111;
  font-weight: 700;
}


/* ==================================================
   BARRA DE PROGRESSO
================================================== */

.shipping-progress {
  width: 100%;
  height: 4px;

  overflow: hidden;

  background: #dddcd8;

  border-radius: 999px;
}

.shipping-progress-bar {
  width: 0;
  height: 100%;

  background: #111;

  border-radius: inherit;

  transition:
    width 0.4s ease;
}


/* ==================================================
   ÁREA DOS ITENS
================================================== */

.cart-items {
  flex: 1;

  overflow-y: auto;

  padding:
    0
    28px;

  overscroll-behavior: contain;
}


/* ==================================================
   CARRINHO VAZIO
================================================== */

.empty-cart {
  min-height: 250px;

  display: flex;
  flex-direction: column;

  align-items: center;
  justify-content: center;

  text-align: center;
}

.empty-cart p {
  margin-bottom: 20px;

  color: #666;

  font-size: 11px;
}

.continue-shopping {
  padding:
    0 0 4px;

  border: 0;
  border-bottom:
    1px solid #111;

  background: transparent;
  color: #111;

  font-family: inherit;

  font-size: 9px;
  font-weight: 700;

  letter-spacing: 1px;

  cursor: pointer;
}


/* ==================================================
   ITEM DO CARRINHO
================================================== */

.cart-item {
  display: grid;

  grid-template-columns:
    105px
    minmax(0, 1fr);

  gap: 18px;

  padding:
    25px
    0;

  border-bottom:
    1px solid
    rgba(0, 0, 0, 0.08);
}

.cart-item-image {
  width: 105px;
  height: 120px;

  background: #ededeb;

  display: flex;
  align-items: center;
  justify-content: center;

  overflow: hidden;
}

.cart-item-image img {
  width: 82%;
  height: 82%;

  object-fit: contain;
}

.cart-item-info {
  min-width: 0;

  display: flex;
  flex-direction: column;

  justify-content: space-between;
}

.cart-item-top {
  display: flex;

  justify-content: space-between;

  gap: 15px;
}

.cart-item-top h3 {
  margin-bottom: 7px;

  font-size: 11px;
  font-weight: 600;

  letter-spacing: 0.2px;

  overflow-wrap: anywhere;
}

.cart-item-top span {
  color: #777;

  font-size: 8px;

  letter-spacing: 1px;
}

.remove-cart-item {
  flex-shrink: 0;

  padding: 0;

  border: 0;

  background: transparent;
  color: #777;

  font-family: inherit;

  font-size: 18px;

  cursor: pointer;
}

.cart-item-bottom {
  display: flex;

  align-items: center;
  justify-content: space-between;

  gap: 12px;
}

.cart-item-bottom strong {
  font-size: 11px;
  font-weight: 600;

  white-space: nowrap;
}


/* ==================================================
   QUANTIDADE
================================================== */

.cart-item-quantity {
  width: 90px;
  height: 34px;

  border:
    1px solid
    rgba(0, 0, 0, 0.15);

  display: flex;
  align-items: center;
  justify-content: space-between;

  padding:
    0
    10px;
}

.cart-item-quantity button {
  padding: 0;

  border: 0;

  background: transparent;
  color: #111;

  font-family: inherit;

  font-size: 16px;

  cursor: pointer;
}

.cart-item-quantity span {
  font-size: 9px;
}


/* ==================================================
   FOOTER DO CARRINHO
================================================== */

.cart-footer {
  padding:
    22px
    28px
    28px;

  background: #f5f5f3;

  border-top:
    1px solid
    rgba(0, 0, 0, 0.1);
}

.cart-total {
  display: flex;

  align-items: center;
  justify-content: space-between;

  margin-bottom: 10px;
}

.cart-total span {
  font-size: 9px;
  font-weight: 600;

  letter-spacing: 1px;
}

.cart-total strong {
  font-size: 15px;
  font-weight: 600;
}

.shipping-note {
  margin-bottom: 18px;

  color: #777;

  font-size: 8px;
  line-height: 1.5;
}


/* ==================================================
   FINALIZAR WHATSAPP
================================================== */

.cart-whatsapp {
  width: 100%;
  height: 55px;

  border:
    1px solid #111;

  background: #111;
  color: #fff;

  display: flex;
  align-items: center;
  justify-content: center;

  padding:
    0 18px;

  font-family: inherit;

  font-size: 10px;
  font-weight: 700;

  letter-spacing: 0.8px;

  cursor: pointer;

  transition:
    background 0.25s ease,
    color 0.25s ease,
    opacity 0.25s ease;
}

.cart-whatsapp:hover:not(:disabled) {
  background: #333;
}

.cart-whatsapp:disabled {
  opacity: 0.35;

  cursor: not-allowed;
}


/* ==================================================
   CONTINUAR COMPRANDO
================================================== */

.continue-shopping-footer {
  width: 100%;

  margin-top: 15px;
  padding: 0;

  border: 0;

  background: transparent;
  color: #555;

  font-family: inherit;

  font-size: 8px;
  font-weight: 600;

  letter-spacing: 1px;

  cursor: pointer;
}


/* ==================================================
   ESTADOS DE FOCO
================================================== */

.close-cart:focus-visible,
.continue-shopping:focus-visible,
.continue-shopping-footer:focus-visible,
.cart-whatsapp:focus-visible,
.cart-item-quantity button:focus-visible,
.remove-cart-item:focus-visible {
  outline:
    2px solid #111;

  outline-offset: 3px;
}


/* ==================================================
   MOBILE
================================================== */

@media (max-width: 700px) {

  .cart-drawer {
    width: 100%;
  }


  .cart-header {
    min-height: 75px;

    padding:
      18px
      20px;
  }


  .cart-header h2 {
    font-size: 20px;
  }


  .shipping-goal {
    padding:
      18px
      20px;
  }


  .cart-items {
    padding:
      0
      20px;
  }


  .cart-item {
    grid-template-columns:
      90px
      minmax(0, 1fr);

    gap: 14px;

    padding:
      20px
      0;
  }


  .cart-item-image {
    width: 90px;
    height: 105px;
  }


  .cart-item-top h3 {
    font-size: 10px;
  }


  .cart-item-bottom {
    gap: 8px;
  }


  .cart-item-quantity {
    width: 85px;
  }


  .cart-footer {
    padding:
      18px
      20px
      22px;
  }


  .cart-whatsapp {
    height: 54px;
  }

}


/* ==================================================
   CELULAR PEQUENO
================================================== */

@media (max-width: 400px) {

  .cart-header,
  .shipping-goal,
  .cart-footer {
    padding-left: 16px;
    padding-right: 16px;
  }


  .cart-items {
    padding-left: 16px;
    padding-right: 16px;
  }


  .cart-item {
    grid-template-columns:
      78px
      minmax(0, 1fr);

    gap: 12px;
  }


  .cart-item-image {
    width: 78px;
    height: 95px;
  }


  .cart-item-quantity {
    width: 80px;
  }


  .cart-item-bottom strong {
    font-size: 10px;
  }

}