:root {
  --pink: #C65A7B;
  --light: #F9EEF2;
  --white: #ffffff;
}

.cb-builder {
  display: grid;
  grid-template-columns: 1fr 1fr;
  max-width: 1400px;
  margin: auto;
  background: var(--light);
  border-radius: 28px;
  overflow: hidden;
}

/* LEFT PREVIEW */
.cb-preview {
  position: sticky;
  /* top:120px; */
  height: calc(100vh - 120px);
  padding: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--white);
  border-right: 2px solid rgba(198, 90, 123, 0.25);
}

.cb-preview-inner {
  position: relative;
  width: 100%;
  max-width: 520px;
  /*aspect-ratio: 3 / 4;*/
  /* 👈 VERY IMPORTANT */
  padding: 0;
}

.cb-preview-inner {
  background: #fff;
}

.cb-chain-img {
  width: 100%;
  border-radius: 20px;
  display: block;
}

/* DROP AREA */
#cbDrop {
  position: absolute;
  inset: 30px 20px;
}

/* CHARM ON CHAIN */
.cb-charm {
  position: absolute;
  width: 90px;
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.cb-charm img {
  width: 100%;
  height: auto;
  display: block;
  pointer-events: none;
  -webkit-user-drag: none;
}

.cb-charm .remove {
  position: absolute;
  top: -4px;
  /* ✅ was -8px */
  right: -4px;
  /* ✅ was -8px */
  background: var(--pink);
  color: #fff;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.cb-charm .remove {
  top: 0px;
  right: 0px;
}


/* RIGHT CONTENT */
.cb-content {
  padding: 40px;
  height: calc(100vh - 120px);
  overflow-y: auto;
  scrollbar-width: none;
  border-left: 2px solid rgba(198, 90, 123, 0.25);
}

.cb-content::-webkit-scrollbar {
  display: none
}

/* TEXT */
.cb-title {
  font-size: 42px;
  color: var(--pink);
  margin-bottom: 6px;
}

.cb-sub {
  margin-bottom: 24px;
}

/* TABS */
.cb-tabs {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin: 16px 0;
}

.cb-tab,
.cb-pill {
  padding: 10px 22px;
  border-radius: 30px;
  border: 2px solid var(--pink);
  background: transparent;
  color: var(--pink);
  cursor: pointer;
  font-weight: 600;
}

.cb-tab.active {
  background: var(--pink);
  color: #fff;
}

button.cb-pill.active {
  background: var(--pink) !important;
  border-color: var(--pink) !important;
  color: #fff !important;
}

/* GRID */
.cb-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.cb-grid.charmsGrid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

/* CARD */
.cb-card {
  background: #fff;
  border-radius: 20px;
  padding: 12px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 6px;
  height: auto;
}

.cb-card img {
  width: 100%;
  max-height: 180px;
  border-radius: 16px;
  display: block;
  object-fit: contain;
  background: #fff;
  aspect-ratio: 1;
}

.cb-card .price {
  font-size: 13px;
  color: var(--pink);
  margin: 0;
  padding: 0;
}
.cb-card .label {
    color: #000;
    font-size: 12px;
    line-height: normal;
}

/* DIVIDER */
.cb-divider {
  height: 1px;
  background: rgba(198, 90, 123, .3);
  margin: 30px 0;
}

/* CLASP hidden default */
#claspRow {
  display: none;
}

/* Color body.elementor-page-6439 */
.cb-colors {
  display: flex;
  gap: 8px;
  margin: 6px 0 2px;
  flex-wrap: wrap;
}

.cb-color-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(0, 0, 0, 0.08);
  cursor: pointer;
}

.cb-color-dot.active {
  outline: 2px solid var(--pink);
  outline-offset: 2px;
}

/* Pagination */
.cb-pagination {
  display: flex;
  gap: 10px;
  margin-top: 18px;
  flex-wrap: wrap;
  justify-content: center;
}

.cb-page-btn {
  padding: 8px 14px;
  border-radius: 12px;
  border: 2px solid var(--pink);
  background: #fff;
  color: var(--pink);
  cursor: pointer;
  font-weight: 700;
  min-width: 40px;
}

.cb-page-btn.active {
  background: var(--pink);
  color: #fff;
}


/* ✅ FORCE charms grid = perfect 4 equal columns */
#charmsGrid {
  display: grid !important;
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  gap: 18px !important;
  width: 100% !important;
}

/* ✅ FORCE every charm card same width + height (perfect alignment) */
#charmsGrid .cb-card {
  width: 100% !important;
  min-width: 0 !important;
  box-sizing: border-box !important;
  height: 310px !important;

  display: grid !important;
  grid-template-rows: 200px 30px 20px 20px !important;
  /* ✅ added 1 row for tag */
  gap: 6px !important;
  align-items: center !important;
}

#charmsGrid .cb-tag {
  height: 20px !important;
  line-height: 20px !important;
  margin: 0 !important;
}


/* ✅ force image box fixed */
#charmsGrid .cb-card img {
  width: 100% !important;
  height: 200px !important;
  object-fit: contain !important;
  background: #fff !important;
}

/* ✅ force colors row fixed (even empty) */
#charmsGrid .cb-colors {
  height: 30px !important;
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
}

#charmsGrid .cb-colors:empty {
  visibility: hidden !important;
}

#charmsGrid .price {
  height: 20px !important;
  line-height: 20px !important;
  margin: 0 !important;
}

.cb-tag {
  font-size: 12px;
  color: #777;
  line-height: 1;
}

#chainOverlay {
  display: none;
  position: absolute;
  inset: 30px 20px;
  /* match drop area */
  width: calc(100% - 40px);
  height: calc(100% - 60px);
  object-fit: contain;
  pointer-events: none;
}

#baseImg.hidden {
  display: none;
}

/* End custom CSS */



.cb-buy-now-wrapper {
  margin-top: 20px;
  text-align: center;
}

.cb-buy-now-btn {
    display: inline-block;
    padding: 10px 20px;
    background: #c25e77;
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
    border-radius: 30px;
    transition: 0.3s;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-family: 'Lato', sans-serif;
}

.cb-total-price-wrapper {
  margin-top: 15px;
  font-size: 18px;
}


.cb-color-dot.active {
  border: 0;
}

.cb-card {
  display: inline-block;
  /*margin: 5px;*/
  cursor: pointer;
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.cb-charm {
  position: absolute;
  cursor: grab;
}

.cb-charm .remove {
  position: absolute;
  top: -5px;
  right: -5px;
  background: #ff3366;
  color: #fff;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  text-align: center;
  line-height: 20px;
  font-weight: bold;
  cursor: pointer;
}

.cb-card.active {
  border: 1px solid;
}


.cb-charm .price {
    display: none;
}
.order-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.cb-total-price-wrapper {
    background: #fff;
    padding: 10px;
    border-radius: 12px;
}
.cb-selected-items {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.cb-selected-item {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
    border-bottom: 1px solid;
    padding-bottom: 10px;
}

.cb-selected-item img {
    width: 60px;
    height: auto;
    border: 1px solid #ddd;
    background: #ffeff3;
}

p.error-msg {
    margin-top: 20px;
    margin-bottom: 0;
    color: red;
    text-align: center;
}


@media(max-width:980px) {
  .cb-builder {
    grid-template-columns: 1fr
  }

  .cb-preview {
    position: relative;
    height: auto
  }

  .cb-content {
    height: auto;
    padding: 20px 15px;
  }

  .cb-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .cb-grid.charmsGrid {
    grid-template-columns: repeat(2, 1fr);
  }

  .cb-grid.charmsGrid {
    grid-template-columns: repeat(2, 1fr);
  }

  .cb-card {
    padding: 15px;
  }
    .cb-title {
    font-size: 34px;
    }
}