/* 장바구니 페이지 스타일 */

/* 스텝 표시기 스타일 */
.cart-steps {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem 0;
    margin-bottom: 1.5rem;
}

.step {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    margin: 0 10px;
}

.step-number {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #e9ecef;
    color: #777;
    font-weight: bold;
    margin-bottom: 0.5rem;
}

.step.active .step-number {
    background-color: var(--primary-color);
    color: #fff;
}

.step-text {
    font-size: 0.9rem;
    color: #777;
}

.step.active .step-text {
    color: var(--primary-color);
    font-weight: 500;
}

.step-line {
    flex-grow: 1;
    height: 2px;
    background-color: #e9ecef;
    margin: 0 0.75rem;
    margin-bottom: 1.5rem;
    max-width: 50px;
}

/* 장바구니 상품 스타일 */
.cart-header {
    border-radius: 0.25rem;
    display: flex;
    align-items: center;
}

.cart-item {
    border: 1px solid #dee2e6;
    border-radius: 0.5rem;
    transition: box-shadow 0.2s ease;
    margin-bottom: 1rem;
}

.cart-item:hover {
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}

.cart-item .card-body {
    padding: 1rem;
}

.cart-item-img {
    width: 80px;
    height: 80px;
    object-fit: contain;
    background-color: #f8f9fa;
    border-radius: 0.25rem;
}

.cart-item-title {
    font-size: 1rem;
    font-weight: 500;
    margin-bottom: 0.25rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.price-original {
    text-decoration: line-through;
    color: #777;
    font-size: 0.85rem;
}

.price-discounted {
    font-weight: 500;
    color: var(--accent-color);
    font-size: 1rem;
}

.item-subtotal {
    font-size: 1.1rem;
    color: var(--accent-color);
}

.item-remove-btn {
    opacity: 0.5;
    transition: opacity 0.2s ease;
}

.item-remove-btn:hover {
    opacity: 1;
}

.item-discount-info {
    font-size: 0.8rem;
}

/* 수량 조절 컨트롤 스타일 */
.quantity-control-item {
    border: 1px solid #ccc;
    border-radius: 4px;
    overflow: hidden;
    width: 120px;
    display: flex;
    align-items: stretch;
}

.quantity-input {
    flex: 1;
    background-color: transparent;
    border: none;
    text-align: center;
    width: 40px;
    height: 40px;
    line-height: 40px;
    padding: 0;
    font-size: 14px;
}

.quantity-input:focus {
    outline: none;
}

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

.qty-btn {
    flex: 0 0 40px;
    background-color: #f8f9fa;
    border: none;
    color: #777;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.qty-minus {
    border-right: 1px solid #ccc;
}

.qty-plus {
    border-left: 1px solid #ccc;
}

/* 결제 정보 요약 스타일 */
.order-summary-card {
    top: 1rem;
}

.summary-item {
    font-size: 0.95rem;
}

.total-amount {
    font-size: 1.2rem;
    color: var(--accent-color);
}

/* 빈 장바구니 스타일 */
.empty-cart-icon {
    font-size: 4rem;
    color: #ccc;
}

.empty-cart-icon i {
    opacity: 0.7;
}

/* 모든 체크박스/라디오 버튼 스타일 통합 개선 */
.form-check {
    margin: 0;
    padding: 0;
    position: relative;
    min-width: 35px;
    display: flex;
    justify-content: center;
}

/* 체크박스와 라디오 버튼 주조색 적용 */
.cart-container .form-check-input:checked {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

/* 체크박스와 라디오 버튼 포커스 스타일 */
.cart-container .form-check-input:focus {
    border-color: rgba(126, 79, 34, 0.5);
    box-shadow: 0 0 0 0.25rem rgba(126, 79, 34, 0.25);
}

/* 강화된 체크박스 컨테이너 스타일 - 모든 아이템에 적용 */
.cart-container .cart-item .col-auto:first-child {
    width: 60px;
    min-width: 60px;
    padding-right: 0;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* 체크박스 위치 고정 */
.cart-container .form-check-input {
    position: relative;
    margin: 0;
}

/* 배송 옵션 라디오 버튼 영역 */
.shipping-option .form-check {
    min-width: 30px;
}

/* 카트 아이템 레이아웃 개선 */
.cart-item .row {
    display: flex;
    align-items: center;
}

/* 특별 처리 - 체크박스 컨테이너에 직접 스타일 적용 */
.checkbox-container {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 60px;
    min-width: 60px;
    padding: 0;
}

/* 전체선택 체크박스 스타일도 수정 */
.cart-header .form-check {
    min-width: 30px;
    display: inline-flex;
}

/* 아이템 옵션 스타일 */
.item-options {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
}

.cart-container .item-options .badge {
    font-weight: normal;
    font-size: 0.75rem;
    padding: 0.35em 0.65em;
    background-color: #f8f9fa;
    color: #495057;
    border: 1px solid #dee2e6;
}

/* 배송 정보 스타일 */
.shipping-info {
    font-size: 0.8rem;
    color: #777;
}

.shipping-info i {
    margin-right: 0.25rem;
    font-size: 0.9rem;
}

/* 카트 요약 정보에서 포인트 관련 내용 제거 */
.summary-item.points-summary {
    display: none;
}

/* 배송 정보 섹션 디자인 개선 */
.shipping-details-card {
    border: none;
    border-radius: 0.5rem;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    margin-bottom: 1.5rem;
    background-color: #f8f9fa;
}

.shipping-details-card .card-header {
    background-color: transparent;
    border-bottom: 1px solid rgba(0,0,0,0.1);
    padding: 1rem 1.25rem;
}

.shipping-details-card .card-header h5 {
    margin-bottom: 0;
    font-size: 1.1rem;
    color: var(--primary-color);
}

.shipping-details-card .card-body {
    padding: 1.25rem;
}

.shipping-option {
    border: 1px solid #dee2e6;
    border-radius: 0.5rem;
    padding: 1rem;
    margin-bottom: 1rem;
    background-color: #fff;
    transition: all 0.2s ease;
    cursor: pointer;
}

.shipping-option:hover {
    border-color: #adb5bd;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.035);
}

.shipping-option.selected {
    border-color: var(--primary-color);
    background-color: rgba(126, 79, 34, 0.03);
}

.shipping-option .shipping-icon {
    margin-right: 1rem;
    font-size: 1.5rem;
    color: var(--primary-color);
    opacity: 0.8;
}

.shipping-option .shipping-method {
    font-weight: 500;
}

.shipping-option .shipping-price {
    font-weight: 500;
    color: var(--accent-color);
}

.shipping-details-footer {
    background-color: transparent;
    border-top: 1px solid rgba(0,0,0,0.1);
    padding: 1rem 1.25rem;
}

/* 반응형 스타일 */
/* M-51: 프로젝트 표준 브레이크포인트(767.98 / 1199.98) 에 맞춰 991.98 → 1199.98 로 통일.
         태블릿 대형 화면(992~1199)에서도 스텝 인디케이터가 작게 표시되어야 자연스러우며,
         데스크탑(1200+)에서만 원본 크기를 유지한다. */
@media (max-width: 1199.98px) {
    .cart-item-title {
        font-size: 0.95rem;
    }

    .cart-steps {
        padding: 1rem 0;
    }

    .step-number {
        width: 36px;
        height: 36px;
        font-size: 0.9rem;
    }

    .step-text {
        font-size: 0.85rem;
    }
}

@media (max-width: 767.98px) {
    .cart-item-img {
        width: 70px;
        height: 70px;
    }
    
    .cart-item-title {
        font-size: 0.9rem;
        -webkit-line-clamp: 2;
    }
    
    .quantity-control-item {
        width: 90px;
    }
    
    .step-number {
        width: 32px;
        height: 32px;
        font-size: 0.85rem;
    }
    
    .step-text {
        font-size: 0.8rem;
    }
    
    .cart-item .row {
        flex-wrap: wrap;
    }
    
    .col-md-2 {
        margin-top: 0.75rem;
        text-align: right;
    }
    
    .cart-container .quantity-control {
        justify-content: flex-start;
    }
    
    .item-subtotal {
        font-size: 1rem;
    }
    
    /* .pe-0, .ms-1: Bootstrap 유틸리티 클래스는 !important 사용으로 재정의 불가 — 제거됨 */

    .cart-item-img {
        margin-left: -0.5rem;
    }
    
    .cart-item-actions {
        display: flex;
        align-items: center;
        justify-content: space-between;
        margin-top: 0.75rem;
        border-top: 1px solid #f0f0f0;
        padding-top: 0.75rem;
    }
    
    .cart-item-actions .quantity-control {
        margin-right: 0;
    }
    
    .cart-item-actions .item-price-actions {
        display: flex;
        align-items: center;
    }
    
    .cart-item-actions .item-subtotal {
        margin-right: 1rem;
    }
    
    .cart-container .cart-item-actions .item-remove-btn {
        margin-top: 0;
    }

    .cart-container .cart-item-mobile-layout {
        display: flex;
        visibility: visible;
        align-items: center;
        gap: 10px; /* 모든 요소 사이에 간격 추가 */
    }
    
    /* 체크박스 */
    .cart-item-checkbox {
        flex: 0 0 24px;
        display: flex;
        align-items: center;
        margin-right: 5px; /* 오른쪽 간격 추가 */
    }
    
    /* 상품 이미지 */
    .cart-item-image {
        flex: 0 0 auto;
        margin-right: 10px; /* 오른쪽 간격 추가 */
    }
    
    /* 상품 정보 */
    .cart-item-info {
        flex: 1;
        min-width: 0;
        padding-right: 4px;
        padding-left: 5px; /* 왼쪽 간격 추가 */
    }
}

@media (max-width: 575.98px) {
    .cart-steps {
        padding: 0.5rem 0 1rem;
    }
    
    .step-number {
        width: 28px;
        height: 28px;
        font-size: 0.8rem;
        margin-bottom: 0.25rem;
    }
    
    .step-text {
        font-size: 0.75rem;
    }
    
    .step-line {
        margin-bottom: 1rem;
    }
    
    .cart-item-img {
        width: 65px;
        height: 65px;
    }
    
    .cart-container .cart-header {
        padding: 0.75rem;
    }

    .cart-container .card-body {
        padding: 0.75rem;
    }

    .cart-container .order-info-container .card-body {
        padding: 1rem;
    }
    
    .order-info-container ul {
        padding-left: 1.25rem;
    }
}

/* 버튼 스타일 */
/* .btn-primary: common.css 사용 */

.btn-outline-primary {
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-outline-primary:hover {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: #fff;
}

.btn-outline-secondary {
    color: #000;
    border-color: #000;
}

.btn-outline-secondary:hover {
    background-color: #f8f9fa;
    color: #000;
    border-color: #000;
}

.btn-link {
    text-decoration: none;
}

/* 유틸리티 클래스 */
.sticky-top {
    top: 1.5rem;
    z-index: 100;
}

/* 컬럼 간격 관리 */
.g-2 {
    --bs-gutter-x: 0.5rem;
}

/* 전체선택 체크박스와 글자 중앙 정렬 */
.cart-header {
    display: flex;
    align-items: center;
}

.cart-header .form-check {
    display: flex;
    align-items: center;
}

.cart-header .form-check-label {
    margin-left: 8px;
    font-size: 0.95rem;
}

/* 선택삭제 버튼 폰트 크기 맞춤 */
.cart-header .btn-link {
    font-size: 0.95rem;
    padding: 0;
}

/* 수량 조절, 가격, 삭제 버튼 한 줄 인라인 배치 */
.quantity-inline-control {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    margin-top: 1rem;
    border-top: 1px solid #f0f0f0;
    padding-top: 1rem;
}

.quantity-inline-wrap {
    display: flex;
    align-items: center;
    flex-shrink: 0; /* 전체 영역 크기 유지 */
}

.quantity-control-simple {
    display: flex;
    align-items: center;
    border: 1px solid #dee2e6;
    border-radius: 0.25rem;
    overflow: hidden;
    max-width: 112px; /* 전체 너비 제한 */
    flex-shrink: 0; /* 축소되지 않도록 설정 */
}

.quantity-control-simple .qty-btn {
    background-color: #f8f9fa;
    border: none;
    color: #495057;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    padding: 0;
    flex-shrink: 0; /* 버튼 크기 유지 */
}

.quantity-control-simple .qty-value {
    width: 40px;
    min-width: 40px; /* 최소 너비 지정 */
    text-align: center;
    line-height: 36px;
    font-weight: 500;
    background-color: #fff;
    border-left: 1px solid #dee2e6;
    border-right: 1px solid #dee2e6;
    flex-shrink: 0; /* 수량 표시 영역 크기 유지 */
}

.item-inline-price {
    font-weight: bold;
    margin: 0 0.5rem 0 1rem; /* 왼쪽 여백 늘리고 오른쪽 여백 줄임 */
    white-space: nowrap; /* 줄바꿈 방지 */
}

.item-inline-remove {
    opacity: 0.6;
    background: none;
    border: none;
    font-size: 1.2rem;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px; /* 너비 축소 */
    height: 32px; /* 높이 축소 */
    flex-shrink: 0; /* 크기 유지 */
}

.item-inline-remove:hover {
    opacity: 1;
}

/* 작은 화면에서 추가 최적화 */
@media (max-width: 375px) {
    .quantity-inline-control {
        flex-wrap: wrap; /* 필요시 줄바꿈 허용 */
    }
    
    .quantity-control-simple {
        max-width: 100px; /* 더 좁은 화면에서 너비 줄임 */
    }
    
    .quantity-control-simple .qty-btn {
        width: 36px; /* 최소 터치 타겟 보장 */
        height: 36px; /* 최소 터치 타겟 보장 */
    }
    
    .quantity-control-simple .qty-value {
        width: 30px; /* 수량 표시 영역 너비 축소 */
        min-width: 30px;
    }
    
    .item-inline-price {
        font-size: 0.95rem; /* 글꼴 크기 축소 */
        margin: 0 0.3rem 0 0.5rem; /* 여백 축소 */
    }
}

/* 모바일 레이아웃 전면 개선 (320px 기준) */

/* 카드 간소화 */
@media (max-width: 576px) {
    .cart-item {
        border-radius: 0.5rem;
        margin-bottom: 0.75rem;
        border: 1px solid rgba(0,0,0,0.08);
        box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    }
    
    .cart-container .cart-item .card-body {
        padding: 0.75rem;
    }

    /* 상품 정보 레이아웃 최적화 */
    .cart-container .cart-item-title {
        font-size: 0.95rem;
        margin-bottom: 0.25rem;
        line-height: 1.4;
        -webkit-line-clamp: 2;
    }

    .cart-container .cart-item-img {
        width: 70px;
        height: 70px;
        object-fit: contain;
        background-color: #f8f9fa;
        border-radius: 0.25rem;
    }

    /* 상품 설명 간소화 */
    .cart-container .text-muted.small {
        font-size: 0.7rem;
        margin-bottom: 0.2rem;
    }

    /* 옵션 태그 컴팩트하게 */
    .cart-container .item-options {
        margin-bottom: 0.35rem;
    }

    .cart-container .item-options .badge {
        font-size: 0.65rem;
        padding: 0.25em 0.5em;
    }

    /* 가격 정보 간소화 */
    .price-info {
        margin-bottom: 0.5rem;
    }

    .cart-container .price-original {
        font-size: 0.75rem;
    }

    .cart-container .price-discounted {
        font-size: 0.9rem;
        font-weight: 600;
    }

    /* 체크박스 컨테이너 최적화 */
    .cart-container .checkbox-container {
        width: 32px;
        min-width: 32px;
        padding-right: 0;
    }

    .cart-container .form-check-input {
        width: 16px;
        height: 16px;
    }

    /* 상품 정보 영역 패딩 감소 */
    .cart-container .cart-item .col-auto {
        padding-right: 0.5rem;
        padding-left: 0.5rem;
    }

    /* 상품 정보 영역 패딩 감소 — Bootstrap .ps-0 uses !important, must match */
    .cart-item .col.ps-0 {
        padding-left: 0 !important;
        padding-right: 0.5rem !important;
    }
}

/* 수량 컨트롤 및 가격 완전 개선 - 320px부터 425px까지 대응 */
.mobile-product-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(0,0,0,0.06);
}

/* 수량 조절 버튼 스타일 */
.quantity-control-compact {
    display: flex;
    align-items: center;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    overflow: hidden;
    height: 36px;
    background-color: #fff;
}

.qty-btn-compact {
    width: 36px;
    height: 36px;
    background: #f8f9fa;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    color: #495057;
    padding: 0;
}

.qty-value-compact {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 500;
    border-left: 1px solid #dee2e6;
    border-right: 1px solid #dee2e6;
    font-size: 0.9rem;
}

/* 가격 및 삭제 버튼 */
.mobile-price-actions {
    display: flex;
    align-items: center;
}

.item-price-compact {
    font-weight: 600;
    font-size: 0.95rem;
    margin-right: 0.5rem;
    white-space: nowrap;
}

.item-delete-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid #dee2e6;
    background-color: #fff;
    color: #777;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    padding: 0;
}

/* 모바일 — WCAG 2.5.5 권장 44x44px 터치 타겟 보장 */
@media (max-width: 767.98px) {
    .item-delete-btn {
        min-width: 44px;
        min-height: 44px;
        padding: 8px;
    }
}

/* 다양한 화면 크기 대응 */
@media (max-width: 360px) {
    .qty-btn-compact {
        width: 36px;
    }
    
    .qty-value-compact {
        width: 30px;
    }
    
    .item-price-compact {
        font-size: 0.9rem;
    }
}

@media (min-width: 361px) and (max-width: 425px) {
    .qty-btn-compact {
        width: 36px;
    }
    
    .qty-value-compact {
        width: 36px;
    }
}

/* 모바일 하단 주문 버튼 개선 */
.mobile-order-button {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: #fff;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.1);
    z-index: 1000;
    padding: 0.75rem 1rem;
    padding-bottom: calc(0.75rem + env(safe-area-inset-bottom));
    display: none;
}

@media (max-width: 767.98px) {
    .mobile-order-button {
        display: block;
    }
    
    main {
        padding-bottom: 80px;
    }
}

/* 주문 버튼 50:50 레이아웃 */
.mobile-order-button-inner {
    display: flex;
    align-items: stretch;
    height: 48px;
    border-radius: 0.25rem;
    overflow: hidden;
    border: 1px solid var(--primary-color);
}

.mobile-order-price {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1rem;
    background-color: #f8f9fa;
    color: var(--accent-color);
}

.mobile-order-button .btn {
    flex: 1;
    margin: 0;
    border-radius: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    height: 100%;
    border: none;
}

/* 매우 작은 화면(320px 정확히)에서 추가 최적화 */
@media (max-width: 320px) {
    .cart-item-img {
        width: 90px;
        height: 90px;
        margin-right: 8px;
    }
    
    .cart-container .checkbox-container {
        min-width: 24px;
        width: 24px;
        margin-right: 4px;
    }

    .cart-item-title {
        font-size: 14px;
        line-height: 1.3;
        -webkit-line-clamp: 2;
        margin-bottom: 6px;
    }

    .cart-container .text-muted.small {
        font-size: 12px;
        margin-bottom: 6px;
    }

    .cart-container .price-original {
        font-size: 12px;
        margin-bottom: 4px;
    }
    
    .price-discounted {
        font-size: 14px;
        font-weight: 600;
    }
    
    .qty-btn-compact {
        width: 36px;
        height: 36px;
    }

    .qty-value-compact {
        width: 30px;
        height: 36px;
        font-size: 14px;
    }
    
    .item-price-compact {
        font-size: 14px;
        font-weight: 600;
    }
    
    .mobile-product-controls {
        margin-top: 12px;
    }
    
    .cart-container .item-option-buttons {
        margin-top: 10px;
    }
    
    .item-option-buttons .btn {
        padding: 4px 8px;
        font-size: 12px;
    }
}

/* 중간 화면(321px-375px)에서 조정 */
@media (min-width: 321px) and (max-width: 375px) {
    .cart-container .cart-item-img {
        width: 75px;
        height: 75px;
    }

    .cart-container .checkbox-container {
        width: 30px;
        min-width: 30px;
    }
}

/* 넓은 모바일 화면(376px-576px)에서 조정 */
@media (min-width: 376px) and (max-width: 576px) {
    .cart-container .cart-item-img {
        width: 80px;
        height: 80px;
    }

    .cart-container .checkbox-container {
        width: 35px;
        min-width: 35px;
    }
}

/* 모바일 하단 고정 버튼 스타일 - 반응형 폰트 크기 */
.mobile-order-button {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background-color: #fff;
    box-shadow: 0 -2px 6px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    padding: 12px 16px;
    padding-bottom: calc(12px + env(safe-area-inset-bottom)); /* iPhone 노치/홈바 영역 회피 */
    display: none;
}

@media (max-width: 767.98px) {
    .mobile-order-button {
        display: block;
    }
    
    main {
        padding-bottom: 70px;
    }
}

.mobile-order-button .btn {
    height: 46px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

/* 모바일 해상도별 폰트 크기 조절 */
@media (max-width: 320px) {
    .mobile-order-button .btn {
        font-size: 14px;
        height: 44px;
        padding: 6px 10px;
    }
}

@media (min-width: 321px) and (max-width: 375px) {
    .mobile-order-button .btn {
        font-size: 15px;
        height: 45px;
    }
}

@media (min-width: 376px) and (max-width: 425px) {
    .mobile-order-button .btn {
        font-size: 16px;
    }
}

@media (min-width: 426px) and (max-width: 767.98px) {
    .mobile-order-button .btn {
        font-size: 16px;
    }
}

/* 체크박스 색상을 브랜드 컬러로 변경 (duplicate - see .cart-container .form-check-input:checked above) */

/* 320px 최적화 장바구니 아이템 스타일 */
.cart-item {
    border: 1px solid #eee;
    border-radius: 8px;
    margin-bottom: 10px;
}

.cart-item .card-body {
    padding: 10px;
}

/* 장바구니 아이템 레이아웃 (가로 배열) */
.cart-item .d-flex {
    gap: 8px;
}

/* 체크박스 */
.cart-item-checkbox {
    flex: 0 0 24px;
    display: flex;
    align-items: center;
}

.cart-item-checkbox .form-check-input {
    margin: 0;
    cursor: pointer;
}

/* 상품 이미지 */
.cart-item-image {
    flex: 0 0 auto;
}

.cart-item-img {
    width: 80px;
    height: 80px;
    object-fit: contain;
    background-color: #f8f9fa;
    border-radius: 4px;
}

/* 상품 정보 */
.cart-item-info {
    flex: 1;
    min-width: 0;
    padding-right: 4px;
}

.cart-item-title {
    font-size: 14px;
    font-weight: 500;
    line-height: 1.3;
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
}

.cart-item-option {
    font-size: 12px;
    color: #777;
    margin-bottom: 4px;
}

.cart-item-price {
    margin-bottom: 4px;
}

.price-original {
    font-size: 12px;
    color: #999;
    text-decoration: line-through;
    margin-bottom: 2px;
}

.price-discounted {
    font-size: 14px;
    font-weight: 600;
    color: #000;
}

.item-discount-text {
    display: block;
    font-size: 0.75rem;
    color: #dc3545;
    margin-top: 0.25rem;
}

/* 수량 조절 스타일 */
.quantity-control-container {
    display: flex;
    justify-content: center;
    align-items: center;
}

.quantity-control-item {
    display: flex;
    align-items: stretch;
    border: 1px solid #ccc;
    border-radius: 0.25rem;
    overflow: hidden;
    width: 120px;
}

.quantity-input {
    flex: 1;
    width: 40px;
    height: 40px;
    line-height: 40px;
    padding: 0;
    text-align: center;
    border: none;
    background: transparent;
}

.quantity-input:focus {
    outline: none;
}

.qty-btn {
    width: 40px;
    height: 40px;
    background: #f8f9fa;
    border: none;
    color: #777;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.qty-minus {
    border-right: 1px solid #ccc;
}

.qty-plus {
    border-left: 1px solid #ccc;
}

/* 가격과 삭제 버튼 스타일 */
.price-delete-container {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    min-width: 120px;
}

.item-subtotal {
    font-size: 16px;
    font-weight: 600;
    color: var(--accent-color);
    margin-right: 10px;
    white-space: nowrap;
}

.item-remove-btn {
    background: transparent;
    border: none;
    font-size: 18px;
    color: #777;
    cursor: pointer;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.item-remove-btn:hover {
    opacity: 1;
}

.item-remove-btn::before {
    content: "\00D7";
    display: block;
}

.item-remove-btn span {
    display: none;
}

/* 태블릿 및 데스크톱 레이아웃 개선 */
@media (min-width: 768px) {
    /* 그리드 레이아웃 열 비율 조정 */
    .cart-container .cart-item-desktop-layout {
        display: grid;
        /* fr 단위를 사용하여 상품 정보 영역에 더 많은 공간 할당 */
        grid-template-columns: minmax(30px, auto) minmax(80px, auto) minmax(200px, 3fr) minmax(120px, 1fr) minmax(120px, 1fr);
        align-items: center;
        gap: 15px;
        width: 100%;
    }
    
    /* 체크박스 영역 */
    .checkbox-container {
        justify-self: center;
        width: 30px;
    }
    
    /* 이미지 영역 */
    .cart-item-image-container {
        width: 80px;
        justify-self: center;
    }
    
    /* 상품 정보 영역 - 최대한 공간 확보 */
    .cart-item-info-container {
        min-width: 0; /* 그리드 셀이 축소될 때 내용이 넘치지 않도록 */
        padding-right: 10px;
    }
    
    .cart-item-title {
        white-space: normal;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    /* 수량 조절 영역 - 너비 고정 및 위치 조정 */
    .quantity-control-container {
        justify-self: center;
        width: 100%;
        max-width: 140px;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 8px;
    }

    .quantity-control-item {
        width: 100%;
        max-width: 120px;
        margin: 0 auto;
    }

    /* 옵션 변경 버튼 추가 */
    .quantity-control-container .btn-option-change {
        font-size: 0.8rem;
        padding: 0.25rem 0.5rem;
        width: 100%;
        max-width: 120px;
        margin-top: 4px;
    }
    
    /* 가격 및 삭제 버튼 영역 */
    .price-delete-container {
        justify-self: end;
        min-width: 0;
        white-space: nowrap;
    }
    
    /* 줄임말 처리 */
    .cart-item-title {
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
        max-height: 2.6em;
    }
}

/* 1200px 이상 큰 화면에서 여유 있는 레이아웃 */
@media (min-width: 1200px) {
    .cart-item-desktop-layout {
        grid-template-columns: minmax(24px, auto) minmax(80px, auto) minmax(120px, 3fr) minmax(100px, 1fr) minmax(140px, 2fr);
        gap: 12px;
    }

    .cart-item-img {
        width: 90px;
        height: 90px;
    }

    .cart-item-title {
        font-size: 1.1rem;
    }
}

/* 태블릿 화면 최적화 */
@media (min-width: 768px) and (max-width: 991.98px) {
    .cart-item-desktop-layout {
        grid-template-columns: minmax(30px, auto) minmax(70px, auto) minmax(160px, 2fr) minmax(100px, 1fr) minmax(100px, 1fr);
        gap: 10px;
    }
    
    .cart-item-img {
        width: 70px;
        height: 70px;
    }
    
    .cart-item-title {
        font-size: 0.9rem;
    }
    
    .cart-item-option {
        font-size: 0.8rem;
    }
    
    /* 태블릿: 데스크탑과 동일한 40+40+40=120px 컨트롤 유지 (grid 4열 minmax 100/1fr 로 수용 가능) */
    .quantity-control-item {
        max-width: 120px;
    }
    
    .item-subtotal {
        font-size: 14px;
        margin-right: 5px;
    }
    
    .item-remove-btn {
        width: 20px;
        height: 20px;
        font-size: 16px;
    }
}

/* 중간 크기 화면 최적화 */
@media (min-width: 992px) and (max-width: 1199.98px) {
    .cart-item-desktop-layout {
        grid-template-columns: minmax(24px, auto) minmax(70px, auto) minmax(120px, 3fr) minmax(90px, 1fr) minmax(90px, 1fr);
        gap: 10px;
    }

    .cart-item-img {
        width: 70px;
        height: 70px;
    }

    .item-subtotal {
        font-size: 15px;
    }
}

/* 모바일/데스크톱 레이아웃 전환 — mobile-first 방식 (base = mobile) */

/* 기본(모바일) 상태: 데스크톱 레이아웃 숨김, 모바일 레이아웃 표시 */
.cart-container .cart-item-desktop-layout {
    display: none;
}

.cart-container .cart-item-mobile-layout {
    display: flex;
    align-items: center;
    gap: 10px; /* 모든 요소 사이에 간격 추가 */
}

.cart-container .cart-summary-mobile {
    display: block;
}

/* 모바일 전용 세부 스타일 */
@media (max-width: 767.98px) {
    /* 체크박스 */
    .cart-item-checkbox {
        flex: 0 0 24px;
        display: flex;
        align-items: center;
        margin-right: 5px; /* 오른쪽 간격 추가 */
    }

    /* 상품 이미지 */
    .cart-item-image {
        flex: 0 0 auto;
        margin-right: 10px; /* 오른쪽 간격 추가 */
    }

    /* 상품 정보 */
    .cart-item-info {
        flex: 1;
        min-width: 0;
        padding-right: 4px;
        padding-left: 5px; /* 왼쪽 간격 추가 */
    }
}

/* 태블릿/데스크톱 레이아웃 (768px 이상) — 모바일 기본 상태를 뒤집음 */
@media (min-width: 768px) {
    .cart-container .cart-item-mobile-layout {
        display: none;
    }

    .cart-container .cart-item-desktop-layout {
        display: grid;
    }

    .mobile-order-button {
        display: none;
    }

    .cart-container .order-summary-card {
        display: block;
    }

    .cart-container .cart-summary-mobile {
        display: none;
    }
}

/* 1224 해상도에서 X 버튼 영역 벗어남 문제 수정 */
@media (min-width: 768px) {
    /* 가격과 삭제 버튼을 담는 컨테이너 조정 */
    .price-delete-container {
        display: flex;
        align-items: center;
        justify-content: flex-end;
        position: relative; /* 포지셔닝 컨텍스트 설정 */
        padding-right: 30px; /* X 버튼 공간 확보 */
        min-width: 100px; /* 최소 너비 설정 */
    }
    
    /* 가격 영역 조정 */
    .item-subtotal {
        font-size: 16px;
        font-weight: 600;
        color: var(--accent-color);
        margin-right: 0; /* 오른쪽 여백 제거 */
        white-space: nowrap;
    }
    
    /* 삭제 버튼 위치 조정 */
    .price-delete-container .item-remove-btn {
        position: absolute; /* 절대 위치 지정 */
        right: 0;
        top: 50%;
        transform: translateY(-50%);
        width: 24px;
        height: 24px;
        background: transparent;
        border: none;
        font-size: 18px;
        color: #777;
        display: flex;
        align-items: center;
        justify-content: center;
        opacity: 0.7;
        transition: opacity 0.2s;
    }
    
    .price-delete-container .item-remove-btn:hover {
        opacity: 1;
    }
    
    .price-delete-container .item-remove-btn::before {
        content: "\00D7";
        display: block;
    }
    
    .price-delete-container .item-remove-btn span {
        display: none;
    }
}

/* 중간 해상도 최적화 (992px - 1300px) */
@media (min-width: 992px) and (max-width: 1300px) {
    /* 그리드 레이아웃 조정으로 컬럼 간격 최적화 */
    .cart-item-desktop-layout {
        grid-template-columns: minmax(30px, auto) minmax(80px, auto) minmax(200px, 3fr) minmax(110px, 1fr) minmax(130px, 1fr);
        gap: 10px;
    }
    
    /* 가격 영역 조정 */
    .item-subtotal {
        font-size: 15px;
    }
    
    /* 가격과 삭제 버튼 컨테이너 */
    .price-delete-container {
        padding-right: 25px; /* X 버튼 공간 축소 */
    }
    
    /* 삭제 버튼 약간 축소 */
    .price-delete-container .item-remove-btn {
        width: 20px;
        height: 20px;
        font-size: 16px;
    }
}

/* 특히 1224 해상도 근처에서 최적화 */
@media (min-width: 1200px) and (max-width: 1250px) {
    /* 그리드 레이아웃 미세 조정 */
    .cart-item-desktop-layout {
        grid-template-columns: minmax(24px, auto) minmax(80px, auto) minmax(150px, 3fr) minmax(100px, 1fr) minmax(100px, 1fr);
    }

    /* 가격 영역 조정 */
    .price-delete-container {
        min-width: 90px;
        padding-right: 28px;
    }
}

/* 1224 해상도에서 상품 정보와 이미지 사이 갭 추가 */
@media (min-width: 768px) {
    /* 상품 정보 컨테이너에 왼쪽 여백 추가 */
    .cart-item-info-container {
        padding-left: 12px; /* 기본 여백 설정 */
    }
    
    /* 그리드 레이아웃에 갭 추가 */
    .cart-item-desktop-layout {
        gap: 15px; /* 기본 갭 설정 */
    }
    
    /* 이미지 컨테이너 스타일 */
    .cart-item-image-container {
        display: flex;
        justify-content: center;
    }
}

/* 중간 해상도 최적화 (992px - 1300px) */
@media (min-width: 992px) and (max-width: 1300px) {
    /* 상품 정보 컨테이너 왼쪽 여백 조정 */
    .cart-item-info-container {
        padding-left: 15px; /* 중간 해상도에서 여백 증가 */
    }
    
    /* 그리드 레이아웃 갭 조정 */
    .cart-item-desktop-layout {
        gap: 12px;
    }
}

/* 특히 1224 해상도 근처에서 최적화 */
@media (min-width: 1200px) and (max-width: 1250px) {
    /* 1224 해상도에서 여백 설정 */
    .cart-item-info-container {
        padding-left: 10px;
    }

    /* 그리드 레이아웃 조정 */
    .cart-item-desktop-layout {
        gap: 10px;
        grid-template-columns: minmax(24px, auto) minmax(80px, auto) minmax(150px, 3fr) minmax(100px, 1fr) minmax(100px, 1fr);
    }
}

/* 큰 해상도에서 여백 최적화 */
@media (min-width: 1251px) {
    .cart-item-info-container {
        padding-left: 12px;
    }

    .cart-item-desktop-layout {
        gap: 12px;
    }
}

/* 태블릿 해상도에서 여백 최적화 */
@media (min-width: 768px) and (max-width: 991.98px) {
    .cart-item-info-container {
        padding-left: 10px; /* 태블릿에서는 약간 작은 여백 */
    }
    
    .cart-item-desktop-layout {
        gap: 8px; /* 태블릿에서 작은 갭 */
    }
}

/* 넓은 화면에서 스텝 인디케이터 간격 최적화 */
@media (min-width: 992px) {
    .cart-steps {
        max-width: 600px; /* 최대 너비 제한으로 중앙에 모이게 함 */
        margin-left: auto;
        margin-right: auto;
    }
    
    .step-line {
        max-width: 60px; /* 큰 화면에서도 너무 넓어지지 않도록 */
    }
}

/* 좁은 화면에서도 적절한 간격 유지 */
@media (max-width: 767.98px) {
    .cart-steps {
        padding: 0.75rem 0;
    }
    
    .step-line {
        margin: 0 0.5rem;
        margin-bottom: 1.25rem;
        max-width: 40px;
    }
    
    .step {
        margin: 0 5px;
    }
    
    .step-number {
        width: 35px;
        height: 35px;
    }
}

/* 매우 좁은 화면에서 더 컴팩트하게 */
@media (max-width: 480px) {
    .cart-steps {
        padding: 0.5rem 0;
    }
    
    .step-line {
        margin: 0 0.3rem;
        margin-bottom: 1rem;
        max-width: 30px;
    }
    
    .step {
        margin: 0 3px;
    }
    
    .step-number {
        width: 30px;
        height: 30px;
        font-size: 0.9rem;
    }
    
    .step-text {
        font-size: 0.8rem;
    }
}

/* 모바일 헤더 아이콘 크기 조정 */
@media (max-width: 767.98px) {
    .header-icons.d-lg-none .btn-icon,
    .header-icons.d-lg-none .btn {
        font-size: 0.9rem;
        width: 32px;
        height: 32px;
        padding: 0;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .header-icons.d-lg-none .bi {
        font-size: 1.1rem;
    }
    
    .header-icons.d-lg-none .btn-icon + .btn-icon,
    .header-icons.d-lg-none .btn + .btn {
        margin-left: 4px;
    }
}

/* ========================================
   재고 부족 / 품절 상태
   ======================================== */

/* 품절 상품 */
.cart-container .cart-item.cart-item-sold-out {
    background-color: #f8f8f8;
    opacity: 0.7;
}

.cart-container .cart-item-sold-out .cart-item-img {
    opacity: 0.5;
}

.cart-container .cart-item-sold-out .cart-item-title a {
    color: #999;
}

.cart-item-sold-out .cart-item-price .price-discounted {
    color: #999;
    text-decoration: line-through;
}

/* 수량 조절된 상품 */
.cart-container .cart-item.cart-item-adjusted {
    border-color: #f0ad4e;
    background-color: #fff9f0;
}

/* 품절 배지 */
.cart-sold-out-badge {
    display: inline-block;
    background-color: #e74c3c;
    color: #fff;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 3px;
    margin-top: 4px;
}

/* 품절 수량 영역 */
.qty-disabled {
    display: flex;
    align-items: center;
    justify-content: center;
}

.cart-sold-out-text {
    color: #e74c3c;
    font-weight: 600;
    font-size: 0.85rem;
}