/* ========================================
   주문내역 전용 CSS - 장바구니 스타일 기반 수정
   ======================================== */

/* 메인 컨테이너 - cart.css와 동일 */
.order-history-wrap {
    max-width: var(--content-max);
    margin-inline: auto;
    margin-top: 144px;
    min-height: calc(100vh - 240px);
}

.order-history-container {
    display: flex;
    gap: 40px;
    width: 100%;
}

/* ========================================
   사이드바는 common-side.css에서 관리
   ======================================== */

/* ========================================
   메인 콘텐츠 스타일 - cart.css와 동일
   ======================================== */
.order-history-content {
    flex: 1;
    min-width: 0;
}

.section-header {
    margin-bottom: 40px;
    text-align: center; /* 장바구니와 동일하게 중앙 정렬 */
}

.section-header h1 {
    font-size: 28px; /* 장바구니와 동일한 크기 */
    font-weight: 700;
    color: var(--font-primary);
    margin: 0; /* 장바구니와 일치 */
}

/* ========================================
   기간 필터 (기존 유지)
   ======================================== */
.history-filter {
    display: flex;
    align-items: stretch;
    gap: 0;
    flex-wrap: wrap;
    margin-bottom: 40px;
    min-height: 60px;
}

.filter-label,
.period-selector {
    background: var(--input-bg);
    border: 1px solid var(--table-border);
}

.filter-label {
    background: var(--table-header-bg);
    border-radius: 8px 0 0 8px;
    border-right: none;
    padding: 14px 24px;
    font-weight: 400;
    font-size: 16px;
    color: var(--font-primary);
    white-space: nowrap;
    display: flex;
    align-items: center;
}

.period-selector {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    flex-wrap: wrap;
    padding: 14px 24px;
    border-radius: 0 8px 8px 0;
    margin-right: 16px;
    min-height: 60px;
    box-sizing: border-box;
}

.quick-periods {
    display: flex;
    gap: 16px;
    align-items: center;
}

.quick-periods input[type="radio"] {
    width: 16px;
    height: 16px;
    margin: 0;
    cursor: pointer;
}

.quick-periods label {
    font-size: 14px;
    color: var(--font-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.custom-period {
    display: flex;
    align-items: center;
    gap: 8px;
}

.custom-period input[type="date"] {
    height: 36px;
    padding: 0 12px;
    font-size: 14px;
    border: 1px solid var(--input-border);
    border-radius: 6px;
    background: var(--input-bg);
    color: var(--font-primary);
}


.sep {
    color: var(--font-light);
    font-size: 14px;
}

.btn-query {
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 400;
    border: 1px solid var(--btn-primary-border);
    background: var(--btn-primary-bg);
    color: var(--btn-primary-text);
    cursor: pointer;
    transition: .2s;
    display: flex;
    align-items: center;
    min-height: 50px;
    box-sizing: border-box;
    white-space: nowrap;
    min-width: 80px;
}

.btn-query:hover {
    filter: brightness(.9);
}

/* ========================================
   주문 테이블 스타일 (장바구니 기반)
   ======================================== */

/* 컬럼 너비 재정의 */
.order-history-table .col-order-info {
    width: 140px;
}

.order-history-table .col-image {
    width: 220px;
}

.order-history-table .col-product {
    width: auto;
    min-width: 250px;
}

.order-history-table .col-price {
    width: 200px;
}

.order-history-table .col-shipping {
    width: 180px;
}

.order-history-table .col-status {
    width: 160px; /* 버튼 크기 조정을 위해 확장 */
}

/* 기존 장바구니 컬럼 숨김 */
.order-history-table .col-checkbox,
.order-history-table .col-quantity,
.order-history-table .col-action {
    display: none;
}

/* ========================================
   주문 정보 컬럼 스타일
   ======================================== */
.col-order-info {
    text-align: center;
    vertical-align: middle;
    padding: 20px 12px;
}

.order-info-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
    justify-content: center;
    align-items: center;
    height: 100%;
}

.order-id {
    font-size: 13px;
    font-weight: 400;
    color: var(--font-primary);
    word-break: break-all;
}

.order-date {
    font-size: 12px;
    color: var(--font-light);
}

/* ========================================
   주문 내역 (상품명) 스타일
   ======================================== */
.col-product {
    text-align: left !important;
}

.order-name {
    font: 500 14px/1.4 var(--font-family, "Noto Sans KR", sans-serif);
    color: var(--font-primary);
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.order-summary {
    font-size: 13px;
    color: var(--font-light);
}

/* ========================================
   결제금액 컬럼 스타일 (3줄 구조)
   ======================================== */
.col-price {
    text-align: center;
    vertical-align: middle;
    padding: 20px 12px;
}

.price-breakdown {
    display: flex;
    flex-direction: column;
    gap: 3px;
    justify-content: center;
    align-items: center;
    height: 100%;
}

.pure-amount {
    font-size: 15px;
    font-weight: 700;
    color: var(--font-primary);
}

.delivery-fee {
    font-size: 12px;
    color: var(--font-light);
}

.total-amount {
}

/* ========================================
   배송 정보 스타일 (기존 유지 + 복사 기능)
   ======================================== */
.col-shipping {
    text-align: left;
    padding: 20px 12px;
}

.shipping-info {
    font-size: 13px;
    line-height: 1.4;
    color: var(--font-primary);
}

.shipping-info p {
    margin: 0 0 4px 0;
}

.shipping-info p:last-child {
    margin-bottom: 0;
}

.tracking-number {
    display: flex;
    align-items: center;
    gap: 6px;
}

.copy-btn {
    padding: 2px 6px;
    font-size: 11px;
    border: 1px solid var(--table-border);
    border-radius: 3px;
    background: #fff;
    color: var(--font-light);
    cursor: pointer;
    transition: background 0.2s;
    width: 50px;
}

.copy-btn:hover {
    background: #f5f5f5;
}

/* ========================================
   상태 컬럼 스타일 (뱃지 + 상세보기 버튼) - 수정
   ======================================== */
.col-status {
    text-align: center;
    padding: 20px 12px;
    vertical-align: middle;
}

.status-content {
    display: flex;
    flex-direction: column;
    gap: 8px;
    justify-content: center;
    align-items: center;
    height: 100%;
}

.badge {
    display: inline-block;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 400;
    color: var(--btn-primary-text);
    white-space: nowrap;
    min-width: 120px; /* 고정 너비 */
    text-align: center;
    border: 1px solid var(--btn-primary-border);
    background: var(--btn-primary-bg);
    cursor: default;
}

/* 뱃지 상태별 색상 제거하고 모두 primary 색상으로 통일 */
.badge.paid,
.badge.delivered,
.badge.pending,
.badge.shipping,
.badge.cancelled,
.badge.refund-exchange {
    background: var(--btn-primary-bg);
    color: var(--btn-primary-text);
    border: 1px solid var(--btn-primary-border);
}

.detail-btn {
    padding: 8px 12px;
    font-size: 12px;
    border: none;
    border-radius: 6px;
    background: #F8F8F8;
    color: var(--font-light);
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    text-decoration: none;
    min-width: 120px; /* 고정 너비 */
    text-align: center;
}

.detail-btn:hover {
    background: #F8F8F8;
    color: var(--font-primary);
}

/* ========================================
   빈 주문내역 스타일
   ======================================== */
.empty-orders {
    text-align: center;
    padding: 60px 20px;
}

.empty-message {
    color: #666;
}

.empty-message i {
    font-size: 48px;
    margin-bottom: 16px;
    color: #ddd;
}

.empty-message p {
    margin: 16px 0;
    font-size: 16px;
}

.loading {
    text-align: center;
    padding: 40px;
    color: #666;
}

/* ========================================
   반응형 스타일
   ======================================== */
@media (max-width: 1024px) {
    .order-history-container {
        flex-direction: column;
        gap: 30px;
    }

    .order-history-table .col-order-info {
        width: 120px;
    }

    .order-history-table .col-price {
        width: 120px;
    }

    .order-history-table .col-status {
        width: 140px;
    }
}

@media (max-width: 768px) {
    .order-history-wrap {
        margin-top: 120px;
    }

    .order-history-container {
        gap: 20px;
    }

    .section-header h1 {
        font-size: 24px;
    }

    /* 모바일 대응 */
    .history-filter {
        flex-direction: column;
        align-items: stretch;
        gap: 0;
    }

    .filter-label {
        border-radius: 8px 8px 0 0;
        border-right: 1px solid var(--table-border);
        border-bottom: none;
    }

    .period-selector {
        border-radius: 0 0 8px 8px;
        border-top: none;
        margin-right: 0;
        margin-bottom: 12px;
        justify-content: flex-start;
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }

    .quick-periods {
        gap: 12px;
        flex-wrap: wrap;
        width: 100%;
    }

    .custom-period {
        width: 100%;
        justify-content: center;
    }

    .btn-query {
        width: 100%;
        border-radius: 8px;
        border: 1px solid var(--btn-primary-border);
    }

    .product-table-container {
        overflow-x: auto;
    }

    .order-history-table {
        min-width: 900px;
    }

    .order-name {
        font-size: 14px;
    }

    /* 모바일에서 버튼 크기 조정 */
    .badge {
        min-width: 100px;
        font-size: 11px;
    }

    .detail-btn {
        min-width: 100px;
        font-size: 11px;
    }
}

@media (max-width: 480px) {
    .order-history-wrap {
        margin-top: 100px;
    }

    .section-header h1 {
        font-size: 20px;
    }

    .custom-period input[type="date"] {
        flex: 1;
    }

    .order-history-table {
        min-width: 800px;
    }

    /* 모바일에서 더 작은 버튼 크기 */
    .badge {
        min-width: 90px;
        font-size: 10px;
        padding: 6px 8px;
    }

    .detail-btn {
        min-width: 90px;
        font-size: 10px;
        padding: 6px 8px;
    }
}