/* 우측 사이드바가 숨겨진 페이지(주문내역 등)에서 730px 빈 공간 없이 100% 가로 확장 */
.shop-layout--no-right,
.shop-layout:has(.shop-right.is-hidden) {
    grid-template-columns: 250px minmax(0, 1fr);
}

.shop-layout--no-right .shop-main,
.shop-layout:has(.shop-right.is-hidden) .shop-main,
.shop-layout--no-right .order-wrap,
.shop-layout:has(.shop-right.is-hidden) .order-wrap {
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    max-width: none;
}

/* ========================
   주문 내역 (가로 최신순, 페이지당 6건)
======================== */

.order-wrap .order-search__input {
    min-width: 0;
}

.order-wrap .order-history__grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-rows: none;
    grid-auto-flow: row;
    grid-auto-rows: minmax(285px, auto);
    width: 100%;
    gap: 16px;
}

.order-card {
    min-width: 0;
    box-sizing: border-box;
    background: #fff;
    border: 1px solid #E5E5E5;
    border-radius: 12px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: transform 0.15s ease, box-shadow 0.2s ease, border-color 0.2s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.03);
}

.order-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.08);
    border-color: #d0d0d0;
}

/* 상단 배지 + 일시 */
.order-card__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 14px;
}

.order-card__status {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.4;
    white-space: nowrap;
}

/* 상태별 세련된 배지 테마 */
.order-card__status--pending {
    background: #FFF4E5;
    color: #D96B00;
    border: 1px solid #FFE0B2;
}

.order-card__status--wait {
    background: #FFF0F0;
    color: #BA0000;
    border: 1px solid #FFCDD2;
}

.order-card__status--ing {
    background: #E8F4FD;
    color: #0A66C2;
    border: 1px solid #BBDEFB;
}

.order-card__status--done {
    background: #E8F5E9;
    color: #2E7D32;
    border: 1px solid #C8E6C9;
}

.order-card__status--stop,
.order-card__status--fail {
    background: #FFEBEE;
    color: #C62828;
    border: 1px solid #FFCDD2;
}

.order-card__status--cancel {
    background: #F5F5F5;
    color: #757575;
    border: 1px solid #E0E0E0;
}

.order-card__date {
    font-size: 13px;
    color: #888;
}

/* 주문번호 */
.order-card__no-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: #777;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px dashed #eee;
}

.order-card__no-label {
    font-size: 11px;
    color: #999;
}

.order-card__no-val {
    font-family: inherit;
    font-weight: 600;
    color: #444;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 170px;
}

.order-card__btn-copy {
    margin-left: auto;
    font-size: 11px;
    padding: 3px 8px;
    border: 1px solid #dcdcdc;
    border-radius: 4px;
    background: #fafafa;
    color: #666;
    cursor: pointer;
    transition: all 0.15s ease;
}

.order-card__btn-copy:hover {
    background: #f0f0f0;
    color: #222;
}

/* 제목(상품명) */
.order-card__title {
    font-size: 17px;
    font-weight: 700;
    color: #212529;
    line-height: 1.45;
    margin: 0 0 12px 0;
    word-break: keep-all;
    overflow-wrap: anywhere;
}

/* 타겟/링크 정보 */
.order-card__target-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #fbfbfb;
    border: 1px solid #f0f0f0;
    border-radius: 6px;
    padding: 8px 12px;
    margin-bottom: 16px;
    font-size: 12px;
}

.order-card__target-label {
    color: #888;
    flex-shrink: 0;
    font-weight: 600;
}

.order-card__link {
    color: #0A66C2;
    text-decoration: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}

.order-card__link:hover {
    text-decoration: underline;
}

.order-card__link--empty {
    color: #bbb;
}

/* 수치 요약 바 */
.order-card__metrics {
    display: grid;
    
    gap: 10px;
    padding: 12px 14px;
    background: #f7f9fa;
    border-radius: 8px;
    margin-bottom: 20px;
}

.order-card__metric {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.order-card__metric-lbl {
    font-size: 11px;
    color: #777;
}

.order-card__metric-val {
    font-size: 13px;
    font-weight: 600;
    color: #333;
}

.order-card__metric-val--accent {
    color: var(--color-red, #BA0000);
    font-weight: 700;
}

/* 하단 푸터 (금액 + 액션 버튼) */
.order-card__footer {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px;
    padding-top: 14px;
    border-top: 1px solid #f0f0f0;
    margin-top: auto;
}

.order-card__price-box {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.order-card__price-lbl {
    font-size: 11px;
    color: #888;
}

.order-card__price-val {
    font-size: 20px;
    font-weight: 800;
    color: #212529;
    letter-spacing: -0.3px;
}

.order-card__actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.order-card__btn-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 600;
    border-radius: 6px;
    border: 1px solid #d0d0d0;
    background: #fff;
    color: #333;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.15s ease;
}

.order-card__btn-action:hover {
    background: #f5f5f5;
    border-color: #bbb;
    color: #111;
}

.order-card__btn-action--primary {
    background: var(--color-red, #BA0000);
    border-color: var(--color-red, #BA0000);
    color: #fff !important;
}

.order-card__btn-action--primary:hover {
    background: #9f0000;
    border-color: #9f0000;
}

.order-card__btn-action--cancel {
    background: #fff;
    border-color: #e57373;
    color: #d32f2f;
}

.order-card__btn-action--cancel:hover {
    background: #ffebee;
    border-color: #ef5350;
}

/* 헤더 행 및 가이드 팁 */
.order-history__header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.order-guide-tip {
    color: #666;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: #f4f6f8;
    padding: 6px 12px;
    border-radius: 6px;
    border: 1px solid #e5e9ec;
    font-size: 12px;
}

.order-guide-tip i {
    color: var(--color-red, #BA0000);
}

/* 순수 잔액 주문 상세 모달 */
.detail-modal-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.detail-modal-backdrop.is-open {
    display: flex;
}

.detail-modal {
    position: relative;
    background: #fff;
    border-radius: 16px;
    padding: 28px 24px;
    width: 100%;
    max-width: 440px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
}

.detail-modal__close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: #F9F9F9;
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    font-size: 14px;
    color: #666;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.detail-modal__close:hover {
    background: #eee;
    color: #111;
}

.detail-modal__tag {
    color: var(--color-red, #BA0000);
    margin: 0 0 4px 0;
}

.detail-modal__title {
    color: #111;
    margin: 0 0 16px 0;
}

.detail-modal__list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #f9f9f9;
    border: 1px solid #eee;
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 20px;
    font-size: 13px;
}

.detail-modal__row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.detail-modal__lbl {
    color: #777;
    font-weight: 600;
    flex-shrink: 0;
}

.detail-modal__val {
    color: #222;
    font-weight: 600;
    text-align: right;
    word-break: break-all;
}

.detail-modal__row--stack {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
}

.detail-modal__val--accent {
    color: var(--color-red, #BA0000);
    font-weight: 700;
}

.detail-modal__val--link {
    text-align: left;
    font-size: 12px;
    width: 100%;
}

a.detail-modal__link {
    color: #0A66C2;
    text-decoration: underline;
    word-break: break-all;
}

p.order-history__notice {
    color: var(--color-red, #BA0000);
    margin-bottom: 16px;
}

.detail-modal__btn-close {
    width: 100%;
    padding: 12px;
    background: #212529;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    font-weight: 700;
    transition: background 0.15s ease;
}

.detail-modal__btn-close:hover {
    background: #000;
}

.order-pagination {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 28px;
}

.order-pagination__button {
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    border: 1px solid var(--color-line);
    border-radius: 6px;
    background: var(--color-white);
    color: #555;
    cursor: pointer;
    font: inherit;
}

.order-pagination__button[aria-current="page"] {
    border-color: var(--color-red, #BA0000);
    background: var(--color-red, #BA0000);
    color: var(--color-white);
}

.order-pagination__button:disabled {
    color: #bbb;
    cursor: default;
}

.order-pagination__button:focus-visible {
    outline: 2px solid var(--color-red, #BA0000);
    outline-offset: 2px;
}

@media (max-width: 1200px) {
    .order-wrap .order-history__grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 1000px) {
    .order-wrap .order-history__grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .order-wrap .search-wrap {
        flex-direction: column;
    }

    .order-wrap .order-filter {
        flex-wrap: wrap;
    }
}

@media (max-width: 768px) {
    .shop-layout--no-right,
    .shop-layout:has(.shop-right.is-hidden) {
        grid-template-columns: minmax(0, 1fr);
    }

    .order-wrap .order-history__grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
    }
}

@media (max-width: 600px) {
    .order-wrap .order-history__grid {
        grid-template-columns: minmax(0, 1fr);
    }
}
