.popbag-bag-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 0;
  border-bottom: 1px solid rgba(0, 55, 69, 0.10);
}

.popbag-bag-header__right {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.popbag-bag-back {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid rgba(0, 55, 69, 0.15);
  color: #003745;
  background: #fff;
  text-decoration: none;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.popbag-bag-back:hover { box-shadow: 0 8px 20px rgba(0,0,0,0.08); transform: translateY(-1px); }

.popbag-bag-title {
  font-size: 26px;
  font-weight: 900;
  color: #003745;
  line-height: 1.1;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 52vw;
}

.popbag-bag-capacity {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #1F525E;
  white-space: nowrap;
}

.popbag-bag-icon {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  border: 1px solid rgba(0, 55, 69, 0.10);
  overflow: hidden;
  background: rgba(0, 55, 69, 0.05);
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.popbag-bag-icon img { width: 100%; height: 100%; object-fit: cover; display: block; }

.popbag-bag-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  min-width: 0;
}
@media (min-width: 640px) {
  .popbag-bag-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 1024px) {
  .popbag-bag-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

.popbag-bag-grid > .popbag-product-card {
  min-width: 0;
}

.popbag-product-card {
  display: block;
  width: 100%;
  min-width: 0;
  text-align: left;
  text-transform: none;
  letter-spacing: normal;
  background: #fff;
  border: 1px solid rgba(0, 55, 69, 0.10);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 8px 20px rgba(0,0,0,0.06);
  transition: transform 150ms ease, box-shadow 150ms ease, border-color 150ms ease;
  position: relative;
}
.popbag-product-card:hover { transform: translateY(-2px); box-shadow: 0 16px 30px rgba(0,0,0,0.10); }
.popbag-product-card.is-selected { border-color: rgba(255, 32, 48, 0.75); box-shadow: 0 16px 30px rgba(255, 32, 48, 0.15); }
.popbag-product-card.is-disabled {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
}
.popbag-product-card.is-hidden-by-rules { display: none !important; }
.popbag-product-card.is-disabled:hover { transform: none; box-shadow: none; }
.popbag-product-card.is-disabled .popbag-product-card__img { filter: grayscale(0.35); }

.popbag-product-card__img { aspect-ratio: 4 / 5; background: rgba(0, 55, 69, 0.05); min-height: 0; }
.popbag-product-card__img img { width: 100%; height: 100%; object-fit: cover; display: block; }

.popbag-product-card__body { padding: 12px 14px; display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; min-width: 0; }
.popbag-product-card__title {
  font-weight: 900;
  color: #003745;
  font-size: 14px;
  line-height: 1.2;
  letter-spacing: normal;
  text-transform: none;
  margin: 0;
  min-width: 0;
  overflow-wrap: break-word;
  word-break: break-word;
}
.popbag-product-card__badge {
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #fff;
  background: #FF2030;
  border-radius: 999px;
  padding: 6px 10px;
  white-space: nowrap;
}
.popbag-product-card__check {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  background: rgba(255,255,255,0.92);
  border: 1px solid rgba(0, 55, 69, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  /* Hide the checkmark when not selected (avoid default button/link blue). */
  color: transparent;
  cursor: pointer;
}
.popbag-product-card.is-selected .popbag-product-card__check { color: #FF2030; border-color: rgba(255, 32, 48, 0.55); }

.popbag-bag-actions { margin-top: 18px; }
.popbag-bag-empty {
  margin: 14px 0 0;
  color: #1F525E;
  font-size: 13px;
  font-weight: 800;
}
.popbag-bag-scroll-sentinel {
  width: 100%;
  height: 1px;
}

.popbag-bag-notice[hidden] { display: none !important; }
.popbag-bag-rules {
  margin: 0 0 10px;
  color: #1F525E;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.popbag-bag-notice {
  margin: 12px 0 0;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(255, 32, 48, 0.25);
  background: rgba(255, 32, 48, 0.08);
  color: #003745;
  font-weight: 800;
  font-size: 12px;
  letter-spacing: 0.06em;
}

.popbag-bag-modes {
  margin: 0 0 14px;
  padding: 12px;
  border-radius: 16px;
  border: 1px solid rgba(0, 55, 69, 0.10);
  background: rgba(0, 55, 69, 0.03);
}
.popbag-bag-modes__title {
  margin: 0 0 8px;
  font-weight: 900;
  color: #003745;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 12px;
}
.popbag-bag-modes__options {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.popbag-bag-mode {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 999px;
  border: 1px solid rgba(0, 55, 69, 0.12);
  background: #fff;
  cursor: pointer;
  font-weight: 900;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  font-size: 11px;
  color: #003745;
}
.popbag-bag-mode input[type="radio"] {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  min-width: 16px;
  margin: 0;
  padding: 0;
  border-radius: 999px;
  border: 2px solid rgba(0, 55, 69, 0.35);
  background: #fff;
  display: inline-grid;
  place-content: center;
  flex: 0 0 16px;
}

.popbag-bag-mode input[type="radio"]::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 999px;
  transform: scale(0);
  transition: transform 120ms ease;
  background: #FF2030;
}

.popbag-bag-mode input[type="radio"]:checked {
  border-color: #FF2030;
}

.popbag-bag-mode input[type="radio"]:checked::before {
  transform: scale(1);
}

/* Desktop: keep mode pills on a single line (no wrap). */
@media (min-width: 768px) {
  .popbag-bag-modes__options {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 2px;
  }

  .popbag-bag-mode {
    flex: 0 0 auto;
    white-space: nowrap;
  }
}

.popbag-bag-submit {
  width: 100%;
  border-radius: 999px;
  background: #FF2030;
  color: #fff;
  font-weight: 900;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  padding: 14px 18px;
  border: none;
  cursor: pointer;
  transition: transform 150ms ease, box-shadow 150ms ease;
}
.popbag-bag-submit:hover { transform: translateY(-1px); box-shadow: 0 16px 30px rgba(0,0,0,0.12); }

/* Modal */
.popbag-modal[hidden] { display: none !important; }
.popbag-modal {
  position: fixed;
  inset: 0;
  z-index: 100000;
}
.popbag-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.55);
}
.popbag-modal__dialog {
  position: relative;
  width: min(980px, calc(100vw - 24px));
  max-height: calc(100vh - 24px);
  margin: 12px auto;
  background: #fff;
  border-radius: 18px;
  overflow: auto;
  box-shadow: 0 30px 70px rgba(0,0,0,0.35);
  padding: 18px;
}
.popbag-modal__close {
  position: sticky;
  top: 0;
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 1px solid rgba(0, 55, 69, 0.15);
  background: #fff;
  cursor: pointer;
}
.popbag-modal__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.popbag-modal__title { margin: 0; font-size: 22px; font-weight: 900; color: #003745; }
.popbag-modal__content { margin-top: 14px; display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 768px) { .popbag-modal__content { grid-template-columns: 1.1fr 0.9fr; } }
.popbag-modal__gallery {
  border: 1px solid rgba(0, 55, 69, 0.10);
  border-radius: 16px;
  overflow: hidden;
  background: rgba(0, 55, 69, 0.04);
}
.popbag-modal__gallery img { width: 100%; height: auto; display: block; }
.popbag-modal__thumbs { display: grid; grid-template-columns: repeat(5, minmax(0,1fr)); gap: 8px; margin-top: 10px; }
.popbag-modal__thumbs button { border: 1px solid rgba(0, 55, 69, 0.15); border-radius: 12px; overflow: hidden; background: #fff; padding: 0; cursor: pointer; }
.popbag-modal__thumbs img { width: 100%; aspect-ratio: 1/1; object-fit: cover; display:block; }
.popbag-modal__desc { color: #1F525E; font-size: 14px; line-height: 1.6; }
.popbag-modal__attrs { border-top: 1px solid rgba(0, 55, 69, 0.10); padding-top: 12px; margin-top: 12px; }
.popbag-modal__attrs dt { font-weight: 900; color: #003745; font-size: 12px; text-transform: uppercase; letter-spacing: 0.12em; }
.popbag-modal__attrs dd { margin: 0 0 10px 0; color: #1F525E; font-size: 14px; }
.popbag-modal__cta {
  margin-top: 14px;
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
}
.popbag-modal__select {
  border-radius: 999px;
  border: 1px solid rgba(0, 55, 69, 0.15);
  background: #003745;
  color: #fff;
  font-weight: 900;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  padding: 12px 16px;
  cursor: pointer;
}
.popbag-modal__select.is-selected { background: #FF2030; }

/* Lightbox */
.popbag-lightbox[hidden] { display: none !important; }
.popbag-lightbox {
  position: fixed;
  inset: 0;
  z-index: 100001;
}
.popbag-lightbox__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.70);
}
.popbag-lightbox__dialog {
  position: relative;
  width: min(1100px, calc(100vw - 24px));
  max-height: calc(100vh - 24px);
  margin: 12px auto;
  background: #fff;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 30px 70px rgba(0,0,0,0.45);
  padding: 14px;
}
.popbag-lightbox__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.popbag-lightbox__controls {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(0, 55, 69, 0.15);
  background: #fff;
}
.popbag-lightbox__btn {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: 1px solid rgba(0, 55, 69, 0.15);
  background: #fff;
  cursor: pointer;
  font-weight: 900;
  color: #003745;
}
.popbag-lightbox__zoom {
  font-weight: 900;
  color: #003745;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  min-width: 56px;
  text-align: center;
}
.popbag-lightbox__close {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 1px solid rgba(0, 55, 69, 0.15);
  background: #fff;
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
}
.popbag-lightbox__stage {
  margin-top: 12px;
  height: min(72vh, 720px);
  overflow: auto;
  border-radius: 16px;
  background: rgba(0, 55, 69, 0.04);
  border: 1px solid rgba(0, 55, 69, 0.10);
  display: flex;
  align-items: center;
  justify-content: center;
}
.popbag-lightbox__stage img {
  max-width: 100%;
  max-height: 100%;
  transform-origin: center center;
  transition: transform 100ms ease;
  cursor: zoom-in;
  touch-action: none;
  user-select: none;
  -webkit-user-drag: none;
  -webkit-touch-callout: none;
}
.popbag-lightbox__stage img.is-zoomed { cursor: grab; }
.popbag-lightbox__stage img.is-dragging { cursor: grabbing; }
.popbag-lightbox__hint {
  margin: 10px 4px 0;
  color: #1F525E;
  font-size: 12px;
}

@media (max-width: 640px) {
  .popbag-bag-title { max-width: 44vw; font-size: 20px; }
  .popbag-bag-icon { width: 40px; height: 40px; border-radius: 12px; }
}
