/* =============================================================
   장바구니 - 몽연 커스텀
============================================================= */

/* ─── 기본 WC 스타일 제거 ─── */
.woocommerce-cart .wc-block-components-main,
.woocommerce-cart table.cart,
.woocommerce-cart .cart-collaterals,
.woocommerce-cart .shop_table { border: none; }

/* ─── 장바구니 래퍼 ─── */
.cart-page-wrap {
    background: var(--color-bg, #FAFAFA);
    min-height: 60vh;
    padding: 40px 0 80px;
}
.cart-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 24px;
}

/* ─── 레이아웃 ─── */
.cart-layout {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 24px;
    align-items: start;
}

/* ─── 빈 장바구니 ─── */
.cart-empty-state {
    text-align: center;
    padding: 80px 24px;
}
.cart-empty-icon {
    color: #ccc;
    margin-bottom: 20px;
}
.cart-empty-msg {
    font-size: 16px;
    color: var(--color-text-muted, #666);
    margin-bottom: 28px;
}
.cart-empty-btn {
    display: inline-flex;
    align-items: center;
    padding: 14px 36px;
    background: var(--color-primary, #8B35C8);
    color: #fff;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 700;
    transition: background .2s;
}
.cart-empty-btn:hover { background: var(--color-primary-dark, #6B1FA8); }

/* ─── 장바구니 메인 ─── */
.cart-main {
    background: #fff;
    border-radius: 12px;
    border: 1px solid var(--color-border, #E8E8E8);
    overflow: hidden;
}
.cart-main-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px 24px;
    border-bottom: 1px solid var(--color-border, #E8E8E8);
}
.cart-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--color-navy, #1A1A2E);
    margin: 0;
}
.cart-count {
    font-size: 14px;
    color: var(--color-text-muted, #666);
}

/* ─── 전체선택 바 ─── */
.cart-select-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 24px;
    border-bottom: 1px solid var(--color-border, #E8E8E8);
    background: #FAFAFA;
}
.cart-check-all {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}
.cart-check-all input[type=checkbox],
.cart-item-checkbox {
    width: 18px;
    height: 18px;
    accent-color: var(--color-primary, #8B35C8);
    cursor: pointer;
}
.cart-check-label {
    font-size: 14px;
    color: #333;
    font-weight: 500;
}
.cart-delete-selected {
    font-size: 13px;
    color: var(--color-text-muted, #666);
    border: 1px solid #ddd;
    padding: 5px 12px;
    border-radius: 4px;
    background: #fff;
    cursor: pointer;
    transition: all .15s;
}
.cart-delete-selected:hover {
    border-color: #999;
    color: #333;
}

/* ─── 상품 행 ─── */
.cart-item {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 20px 24px;
    border-bottom: 1px solid var(--color-border, #E8E8E8);
    position: relative;
    transition: background .15s;
}
.cart-item:last-child { border-bottom: none; }
.cart-item:hover { background: #FAFFFE; }

.cart-item-check {
    display: flex;
    align-items: center;
    padding-top: 4px;
    flex-shrink: 0;
}

.cart-item-thumb {
    flex-shrink: 0;
    width: 88px;
    height: 88px;
    border-radius: 8px;
    overflow: hidden;
    background: #f5f5f5;
}
.cart-item-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cart-item-info {
    flex: 1;
    min-width: 0;
}
.cart-item-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--color-navy, #1A1A2E);
    line-height: 1.5;
    margin-bottom: 4px;
}
.cart-item-name a { color: inherit; }
.cart-item-name a:hover { color: var(--color-primary, #8B35C8); }
.cart-item-option {
    font-size: 12px;
    color: var(--color-text-muted, #666);
    margin-bottom: 8px;
}

/* 가격 (모바일용) */
.cart-item-price-mobile { display: none; }

/* 수량 */
.cart-item-qty-wrap { margin-top: 10px; }
.cart-qty {
    display: inline-flex;
    align-items: center;
    border: 1px solid #ddd;
    border-radius: 6px;
    overflow: hidden;
}
.cart-qty-btn {
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: #555;
    background: #f5f5f5;
    border: none;
    cursor: pointer;
    transition: background .15s;
    line-height: 1;
}
.cart-qty-btn:hover { background: #ebebeb; }
.cart-qty-input {
    width: 44px;
    height: 34px;
    text-align: center;
    border: none;
    border-left: 1px solid #ddd;
    border-right: 1px solid #ddd;
    font-size: 14px;
    font-weight: 600;
    color: var(--color-navy, #1A1A2E);
    background: #fff;
    -moz-appearance: textfield;
}
.cart-qty-input::-webkit-inner-spin-button,
.cart-qty-input::-webkit-outer-spin-button { -webkit-appearance: none; }
.cart-item-qty-single {
    font-size: 14px;
    color: #555;
}

/* 가격 컬럼 (데스크탑) */
.cart-item-price-col {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: flex-start;
    min-width: 100px;
    padding-top: 4px;
}
.cart-item-origin-price {
    font-size: 13px;
    color: #aaa;
    text-decoration: line-through;
    margin-bottom: 2px;
}
.cart-item-origin-price .woocommerce-Price-amount { color: #aaa; }
.cart-item-subtotal {
    font-size: 16px;
    font-weight: 700;
    color: var(--color-navy, #1A1A2E);
}
.cart-item-subtotal .woocommerce-Price-amount { font-size: inherit; font-weight: inherit; }

/* 삭제 버튼 */
.cart-item-remove-col {
    display: flex;
    align-items: flex-start;
    padding-top: 4px;
    flex-shrink: 0;
}
.cart-item-remove {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #f0f0f0;
    color: #888;
    font-size: 18px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
    transition: all .15s;
}
.cart-item-remove:hover { background: #ffe0e0; color: #e53e3e; }

/* 장바구니 액션 (숨김) */
.cart-actions { display: none; }

/* 쇼핑 계속하기 */
.cart-continue-row {
    padding: 16px 24px;
    border-top: 1px solid var(--color-border, #E8E8E8);
    background: #FAFAFA;
}
.cart-continue-link {
    font-size: 14px;
    color: var(--color-text-muted, #666);
    transition: color .15s;
}
.cart-continue-link:hover { color: var(--color-primary, #8B35C8); }

/* ─── 사이드바 요약 ─── */
.cart-sidebar { position: sticky; top: calc(var(--header-height, 68px) + 24px); }
.cart-summary-box {
    background: #fff;
    border-radius: 12px;
    border: 1px solid var(--color-border, #E8E8E8);
    overflow: hidden;
}
.cart-summary-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--color-navy, #1A1A2E);
    padding: 20px 24px;
    border-bottom: 1px solid var(--color-border, #E8E8E8);
    margin: 0;
}
.cart-summary-rows {
    padding: 20px 24px 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.cart-summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    color: #555;
}
.cart-summary-discount { color: #e53e3e; }
.cart-free-ship {
    color: var(--color-primary, #8B35C8);
    font-weight: 600;
}
.cart-summary-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 24px;
    margin: 16px 0 0;
    border-top: 1px solid var(--color-border, #E8E8E8);
    font-size: 15px;
    font-weight: 700;
    color: var(--color-navy, #1A1A2E);
}
.cart-total-price {
    font-size: 20px;
    font-weight: 800;
    color: var(--color-primary, #8B35C8);
}
.cart-total-price .woocommerce-Price-amount { font-size: inherit; font-weight: inherit; color: inherit; }

/* 주문하기 버튼 */
.cart-summary-box .checkout-button,
.cart-summary-box a.checkout-button,
.woocommerce .cart-summary-box .button.alt {
    display: block !important;
    width: 100% !important;
    padding: 16px 24px !important;
    margin: 0 24px 0 !important;
    margin: 16px 24px 16px !important;
    background: var(--color-primary, #8B35C8) !important;
    color: #fff !important;
    text-align: center !important;
    font-size: 16px !important;
    font-weight: 700 !important;
    border-radius: 8px !important;
    border: none !important;
    cursor: pointer !important;
    transition: background .2s !important;
    box-sizing: border-box !important;
    width: calc(100% - 48px) !important;
}
.cart-summary-box .checkout-button:hover,
.woocommerce .cart-summary-box .button.alt:hover {
    background: var(--color-primary-dark, #6B1FA8) !important;
    color: #fff !important;
}

/* 주문하기 버튼 래퍼 */
.woocommerce-proceed-to-checkout { padding: 16px 24px 0; }
.woocommerce-proceed-to-checkout .checkout-button {
    display: block;
    width: 100%;
    padding: 16px;
    background: var(--color-primary, #8B35C8);
    color: #fff;
    text-align: center;
    font-size: 16px;
    font-weight: 700;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: background .2s;
    box-sizing: border-box;
}
.woocommerce-proceed-to-checkout .checkout-button:hover {
    background: var(--color-primary-dark, #6B1FA8);
    color: #fff;
}

.cart-summary-notice {
    padding: 12px 24px 20px;
    font-size: 12px;
    color: #aaa;
    line-height: 1.5;
    margin: 0;
}

/* ─── 반응형 ─── */
@media (max-width: 900px) {
    .cart-layout { grid-template-columns: 1fr; }
    .cart-sidebar { position: static; }
}

@media (max-width: 640px) {
    .cart-page-wrap { padding: 20px 0 60px; }

    .cart-item { padding: 16px; gap: 10px; }
    .cart-item-thumb { width: 72px; height: 72px; }

    /* 데스크탑 가격 숨기고 모바일 가격 표시 */
    .cart-item-price-col { display: none; }
    .cart-item-price-mobile {
        display: flex;
        align-items: center;
        gap: 6px;
        margin-top: 6px;
        flex-wrap: wrap;
    }
    .cart-item-price-mobile .cart-item-origin-price { font-size: 12px; }
    .cart-item-price-mobile .cart-item-subtotal { font-size: 15px; }

    .cart-select-bar { padding: 12px 16px; }
    .cart-main-header { padding: 16px; }
}
