﻿/* ================================
   cart.css
   ================================ */


/* 공통 버튼 */
.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 18px;
    min-width: 140px;
    height: 42px;
    border-radius: 0px;
    border: none;
    background-color: #56ab68;
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color .15s ease, transform .05s ease;
}

    .btn-primary:hover {
        background-color: #4a975a;
    }

    .btn-primary:active {
        transform: translateY(1px);
    }

.btn-slt-del {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 18px;
    min-width: 120px;
    height: 40px;
    border-radius: 0px;
    border: none;
    background-color: #56ab68;
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color .15s ease, transform .05s ease;
}

    .btn-slt-del:hover {
        background-color: #4a975a;
    }

    .btn-slt-del:active {
        transform: translateY(1px);
    }

.btn-all-del {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 18px;
    min-width: 120px;
    height: 40px;
    border-radius: 0px;
    border: none;
    background-color: #6f2c4a;
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color .15s ease, transform .05s ease;
}

    .btn-all-del:hover {
        background-color: #6f2c4a;
    }

    .btn-all-del:active {
        transform: translateY(1px);
    }


/* ================================
   ✅ 커스텀 체크박스 (요청5)
   ================================ */
.cart-check {
    width: 23px;
    height: 18px;
    transform: scale(1.30);
    transform-origin: left center;
    cursor: pointer;
}

    .cart-check:checked {
        border-color: #56ab68;
        background: #56ab68;
    }

        .cart-check:checked::after {
            content: "";
            width: 8px;
            height: 4px;
            border-left: 2px solid #fff;
            border-bottom: 2px solid #fff;
            transform: rotate(-45deg);
            margin-top: -1px;
        }

    .cart-check:focus {
        outline: none;
        box-shadow: 0 0 0 3px rgba(86,171,104,0.18);
    }


/* ================================
   로딩/빈상태
   ================================ */
.cart-loading {
    padding: 40px 0;
    text-align: center;
    font-size: 15px;
    color: #555;
}

.cart-empty {
    padding: 60px 0 80px;
    text-align: center;
    font-size: 15px;
    color: #666;
}

    .cart-empty p {
        margin-bottom: 18px;
    }


/* ================================
   ✅ Cart 헤더(제목/버튼)
   ================================ */
.cart-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin-top: 4px;
}

.cart-title {
    margin: 0;
}

.cart-sub {
    margin: 6px 0 0;
    color: #777;
    font-size: 13px;
}

.cart-head-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-shrink: 0;
}


/* ================================
   리스트 레이아웃
   ================================ */
.cart-list {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr);
    gap: 24px;
    margin-top: 10px;
}

@media (max-width: 960px) {
    .cart-list {
        grid-template-columns: minmax(0, 1fr);
    }

    .cart-summary {
        align-self: stretch;
    }
}


/* ================================
   테이블
   ================================ */
.cart-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

    .cart-table thead th {
        padding: 10px 8px;
        border-bottom: 1px solid #ddd;
        font-weight: 500;
        color: #555;
        text-align: left;
    }

    .cart-table tbody td {
        padding: 0;
        border-bottom: none;
    }


/* ================================
   날짜 그룹 박스
   ================================ */
.cart-group-box {
    margin-top: 10px;
    margin-bottom: 14px;
    border: 1px solid #e6e6e6;
    border-radius: 8px;
    background: #fafafa;
    padding: 12px 12px 20px;
}

.cart-group-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 13px;
}

.cart-group-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ✅ 옵션 라인 "박스" */
.cart-opt-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    margin-top: 8px;
    background: #f7f7f7;
    border: 1px solid #e8e8e8;
    border-radius: 6px;
    gap: 10px;
}

.cart-opt-name {
    font-size: 14px;
    font-weight: 500;
    color: #222;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cart-opt-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
    text-align: right;
}

.cart-opt-qty {
    min-width: 18px;
    text-align: right;
    font-size: 14px;
    color: #333;
}

.cart-opt-qty-suffix {
    font-size: 13px;
    color: #666;
}

.cart-opt-price {
    min-width: 90px;
    text-align: right;
    font-size: 14px;
    font-weight: 700;
    color: #111;
}

.cart-group-date {
    font-weight: 700;
    color: #222;
}

/* ✅ 그룹 소계 */
.cart-group-footer {
    margin-top: 8px;
    padding-top: 10px;
    border-top: 1px solid #e3e3e3;
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 10px;
}

.group-foot-label {
    font-size: 16px;
    font-weight: 600;
    color: #222;
}

.group-foot-amount {
    font-size: 23px;
    font-weight: 700;
    color: #111;
    white-space: nowrap;
}


/* ================================
   상품 카드
   ================================ */
.cart-item-block {
    background: #fff;
    border-radius: 8px;
    border: 1px solid #f0f0f0;
    padding: 12px 12px 12px;
    margin-bottom: 10px;
}

/* 1행: 상품/총액 */
.cart-item-row1 {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid #f5f5f5;
}

.cart-item-main {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    min-width: 0;
}

    .cart-item-main img {
        width: 74px;
        height: 74px;
        border-radius: 8px;
        border: 1px solid #eee;
        object-fit: cover;
        flex-shrink: 0;
    }

.cart-item-title {
    font-size: 15px;
    font-weight: 600;
    line-height: 1.45;
    color: #222;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-top: 1px;
}

.cart-item-total {
    font-size: 15px;
    font-weight: 700;
    color: #222;
    white-space: nowrap;
    flex-shrink: 0;
}

/* 옵션 리스트 */
.cart-item-row2 {
    margin-top: 10px;
}

/* (이 클래스는 현재 Razor에서 쓰지 않지만, 기존 유지) */
.cart-item-option-line {
    display: grid;
    grid-template-columns: 1fr 90px 130px;
    gap: 12px;
    align-items: center;
    padding: 8px 6px;
    border-radius: 6px;
    font-size: 14px;
    color: #444;
}

    .cart-item-option-line + .cart-item-option-line {
        margin-top: 6px;
    }

    .cart-item-option-line .opt-name {
        min-width: 0;
        white-space: nowrap;
        text-overflow: ellipsis;
        overflow: hidden;
        font-weight: 500;
    }

    .cart-item-option-line .opt-qty {
        text-align: right;
        color: #666;
        white-space: nowrap;
        font-weight: 600;
    }

    .cart-item-option-line .opt-sub {
        text-align: right;
        white-space: nowrap;
        font-weight: 800;
        color: #222;
    }

/* 3행: 버튼 */
.cart-item-row3 {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px dashed #ececec;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.cart-item-row3-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.cart-mini-btn {
    min-width: auto;
    height: 34px;
    font-size: 14px;
    padding: 0 15px;
    border-radius: 0px;
}

.cart-mini-btn--ghost {
    height: 34px;
    font-size: 14px;
    padding: 0 14px;
    border-radius: 0px;
    border: 1px solid #ddd;
    background: #fff;
    cursor: pointer;
}


/* ================================
   우측 요약 영역
   ================================ */
.cart-summary {
    border: 1px solid #eee;
    border-radius: 10px;
    padding: 18px 16px 16px;
    background: #fafafa;
    align-self: flex-start;
    display: grid;
    row-gap: 10px;
    font-size: 14px;
}

    .cart-summary .sum-row {
        display: flex;
        justify-content: space-between;
        color: #444;
        gap: 10px;
    }

        .cart-summary .sum-row.total {
            margin-top: 6px;
            padding-top: 10px;
            border-top: 1px solid #e3e3e3;
            font-size: 15px;
            font-weight: 700;
        }

.cart-inline-controls {
    display: flex;
    gap: 8px;
    align-items: center;
    margin: 8px 0 10px;
}

.cart-point-input,
.cart-coupon-select {
    flex: 1;
    height: 36px;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 0 10px;
    background: #fff;
    min-width: 0;
}

.cart-ghost-btn {
    height: 36px;
    border: 1px solid #ddd;
    background: #fff;
    border-radius: 8px;
    padding: 0 12px;
    cursor: pointer;
    white-space: nowrap;
}

.cart-hr {
    border: none;
    border-top: 1px solid #eaeaea;
    margin: 12px 0;
}

.cart-hint {
    font-size: 12px;
    color: #888;
    margin-top: -4px;
    margin-bottom: 6px;
}

/* 최종 결제 금액 강조 */
.final-pay .final-label {
    font-size: 16px;
    font-weight: 800;
    color: #222;
}

.final-pay .final-amount {
    font-size: 30px;
    font-weight: 900;
    color: #111;
    letter-spacing: -0.2px;
}


/* ================================
   1) 상품 옵션 선택 팝업
   ================================ */

.cart-popup-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 9990;
    display: flex;
    justify-content: center;
    align-items: flex-end;
}

.cart-popup-panel {
    width: 100%;
    max-width: 500px;
    max-height: 88vh;
    background: #fff;
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.18);
    padding: 20px 22px 16px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
}

/* 큰 화면에서는 중앙 */
@media (min-width: 960px) {
    .cart-popup-backdrop {
        align-items: center;
    }

    .cart-popup-panel {
        max-width: 640px;
        max-height: 80vh;
        border-radius: 18px;
    }
}

.cart-popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 8px;
    border-bottom: 1px solid #eee;
    margin-bottom: 10px;
}

    .cart-popup-header span {
        font-size: 18px;
        font-weight: 600;
    }

.popup-close {
    border: none;
    background: transparent;
    font-size: 22px;
    line-height: 1;
    padding: 4px 6px;
    cursor: pointer;
    color: #777;
}

    .popup-close:hover {
        color: #000;
    }

.cart-popup-body {
    flex: 1;
    overflow-y: auto;
    padding-right: 4px;
}

.popup-product {
    display: flex;
    gap: 10px;
    margin-bottom: 12px;
}

    .popup-product img {
        width: 64px;
        height: 64px;
        border-radius: 8px;
        border: 1px solid #ddd;
        object-fit: cover;
        flex-shrink: 0;
    }

.popup-product-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 2px;
    min-width: 0;
}

    .popup-product-info .title {
        font-size: 16px;
        font-weight: 600;
        line-height: 1.3;
    }

    .popup-product-info .sub {
        font-size: 14px;
        color: #777;
    }

.popup-options {
    border-top: 1px solid #f0f0f0;
    padding-top: 8px;
    margin-top: 4px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.popup-empty {
    padding: 20px 6px;
    text-align: center;
    font-size: 14px;
    color: #666;
}

.popup-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 9px 8px;
    border-radius: 9px;
    border: 1px solid #e2e2e2;
    background: #fff;
    gap: 10px;
}

    .popup-option.soldout {
        opacity: 0.55;
        background: #f9f9f9;
    }

    .popup-option:hover {
        border-color: #7f3faf;
    }

    .popup-option .opt-text {
        display: flex;
        flex-direction: column;
        gap: 2px;
        flex: 1;
        min-width: 0;
    }

        .popup-option .opt-text .name {
            font-size: 15px;
            font-weight: 500;
            line-height: 1.3;
        }

        .popup-option .opt-text .price {
            font-size: 14px;
            color: #333;
        }

.soldout-label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
    margin-left: 6px;
    height: 18px;
    border-radius: 999px;
    background: #ccc;
    color: #fff;
    font-size: 11px;
}

.opt-qty {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

    .opt-qty button {
        width: 26px;
        height: 26px;
        border-radius: 4px;
        border: 1px solid #ccc;
        background: #fff;
        font-size: 16px;
        line-height: 1;
        cursor: pointer;
        padding: 0;
    }

        .opt-qty button:disabled {
            cursor: default;
            opacity: 0.4;
        }

    .opt-qty span {
        min-width: 24px;
        text-align: center;
        font-size: 15px;
    }

.cart-popup-footer {
    padding-top: 10px;
    border-top: 1px solid #eee;
    margin-top: 8px;
}

    .cart-popup-footer .btn-primary {
        width: 100%;
        height: 50px;
        font-size: 17px;
    }


/* ================================
   3) 장바구니 담기 토스트
   ================================ */

.cart-wrap {
    position: relative;
}

.cart-toast {
    position: absolute;
    top: 38px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1500;
    font-size: 12px;
}

.cart-toast-inner {
    display: flex;
    align-items: center;
    background: #fff;
    border-radius: 8px;
    padding: 10px 12px;
    box-shadow: 0 4px 16px rgba(0,0,0,.18);
    border: 1px solid #e5e5e5;
    min-width: 260px;
    max-width: 320px;
}

.cart-toast img {
    width: 44px;
    height: 44px;
    border-radius: 4px;
    object-fit: cover;
    margin-right: 10px;
}

.cart-toast-text {
    max-width: 250px;
}

.cart-toast-title {
    font-size: 13px;
    font-weight: 600;
    color: #333;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
    margin-bottom: 3px;
}

.cart-toast-msg {
    font-size: 12px;
    color: #666;
}

.cart-toast::before {
    content: "";
    position: absolute;
    top: -7px;
    left: 50%;
    transform: translateX(-50%);
    border-width: 0 7px 7px 7px;
    border-style: solid;
    border-color: transparent transparent #fff transparent;
}

.cart-toast::after {
    content: "";
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
    border-width: 0 8px 8px 8px;
    border-style: solid;
    border-color: transparent transparent #ddd transparent;
}


/* =========================================================
   ✅ (신규) 모바일 하단 고정 결제바 + 포인트/쿠폰 고정 패널
   ========================================================= */
.cart-mobile-sticky {
    display: none; /* PC 기본 숨김 */
}

/* =========================================================
   ✅ 모바일 반응형 (핵심)
   ========================================================= */
@media (max-width: 768px) {

    .container-1080.cart-page {
        padding: 0px 15px !important;
    }

    /* ✅ 하단 고정바/탭바에 컨텐츠가 가려지지 않도록 여유 */
    .cart-page {
        padding-bottom: calc(210px + var(--wm-bottom-tab-h, 64px) + env(safe-area-inset-bottom, 0px));
    }

    /* 헤더: 버튼이 아래로 떨어질 수 있게 */
    .cart-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .cart-head-actions {
        width: 100%;
        gap: 8px;
    }

    /* 버튼 2개를 동일 폭으로 */
    .btn-slt-del, .btn-all-del {
        flex: 1;
        min-width: 0;
        height: 42px;
        font-size: 14px;
        padding: 0 12px;
    }

    /* 리스트/요약: 1열 + 간격 축소 */
    .cart-list {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    /* 테이블 헤더 숨김 */
    .cart-table thead {
        display: none;
    }

    /* 그룹 박스 좌우 패딩 확보 */
    .cart-group-box {
        padding: 10px 10px 16px;
    }

    /* 1행(썸네일/제목/금액)에서 금액이 좁아지면 아래로 내리기 */
    .cart-item-row1 {
        flex-wrap: wrap;
        gap: 10px;
    }

    .cart-item-total {
        width: 100%;
        text-align: right;
        font-size: 16px;
    }

    /* 이미지 조금 축소 */
    .cart-item-main img {
        width: 64px;
        height: 64px;
    }

    /* 옵션 박스: 모바일에서 우측이 넘치면 줄바꿈 허용 */
    .cart-opt-box {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }

    .cart-opt-name {
        width: 100%;
        white-space: normal;
        overflow: visible;
        text-overflow: clip;
    }

    .cart-opt-right {
        width: 100%;
        justify-content: flex-end;
        flex-wrap: wrap;
        gap: 8px;
    }

    .cart-opt-price {
        min-width: 0;
    }

    /* 버튼 영역: 터치 영역 강화 */
    .cart-item-row3-right {
        width: 100%;
        justify-content: flex-end;
        gap: 8px;
    }

    .cart-mini-btn, .cart-mini-btn--ghost {
        height: 40px;
        padding: 0 14px;
        font-size: 14px;
    }

    /* 요약 영역: 컨트롤 wrap (포인트/쿠폰) */
    .cart-inline-controls {
        flex-wrap: wrap;
        gap: 8px;
    }

    .cart-point-input, .cart-coupon-select {
        flex: 1 1 100%;
        height: 42px;
    }

    .cart-ghost-btn {
        flex: 1 1 calc(50% - 4px);
        height: 42px;
        justify-content: center;
    }

    .final-pay .final-amount {
        font-size: 28px;
    }

    /* 팝업: 뷰포트 폭 꽉 차게 + 내부 스크롤 안정 */
    .cart-popup-panel {
        max-width: none;
        width: 100%;
        max-height: 90vh;
        padding: 18px 16px 14px;
    }

    .cart-popup-body {
        -webkit-overflow-scrolling: touch;
    }

    /* ✅ (신규) 모바일에서는 요약박스 안의 "포인트/쿠폰", "최종/주문" 영역 숨김 */
    .cart-summary-discount,
    .cart-summary-bottom {
        display: none !important;
    }

    /* ✅ (신규) 모바일 하단 고정 영역 표시 */
    .cart-mobile-sticky {
        display: block;
        position: fixed;
        left: 0;
        right: 0;
        bottom: calc(var(--wm-bottom-tab-h, 64px) + env(safe-area-inset-bottom, 0px));
        z-index: 5900; /* wm-bottom-tab(6000) 아래, 본문 위 */
        padding: 10px 12px 12px;
        background: #fff; /* ✅ 한 덩어리 흰 배경 */
        border: 1px solid #e7e7e7; /* ✅ 바깥 카드 테두리 */
        border-radius: 16px 16px 0 0; /* ✅ 바깥 카드 라운드 */
        box-shadow: 0 8px 22px rgba(0,0,0,.40); /* ✅ 바깥 카드 그림자 */
        pointer-events: none; /* 바깥은 클릭 방지, 내부만 허용 */
    }

        .cart-mobile-sticky * {
            pointer-events: auto;
        }

    /* ✅ 포인트/쿠폰 패널(결제바 위) - 이제 "바깥 카드" 안에 포함되므로 개별 카드 제거 */
    .cart-mobile-discount {
        border: 0 !important;
        border-radius: 0 !important;
        background: transparent !important;
        box-shadow: none !important;
        overflow: hidden;
        margin-bottom: 0 !important; /* ✅ 틈 제거 */
    }

    .cart-mobile-discount-toggle {
        width: 100%;
        border: 0;
        background: transparent !important; /* ✅ 바깥 카드 배경을 사용 */
        cursor: pointer;
        display: grid;
        grid-template-columns: 1fr auto auto;
        align-items: center;
        gap: 10px;
        padding: 10px 0; /* ✅ 바깥 패딩과 자연스럽게 */
        text-align: left;
    }

    .cart-mobile-discount-title {
        font-size: 14px;
        font-weight: 800;
        color: #222;
    }

    .cart-mobile-discount-sub {
        font-size: 16px;
        color: #666;
        white-space: nowrap;
    }

    .cart-mobile-discount-caret {
        font-size: 36px;
        color: #444;
        transform: rotate(0deg);
        transition: transform .18s ease;
    }

    .cart-mobile-discount.open .cart-mobile-discount-caret {
        transform: rotate(180deg);
    }

    .cart-mobile-discount-body {
        border-top: 1px solid #f0f0f0;
        padding: 10px 0 0px; /* ✅ 좌우 0으로(한 카드 느낌) */
        max-height: 0;
        overflow: hidden;
        transition: max-height .22s ease;
    }

    .cart-mobile-discount.open .cart-mobile-discount-body {
        max-height: 70vh; /* 충분히 크게 */
    }

    /* ✅ 하단 결제바 - 개별 카드 제거 + 내부 구분선만 */
    .cart-mobile-paybar {
        border: 0 !important;
        border-radius: 0 !important;
        background: transparent !important;
        box-shadow: none !important;
        padding: 12px 0 0; /* ✅ 위쪽만 여백 */
        margin-top: 5px;
        border-top: 1px solid #f0f0f0; /* ✅ 포인트/쿠폰과 한 카드 내부 구분 */
        display: grid;
        grid-template-columns: 1fr 140px;
        gap: 10px;
        align-items: center;
    }

    .cart-mobile-payinfo {
        display: flex;
        flex-direction: column;
        gap: 2px;
        min-width: 0;
    }

    .cart-mobile-paylabel {
        font-size: 14px;
        color: #666;
        font-weight: 700;
    }

    .cart-mobile-payamount {
        font-size: 25px;
        font-weight: 900;
        color: #111;
        letter-spacing: -0.2px;
        white-space: nowrap;
    }

    .cart-mobile-orderbtn {
        width: 100%;
        min-width: 0;
        height: 46px;
        font-size: 15px;
        font-weight: 800;
    }

    .cart-mobile-hint {
        margin-top: 8px;
        padding: 10px 12px;
        border-radius: 12px;
        background: #fff;
        border: 1px solid #ffe0e0;
        color: #ef4444;
        font-size: 12px;
        font-weight: 800;
        box-shadow: 0 8px 22px rgba(0,0,0,.08);
    }
}



/* ---------- <= 600px ---------- */
@media (max-width: 600px) {

    .cart-group-box {
        margin-left: -4px;
        margin-right: -4px;
        border-radius: 8px;
    }

    .cart-item-main img {
        width: 60px;
        height: 60px;
    }

    .cart-item-option-line {
        grid-template-columns: 1fr 72px 110px;
    }

    .cart-summary {
        padding: 16px 14px 14px;
    }

    .final-pay .final-label {
        font-size: 15px;
    }

    .final-pay .final-amount {
        font-size: 26px;
    }

    .opt-qty button {
        width: 30px;
        height: 30px;
    }

    /* 결제바 버튼 폭 살짝 축소 (소형) */
    .cart-mobile-paybar {
        grid-template-columns: 1fr 128px;
    }
}
