/* =========================
   레이아웃/공통
   ========================= */

/* 그리드: B=400px 고정, A=나머지. A<500px이면 1열 전환 */
.gmbs-cart .gmbs-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 400px; /* A=남은폭, B=400 고정 */
  gap: 55px;
}
@media (max-width: 864px) {
  .gmbs-cart .gmbs-grid {
    grid-template-columns: 1fr;
  }
}

.gmbs-checkout .gmbs-h3 {
  margin: 0 0 16px;
  font-weight: 700;
}
.gmbs-vendor {
  padding: 8px 0 5px;
} /* 아래 여백 조정(익스텐션 유지) */
.gmbs-vendor-head {
  display: flex;
  align-items: center;
  gap: 8px;
}
.gmbs-vendor-name {
  font-weight: 700;
  margin-bottom: 8px;
}
.gmbs-divide {
  border: 0;
  border-top: 1px solid #000;
  margin: 12px 0;
}
.gmbs-divide.light {
  border-top-color: #ccc;
}
.gmbs-divide.strong {
  border-top-width: 2px;
}

/* 라벨 정렬 기준선(왼쪽에서 120px) */
.gmbs-cart {
  --gmbs-label-col: 200px;
}

/* 공급업체 줄 바로 아래 디바이더 간격만 축소 */
.gmbs-vendor + .gmbs-divide {
  margin-top: 6px;
}

/* === 카트 아이템 행 === */
.gmbs-item {
  display: grid;
  grid-template-columns: calc(var(--gmbs-check-size) + 6px) 80px 1fr auto;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 0;
}
.gmbs-item > .gmbs-check,
.gmbs-item > .gmbs-thumb,
.gmbs-item > *:nth-child(3),
.gmbs-item > .gmbs-price {
  align-self: flex-start;
}

/* 썸네일 */
.gmbs-thumb,
.gmbs-thumb a {
  display: block;
  line-height: 0;
}
.gmbs-thumb img {
  width: 80px;
  height: 80px;
  object-fit: cover;
  display: block;
  vertical-align: top;
}

/* 설명 칸 첫 요소 위 여백 제거 */
.gmbs-item > *:nth-child(3) > *:first-child {
  margin-top: 0;
  line-height: 1;
}

/* 가격 칸 상단 맞춤 + 우측 정렬 */
.gmbs-price {
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  line-height: 1;
  min-width: 90px;
  text-align: right;
}

/* 옵션/메타 */
.gmbs-attrs {
  color: #777;
  font-size: 0.92em;
}

/* 옵션명:옵션값 한 줄(variation, wc-item-meta 모두) */
.gmbs-cart .gmbs-attrs dl.variation,
.gmbs-cart .gmbs-attrs .wc-item-meta {
  display: flex !important;
  flex-wrap: wrap !important;
  column-gap: 6px;
  row-gap: 0;
  margin: 2px 0 0;
}
.gmbs-cart .gmbs-attrs dl.variation dt,
.gmbs-cart .gmbs-attrs dl.variation dd {
  float: none !important;
  clear: none !important;
  display: inline !important;
  margin: 0 !important;
}
.gmbs-cart .gmbs-attrs .wc-item-meta li,
.gmbs-cart .gmbs-attrs .wc-item-meta .wc-item-meta-label,
.gmbs-cart .gmbs-attrs .wc-item-meta p {
  display: inline !important;
  margin: 0 !important;
}
/* 일부 테마의 dt 콜론 자동삽입 방지 */
.gmbs-cart .gmbs-attrs dl.variation dt:after {
  content: none !important;
}

/* === 상품명 ↔ 옵션/수량 간격 통일 === */
.gmbs-cart {
  --gmbs-title-gap: 6px;
} /* 5~8px 선호 */
.gmbs-desc .gmbs-qty-line {
  margin-top: var(--gmbs-title-gap) !important;
}
.gmbs-desc .gmbs-attrs {
  margin-top: var(--gmbs-title-gap) !important;
}
.gmbs-desc .gmbs-attrs + .gmbs-qty-line {
  margin-top: var(--gmbs-title-gap) !important;
}
.gmbs-desc > *:first-child + .gmbs-qty-line {
  margin-top: var(--gmbs-title-gap) !important;
}
.gmbs-desc .gmbs-qty-line .quantity,
.gmbs-desc .gmbs-qty-line .gmbs-qtyctrl {
  margin-top: 0 !important;
}

/* 설명 칸(그리드 3번째) 자식들의 통일 마진 */
.gmbs-item > *:nth-child(3) > * {
  margin-top: var(--gmbs-title-gap) !important;
}
.gmbs-item > *:nth-child(3) > *:first-child {
  margin-top: 0 !important;
}
.gmbs-item > *:nth-child(3) p,
.gmbs-item > *:nth-child(3) strong {
  margin: 0 !important;
}

/* 수량 컨트롤(최종 값으로 통일) */
.gmbs-qtyctrl {
  display: inline-grid;
  grid-template-columns: 28px 44px 28px;
  border: 1px solid #ddd;
  height: 32px;
  box-sizing: border-box;
}
.gmbs-qtyctrl .gmbs-qtybtn {
  border: 0;
  background: #f5f5f5;
  width: 28px;
  height: 30px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.gmbs-qtyctrl .gmbs-qty {
  width: 44px;
  border: 0;
  text-align: center;
  height: 30px;
  line-height: 30px;
  padding: 0;
  margin: 0;
  box-sizing: border-box;
}
.gmbs-qtyctrl .gmbs-qty::-webkit-outer-spin-button,
.gmbs-qtyctrl .gmbs-qty::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.gmbs-qtyctrl .gmbs-qty {
  -moz-appearance: textfield;
}

/* 벤더 풋: 배송비 1줄 + “000에서 더 담기” 다음 줄 + 디바이더 제거 */
.gmbs-cart .gmbs-vendor-foot {
  display: block !important;
  text-align: right;
  margin-top: 8px;
  margin-bottom: 14px;
  font-size: 0.92em;
  color: #777;
}
.gmbs-cart .gmbs-vendor-foot > a:last-child {
  display: block;
  margin-top: 6px;
}
.gmbs-cart .gmbs-vendor-foot + .gmbs-divide {
  display: none !important;
}

/* 액션 버튼들 */
.gmbs-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0;
}
.gmbs-actions .button,
.gmbs-actions button,
.gmbs-actions a.button {
  cursor: pointer;
  font-size: 15px;
  padding: 10px 14px;
  border-radius: 0;
}
.button[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}
/* 선택삭제 / 선택주문 비활성 시: 글자색 + 테두리색을 동일한 연회색으로 */
#gmbs-delete-selected[disabled],
#gmbs-order-selected[disabled],
#gmbs-order-selected-ghost[disabled] {
  color: #bdbdbd !important;
  border: 1px solid #bdbdbd !important;
  background: #fff !important;
  opacity: 1 !important; /* 투명도로 흐려지지 않게 */
}

/* 플로터(모바일 하단 고정) 안의 복제 버튼도 동일 규칙 */
.gmbs-order-floater #gmbs-order-selected-ghost[disabled] {
  color: #bdbdbd !important;
  border: 1px solid #bdbdbd !important;
  background: #fff !important;
  opacity: 1 !important;
}

.button.gmbs-outline {
  background: #fff;
  border: 1px solid #000;
}
.button.gmbs-primary {
  width: 100%;
  background: #9cfe20;
  color: #000;
  border: 0;
  padding: 16px 20px;
  font-size: 1.125rem;
  font-weight: 400;
}

/* 합계 라인: [고정 120px 라벨칸] | [나머지 칸] */
.gmbs-totals .gmbs-sumrow,
.gmbs-totals .gmbs-total {
  display: grid !important;
  grid-template-columns: var(--gmbs-label-col) 1fr; /* ← 120px | 남은폭 */
  align-items: center;
  column-gap: 16px;
  padding-left: 0; /* 기존 들여쓰기 제거 */
}

.gmbs-totals .gmbs-sumrow > :last-child,
.gmbs-totals .gmbs-total > :last-child {
  justify-self: end;
  text-align: right;
}

.gmbs-totals .gmbs-total .lab {
  font-weight: 700;
}

/* 합계 영역 Grid의 1열(라벨)을 끝쪽으로 정렬해 같은 x축에 맞춤 */
.gmbs-totals .gmbs-sumrow > :first-child,
.gmbs-totals .gmbs-total > :first-child {
  justify-self: end;
  text-align: right;
}

/* B섹션 간격(요청: 2배) */
.gmbs-cart {
  --gmbs-totals-gap: 8px;
  --gmbs-gap-mult: 2;
}
.gmbs-totals .gmbs-sumrow {
  margin: calc(var(--gmbs-totals-gap) * var(--gmbs-gap-mult)) 0 !important;
}
.gmbs-totals hr,
.gmbs-totals .gmbs-divide {
  margin: calc(var(--gmbs-totals-gap) * var(--gmbs-gap-mult)) 0 !important;
}
.gmbs-totals .gmbs-total {
  margin: calc(var(--gmbs-totals-gap) * var(--gmbs-gap-mult)) 0 !important;
}
.gmbs-totals > * + * {
  margin-top: calc(var(--gmbs-totals-gap) * var(--gmbs-gap-mult)) !important;
}

/* “총 n종류…” 라벨: 형광펜 효과 + 중앙 정렬 */
#gmbs-sel-count {
  display: inline-block;
  font-size: var(--gmbs-sel-title-size) !important;
  line-height: 1.25;
  font-weight: 700;
  background: #9cfe20; /* 형광펜 */
  color: #000;
  padding: 2px 6px; /* 형광펜 두께 */
  border-radius: 2px;
  text-align: center !important;
  margin: 0;
}

/* 배송비 합계 아래 디바이더 1px */
.gmbs-cart .gmbs-totals hr {
  border: 0;
  height: 0;
  border-top: 1px solid #000;
}
.gmbs-cart .gmbs-totals .gmbs-divide {
  border-top-width: 1px !important;
}

/* B섹션 버튼 2개를 한 줄 가득 채우는 그리드 */
.gmbs-order-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 19px; /* 합계 박스와 버튼 줄 사이 간격 */
}
.gmbs-order-row #gmbs-order-selected,
.gmbs-order-row #gmbs-order-all {
  font-size: 1.125rem !important;
  padding: 16px 20px !important;
  line-height: 1.2;
  width: 100%;
  box-sizing: border-box;
  cursor: pointer;
}
.gmbs-totals .gmbs-order-row #gmbs-order-selected {
  border-width: 1px;
}

/* 데스크탑: B섹션 고정 */
@media (min-width: 865px) {
  .gmbs-cart .gmbs-grid > *:last-child {
    position: sticky;
    top: 24px;
    align-self: start;
  }
}

/* 모바일 하단 고정 플로터 */
@media (max-width: 864px) {
  .gmbs-order-floater {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 999;
    display: none; /* 원래 줄이 보일 땐 숨김 */
    background: #fff;
    box-shadow: 0 -8px 16px rgba(0, 0, 0, 0.12);
    /* 합계 박스(.gmbs-totals)와 동일한 안쪽 여백: 12px 16px 16px */
    padding: 12px 16px calc(16px + env(safe-area-inset-bottom));
  }
  .gmbs-order-floater.is-on {
    display: block;
  }
  body.has-order-floater {
    padding-bottom: 76px;
  } /* 컨텐츠 가림 방지(필요시 높이 조정) */

  .gmbs-order-floater .gmbs-order-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin: 0; /* 플로터 안에선 바깥 여백 제거 */
  }
  .gmbs-order-floater .button {
    width: 100%;
    padding: 16px 20px;
    line-height: 1.2;
    font-size: 1.125rem;
    box-sizing: border-box;
  }
  .gmbs-order-floater .gmbs-outline {
    background: #fff;
    border: 1px solid #000;
    color: #000;
  }
  .gmbs-order-floater .gmbs-primary {
    background: #9cfe20;
    border: 0;
    color: #000;
  }

  /* 플로터가 떠 있을 때 본문이 가려지지 않도록 바닥 여백 확보 */
  body.has-order-floater {
    padding-bottom: 76px; /* 버튼 높이+패딩만큼, 테마에 맞게 필요시 미세조정 */
  }
}

/* =========================
   체크박스(최종) – 각진 박스 + 뾰족한 체크 아이콘
   ========================= */

/* 변수(최종) */
.gmbs-cart {
  --gmbs-check-size: 23px;
  --gmbs-check-bgsize: 92%;
  --gmbs-icon-off: url("data:image/svg+xml;utf8,\
<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'>\
<path d='M3 12 L9 18 L21 6' fill='none' stroke='%23c7c7c7' stroke-width='3.4' stroke-linecap='butt' stroke-linejoin='miter'/>\
</svg>");
  --gmbs-icon-on: url("data:image/svg+xml;utf8,\
<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'>\
<path d='M3 12 L9 18 L21 6' fill='none' stroke='%23000' stroke-width='3.4' stroke-linecap='butt' stroke-linejoin='miter'/>\
</svg>");
}

/* 과거 가짜 UI/배경이미지 비활성화(겹침 원인 제거) */
.gmbs-cart .gmbs-check .gmbs-check-ui {
  display: none !important;
}
/* 라벨 박스 정렬(베이스라인 갭 제거) */
.gmbs-item > .gmbs-check,
.gmbs-vendor-head > .gmbs-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: var(--gmbs-check-size);
  line-height: 0;
}

/* 실제 체크박스 */
.gmbs-cart .gmbs-check input[type="checkbox"] {
  -webkit-appearance: none;
  appearance: none;
  display: inline-block;
  vertical-align: middle;
  line-height: 0;
  padding: 0;
  margin: 0;

  width: var(--gmbs-check-size);
  height: var(--gmbs-check-size);
  border: 1.5px solid #cfcfcf;
  border-radius: 0;
  background: #fff;

  background-repeat: no-repeat;
  background-position: 50% 50%;
  background-size: var(--gmbs-check-bgsize) var(--gmbs-check-bgsize);
  background-image: var(--gmbs-icon-off);
  cursor: pointer;
}
.gmbs-cart .gmbs-check input[type="checkbox"]:checked {
  border-color: #9cfe20;
  background-color: #9cfe20;
  background-image: var(--gmbs-icon-on);
}
/* 옛 pseudo 아이콘 전부 차단 */
.gmbs-cart input[type="checkbox"].gmbs-item-check::before,
.gmbs-cart input[type="checkbox"].gmbs-vendor-check::before,
.gmbs-cart .gmbs-check input[type="checkbox"]::before,
.gmbs-cart .gmbs-check input[type="checkbox"]::after,
.gmbs-cart label.gmbs-check::before,
.gmbs-cart label.gmbs-check::after,
.gmbs-cart .gmbs-check::before,
.gmbs-cart .gmbs-check::after {
  content: none !important;
  background: none !important;
  -webkit-mask: none !important;
  mask: none !important;
}

/* =========================
   B섹션 타이포 최종 정리
   ========================= */
.gmbs-cart {
  /* 1) “총 n종류의 …” : A섹션 제목의 약 2/3 크기 느낌 + 모바일에서도 작아지지 않게 */
  /* 데스크톱 기준 최대 32px, 모바일에서도 최소 22px 확보 */
  --gmbs-sel-title-size: clamp(22px, 2.5vw, 25px);

  /* 2) 상품합계/배송비합계(라벨/금액) : A섹션 상품명(=본문) 크기와 동일(1rem 가정) */
  --gmbs-name-size: 1.1rem;

  /* 3) “합계/합계금액” : ①보단 작게, ②보다는 확실히 크게 */
  /* 데스크톱 최댓값 24px, 모바일 최소 19px 정도로 설정 */
  --gmbs-total-size: clamp(19px, 2vw, 20px);
}

/* 1) "총 n종류의 상품을 선택했어요" */
#gmbs-sel-count {
  font-size: var(--gmbs-sel-title-size) !important;
  line-height: 1.25;
  font-weight: 700;
  text-align: center !important;
}

/* 합계 박스: 흰 배경 + 연두 테두리 */
.gmbs-totals {
  background: #fff;
  border: 1px solid #9cfe20;
  padding: 12px 16px 16px; /* 여백은 현재 값 유지 */
}

/* 합계 박스의 마지막 자식은 아래 마진 제거 → 상/하 테두리 간격 균등 */
.gmbs-totals > :last-child {
  margin-bottom: 0 !important;
}

.gmbs-totals .gmbs-order-row {
  margin-top: 14px; /* 기존 14px 기준 +5px (다르면 5px 더 키워줘도 OK) */
}

/* 2) 상품합계/배송비합계(라벨+금액) → A섹션 상품명 크기와 동일 */
.gmbs-totals .gmbs-sumrow,
.gmbs-totals .gmbs-sumrow > *,
.gmbs-totals .gmbs-sumrow .lab,
.gmbs-totals .gmbs-sumrow .val {
  font-size: var(--gmbs-name-size) !important;
  line-height: 1.25;
}

/* 3) 합계(라벨+금액) */
.gmbs-totals .gmbs-total,
.gmbs-totals .gmbs-total > *,
.gmbs-totals .gmbs-total .lab,
#gmbs-sum-grand {
  font-size: var(--gmbs-total-size) !important;
  font-weight: 700;
  line-height: 1.25;
}

/* 헤더 컨테이너를 가운데 정렬 */
.gmbs-totals-head {
  margin: 0 0 5px 0;
  text-align: center;
}

.gmbs-totals-head:empty {
  display: none;
}

/* 빈 장바구니 커스텀 블록 */
.woocommerce-cart .gmbs-emptycart {
  min-height: 60vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}
.gmbs-emptycart-inner {
  text-align: center;
}

/* “텅…” 큰 타이틀 */
.gmbs-emptycart-title {
  font-weight: 800;
  letter-spacing: -0.02em;
  font-size: clamp(48px, 7vw, 96px);
  margin: 0 0 8px;
}

/* “장바구니가 비어있어요” 서브텍스트 */
.gmbs-emptycart-sub {
  font-size: clamp(16px, 2.4vw, 18px);
  color: #333;
  margin: 0 0 18px;
}

/* 캡처처럼 형광그린(#9CFE20) + 검정 글씨, 각진 박스 */
.gmbs-empty-btn {
  display: inline-block !important;
  background: #9cfe20 !important;
  color: #000 !important;
  border: 0 !important;
  border-radius: 0 !important;
  padding: 16px 32px !important; /* 캡처 동일 슬림 패딩 */
  line-height: 1.2 !important;
  font-size: 15px !important;
  font-weight: 400 !important;
  text-decoration: none !important;
  box-shadow: none !important;
}

/* hover */
.gmbs-empty-btn:hover,
.gmbs-empty-btn:focus {
  filter: brightness(0.96);
}

/* 혹시 테마가 더 강한 선택자로 덮어씌우면, 같은 규칙을 스코프로 한 번 더 */
.woocommerce .cart-empty .return-to-shop a.gmbs-empty-btn,
.wc-block-cart .gmbs-empty-btn {
  all: unset;
} /* 기본 스타일 제거 */
.woocommerce .cart-empty .return-to-shop a.gmbs-empty-btn,
.wc-block-cart .gmbs-empty-btn {
  display: inline-block !important;
  background: #9cfe20 !important;
  color: #000 !important;
  border: 0 !important;
  border-radius: 0 !important;
  padding: 16px 32px !important;
  line-height: 1.2 !important;
  font-size: 15px !important;
  font-weight: 400 !important;
  text-decoration: none !important;
  box-shadow: none !important;
}

/* A섹션: 체크박스 관련 액션 버튼 줄 정렬 보정 */
.gmbs-cart .gmbs-actions {
  display: flex; /* 혹시 다른 값이면 고정 */
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0;
  justify-content: flex-start !important; /* 데스크탑 */
}

@media (max-width: 864px) {
  .gmbs-cart .gmbs-actions {
    justify-content: center !important;
  }
}

/* "000에서 더 담기" — 기본 무밑줄, hover 시 밑줄(가짜 밑줄 테마도 커버) */
.gmbs-cart .gmbs-vendor-foot a,
.gmbs-cart .gmbs-vendor-foot a:visited {
  text-decoration: none !important;
  border-bottom: 0 !important; /* 테마가 쓰는 가짜 밑줄 제거 */
  background-image: none !important; /* 이미지로 그리는 밑줄 예방 */
}

.gmbs-cart .gmbs-vendor-foot a:hover,
.gmbs-cart .gmbs-vendor-foot a:focus {
  text-decoration: underline !important; /* 표준 밑줄 */
  text-decoration-thickness: 1px !important;
  text-underline-offset: 2px !important;
  background-image: none !important;
}
