/* ── Product card grid ────────────────────────────────────────────────── */

.bb-order-form {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
  max-width: none;
  margin: 0;
}

.path-store .bb-order-form .form-item,
.path-store .bb-order-form .form-actions,
.path-basket .bb-order-form .form-item,
.path-basket .bb-order-form .form-actions {
  margin-top: 0;
  margin-bottom: 0;
}

/* ── Single-variation card ────────────────────────────────────────────── */

.bb-order-row {
  display: flex;
  flex-direction: column;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
  transition: box-shadow 0.3s ease;
}

.bb-order-row:hover {
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
}

/* Image link wrapper */
.bb-order-row > a:first-child {
  display: block;
  aspect-ratio: 1;
  overflow: hidden;
  cursor: pointer;
}

.bb-order-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.bb-order-row > a:first-child:hover .bb-order-thumb {
  transform: scale(1.05);
}

.bb-order-thumb--placeholder {
  width: 100%;
  aspect-ratio: 1;
  background-color: #fef3c7;
}

/* Card body */
.bb-order-row > .bb-order-info {
  padding: 1.5rem 1.5rem 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.bb-order-title {
  font-family: var(--bb-font-heading, 'Poppins', sans-serif);
  font-size: 1.25rem;
  font-weight: 600;
  color: #78350f;
  margin-bottom: 0;
}

.bb-order-title a {
  color: inherit;
  text-decoration: none;
}

.bb-order-title a:hover {
  color: #b45309;
}

.bb-order-price {
  font-size: 1.25rem;
  font-weight: 600;
  color: #78350f;
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.bb-order-price-original {
  text-decoration: line-through;
  color: #9ca3af;
  font-size: 1rem;
  font-weight: 400;
}

.bb-order-price-discount {
  font-weight: 700;
  color: #b45309;
}

.bb-order-promo-label {
  font-size: 0.8rem;
  font-weight: 500;
  color: #b45309;
  white-space: nowrap;
}

/* Qty controls + row total at bottom of card */
.bb-order-row > .bb-order-qty {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 1rem 1.5rem 1.5rem;
}

.bb-order-row > .bb-order-qty > .bb-order-row-total {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.1rem;
  font-weight: 600;
  font-size: 0.95rem;
  color: #78350f;
  min-width: 4rem;
  text-align: right;
}

/* ── Qty buttons ──────────────────────────────────────────────────────── */

.bb-order-qty-btn {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border-radius: 50%;
  border: none;
  font-size: 1.25rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 1;
  transition: background-color 0.2s, opacity 0.2s;
}

.bb-order-qty-btn.bb-order-qty-minus {
  background: #e5e7eb;
  color: #374151;
}

.bb-order-qty-btn.bb-order-qty-minus:hover {
  background: #d1d5db;
}

.bb-order-qty-btn.bb-order-qty-minus:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.bb-order-qty-btn.bb-order-qty-plus {
  background: #d97706;
  color: #ffffff;
}

.bb-order-qty-btn.bb-order-qty-plus:hover {
  background: #b45309;
}

.bb-order-qty-input {
  width: 2.5rem;
  text-align: center;
  border: none;
  font-size: 1.25rem;
  font-family: var(--bb-font-body, 'Inter', sans-serif);
  font-weight: 500;
  background: transparent;
  color: #111827;
}

.bb-order-qty-input::-webkit-inner-spin-button,
.bb-order-qty-input::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.bb-order-qty-input[type='number'] {
  -moz-appearance: textfield;
}

/* ── Multi-variation group card ───────────────────────────────────────── */

.bb-order-group {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
  transition: box-shadow 0.3s ease;
}

.bb-order-group:hover {
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
}

.bb-order-group-header {
  display: flex;
  flex-direction: column;
  border-bottom: 1px solid #f3f4f6;
}

.bb-order-group-header > a:first-child {
  display: block;
  aspect-ratio: 1;
  overflow: hidden;
}

.bb-order-group-header .bb-order-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.bb-order-group-header > a:first-child:hover .bb-order-thumb {
  transform: scale(1.05);
}

.bb-order-group-title {
  font-family: var(--bb-font-heading, 'Poppins', sans-serif);
  font-size: 1.25rem;
  font-weight: 600;
  color: #78350f;
  padding: 1.5rem 1.5rem 0;
}

.bb-order-group-title a {
  color: inherit;
  text-decoration: none;
}

.bb-order-group-title a:hover {
  color: #b45309;
}

.bb-order-variation {
  display: grid;
  grid-template-columns: 1fr auto auto;
  grid-template-areas:
    'info info info'
    '. qty total';
  column-gap: 1rem;
  row-gap: 0.5rem;
  align-items: center;
  padding: 0.75rem 1.5rem 1rem;
  border-bottom: 1px solid #f3f4f6;
  transition: background-color 0.15s ease;
}

.bb-order-variation:hover {
  background-color: #fffbeb;
}

.bb-order-variation:last-child {
  border-bottom: none;
  padding-bottom: 1.5rem;
}

.bb-order-variation-info {
  grid-area: info;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
  align-self: start;
}

.bb-order-variation-title {
  font-size: 0.95rem;
  color: #374151;
  font-weight: 500;
}

.bb-order-variation .bb-order-price {
  font-size: 1rem;
  font-weight: 600;
  color: #78350f;
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.bb-order-variation .bb-order-qty {
  grid-area: qty;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  align-self: center;
  justify-self: end;
}

.bb-order-variation .bb-order-qty-btn {
  width: 32px;
  height: 32px;
  font-size: 1rem;
  flex-shrink: 0;
}

.bb-order-variation .bb-order-row-total {
  grid-area: total;
  font-weight: 600;
  font-size: 0.95rem;
  color: #78350f;
  min-width: 4rem;
  text-align: right;
  align-self: center;
  justify-self: end;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.1rem;
}

/* ── Checkout footer bar ──────────────────────────────────────────────── */

.bb-order-footer {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 2rem);
  max-width: 100%;
  box-sizing: border-box;
  background: transparent;
  border-top: none;
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.10);
  z-index: 1030;
  padding: 1rem 2rem;
  padding-bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  isolation: isolate;
}

.bb-order-footer::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 100vw;
  transform: translateX(-50%);
  background: #fffbeb;
  border-top: 1px solid #fde68a;
  z-index: -1;
}

@media (min-width: 576px) {
  .bb-order-footer {
    max-width: 540px;
  }
}

@media (min-width: 768px) {
  .bb-order-footer {
    max-width: 720px;
  }
}

@media (min-width: 992px) {
  .bb-order-footer {
    max-width: 960px;
  }
}

@media (min-width: 1200px) {
  .bb-order-footer {
    max-width: 1140px;
  }
}

@media (min-width: 1400px) {
  .bb-order-footer {
    max-width: 1320px;
  }
}

.bb-order-cancel-btn {
  align-items: center;
  background-color: transparent;
  border: 1.5px solid #d1d5db;
  border-radius: var(--bb-radius-pill, 24px);
  color: #6b7280;
  display: inline-flex;
  justify-content: center;
  padding: 0.5rem 1.25rem;
  text-decoration: none;
  font-size: 0.9rem;
  transition: border-color 0.2s, color 0.2s;
  white-space: nowrap;
}

.bb-order-cancel-btn:hover {
  border-color: #9ca3af;
  color: #374151;
}

.bb-order-footer-summary {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  text-align: center;
}

.bb-order-footer-actions {
  align-items: center;
  display: flex;
  gap: 1rem;
}

.bb-order-basket-filter-toggle {
  margin: 0;
  position: relative;
}

.bb-order-basket-filter-toggle label {
  align-items: center;
  color: #78350f;
  cursor: pointer;
  display: inline-flex;
  font-size: 0.95rem;
  font-weight: 600;
  gap: 0.45rem;
  line-height: 1.2;
  margin: 0;
  min-height: 1.4rem;
  padding-left: 3.05rem;
  position: relative;
  white-space: nowrap;
}

.bb-order-basket-filter {
  height: 1px;
  opacity: 0;
  position: absolute;
  width: 1px;
}

.bb-order-basket-filter-toggle label::before {
  background-color: #d1d5db;
  border-radius: 999px;
  content: '';
  height: 1.4rem;
  left: 0;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  transition: background-color 0.2s;
  width: 2.6rem;
}

.bb-order-basket-filter-toggle label::after {
  background-color: #ffffff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.22);
  content: '';
  height: 1rem;
  left: 0.2rem;
  position: absolute;
  top: 50%;
  transition: transform 0.2s;
  transform: translateY(-50%);
  width: 1rem;
}

.bb-order-basket-filter:checked + label::before {
  background-color: #d97706;
}

.bb-order-basket-filter-toggle:has(.bb-order-basket-filter:checked) label::before {
  background-color: #d97706;
}

.bb-order-basket-filter:checked + label::after {
  transform: translate(1.2rem, -50%);
}

.bb-order-basket-filter-toggle:has(.bb-order-basket-filter:checked) label::after {
  transform: translate(1.2rem, -50%);
}

.bb-order-basket-filter:focus-visible + label::before {
  outline: 2px solid #78350f;
  outline-offset: 3px;
}

.bb-order-basket-filter-toggle:has(.bb-order-basket-filter:focus-visible) label::before {
  outline: 2px solid #78350f;
  outline-offset: 3px;
}

.bb-order-filtered-out {
  display: none;
}

.bb-order-item-count {
  font-size: 0.95rem;
  color: #6b7280;
  min-height: 1.2em;
}

.bb-order-grand-total {
  font-weight: 700;
  font-size: 1.75rem;
  color: #78350f;
  line-height: 1.1;
}

.bb-order-footer .bb-order-submit,
input.bb-order-submit {
  background-color: #d97706 !important;
  color: #ffffff !important;
  border: none;
  border-radius: var(--bb-radius-pill, 24px);
  padding: 0.875rem 2.5rem;
  font-family: var(--bb-font-heading, 'Poppins', sans-serif);
  font-weight: 600;
  font-size: 1.1rem;
  cursor: pointer;
  transition: background-color 0.2s;
  white-space: nowrap;
}

.bb-order-footer .bb-order-submit:hover,
input.bb-order-submit:hover {
  background-color: #b45309 !important;
}

/* ── Product modal ────────────────────────────────────────────────────── */

body.bb-pmodal-open {
  overflow: hidden;
}

.bb-pmodal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.bb-pmodal-overlay.bb-pmodal-visible {
  opacity: 1;
}

.bb-pmodal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
}

.bb-pmodal-dialog {
  position: relative;
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.3);
  width: 100%;
  max-width: 860px;
  max-height: 90vh;
  overflow-x: hidden;
  overflow-y: auto;
  transform: translateY(12px);
  transition: transform 0.2s ease;
}

.bb-pmodal-overlay.bb-pmodal-visible .bb-pmodal-dialog {
  transform: translateY(0);
}

.bb-pmodal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  z-index: 10;
  width: 2.5rem;
  height: 2.5rem;
  border: none;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.15s;
  color: #374151;
}

.bb-pmodal-close:hover {
  background: #f3f4f6;
}

.bb-pmodal-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.bb-pmodal-gallery {
  background: #f3f4f6;
  min-width: 0;
}

.bb-pmodal-main {
  aspect-ratio: 1;
  min-width: 0;
  overflow: hidden;
  position: relative;
  width: 100%;
}

.bb-pmodal-main-img {
  display: block;
  height: 100%;
  object-fit: cover;
  width: 100%;
}

.bb-pmodal-swiper,
.bb-pmodal-swiper .swiper-wrapper,
.bb-pmodal-swiper .swiper-slide {
  height: 100%;
  min-width: 0;
}

.bb-pmodal-swiper {
  width: 100%;
}

.bb-pmodal-swiper-nav {
  align-items: center;
  background: rgba(75, 37, 27, 0.38);
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 999px;
  color: #ffffff;
  cursor: pointer;
  display: flex;
  height: 2rem;
  justify-content: center;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 2rem;
  z-index: 2;
}

.bb-pmodal-swiper-nav:hover {
  background: rgba(188, 96, 64, 0.78);
}

.bb-pmodal-swiper-prev {
  left: 0.75rem;
}

.bb-pmodal-swiper-next {
  right: 0.75rem;
}

.bb-pmodal-swiper-prev::before,
.bb-pmodal-swiper-next::before {
  border-color: currentColor;
  border-style: solid;
  content: '';
  display: block;
  height: 0.55rem;
  width: 0.55rem;
}

.bb-pmodal-swiper-prev::before {
  border-width: 0 0 2px 2px;
  margin-left: 0.2rem;
  transform: rotate(45deg);
}

.bb-pmodal-swiper-next::before {
  border-width: 2px 2px 0 0;
  margin-right: 0.2rem;
  transform: rotate(45deg);
}

.bb-pmodal-swiper-pagination {
  bottom: 0.75rem !important;
  left: 0;
  position: absolute;
  right: 0;
  z-index: 2;
}

.bb-pmodal-swiper-pagination .swiper-pagination-bullet {
  background: rgba(255, 255, 255, 0.72);
  height: 0.45rem;
  opacity: 1;
  width: 0.45rem;
}

.bb-pmodal-swiper-pagination .swiper-pagination-bullet-active {
  background: #f7ead8;
}

.bb-pmodal-no-image {
  width: 100%;
  height: 100%;
  background: #e5e7eb;
}

.bb-pmodal-content {
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.bb-pmodal-name {
  font-size: clamp(1.75rem, 3vw, 2.25rem);
  color: #78350f;
  line-height: 1.2;
  margin: 0;
}

.bb-pmodal-price {
  font-size: 1.75rem;
  font-weight: 600;
  color: #b45309;
  margin: 0;
}

.bb-pmodal-desc {
  color: #374151;
  font-size: 1rem;
  line-height: 1.75;
  margin: 0;
  white-space: pre-line;
}

body.bb-availability-modal-open {
  overflow: hidden;
}

.bb-availability-modal {
  align-items: center;
  display: flex;
  inset: 0;
  justify-content: center;
  opacity: 0;
  padding: 1rem;
  position: fixed;
  transition: opacity 0.2s ease;
  z-index: 1300;
}

.bb-availability-modal--visible {
  opacity: 1;
}

.bb-availability-modal__backdrop {
  background: rgba(75, 37, 27, 0.45);
  inset: 0;
  position: absolute;
}

.bb-availability-modal__dialog {
  background-color: #fffdfa;
  border: 1px solid #dec4aa;
  border-radius: 1rem;
  box-shadow: 0 24px 60px rgba(75, 37, 27, 0.28);
  color: #4b251b;
  max-width: 34rem;
  padding: 1.5rem;
  position: relative;
  transform: translateY(12px);
  transition: transform 0.2s ease;
  width: 100%;
}

.bb-availability-modal--visible .bb-availability-modal__dialog {
  transform: translateY(0);
}

.bb-availability-modal__dialog h2 {
  color: #4b251b;
  font-size: 1.6rem;
  margin: 0 0 0.75rem;
}

.bb-availability-modal__message {
  font-size: 1rem;
  line-height: 1.6;
  white-space: pre-line;
}

.bb-availability-modal__message p {
  margin: 0 0 0.75rem;
}

.bb-availability-modal__message strong {
  font-weight: 700;
}

.bb-availability-modal__message ul {
  margin: 0.75rem 0 0;
  padding-left: 1.4rem;
}

.bb-availability-modal__message li {
  margin-bottom: 0.35rem;
}

.bb-availability-modal__actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 1.25rem;
}

.bb-availability-modal__button {
  background-color: #bc6040;
  border: 1px solid #bc6040;
  border-radius: var(--bb-radius-pill, 24px);
  color: #ffffff;
  cursor: pointer;
  font-family: var(--bb-font-heading, 'Poppins', sans-serif);
  font-weight: 600;
  padding: 0.55rem 1.25rem;
}

.bb-availability-modal__button:hover,
.bb-availability-modal__button:focus {
  background-color: #8c4a34;
  border-color: #8c4a34;
  color: #ffffff;
}

@media (max-width: 640px) {
  .bb-pmodal-grid {
    grid-template-columns: 1fr;
  }
}

/* ── Empty state ──────────────────────────────────────────────────────── */

.bb-order-empty {
  text-align: center;
  padding: 3rem 1rem;
  color: #6b7280;
}

.bb-order-empty a {
  color: #78350f;
  font-weight: 600;
}

/* ── Bottom padding so fixed footer doesn't overlap ──────────────────── */

.path-store .main-container,
.path-basket .main-container {
  padding-bottom: 100px;
}

.path-store .bb-footer,
.path-basket .bb-footer {
  padding-bottom: 120px;
}

/* ── Responsive ───────────────────────────────────────────────────────── */

@media (max-width: 1024px) {
  .bb-order-form {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .bb-order-form {
    grid-template-columns: 1fr;
  }

  .bb-order-footer {
    bottom: 0;
    display: grid;
    gap: 0.35rem 0.75rem;
    grid-template-areas:
      'toggle total'
      'cancel checkout';
    grid-template-columns: minmax(0, 1fr) auto;
    left: 0;
    max-width: none;
    padding: 0.45rem 0.75rem;
    padding-bottom: calc(0.45rem + env(safe-area-inset-bottom, 0px));
    right: 0;
    transform: none;
    width: 100%;
  }

  .path-store .bb-footer,
  .path-basket .bb-footer {
    padding-bottom: 48px;
  }

  .path-store .main-container,
  .path-basket .main-container {
    padding-bottom: 0;
  }

  .bb-order-cancel-btn {
    grid-area: cancel;
    padding: 0.45rem 0.85rem;
  }

  .bb-order-footer .bb-order-submit,
  input.bb-order-submit {
    grid-area: checkout;
    font-size: 0.95rem;
    padding: 0.45rem 1rem;
  }

  .bb-order-footer-actions {
    display: contents;
  }

  .bb-order-basket-filter-toggle,
  .bb-order-continue-shopping {
    grid-area: toggle;
  }

  .bb-order-item-count {
    display: none;
  }

  .bb-order-footer-summary {
    align-items: flex-end;
    grid-area: total;
    justify-content: center;
  }

  .bb-order-grand-total {
    font-size: 1.25rem;
  }
}
