:root {
    --shopee-orange: #ee4d2d;
    --shopee-bg: #ffffff;
    --shopee-text-main: #222;
    --shopee-text-soft: #757575;
    --shopee-border: #e8e8e8;
    --shopee-card-bg: #ffffff;
}

body {
    background-color: var(--shopee-bg) !important;
}

.purchases-container {
    max-width: 1200px;
    margin: 40px auto;
    padding: 0 20px;
}

/* Status Tabs */
.order-tabs {
    display: flex;
    background: #fff;
    border-radius: 4px;
    border-bottom: 1px solid var(--shopee-border);
    margin-bottom: 15px;
    overflow-x: auto;
    scrollbar-width: none;
}

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

.order-tab {
    flex: 1;
    min-width: 120px;
    padding: 16px 10px;
    text-align: center;
    font-size: 1rem;
    color: var(--shopee-text-main);
    cursor: pointer;
    transition: color 0.2s;
    border-bottom: 2px solid transparent;
    white-space: nowrap;
}

.order-tab:hover {
    color: var(--shopee-orange);
}

.order-tab.active {
    color: var(--shopee-orange);
    border-bottom-color: var(--shopee-orange);
}

/* Order Search */
.order-search {
    margin-bottom: 15px;
}

.order-search-inner {
    display: flex;
    align-items: center;
    background: #eaeaea;
    padding: 10px 15px;
    border-radius: 2px;
}

.order-search-icon {
    font-size: 1.2rem;
    color: #999;
    margin-right: 12px;
}

.order-search-input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 0.95rem;
    color: #333;
    outline: none;
}

/* Order Card */
.order-card {
    background: #fff;
    border-radius: 4px;
    margin-bottom: 12px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.order-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid var(--shopee-border);
}

.shop-info {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
}

.shop-badge {
    background: var(--shopee-orange);
    color: #fff;
    font-size: 0.75rem;
    padding: 2px 6px;
    border-radius: 2px;
}

.order-status {
    color: var(--shopee-orange);
    text-transform: uppercase;
    font-size: 0.9rem;
    font-weight: 500;
}

.order-card-body {
    padding: 12px 20px;
}

.order-item {
    display: flex;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid #f9f9f9;
}

.order-item:last-child {
    border-bottom: none;
}

.item-img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border: 1px solid var(--shopee-border);
    border-radius: 2px;
}

.item-details {
    flex: 1;
}

.item-name {
    font-size: 1rem;
    margin-bottom: 4px;
    color: var(--shopee-text-main);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.item-variation {
    font-size: 0.85rem;
    color: var(--shopee-text-soft);
    margin-bottom: 4px;
}

.item-price-info {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
}

.price-original {
    text-decoration: line-through;
    color: var(--shopee-text-soft);
    font-size: 0.9rem;
}

.price-final {
    color: var(--shopee-orange);
    font-weight: 600;
    font-size: 1.1rem;
}

.order-card-footer {
    padding: 20px;
    background: #fff;
    border-top: 1px solid #f9f9f9;
    /* text-align: right; */
}

.order-total-row {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
}

.total-label {
    font-size: 0.9rem;
    color: var(--shopee-text-main);
}

.total-price {
    font-size: 1.5rem;
    color: var(--shopee-orange);
    font-weight: 500;
}

.order-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}

.btn-purchase {
    padding: 10px 20px;
    border-radius: 2px;
    font-size: 0.95rem;
    cursor: pointer;
    border: 1px solid var(--shopee-border);
    font-family: 'Outfit', 'Noto Sans Thai', sans-serif;
    background-color: #f7f7f7;
    color: #333;
    line-height: 1.6;
    min-width: 140px;
    text-align: center;
}

.btn-purchase-primary {
    background: var(--shopee-orange);
    color: #fff;
    border-color: var(--shopee-orange);
}

.btn-purchase:hover {
    opacity: 0.9;
}

/* Mobile optimizations */
@media (max-width: 768px) {
    .purchases-container {
        margin: 20px auto;
        padding: 0 10px;
    }
    
    .item-img {
        width: 60px;
        height: 60px;
    }
    
    .total-price {
        font-size: 1.2rem;
    }
    
    .btn-purchase {
        flex: 1;
        min-width: 100px;
        padding: 10px;
    }
}

/* Modal Styles */
.modal-overlay, .cancel-modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.5); z-index: 1000;
}
.modal-container, .cancel-modal {
    position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
    background: #fff; width: 90%; max-width: 500px;
    border-radius: 4px; box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 1001; overflow: hidden;
}
.cancel-modal-header {
    padding: 20px 24px; border-bottom: 1px solid #f0f0f0;
}
.cancel-modal-header h3 {
    margin: 0; font-size: 1.15rem; color: #333; font-weight: 500;
}
.cancel-modal-body {
    padding: 20px 24px;
}
.cancel-warning-box {
    background: #fff8e1; border: 1px solid #ffecb3; padding: 12px 16px;
    border-radius: 4px; display: flex; gap: 12px; margin-bottom: 20px;
}
.cancel-warning-box p {
    margin: 0; font-size: 0.9rem; color: #666; line-height: 1.4;
}
.cancel-radio-group {
    display: flex; flex-direction: column; gap: 12px; margin-bottom: 10px;
}
.cancel-radio-label {
    display: flex; align-items: center; gap: 10px; font-size: 0.95rem; color: #333; cursor: pointer;
}
.cancel-radio-label input[type="radio"] {
    width: 18px; height: 18px; accent-color: var(--shopee-orange);
}
.cancel-modal-footer {
    padding: 16px 24px; border-top: 1px solid #f0f0f0; background: #fafafa;
    display: flex; justify-content: flex-end; gap: 12px;
}
.btn-cancel-notyet {
    padding: 10px 20px; border: 1px solid #ddd; background: #fff; border-radius: 2px;
    color: #555; cursor: pointer; font-size: 0.95rem; font-family: inherit;
}
.btn-cancel-confirm {
    padding: 10px 20px; border: none; background: var(--shopee-orange); border-radius: 2px;
    color: #fff; cursor: pointer; font-size: 0.95rem; font-family: inherit;
}
.btn-cancel-confirm:disabled {
    background: #facac0; cursor: not-allowed;
}

/* Payment Options Grid for Change Payment Modal */
.pm-opt-btn {
    background: #fff; border: 1px solid #e8e8e8; padding: 10px 16px; border-radius: 2px;
    color: #333; font-family: inherit; font-size: 0.9rem; cursor: pointer; position: relative;
}
.pm-opt-btn.active {
    border-color: #ee4d2d; color: #ee4d2d;
}
.pm-tick {
    position: absolute; bottom: 0; right: 0; width: 14px; height: 14px; background: #ee4d2d; 
    display: none; align-items: center; justify-content: center; clip-path: polygon(100% 0, 0% 100%, 100% 100%);
}
.pm-opt-btn.active .pm-tick { display: flex; }
