/* ============================================================
   주문 목록 페이지 스타일
   ============================================================ */

/* 기간 필터 바 */
.period-filter-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    padding: 16px 0;
    border-bottom: 1px solid var(--color-border-light, #e5e7eb);
    margin-bottom: 16px;
}

.period-btn {
    padding: 6px 14px;
    border: 1px solid var(--color-border, #d1d5db);
    border-radius: 20px;
    background: #fff;
    color: var(--color-text-light, #6b7280);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.period-btn:hover {
    border-color: var(--color-primary, #4f46e5);
    color: var(--color-primary, #4f46e5);
}

.period-btn.active {
    background: var(--color-primary, #4f46e5);
    border-color: var(--color-primary, #4f46e5);
    color: #fff;
}

/* 직접 날짜 입력 */
.period-date-input {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: 4px;
}

.period-date-input input[type="date"] {
    padding: 5px 10px;
    border: 1px solid var(--color-border, #d1d5db);
    border-radius: 6px;
    font-size: 13px;
    color: var(--color-text, #111827);
    background: #fff;
    cursor: pointer;
}

.period-date-input input[type="date"]:focus {
    outline: none;
    border-color: var(--color-primary, #4f46e5);
}

.period-date-separator {
    font-size: 13px;
    color: var(--color-text-light, #6b7280);
}

#applyDateBtn {
    padding: 6px 14px;
    border: 1px solid var(--color-primary, #4f46e5);
    border-radius: 6px;
    background: #fff;
    color: var(--color-primary, #4f46e5);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

#applyDateBtn:hover {
    background: var(--color-primary, #4f46e5);
    color: #fff;
}

/* ============================================================
   상태 탭
   ============================================================ */
.order-status-tabs {
    display: flex;
    gap: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    border-bottom: 2px solid var(--color-border-light, #e5e7eb);
    margin-bottom: 20px;
}

.order-status-tabs::-webkit-scrollbar {
    display: none;
}

.status-tab {
    flex-shrink: 0;
    padding: 10px 16px;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    background: transparent;
    color: var(--color-text-light, #6b7280);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.status-tab:hover {
    color: var(--color-primary, #4f46e5);
}

.status-tab.active {
    color: var(--color-primary, #4f46e5);
    border-bottom-color: var(--color-primary, #4f46e5);
    font-weight: 600;
}

/* ============================================================
   주문 카드
   ============================================================ */
.order-card {
    background: #fff;
    border: 1px solid var(--color-border-light, #e5e7eb);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
    cursor: pointer;
    transition: box-shadow 0.15s ease, border-color 0.15s ease;
}

.order-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    border-color: var(--color-border, #d1d5db);
}

.order-card:focus {
    outline: 2px solid var(--color-primary, #4f46e5);
    outline-offset: 2px;
}

/* 카드 헤더 */
.order-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--color-border-light, #e5e7eb);
}

.order-card-meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.order-no {
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text, #111827);
}

.order-date {
    font-size: 12px;
    color: var(--color-text-light, #6b7280);
}

/* 상태 배지 */
.order-status-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
}

.order-status-badge.pending {
    background: #fef3c7;
    color: #d97706;
}

.order-status-badge.confirmed,
.order-status-badge.preparing {
    background: #dbeafe;
    color: #2563eb;
}

.order-status-badge.shipping {
    background: #e0e7ff;
    color: #4f46e5;
}

.order-status-badge.delivered {
    background: #dcfce7;
    color: #16a34a;
}

.order-status-badge.cancelled,
.order-status-badge.returned {
    background: #fee2e2;
    color: #dc2626;
}

/* 카드 본문 (상품 정보) */
.order-card-body {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    margin-bottom: 14px;
}

.order-thumb {
    width: 72px;
    height: 72px;
    border-radius: 8px;
    object-fit: cover;
    background: var(--color-bg-light, #f9fafb);
    flex-shrink: 0;
}

.order-product-info {
    flex: 1;
    min-width: 0;
}

.order-product-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--color-text, #111827);
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.order-product-option {
    display: block;
    font-size: 12px;
    color: var(--color-text-light, #6b7280);
    margin-bottom: 4px;
}

.order-product-price {
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text, #111827);
    margin-bottom: 4px;
}

.order-extra-count {
    display: inline-block;
    font-size: 12px;
    color: var(--color-text-light, #6b7280);
    background: var(--color-bg-light, #f3f4f6);
    padding: 2px 8px;
    border-radius: 10px;
}

/* 카드 푸터 */
.order-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 12px;
    border-top: 1px solid var(--color-border-light, #e5e7eb);
}

.order-total {
    font-size: 14px;
    color: var(--color-text-light, #6b7280);
}

.order-total strong {
    font-size: 16px;
    font-weight: 700;
    color: var(--color-text, #111827);
}

.order-detail-link {
    font-size: 13px;
    color: var(--color-primary, #4f46e5);
    font-weight: 500;
}

/* ============================================================
   빈 상태 / 로딩 / 에러 상태
   ============================================================ */
.orders-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    gap: 16px;
    color: var(--color-text-light, #6b7280);
    font-size: 14px;
}

.orders-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    gap: 16px;
    color: var(--color-text-light, #6b7280);
    font-size: 14px;
    text-align: center;
}

.orders-empty svg {
    color: var(--color-border, #d1d5db);
}

.orders-empty p {
    margin: 0;
}

.orders-error {
    text-align: center;
    padding: 40px 20px;
    color: var(--color-text-light, #6b7280);
    font-size: 14px;
}

/* 무한 스크롤 로딩 */
.loading-more {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 24px;
}

/* 로딩 스피너 */
.loading-spinner {
    width: 28px;
    height: 28px;
    border: 3px solid var(--color-border-light, #e5e7eb);
    border-top-color: var(--color-primary, #4f46e5);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============================================================
   모바일 반응형
   ============================================================ */
@media (max-width: 480px) {
    .period-filter-bar {
        gap: 6px;
    }

    .period-btn {
        padding: 5px 10px;
        font-size: 12px;
    }

    .period-date-input {
        width: 100%;
        flex-wrap: wrap;
    }

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

    .status-tab {
        padding: 10px 12px;
        font-size: 13px;
    }

    .order-card {
        padding: 16px;
        border-radius: 10px;
        margin-bottom: 12px;
    }

    .order-thumb {
        width: 60px;
        height: 60px;
    }

    .order-product-name {
        font-size: 13px;
    }

    .order-total strong {
        font-size: 15px;
    }
}
