/* 订单页面 - 轻奢极简 App 风格 */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
}

:root {
    --primary-color: #1a1a1a;
    --secondary-color: #f5f5f5;
    --accent-color: #d4af37;
    --text-primary: #1a1a1a;
    --text-secondary: #8e8e93;
    --border-color: #e5e5ea;
    --background: #ffffff;
    --card-background: #ffffff;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
    --shadow-hover: 0 4px 20px rgba(0, 0, 0, 0.08);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
    background: var(--background);
    color: var(--text-primary);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

.container {
    max-width: 430px;
    margin: 0 auto;
    background: var(--background);
    min-height: 100vh;
    position: relative;
    padding-bottom: 80px;
}

/* 顶部栏 */
.top-bar {
    background: var(--background);
    padding: 12px 20px;
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid var(--border-color);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.page-title {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
    letter-spacing: -0.5px;
}

.search-box {
    position: relative;
}

.search-input {
    width: 100%;
    padding: 10px 40px 10px 16px;
    background: var(--secondary-color);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    font-size: 14px;
    color: var(--text-primary);
    outline: none;
}

.search-input::placeholder {
    color: var(--text-secondary);
}

.search-icon {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    color: var(--text-secondary);
    pointer-events: none;
    font-size: 16px;
}

/* 搜索区域 */
.search-section {
    padding: 12px 20px;
    background: var(--background);
    border-bottom: 1px solid var(--border-color);
}

.search-icon svg {
    width: 100%;
    height: 100%;
    display: block;
    stroke: currentColor;
}

/* 状态标签 */
.status-tabs {
    display: flex;
    gap: 8px;
    padding: 16px 20px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.status-tabs::-webkit-scrollbar {
    display: none;
}

.tab-item {
    padding: 8px 16px;
    background: var(--secondary-color);
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid transparent;
}

.tab-item.active {
    background: var(--text-primary);
    color: #fff;
    border-color: var(--text-primary);
}

/* 订单列表 */
.orders-section {
    padding: 0 20px;
}

.orders-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.order-card {
    background: var(--card-background);
    border-radius: 16px;
    padding: 16px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

/* 🔥 可点击的订单卡片（已完成和已发货） */
.order-card.clickable {
    cursor: pointer;
}

.order-card.clickable:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-2px);
}

.order-card.clickable:active {
    transform: scale(0.98) translateY(0);
}

/* 不可点击的订单卡片 */
.order-card:not(.clickable) {
    cursor: default;
}

.order-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.order-id {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.order-status {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.order-status.pending {
    background: #fff3cd;
    color: #856404;
}

.order-status.paid {
    background: #d4edda;
    color: #155724;
}

.order-status.completed {
    background: #d1ecf1;
    color: #0c5460;
}

.order-status.cancelled {
    background: #f8d7da;
    color: #721c24;
}

.order-info {
    margin-bottom: 12px;
}

.product-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.product-spec {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.order-amount {
    font-size: 18px;
    font-weight: 600;
    color: var(--accent-color);
    margin-top: 8px;
}

.order-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

.order-time {
    font-size: 12px;
    color: var(--text-secondary);
}

.order-action {
    padding: 6px 16px;
    background: var(--text-primary);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.order-action:active {
    transform: scale(0.95);
    opacity: 0.9;
}

/* 底部导航栏 */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 430px;
    background: var(--background);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-around;
    padding: 8px 0 calc(8px + env(safe-area-inset-bottom));
    z-index: 100;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.04);
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    text-decoration: none;
    color: var(--text-secondary);
    padding: 8px 16px;
    border-radius: 12px;
    transition: all 0.3s ease;
    flex: 1;
    max-width: 80px;
}

.nav-item.active {
    color: var(--accent-color);
}

.nav-icon {
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease;
    color: currentColor;
}

.nav-icon svg {
    width: 100%;
    height: 100%;
    stroke: currentColor;
}

.nav-item.active .nav-icon {
    transform: scale(1.1);
}

.nav-label {
    font-size: 11px;
    font-weight: 500;
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state-text {
    font-size: 14px;
}

/* 加载状态 */
.loading-placeholder {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
}

.loading-placeholder.show {
    opacity: 1;
}

.loading {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 12px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 订单卡片完整样式 */
.order-content {
    margin-bottom: 12px;
}

.order-product {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.product-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--secondary-color) 0%, #e8e8e8 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
    overflow: hidden;
    position: relative;
}

.product-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 12px;
}

.product-info {
    flex: 1;
    min-width: 0;
}

.product-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.product-spec {
    font-size: 13px;
    color: var(--text-secondary);
}

.order-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

.order-time {
    font-size: 12px;
    color: var(--text-secondary);
}

.order-amount {
    font-size: 16px;
    font-weight: 700;
    color: #dc3545; /* 🔥 适中的红色 */
}

.order-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

.action-btn {
    flex: 1;
    padding: 10px 16px;
    border: none;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.btn-primary {
    background: var(--accent-color);
    color: #fff;
    box-shadow: 0 2px 8px rgba(212, 175, 55, 0.3);
}

.btn-primary:active {
    transform: scale(0.98);
    box-shadow: 0 1px 4px rgba(212, 175, 55, 0.3);
}

.btn-secondary {
    background: var(--card-background);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

/* 🔥 提取卡密按钮 - 黑色渐变样式 */
.btn-extract {
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 50%, #1a1a1a 100%);
    color: #fff;
    border: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.btn-extract:hover {
    background: linear-gradient(135deg, #2d2d2d 0%, #3d3d3d 50%, #2d2d2d 100%);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.btn-extract:active {
    transform: scale(0.98);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

.btn-secondary:active {
    transform: scale(0.98);
    background: var(--secondary-color);
}

.btn-danger {
    background: #ff6b6b;
    color: #fff;
    box-shadow: 0 2px 8px rgba(255, 107, 107, 0.3);
}

.btn-danger:active {
    transform: scale(0.98);
    box-shadow: 0 1px 4px rgba(255, 107, 107, 0.3);
}

/* 订单状态样式 */
.status-pending {
    background: rgba(255, 193, 7, 0.1);
    color: #f57c00;
}

.status-paid {
    background: rgba(76, 175, 80, 0.1);
    color: #2e7d32;
}

.status-delivered {
    background: rgba(33, 150, 243, 0.1);
    color: #1565c0;
}

.status-completed {
    background: rgba(76, 175, 80, 0.1);
    color: #2e7d32;
}

.status-cancelled {
    background: rgba(244, 67, 54, 0.1);
    color: #c62828;
}

.status-expired {
    background: rgba(158, 158, 158, 0.1);
    color: #616161;
}

.status-risk {
    background: rgba(255, 152, 0, 0.1);
    color: #e65100;
}

.status-unknown {
    background: rgba(158, 158, 158, 0.1);
    color: #616161;
}

/* 空状态和错误状态 */
.empty-state {
    text-align: center;
    padding: 60px 20px;
}

.empty-icon {
    font-size: 64px;
    margin-bottom: 16px;
    opacity: 0.3;
}

.empty-text {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.empty-hint {
    font-size: 14px;
    color: var(--text-secondary);
}

.error-state {
    text-align: center;
    padding: 60px 20px;
}

.error-icon {
    font-size: 64px;
    margin-bottom: 16px;
    color: #ff6b6b;
    opacity: 0.7;
}

.error-text {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.retry-btn {
    padding: 10px 24px;
    background: var(--accent-color);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.retry-btn:active {
    transform: scale(0.98);
}

/* 订单详情弹窗 */
.order-detail-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.order-detail-modal.show {
    opacity: 1;
    visibility: visible;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

.modal-content {
    position: relative;
    background: var(--card-background);
    border-radius: 20px;
    max-width: 90%;
    width: 400px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    transform: scale(0.9);
    transition: transform 0.3s ease;
    overflow: hidden;
}

.order-detail-modal.show .modal-content {
    transform: scale(1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.3px;
}

.modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: var(--secondary-color);
    border-radius: 50%;
    font-size: 20px;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.modal-close:active {
    transform: scale(0.95);
    background: var(--border-color);
}

.modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.modal-body::-webkit-scrollbar {
    width: 6px;
}

.modal-body::-webkit-scrollbar-track {
    background: var(--secondary-color);
    border-radius: 10px;
}

.modal-body::-webkit-scrollbar-thumb {
    background: var(--accent-color);
    border-radius: 10px;
}

.detail-section {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.detail-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

.detail-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.detail-label {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
}

.detail-value {
    font-size: 14px;
    color: var(--text-primary);
    font-weight: 500;
}

/* 🔥 订单详情中的金额显示为红色 */
.detail-item .detail-value[style*="color: #dc3545"] {
    color: #dc3545 !important;
    font-weight: 700;
}

.card-content {
    background: var(--secondary-color);
    padding: 12px;
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.6;
    word-break: break-all;
    border: 1px solid var(--border-color);
}

.modal-footer {
    display: flex;
    gap: 12px;
    padding: 20px;
    border-top: 1px solid var(--border-color);
}

.modal-footer button {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.modal-footer .btn-primary {
    background: var(--accent-color);
    color: #fff;
    box-shadow: 0 2px 8px rgba(212, 175, 55, 0.3);
}

.modal-footer .btn-primary:active {
    transform: scale(0.98);
}

.modal-footer .btn-secondary {
    background: var(--secondary-color);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.modal-footer .btn-secondary:active {
    transform: scale(0.98);
    background: var(--border-color);
}

/* 响应式设计 */
@media (max-width: 375px) {
    .order-actions {
        flex-direction: column;
    }
    
    .action-btn {
        width: 100%;
    }
    
    .modal-content {
        width: 95%;
        max-height: 90vh;
    }
}
