/* 用户订单页面样式 - 红色主题 */
.user-orders-page {
    max-width: 1440px;
    margin: 0 auto;
    padding: 20px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    /* background: #fef2f2; */
    min-height: 100vh;
}

.orders-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(220, 38, 38, 0.1);
    overflow: hidden;
    border: 1px solid #fecaca;
}

/* 页面标题 */
.orders-header {
    padding: 30px;
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    color: white;
    text-align: center;
}

.orders-header h1 {
    margin: 0 0 10px 0;
    font-size: 2.5rem;
    font-weight: 700;
}

.orders-header .orders-subtitle {
    margin: 0;
    font-size: 1.1rem;
    opacity: 0.9;
}

/* 订单筛选 */
.orders-filter {
    padding: 20px 30px;
    border-bottom: 1px solid #fecaca;
    background: #fef2f2;
}

.filter-tabs {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

.filter-tab {
    padding: 12px 20px;
    border: 2px solid #fecaca;
    border-radius: 25px;
    background: white;
    color: #7f1d1d;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-tab:hover {
    border-color: #dc2626;
    color: #dc2626;
    background: #fef2f2;
}

.filter-tab.active {
    background: #dc2626;
    border-color: #dc2626;
    color: white;
}


/* 订单列表容器 */
.orders-list {
    padding: 20px;
    min-height: 400px;
    position: relative; /* 添加相对定位 */
}

/* 当没有订单时，隐藏订单列表的内容区域 */
.orders-list:has(.empty-state) {
    padding: 0; /* 移除内边距 */
    min-height: 500px; /* 增加最小高度 */
    display: flex; /* 使用flex布局 */
    align-items: center; /* 垂直居中 */
    justify-content: center; /* 水平居中 */
}

.order-card {
    background: white;
    border: 1px solid #fecaca;
    border-radius: 12px;
    margin-bottom: 20px;
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(220, 38, 38, 0.05);
}

.order-card:hover {
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.1);
    transform: translateY(-2px);
    border-color: #f87171;
}

.order-header {
    padding: 20px;
    background: #fef2f2;
    border-bottom: 1px solid #fecaca;
    display: flex;
    justify-content: between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.order-info {
    display: flex;
    flex-direction: column;
    gap: 5px;
    flex: 1;
}

.order-number {
    font-size: 1.2rem;
    font-weight: 700;
    color: #7f1d1d;
}

.order-date {
    color: #b91c1c;
    font-size: 0.9rem;
}

.order-status {
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
}

.status-pending { background: #fecaca; color: #dc2626; }
.status-confirmed { background: #fed7aa; color: #ea580c; }
.status-shipped { background: #bbf7d0; color: #16a34a; }
.status-delivered { background: #dcfce7; color: #15803d; }
.status-cancelled { background: #f3f4f6; color: #6b7280; }

.order-amount {
    font-size: 1.3rem;
    font-weight: 700;
    color: #dc2626;
}

/* 订单商品 */
.order-items {
    padding: 20px;
    max-height: 400px; /* 限制最大高度 */
    overflow-y: auto; /* 添加滚动条 */
    border-radius: 8px;
    background: #fef2f2;
    border: 1px solid #fecaca;
}


.order-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    border-bottom: 1px solid #fecaca;
    background: white;
    border-radius: 6px;
    margin-bottom: 10px;
    transition: all 0.3s ease;
}

.order-item:hover {
    background: #fecaca;
    transform: translateX(5px);
}

.order-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.item-image {
    width: 60px; /* 稍微调小图片尺寸 */
    height: 60px;
    border-radius: 6px;
    overflow: hidden;
    flex-shrink: 0;
    border: 1px solid #fecaca;
}

.item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.item-details {
    flex: 1;
    min-width: 0; /* 防止文本溢出 */
}

.item-name {
    font-weight: 600;
    color: #7f1d1d;
    margin-bottom: 5px;
    line-height: 1.4;
    font-size: 0.95rem;
    /* 文本溢出处理 */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}


.item-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #b91c1c;
    font-size: 0.85rem;
    flex-wrap: wrap;
    gap: 5px;
}

.item-price {
    font-weight: 600;
    color: #dc2626;
    font-size: 0.9rem;
}

/* 滚动条样式 */
.order-items::-webkit-scrollbar {
    width: 6px;
}

.order-items::-webkit-scrollbar-track {
    background: #fecaca;
    border-radius: 3px;
}

.order-items::-webkit-scrollbar-thumb {
    background: #dc2626;
    border-radius: 3px;
}

.order-items::-webkit-scrollbar-thumb:hover {
    background: #b91c1c;
}

/* 当商品数量较少时的样式 */
.order-items:not(:has(.order-item ~ .order-item)) {
    max-height: none;
    overflow-y: visible;
}

/* 响应式调整 */
@media (max-width: 768px) {
    .order-items {
        max-height: 300px;
        padding: 15px;
    }
    
    .order-item {
        padding: 12px;
        gap: 12px;
    }
    
    .item-image {
        width: 50px;
        height: 50px;
    }
    
    .item-name {
        font-size: 0.9rem;
    }
    
    .item-meta {
        font-size: 0.8rem;
        flex-direction: column;
        align-items: flex-start;
        gap: 3px;
    }
}

@media (max-width: 480px) {
    .order-items {
        max-height: 250px;
        padding: 10px;
    }
    
    .order-item {
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }
    
    .item-details {
        width: 100%;
    }
    
    .item-meta {
        flex-direction: row;
        justify-content: space-between;
    }
}


/* 订单操作 */
.order-actions {
    padding: 20px;
    background: #fef2f2;
    border-top: 1px solid #fecaca;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    flex-wrap: wrap;
}

.action-btn {
    padding: 10px 20px;
    border: 2px solid #dc2626;
    border-radius: 6px;
    background: white;
    color: #dc2626;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.action-btn:hover {
    background: #dc2626;
    color: white;
    transform: translateY(-1px);
}

.action-btn.primary {
    background: #dc2626;
    color: white;
}

.action-btn.primary:hover {
    background: #b91c1c;
    border-color: #b91c1c;
}

.action-btn.danger {
    border-color: #ef4444;
    color: #ef4444;
}

.action-btn.danger:hover {
    background: #ef4444;
    color: white;
}

/* 加载状态 */
.loading-state {
    text-align: center;
    padding: 40px;
    color: #b91c1c;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #fecaca;
    border-left: 4px solid #dc2626;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 80px 20px;
    color: #b91c1c;
    width: 100%; /* 占据整个宽度 */
    height: 100%; /* 占据整个高度 */
    display: flex;
    flex-direction: column;
    justify-content: center; /* 垂直居中 */
    align-items: center; /* 水平居中 */
    background: white; /* 添加背景色 */
    border-radius: 8px; /* 圆角 */
    box-shadow: 0 2px 8px rgba(220, 38, 38, 0.1); /* 轻微阴影 */
    margin: 0; /* 移除外边距 */
}

.empty-icon {
    font-size: 6rem;
    color: #fecaca;
    margin-bottom: 30px;
    opacity: 0.8;
}

.empty-state h3 {
    color: #7f1d1d;
    margin-bottom: 15px;
    font-size: 1.8rem;
    font-weight: 700;
}

.empty-state p {
    color: #b91c1c;
    font-size: 1.1rem;
    margin-bottom: 30px;
    max-width: 400px;
    line-height: 1.6;
}

.start-shopping-btn {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 16px 32px;
    background: #dc2626;
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    margin-top: 20px;
    transition: all 0.3s ease;
    font-size: 1.1rem;
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.3);
}

.start-shopping-btn:hover {
    background: #b91c1c;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(220, 38, 38, 0.4);
}

/* 分页 */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    padding: 30px;
    border-top: 1px solid #fecaca;
}

.pagination-btn {
    padding: 10px 20px;
    border: 1px solid #fecaca;
    border-radius: 6px;
    background: white;
    color: #7f1d1d;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.pagination-btn:hover:not(:disabled) {
    border-color: #dc2626;
    color: #dc2626;
    background: #fef2f2;
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.page-info {
    color: #b91c1c;
    font-weight: 600;
}

/* 加载遮罩 */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(220, 38, 38, 0.1);
    backdrop-filter: blur(5px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 10000;
}

.loading-overlay.show {
    display: flex;
}

.loading-content {
    background: white;
    padding: 30px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.15);
    border: 1px solid #fecaca;
}

.loading-content .spinner {
    margin-bottom: 15px;
}

.loading-content p {
    color: #dc2626;
    font-weight: 600;
    margin: 0;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .user-orders-page {
        padding: 10px;
    }
    
    .orders-header {
        padding: 20px;
    }
    
    .orders-header h1 {
        font-size: 2rem;
    }
    
    .filter-tabs {
        flex-direction: column;
    }
    
    .filter-tab {
        justify-content: center;
    }
    
    .order-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .order-actions {
        justify-content: center;
    }
    
    .order-item {
        flex-direction: column;
        align-items: flex-start;
        text-align: left;
    }
    
    .item-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
    
    .pagination {
        flex-direction: column;
        gap: 15px;
    }
}

@media (max-width: 480px) {
    .orders-header h1 {
        font-size: 1.5rem;
    }
    
    .order-number {
        font-size: 1rem;
    }
    
    .order-amount {
        font-size: 1.1rem;
    }
    
    .action-btn {
        padding: 8px 16px;
        font-size: 0.9rem;
    }
    
    .filter-tab {
        padding: 10px 16px;
        font-size: 0.9rem;
    }
}

/* 订单状态徽章增强 */
.order-status {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.status-pending {
    box-shadow: 0 2px 4px rgba(220, 38, 38, 0.2);
}

.status-confirmed {
    box-shadow: 0 2px 4px rgba(234, 88, 12, 0.2);
}

.status-shipped {
    box-shadow: 0 2px 4px rgba(22, 163, 74, 0.2);
}

.status-delivered {
    box-shadow: 0 2px 4px rgba(21, 128, 61, 0.2);
}

/* 悬停效果增强 */
.order-card:hover .order-number {
    color: #dc2626;
}

.order-card:hover .order-amount {
    color: #b91c1c;
}


/* 删除按钮样式 */
.delete-order-btn {
    border-color: #ef4444;
    color: #ef4444;
    position: relative;
}

.delete-order-btn:hover:not(:disabled) {
    background: #ef4444;
    color: white;
    transform: translateY(-1px);
}

/* 禁用状态的删除按钮 */
.delete-order-btn:disabled {
    border-color: #d1d5db;
    color: #d1d5db;
    cursor: not-allowed;
    background: #f9fafb;
}

.delete-order-btn:disabled:hover {
    background: #f9fafb;
    color: #d1d5db;
    transform: none;
}

/* 删除按钮的提示工具 */
.delete-order-btn[title] {
    position: relative;
}

.delete-order-btn[title]:hover::after {
    content: attr(title);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #374151;
    color: white;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 0.8rem;
    white-space: nowrap;
    z-index: 1000;
    margin-bottom: 5px;
}

.delete-order-btn[title]:hover::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: #374151;
    margin-bottom: -5px;
}


/* 订单商品数量统计 */
.order-item-count {
    color: #b91c1c;
    font-size: 0.85rem;
    margin-top: 5px;
    font-weight: 500;
}

/* 订单头部信息调整 */
.order-info {
    display: flex;
    flex-direction: column;
    gap: 5px;
    flex: 1;
}