/* 代买订单管理网站 - 主样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #4f46e5;
    --primary-hover: #4338ca;
    --secondary-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --info-color: #3b82f6;
    --bg-color: #f3f4f6;
    --text-color: #111827;
    --text-light: #6b7280;
    --border-color: #e5e7eb;
    --card-bg: #ffffff;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
    --radius: 8px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
}

.hidden {
    display: none !important;
}

/* 顶部导航 */
.navbar {
    background: var(--card-bg);
    box-shadow: var(--shadow);
    padding: 0 24px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar .brand {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 8px;
}

.navbar .nav-actions {
    display: flex;
    gap: 12px;
}

/* 主区容器 - 左右布局 */
.page-layout {
    display: flex;
    min-height: calc(100vh - 60px);
}

.sidebar {
    width: 200px;
    flex-shrink: 0;
    background: var(--card-bg);
    border-right: 1px solid var(--border-color);
    padding: 16px 0;
    position: sticky;
    top: 60px;
    height: calc(100vh - 60px);
    overflow-y: auto;
}

.sidebar-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0 16px 12px;
}

.sidebar-nav {
    list-style: none;
    padding: 0;
    margin: 0;
}

.nav-group-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-light);
    padding: 16px 16px 6px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-color);
    transition: background 0.15s, color 0.15s;
    border-left: 3px solid transparent;
}

.nav-item:hover {
    background: var(--bg-color);
}

.nav-item.active {
    background: rgba(79, 70, 229, 0.06);
    color: var(--primary-color);
    font-weight: 600;
    border-left-color: var(--primary-color);
}

.nav-icon {
    font-size: 16px;
    width: 22px;
    text-align: center;
    flex-shrink: 0;
}

.nav-text {
    flex: 1;
    white-space: nowrap;
}

.nav-count {
    font-size: 12px;
    color: var(--text-light);
    background: var(--bg-color);
    padding: 1px 8px;
    border-radius: 999px;
    min-width: 24px;
    text-align: center;
}

.nav-item.active .nav-count {
    background: rgba(79, 70, 229, 0.12);
    color: var(--primary-color);
}

.nav-count:empty {
    display: none;
}

.main-content {
    flex: 1;
    min-width: 0;
    padding: 24px;
}

.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    margin-bottom: 20px;
}

.card-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-color);
}

/* 批量操作工具栏 */
.batch-toolbar {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 10px 16px;
    background: #eef2ff;
    border-radius: var(--radius);
    margin-bottom: 12px;
}
.batch-toolbar.hidden { display: none; }
.batch-check-all {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    cursor: pointer;
}
.batch-selected {
    font-size: 13px;
    color: var(--text-light);
}
.col-check {
    width: 36px;
    text-align: center;
}

/* 筛选栏 */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: flex-end;
}

.filter-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.filter-item label {
    font-size: 12px;
    color: var(--text-light);
}

/* 表单控件 */
.form-control,
input[type="text"],
input[type="number"],
input[type="datetime-local"],
select,
textarea {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
    background: #fff;
    color: var(--text-color);
    transition: border-color 0.15s;
    min-width: 160px;
}

.form-control:focus,
input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

textarea {
    resize: vertical;
    min-height: 60px;
    width: 100%;
}

/* 按钮 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, opacity 0.15s;
    white-space: nowrap;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--primary-color);
    color: #fff;
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-hover);
}

.btn-secondary {
    background: var(--secondary-color);
    color: #fff;
}

.btn-secondary:hover:not(:disabled) {
    opacity: 0.9;
}

.btn-danger {
    background: var(--danger-color);
    color: #fff;
}

.btn-danger:hover:not(:disabled) {
    opacity: 0.9;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-color);
}

.btn-outline:hover:not(:disabled) {
    background: var(--bg-color);
}

.btn-sm {
    padding: 4px 10px;
    font-size: 12px;
}

.btn-link {
    background: none;
    border: none;
    color: var(--primary-color);
    cursor: pointer;
    padding: 4px 6px;
    font-size: 13px;
}

.btn-link:hover {
    text-decoration: underline;
}

.btn-link.danger {
    color: var(--danger-color);
}

/* 表格 */
.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

thead th {
    text-align: left;
    padding: 12px;
    background: #f9fafb;
    color: var(--text-light);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

tbody td {
    padding: 12px;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

tbody tr:hover {
    background: #f9fafb;
}

.text-muted {
    color: var(--text-light);
}

.empty-row {
    text-align: center;
    color: var(--text-light);
    padding: 40px 0 !important;
}

.actions-cell {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

/* 状态徽章 */
.badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.5;
}

.badge-pending {
    background: #e5e7eb;
    color: #374151;
}

.badge-warning {
    background: #fef3c7;
    color: #92400e;
}

.badge-info {
    background: #dbeafe;
    color: #1e40af;
}

.badge-shipped {
    background: #cffafe;
    color: #155e75;
}

.badge-success {
    background: #d1fae5;
    color: #065f46;
}

.badge-cancelled {
    background: #f3f4f6;
    color: #9ca3af;
}

.badge-danger {
    background: #fee2e2;
    color: #991b1b;
}

/* 平台标签 */
.platform-tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.platform-tag.alibaba {
    background: #fff2e8;
    color: #d4380d;
}

.platform-tag.taobao {
    background: #fff0f6;
    color: #c41d7f;
}

/* 分页 */
.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 16px;
    flex-wrap: wrap;
    gap: 12px;
}

.pagination .page-info {
    color: var(--text-light);
    font-size: 14px;
}

.pagination .page-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.pagination .page-controls span {
    font-size: 14px;
    color: var(--text-color);
}

/* 模态框 */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.modal {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 640px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.modal.modal-lg {
    max-width: 800px;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    font-size: 16px;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    color: var(--text-light);
}

.modal-close:hover {
    color: var(--text-color);
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
}

/* 表单布局 */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-color);
}

.form-group label .required {
    color: var(--danger-color);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.form-section {
    margin-bottom: 20px;
}

.form-section-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-light);
    margin-bottom: 12px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border-color);
}

.field-hint {
    font-size: 12px;
    color: var(--text-light);
    margin-top: 4px;
}

/* 详情展示 */
.detail-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px 24px;
}

.detail-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.detail-item .label {
    font-size: 12px;
    color: var(--text-light);
}

.detail-item .value {
    font-size: 14px;
    color: var(--text-color);
    word-break: break-all;
}

.logistics-list {
    margin-top: 8px;
}

.logistics-item {
    padding: 10px 12px;
    background: #f9fafb;
    border-radius: 6px;
    margin-bottom: 8px;
    font-size: 13px;
}

.logistics-item .lg-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

/* Tab 切换 */
.tabs {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 20px;
}

.tab {
    padding: 10px 20px;
    cursor: pointer;
    border: none;
    background: none;
    font-size: 14px;
    color: var(--text-light);
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
}

.tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    font-weight: 600;
}

/* Toast 消息 */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 20px;
    border-radius: 6px;
    color: #fff;
    font-size: 14px;
    box-shadow: var(--shadow-lg);
    z-index: 2000;
    animation: toast-in 0.3s ease;
    max-width: 360px;
}

.toast-info {
    background: var(--info-color);
}

.toast-success {
    background: var(--secondary-color);
}

.toast-error {
    background: var(--danger-color);
}

.toast-warning {
    background: var(--warning-color);
}

.toast-out {
    animation: toast-out 0.3s ease forwards;
}

@keyframes toast-in {
    from {
        opacity: 0;
        transform: translateX(20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes toast-out {
    from {
        opacity: 1;
        transform: translateX(0);
    }

    to {
        opacity: 0;
        transform: translateX(20px);
    }
}

/* 加载状态 */
.loading {
    text-align: center;
    padding: 40px;
    color: var(--text-light);
}

.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    vertical-align: middle;
    margin-right: 8px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* 响应式 */
@media (max-width: 768px) {
    .form-row,
    .detail-grid {
        grid-template-columns: 1fr;
    }

    .page-layout {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        height: auto;
        position: static;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }

    .sidebar-nav {
        display: flex;
        flex-wrap: wrap;
        gap: 4px;
        padding: 0 12px 12px;
    }

    .nav-group-label {
        display: none;
    }

    .nav-item {
        padding: 6px 12px;
        border-left: none;
        border-radius: 999px;
        font-size: 13px;
    }

    .nav-item.active {
        border-left-color: transparent;
        background: var(--primary-color);
        color: #fff;
    }

    .nav-item.active .nav-count {
        background: rgba(255, 255, 255, 0.2);
        color: #fff;
    }

    .main-content {
        padding: 12px;
    }
}

/* 商品展示 - 列表 */
.product-cell {
    display: flex;
    align-items: center;
    gap: 8px;
    max-width: 280px;
}

.product-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow: hidden;
}

.product-sku {
    font-size: 11px;
    color: #999;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.product-thumb {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    flex-shrink: 0;
}

.product-title {
    font-size: 13px;
    color: var(--text-color);
    text-decoration: none;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-height: 1.35;
}

.product-title[target="_blank"]:hover {
    color: var(--primary-color);
    text-decoration: underline;
}

/* 商品展示 - 详情 */
.product-detail {
    display: flex;
    gap: 14px;
    padding: 12px;
    background: var(--bg-color);
    border-radius: 8px;
    margin-bottom: 16px;
}

.product-detail-img {
    width: 72px;
    height: 72px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    flex-shrink: 0;
}

.product-detail-info {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.product-detail-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-color);
    line-height: 1.4;
}

.product-detail-sku {
    font-size: 13px;
    color: var(--text-light);
}
