/* =========================================================
   장바구니 페이지
========================================================= */

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: #f5f6f8;
  color: #222;
  font-family:
    "Pretendard",
    "Noto Sans KR",
    Arial,
    sans-serif;
}

.logo a {
  color: inherit;
  text-decoration: none;
}

/* =========================================================
   장바구니 전체 영역
========================================================= */

.cart-section {
  min-height: 650px;
  padding: 55px 20px 90px;
}

.cart-container {
  width: min(1240px, 100%);
  margin: 0 auto;
}

/* =========================================================
   상단 제목
========================================================= */

.cart-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 30px;
  margin-bottom: 34px;
}

.cart-heading-label {
  display: inline-block;
  margin-bottom: 9px;
  color: #7a828d;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 1.5px;
}

.cart-heading h1 {
  margin: 0;
  color: #232932;
  font-size: 38px;
  font-weight: 850;
  letter-spacing: -1.5px;
}

.cart-heading p {
  margin: 12px 0 0;
  color: #777f89;
  font-size: 15px;
}

.continue-shopping-link {
  flex-shrink: 0;
  padding: 12px 18px;
  border: 1px solid #d8dce2;
  border-radius: 9px;
  background: #fff;
  color: #444c57;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  transition:
    border-color 0.2s ease,
    background 0.2s ease;
}

.continue-shopping-link:hover {
  border-color: #aeb5bf;
  background: #fafbfc;
}

/* =========================================================
   빈 장바구니
========================================================= */

.cart-empty {
  padding: 110px 20px;
  border: 1px solid #e1e4e9;
  border-radius: 16px;
  background: #fff;
  text-align: center;
  box-shadow: 0 12px 36px rgba(32, 40, 52, 0.06);
}

.cart-empty-icon {
  margin-bottom: 18px;
  font-size: 60px;
}

.cart-empty h2 {
  margin: 0 0 12px;
  color: #303741;
  font-size: 25px;
}

.cart-empty p {
  margin: 0 0 28px;
  color: #858c96;
  font-size: 15px;
}

.cart-empty-button {
  display: inline-block;
  padding: 14px 25px;
  border-radius: 9px;
  background: #26313f;
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  text-decoration: none;
}

.cart-empty-button:hover {
  background: #151c25;
}

/* =========================================================
   장바구니 레이아웃
========================================================= */

.cart-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 350px;
  align-items: start;
  gap: 28px;
}

.cart-list-area {
  overflow: hidden;
  border: 1px solid #e1e4e9;
  border-radius: 15px;
  background: #fff;
  box-shadow: 0 10px 32px rgba(32, 40, 52, 0.05);
}

/* =========================================================
   장바구니 도구
========================================================= */

.cart-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
  padding: 0 22px;
  border-bottom: 1px solid #e5e8ec;
  background: #fff;
}

.cart-check-label {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
  color: #454c56;
  font-size: 14px;
  font-weight: 700;
}

.cart-check-label input,
.cart-item-checkbox {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: #26313f;
}

.delete-selected-button {
  padding: 9px 14px;
  border: 1px solid #d8dce2;
  border-radius: 8px;
  cursor: pointer;
  background: #fff;
  color: #5f6670;
  font-size: 13px;
}

.delete-selected-button:hover {
  border-color: #d96a60;
  background: #fff7f6;
  color: #c94c41;
}

/* =========================================================
   장바구니 표
========================================================= */

.cart-table-header {
  display: grid;
  grid-template-columns: 65px minmax(260px, 1fr) 135px 145px 70px;
  align-items: center;
  min-height: 52px;
  padding: 0 14px;
  border-bottom: 1px solid #e5e8ec;
  background: #f3f5f7;
  color: #68717d;
  font-size: 13px;
  font-weight: 750;
  text-align: center;
}

.cart-list {
  min-height: 130px;
}

.cart-item {
  display: grid;
  grid-template-columns: 65px minmax(260px, 1fr) 135px 145px 70px;
  align-items: center;
  min-height: 150px;
  padding: 18px 14px;
  border-bottom: 1px solid #eceef2;
}

.cart-item:last-child {
  border-bottom: none;
}

.cart-item.is-sold-out {
  background: #fafafa;
  opacity: 0.75;
}

.cart-check-cell,
.cart-quantity-cell,
.cart-price-cell,
.cart-delete-cell {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* =========================================================
   상품정보
========================================================= */

.cart-product-info {
  display: flex;
  align-items: center;
  gap: 17px;
  min-width: 0;
  padding: 0 12px;
}

.cart-product-image-link {
  flex-shrink: 0;
}

.cart-product-image {
  display: block;
  width: 112px;
  height: 112px;
  border: 1px solid #e4e7eb;
  border-radius: 10px;
  object-fit: cover;
  background: #f5f6f8;
}

.cart-product-text {
  min-width: 0;
}

.cart-product-category {
  display: inline-block;
  margin-bottom: 7px;
  color: #7d8590;
  font-size: 12px;
}

.cart-product-name {
  display: -webkit-box;
  overflow: hidden;
  margin: 0 0 10px;
  color: #29303a;
  font-size: 16px;
  font-weight: 750;
  line-height: 1.5;
  text-decoration: none;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
}

.cart-product-name:hover {
  text-decoration: underline;
}

.cart-product-unit-price {
  margin: 0;
  color: #7c848f;
  font-size: 13px;
}

.cart-product-stock {
  margin: 7px 0 0;
  color: #5f6873;
  font-size: 13px;
}

.cart-product-stock.low-stock {
  color: #d45643;
  font-weight: 700;
}

.sold-out-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 8px;
  padding: 5px 9px;
  border-radius: 999px;
  background: #fcebea;
  color: #cf4135;
  font-size: 12px;
  font-weight: 800;
}

/* =========================================================
   수량 조절
========================================================= */

.cart-quantity-control {
  display: inline-grid;
  grid-template-columns: 34px 48px 34px;
  overflow: hidden;
  border: 1px solid #d8dce2;
  border-radius: 8px;
  background: #fff;
}

.cart-quantity-control button {
  width: 34px;
  height: 36px;
  padding: 0;
  border: none;
  cursor: pointer;
  background: #f7f8fa;
  color: #454c56;
  font-size: 18px;
}

.cart-quantity-control button:hover:not(:disabled) {
  background: #eceff3;
}

.cart-quantity-control button:disabled {
  cursor: not-allowed;
  color: #b1b6be;
}

.cart-quantity-input {
  width: 48px;
  height: 36px;
  padding: 0 4px;
  border: none;
  border-right: 1px solid #d8dce2;
  border-left: 1px solid #d8dce2;
  outline: none;
  color: #303741;
  font-size: 14px;
  font-weight: 700;
  text-align: center;
  appearance: textfield;
}

.cart-quantity-input::-webkit-outer-spin-button,
.cart-quantity-input::-webkit-inner-spin-button {
  margin: 0;
  appearance: none;
}

/* =========================================================
   상품금액 / 삭제
========================================================= */

.cart-item-price {
  color: #242b34;
  font-size: 16px;
  font-weight: 800;
  white-space: nowrap;
}

.cart-delete-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid #dfe2e7;
  border-radius: 50%;
  cursor: pointer;
  background: #fff;
  color: #777f89;
  font-size: 18px;
}

.cart-delete-button:hover {
  border-color: #d96a60;
  background: #fff7f6;
  color: #c94c41;
}

/* =========================================================
   주문 예상금액
========================================================= */

.cart-summary {
  position: sticky;
  top: 25px;
  padding: 28px 24px;
  border: 1px solid #e0e4e9;
  border-radius: 15px;
  background: #fff;
  box-shadow: 0 12px 36px rgba(32, 40, 52, 0.07);
}

.cart-summary h2 {
  margin: 0 0 25px;
  color: #29303a;
  font-size: 22px;
}

.summary-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 17px;
  color: #666e79;
  font-size: 14px;
}

.summary-row strong {
  color: #333b45;
  font-size: 15px;
}

.summary-divider {
  height: 1px;
  margin: 25px 0;
  background: #e5e8ec;
}

.summary-total {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

.summary-total span {
  color: #323a44;
  font-size: 15px;
  font-weight: 750;
}

.summary-total strong {
  color: #d54236;
  font-size: 26px;
  line-height: 1;
  white-space: nowrap;
}

.summary-total strong span {
  color: inherit;
  font-size: inherit;
}

.summary-notice {
  margin: 0 0 22px;
  padding: 14px;
  border-radius: 9px;
  background: #f5f7f9;
  color: #737b86;
  font-size: 12px;
  line-height: 1.65;
}

.cart-order-button,
.cart-inquiry-button {
  width: 100%;
  min-height: 51px;
  margin-bottom: 11px;
  border: none;
  border-radius: 9px;
  cursor: pointer;
  font-size: 15px;
  font-weight: 800;
}

.cart-order-button {
  background: #26313f;
  color: #fff;
}

.cart-order-button:hover:not(:disabled) {
  background: #151c25;
}

.cart-inquiry-button {
  border: 1px solid #26313f;
  background: #fff;
  color: #26313f;
}

.cart-inquiry-button:hover:not(:disabled) {
  background: #f3f5f7;
}

.cart-order-button:disabled,
.cart-inquiry-button:disabled {
  cursor: not-allowed;
  border-color: #d8dce2;
  background: #e5e8ec;
  color: #9ba1aa;
}

.cart-contact-box {
  margin-top: 14px;
  padding: 16px;
  border-radius: 9px;
  background: #fff7e7;
  text-align: center;
}

.cart-contact-box span {
  display: block;
  margin-bottom: 7px;
  color: #7b6b47;
  font-size: 12px;
}

.cart-contact-box a {
  color: #c16b00;
  font-size: 21px;
  font-weight: 850;
  text-decoration: none;
}

/* =========================================================
   오류 및 로딩
========================================================= */

.cart-loading,
.cart-error-message {
  padding: 70px 20px;
  text-align: center;
  color: #777f89;
  font-size: 15px;
}

.cart-error-message {
  color: #c94c41;
}

/* =========================================================
   반응형
========================================================= */

@media (max-width: 1050px) {
  .cart-layout {
    grid-template-columns: 1fr;
  }

  .cart-summary {
    position: static;
  }

  .cart-table-header {
    grid-template-columns: 55px minmax(220px, 1fr) 125px 135px 60px;
  }

  .cart-item {
    grid-template-columns: 55px minmax(220px, 1fr) 125px 135px 60px;
  }
}

@media (max-width: 780px) {
  .cart-section {
    padding: 38px 12px 65px;
  }

  .cart-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 18px;
  }

  .cart-heading h1 {
    font-size: 31px;
  }

  .cart-list-area {
    overflow: visible;
    border: none;
    background: transparent;
    box-shadow: none;
  }

  .cart-toolbar {
    border: 1px solid #e1e4e9;
    border-radius: 11px;
    margin-bottom: 13px;
  }

  .cart-table-header {
    display: none;
  }

  .cart-list {
    display: grid;
    gap: 13px;
  }

  .cart-item {
    position: relative;
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr);
    gap: 13px;
    min-height: 0;
    padding: 18px;
    border: 1px solid #e1e4e9;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 7px 20px rgba(32, 40, 52, 0.04);
  }

  .cart-item:last-child {
    border-bottom: 1px solid #e1e4e9;
  }

  .cart-check-cell {
    align-items: flex-start;
    padding-top: 5px;
  }

  .cart-product-info {
    align-items: flex-start;
    padding: 0 35px 0 0;
  }

  .cart-product-image {
    width: 95px;
    height: 95px;
  }

  .cart-quantity-cell,
  .cart-price-cell {
    grid-column: 2;
    justify-content: flex-start;
    padding-left: 112px;
  }

  .cart-price-cell {
    justify-content: space-between;
  }

  .cart-price-cell::before {
    content: "상품금액";
    color: #777f89;
    font-size: 13px;
  }

  .cart-delete-cell {
    position: absolute;
    top: 15px;
    right: 15px;
  }
}

@media (max-width: 520px) {
  .cart-heading h1 {
    font-size: 27px;
  }

  .cart-toolbar {
    min-height: 58px;
    padding: 0 15px;
  }

  .delete-selected-button {
    padding: 8px 10px;
    font-size: 12px;
  }

  .cart-item {
    grid-template-columns: 26px minmax(0, 1fr);
    padding: 15px;
  }

  .cart-product-info {
    display: grid;
    grid-template-columns: 82px minmax(0, 1fr);
    gap: 12px;
    padding-right: 28px;
  }

  .cart-product-image {
    width: 82px;
    height: 82px;
  }

  .cart-product-name {
    margin-bottom: 7px;
    font-size: 14px;
  }

  .cart-product-unit-price,
  .cart-product-stock {
    font-size: 12px;
  }

  .cart-quantity-cell,
  .cart-price-cell {
    padding-left: 94px;
  }

  .cart-summary {
    padding: 24px 19px;
  }

  .summary-total strong {
    font-size: 23px;
  }

  .cart-empty {
    padding: 80px 17px;
  }
}