/* =========================
 * Design tokens
 * ========================= */
:root {
  --ink: #222; /* 본문 글자 */
  --ink-weak: #666; /* 보조 텍스트 */
  --ink-mute: #9aa0a6; /* 더 연한 텍스트 */
  --danger: #d93025; /* 삭제/경고 */
  --accent: #0b57d0; /* 주요 버튼/포커스 */
  --paper: #fff; /* 카드 배경 */
  --bg: #fafafa; /* 페이지 배경 */
  --line: #e6e6e6; /* 구분선 */
  --radius: 12px; /* 둥근 모서리 */
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
  --container: 1200px;
}

/* 페이지 컨테이너 */
.container_wrap {
  max-width: var(--container);
  margin: 40px auto;
  padding: 0 20px;
}

/* =========================
 * 레이아웃
 * ========================= */
.cart_content {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 24px;
}

.cart_items_section,
.order_summary {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.cart_items_section {
  padding: 20px;
}
.order_summary {
  padding: 20px;
  position: sticky;
  top: 20px;
  align-self: start;
}

.section_title {
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 16px;
}

/* =========================
 * 카트 아이템
 * ========================= */
.cart-list-v1-user-cart .cart_item {
  display: grid;
  grid-template-columns: 40px 96px 1fr 160px 32px;
  align-items: center;
  gap: 16px;
  padding: 16px 8px;
  border-top: 1px solid var(--line);
}
.cart-list-v1-user-cart .cart_item:first-child {
  border-top: 0;
}

.item_image img {
  width: 96px;
  height: 96px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #f4f4f4;
}

.item_details {
  display: grid;
  gap: 6px;
}
.item_name {
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
}
.item_details .item_price {
  font-weight: 700;
}

.item_details .item_shipping {
  color: var(--ink-weak);
  font-size: 13px;
}

.quantity_section {
  justify-self: end;
}
.quantity_label {
  font-size: 12px;
  color: var(--ink-mute);
  margin-bottom: 6px;
}

.quantity_controls {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 10px;
  background: #fff;
}
.quantity_btn {
  width: 28px;
  height: 28px;
  border: 0;
  background: transparent;
  border-radius: 50%;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
}
.quantity_btn:hover {
  background: #f4f6f8;
}
.quantity_display {
  min-width: 22px;
  text-align: center;
  font-weight: 600;
}

.remove_btn {
  width: 32px;
  height: 32px;
  border: 0;
  background: transparent;
  color: var(--ink-mute);
  border-radius: 8px;
  cursor: pointer;
  justify-self: end;
}
.remove_btn:hover {
  background: #f4f6f8;
  color: var(--danger);
}

/* 품절 표시 (마크업에서 span에 텍스트 바인딩해둠) */
.item_details .sold-out,
.item_details span[style*="sold-out"] {
  color: var(--danger) !important;
  font-weight: 700 !important;
}

/* =========================
 * 체크박스 (커스텀)
 * ========================= */
.item_checkbox {
  display: flex;
  align-items: center;
  justify-content: center;
}

.item_checkbox input.js-cart-select {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.item_checkbox label {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  background: #fff;
  cursor: pointer;
  transition: 0.15s ease;
}
.item_checkbox label svg {
  opacity: 0;
  transition: 0.15s ease;
}
.item_checkbox input.js-cart-select:checked + label {
  background: var(--accent);
  border-color: var(--accent);
}
.item_checkbox input.js-cart-select:checked + label svg {
  opacity: 1;
}

/* =========================
 * 카트 액션
 * ========================= */
.cart_actions {
  display: flex;
  justify-content: flex-start;
  gap: 10px;
  padding-top: 16px;
}
.btn_delete_selected {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  cursor: pointer;
}
.btn_delete_selected:hover {
  background: #f7f9fc;
}

/* =========================
 * 요약 박스
 * ========================= */
.order_summary .summary_item {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 10px 0;
  border-top: 1px dashed var(--line);
}
.order_summary .summary_item:first-child {
  border-top: 0;
}
.summary_label {
  color: var(--ink-weak);
}
.summary_value {
  font-weight: 700;
}

.order_summary .summary_divider {
  height: 1px;
  background: var(--line);
  margin: 12px 0;
}

.order_summary .total .summary_label {
  color: var(--ink);
  font-weight: 800;
}
.order_summary .total .summary_value {
  font-size: 20px;
}

/* 주문 버튼 */
.order_buttons {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}
.order_buttons .btn_order_selected,
.order_buttons .btn_order_all {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid transparent;
  font-weight: 700;
  cursor: pointer;
}
.order_buttons .btn_order_selected {
  background: #fff;
  border-color: var(--line);
  color: var(--ink);
}
.order_buttons .btn_order_selected:hover {
  background: #f7f9fc;
}
.order_buttons .btn_order_all {
  background: var(--accent);
  color: #fff;
}
.order_buttons .btn_order_all:hover {
  filter: brightness(0.96);
}

/* =========================
 * 유틸
 * ========================= */
.js-format-price {
  letter-spacing: -0.2px;
}
.js-cart-count {
  font-variant-numeric: tabular-nums;
}

/* 선택 불가/품절 스타일 옵션 (is-available=false일 때 흐리게) */
.cart_item[data-is-available="false"] {
  opacity: 0.55;
}
.cart_item[data-is-available="false"] .quantity_controls,
.cart_item[data-is-available="false"] .remove_btn {
  pointer-events: none;
}

/* =========================
 * 반응형
 * ========================= */
@media (max-width: 1024px) {
  .cart_content {
    grid-template-columns: 1fr;
  }
  .order_summary {
    position: static;
  }
}

@media (max-width: 720px) {
  .cart-list-v1-user-cart .cart_item {
    grid-template-columns: 32px 72px 1fr;
    grid-template-areas:
      "chk img remove"
      "chk info info"
      "chk qty  qty";
    gap: 12px;
    padding: 14px 6px;
  }
  .item_checkbox {
    grid-area: chk;
  }
  .item_image {
    grid-area: img;
  }
  .item_details {
    grid-area: info;
  }
  .quantity_section {
    grid-area: qty;
    justify-self: start;
  }
  .remove_btn {
    grid-area: remove;
    justify-self: end;
  }

  .item_image img {
    width: 72px;
    height: 72px;
  }
  .item_name {
    font-size: 15px;
  }
  .quantity_controls {
    padding: 4px 8px;
    gap: 8px;
  }
}
