/**
 * Sticky Add to Cart Bar
 * Appears at the bottom when scrolling past product section
 */

/* ===================================
   Sticky Add to Cart Bar
   =================================== */

.sticky-add-to-cart {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background-color: var(--color-white);
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
  z-index: 999;
  transform: translateY(100%);
  transition: transform 0.3s ease;
  padding: 16px 0;
  display: flex;
  justify-content: space-between;
}

.sticky-add-to-cart.is-visible {
  transform: translateY(0);
}

.sticky-add-to-cart__container {
  max-width: var(--container-max-width);
  width: 100%;
  margin: 0 auto; /* center like live site */
  padding: 0 var(--spacing-xl);
  display: flex;
  align-items: center;
  justify-content: space-between; /* spread contents across width */
  gap: 24px;
}

/* Product Image */
.sticky-add-to-cart__image {
  width: 50px;
  height: 50px;
  flex-shrink: 0;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #e5e5e5;
}
.sticky-add-to-cart__info-container {
  display: flex;
  flex-direction: row;
  gap: 8px;
  @media (max-width: 767px) {
    flex-direction: column;
    gap: 0;
  }
}
.sticky-add-to-cart__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Product Info */
.sticky-add-to-cart__info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sticky-add-to-cart__brand {
  font-family: var(--font-primary);
  font-size: 14px;
  font-weight: 600;
  color: var(--color-black);
  margin: 0;
  line-height: 1;
}

.sticky-add-to-cart__title {
  font-family: var(--font-primary);
  font-size: 14px;
  font-weight: 400;
  color: var(--color-black);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}

.sticky-add-to-cart__rating {
  display: flex;
  align-items: center;
  gap: 6px;
  @media (max-width: 767px) {
    display: none;
  }
}

.sticky-add-to-cart__stars {
  display: flex;
  gap: 2px;
}

.sticky-add-to-cart__stars img {
  width: 20px;
  height: 20px;
  display: block;
}

.sticky-add-to-cart__rating-value {
  font-family: var(--font-bold);
  font-size: 16px;
  font-weight: 600;
  color: var(--color-black);
  transform: translateY(3px);
}

/* Pricing */
.sticky-add-to-cart__pricing {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex-shrink: 0;
  order: 2;
}

.sticky-add-to-cart__pricing-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sticky-add-to-cart__price {
  font-family: var(--font-bold);
  font-size: 24px;
  font-weight: 700;
  color: var(--color-nava);
  letter-spacing: 0.5px;
}

.sticky-add-to-cart__price-original {
  font-family: var(--font-primary);
  font-size: 16px;
  color: #898984;
  text-decoration: line-through;
}

.sticky-add-to-cart__savings {
  font-family: var(--font-primary);
  font-size: 14px;
  font-weight: 500;
  color: var(--color-black);
}
/* Quantity Controls */
.sticky-add-to-cart__quantity {
  display: flex;
  align-items: center;
  gap: 0;
  border: 1px solid #e5e5e5;
  border-radius: 6px;
  overflow: hidden;
  background-color: var(--color-white);
  flex-shrink: 0;
  order: 1;
}

.sticky-add-to-cart__quantity-btn {
  width: 40px;
  height: 54px;
  background-color: #f1f1f1;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s ease;
  flex-shrink: 0;
}

.sticky-add-to-cart__quantity-btn:hover {
  background-color: #f5f5f5;
}

.sticky-add-to-cart__quantity-btn:active {
  background-color: #e5e5e5;
}

.sticky-add-to-cart__quantity-input {
  width: 80px;
  height: 40px;
  border: none;
  padding-top: 2px;
  border-left: 1px solid #e5e5e5;
  border-right: 1px solid #e5e5e5;
  text-align: center;
  font-family: var(--font-bold);
  font-size: 16px;
  font-weight: 600;
  color: var(--color-black);
  background-color: var(--color-white);
  -moz-appearance: textfield;
  -webkit-appearance: none;
  appearance: textfield;
}

.sticky-add-to-cart__quantity-input::-webkit-outer-spin-button,
.sticky-add-to-cart__quantity-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  appearance: none;
  margin: 0;
}

.sticky-add-to-cart__quantity-input:focus {
  outline: none;
  background-color: #f9f9f9;
}

/* Add to Cart Button */
.sticky-add-to-cart__button {
  padding: 12px 32px;
  background-color: var(--color-nava);
  color: var(--color-white);
  border: 2px solid var(--color-nava);
  border-radius: 6px;
  font-family: var(--font-bold);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  flex-shrink: 0;
  order: 3;
  text-decoration: none; /* Remove underline for links (Checkout button) */
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.sticky-add-to-cart__button:hover {
  background-color: var(--color-nava-dark);
  border-color: var(--color-nava-dark);
}

.sticky-add-to-cart__button:active {
  transform: scale(0.98);
}

/* Out of Stock State */
.sticky-add-to-cart__button.is-out-of-stock,
.sticky-add-to-cart__button[data-out-of-stock="true"] {
  background-color: #999;
  border-color: #999;
  cursor: pointer;
}

.sticky-add-to-cart__button.is-out-of-stock:hover,
.sticky-add-to-cart__button[data-out-of-stock="true"]:hover {
  background-color: #777;
  border-color: #777;
}

/* ===================================
   Responsive Styles
   =================================== */

/* Tablet: 768px - 1023px */
@media (max-width: 1023px) {
  .sticky-add-to-cart__container {
    gap: 16px;
  }

  .sticky-add-to-cart__title {
    font-size: 14px;
  }

  .sticky-add-to-cart__price {
    font-size: 24px;
  }

  .sticky-add-to-cart__price-original {
    font-size: 14px;
  }

  .sticky-add-to-cart__button {
    padding: 10px 24px;
    font-size: 14px;
  }
}

/* Mobile: 320px - 767px */
@media (max-width: 767px) {
  .sticky-add-to-cart {
    padding: 10px 0;
    flex-direction: column;
  }

  /* Simplified Two-Row Grid Layout */
  .sticky-add-to-cart__container {
    display: grid;
    grid-template-columns: 60px 1fr auto;
    grid-template-rows: auto auto;
    gap: 8px 12px;
    padding: 0 16px;
    align-items: center;
  }

  /* Row 1: Image (spans 2 rows) | Brand/Title | Quantity */
  .sticky-add-to-cart__image {
    grid-row: 1 / 3;
    grid-column: 1;
    width: 60px;
    height: 60px;
  }

  .sticky-add-to-cart__info-container {
    grid-row: 1;
    grid-column: 2;
    display: flex;
    flex-direction: column;
    gap: 2px;
  }

  .sticky-add-to-cart__info {
    display: flex;
    flex-direction: column;
    gap: 2px;
  }

  .sticky-add-to-cart__brand {
    font-family: var(--font-bold);
    font-size: 11px;
    font-weight: 700;
    color: var(--color-black);
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    line-height: 1.2;
  }

  .sticky-add-to-cart__title {
    font-family: var(--font-primary);
    font-size: 13px;
    font-weight: 500;
    color: var(--color-black);
    margin: 0;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .sticky-add-to-cart__quantity {
    grid-row: 1;
    grid-column: 3;
    height: 44px;
  }

  /* Row 2: Price | Add to Cart Button */
  .sticky-add-to-cart__pricing {
    grid-row: 2;
    grid-column: 2;
    flex-direction: row;
    align-items: center;
    gap: 8px;
  }

  .sticky-add-to-cart__pricing-row {
    gap: 6px;
    align-items: center;
  }

  .sticky-add-to-cart__price {
    font-size: 22px;
    font-weight: 700;
    line-height: 1;
  }

  /* Hide strikethrough price to save space */
  .sticky-add-to-cart__price-original {
    display: none;
  }

  /* Show savings badge instead */
  .sticky-add-to-cart__savings {
    display: none;
    font-size: 11px;
    color: #16a34a;
    font-weight: 600;
    background: #f0fdf4;
    padding: 2px 6px;
    border-radius: 4px;
  }

  .sticky-add-to-cart__button {
    grid-row: 2;
    grid-column: 3;
    padding: 12px 16px;
    height: 44px;
    font-size: 15px;
    font-weight: 600;
    white-space: nowrap;
    min-width: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
  }

  /* Larger quantity buttons for better tap targets (44x44 minimum) */
  .sticky-add-to-cart__quantity-btn {
    width: 36px;
    height: 44px;
  }

  .sticky-add-to-cart__quantity-input {
    width: 50px;
    height: 44px;
    font-size: 16px;
    font-weight: 600;
  }

  /* Mobile notify button styling */
  .sticky-add-to-cart__button[data-out-of-stock="true"] {
    background-color: #999;
    border-color: #999;
    color: var(--color-white);
  }

  .sticky-add-to-cart__button[data-out-of-stock="true"]:hover {
    background-color: #777;
    border-color: #777;
  }
}

/* Small Mobile: 320px - 374px */
@media (max-width: 374px) {
  .sticky-add-to-cart__container {
    gap: 6px 10px;
    padding: 0 12px;
  }

  .sticky-add-to-cart__image {
    width: 55px;
    height: 55px;
  }

  .sticky-add-to-cart__brand {
    font-size: 10px;
  }

  .sticky-add-to-cart__title {
    font-size: 12px;
  }

  .sticky-add-to-cart__price {
    font-size: 20px;
  }

  .sticky-add-to-cart__savings {
    font-size: 10px;
    padding: 2px 5px;
  }

  .sticky-add-to-cart__quantity-btn {
    width: 34px;
    height: 42px;
  }

  .sticky-add-to-cart__quantity-input {
    width: 45px;
    height: 42px;
    font-size: 15px;
  }

  .sticky-add-to-cart__button {
    padding: 10px 16px;
    height: 42px;
    font-size: 14px;
    min-width: 90px;
  }
}
