/* ========== 基础变量 ========== */
:root {
    --primary: #2563eb;
    --primary-light: #dbeafe;
    --success: #059669;
    --success-light: #d1fae5;
    --warning: #d97706;
    --warning-light: #fef3c7;
    --danger: #dc2626;
    --danger-light: #fee2e2;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-500: #6b7280;
    --gray-700: #374151;
    --gray-900: #111827;
    --radius: 10px;
    --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
    --transition: 0.2s ease;
}

/* ========== 全局 ========== */
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    background: var(--gray-50);
    color: var(--gray-900);
    line-height: 1.6;
    min-height: 100vh;
}

/* ========== 顶部导航 ========== */
.top-bar {
    background: #fff;
    border-bottom: 1px solid var(--gray-200);
    padding: 0 24px;
    height: 60px;
    display: flex;
    align-items: center;
    gap: 32px;
    position: sticky;
    top: 0;
    z-index: 100;
}
.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-weight: 700;
    font-size: 20px;
    color: var(--primary);
    user-select: none;
}
.logo-icon { font-size: 28px; }
.main-nav {
    display: flex;
    gap: 4px;
    background: var(--gray-100);
    border-radius: 8px;
    padding: 3px;
}
.nav-btn {
    padding: 8px 20px;
    border: none;
    background: transparent;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
}
.nav-btn.active {
    background: #fff;
    box-shadow: var(--shadow);
    color: var(--primary);
}
.top-bar-right { margin-left: auto; }
.badge-demo {
    background: var(--warning-light);
    color: var(--warning);
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 20px;
    font-weight: 600;
}

/* ========== 视图 ========== */
.view { display: none; padding: 24px; max-width: 1200px; margin: 0 auto; }
.view.active { display: block; }

/* ========== 子导航 ========== */
.sub-nav {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
}
.sub-nav-btn {
    padding: 10px 24px;
    border: 1px solid var(--gray-300);
    background: #fff;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: var(--transition);
}
.sub-nav-btn.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

/* ========== 标签内容 ========== */
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ========== 卡片 ========== */
.card {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
    margin-bottom: 20px;
}
.section-title {
    font-size: 20px;
    margin-bottom: 20px;
    color: var(--gray-900);
}

/* ========== 品类选择 ========== */
.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}
.category-card {
    border: 2px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 24px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
}
.category-card:hover {
    border-color: var(--primary);
    background: var(--primary-light);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}
.category-card.selected {
    border-color: var(--primary);
    background: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.2);
}
.cat-icon { font-size: 40px; margin-bottom: 8px; }
.cat-name { font-size: 17px; font-weight: 600; color: var(--gray-900); }
.cat-desc { font-size: 13px; color: var(--gray-500); margin-top: 4px; }

/* ========== 下单布局 ========== */
.order-layout {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 20px;
    align-items: start;
}
@media (max-width: 768px) {
    .order-layout { grid-template-columns: 1fr; }
    .top-bar { padding: 0 12px; gap: 12px; }
    .nav-btn { padding: 8px 12px; font-size: 13px; }
    .logo-text { display: none; }
}

/* ========== 步骤指示器 ========== */
.step-indicator {
    display: flex;
    align-items: center;
    gap: 0;
    margin-bottom: 24px;
    padding: 0 20px;
}
.step {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--gray-500);
    white-space: nowrap;
}
.step.active { color: var(--primary); font-weight: 600; }
.step.done { color: var(--success); }
.step-num {
    width: 28px; height: 28px;
    border-radius: 50%;
    background: var(--gray-200);
    display: flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 600;
}
.step.active .step-num { background: var(--primary); color: #fff; }
.step.done .step-num { background: var(--success); color: #fff; }
.step-line {
    flex: 1; height: 2px; background: var(--gray-200);
    margin: 0 12px; min-width: 30px;
}

/* ========== 表单 ========== */
.form-step { display: none; }
.form-step.active { display: block; }
.step-title { font-size: 17px; margin-bottom: 16px; display: flex; align-items: center; gap: 12px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 768px) { .form-grid { grid-template-columns: 1fr; } }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label { font-size: 14px; font-weight: 500; color: var(--gray-700); }
.form-group input, .form-group select, .form-group textarea {
    padding: 10px 12px;
    border: 1px solid var(--gray-300);
    border-radius: 8px;
    font-size: 14px;
    transition: var(--transition);
    font-family: inherit;
    background: #fff;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}
.radio-group { display: flex; gap: 16px; padding-top: 6px; }
.radio-label { display: flex; align-items: center; gap: 6px; font-size: 14px; cursor: pointer; font-weight: 400; }
.required { color: var(--danger); }

/* ========== 按钮 ========== */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: #1d4ed8; }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #047857; }
.btn-outline { background: #fff; border: 1px solid var(--gray-300); color: var(--gray-700); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-block { width: 100%; }
.btn-text { background: none; border: none; color: var(--gray-500); cursor: pointer; font-size: 13px; }
.btn-text:hover { color: var(--danger); }
.btn-icon {
    background: none; border: none; font-size: 20px; cursor: pointer;
    padding: 4px 8px; border-radius: 6px; color: var(--gray-500);
}
.btn-icon:hover { background: var(--gray-100); }

/* ========== 文件上传 ========== */
.upload-area {
    border: 2px dashed var(--gray-300);
    border-radius: var(--radius);
    padding: 40px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
}
.upload-area:hover, .upload-area.drag-over {
    border-color: var(--primary);
    background: var(--primary-light);
}
.upload-icon { font-size: 48px; margin-bottom: 8px; }
.upload-text { font-size: 15px; color: var(--gray-700); margin-bottom: 4px; }
.upload-hint { font-size: 13px; color: var(--gray-500); margin-bottom: 16px; }
.uploaded-list { margin-top: 12px; }
.uploaded-file {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 14px; background: var(--gray-50); border-radius: 8px;
    margin-bottom: 8px; font-size: 14px;
}
.uploaded-file .file-name { font-weight: 500; }
.uploaded-file .file-size { color: var(--gray-500); font-size: 13px; }
.uploaded-file .file-remove { color: var(--danger); cursor: pointer; font-size: 13px; }
.check-result { padding: 12px; border-radius: 8px; margin-top: 12px; font-size: 14px; }
.check-result.pass { background: var(--success-light); color: var(--success); }
.check-result.fail { background: var(--danger-light); color: var(--danger); }

/* ========== 报价卡片 ========== */
.quote-card {
    position: sticky;
    top: 80px;
    text-align: center;
}
.quote-card h3 { font-size: 16px; margin-bottom: 12px; color: var(--gray-700); }
.quote-price {
    font-size: 36px; font-weight: 800; color: var(--primary);
    margin-bottom: 8px;
}
.quote-detail { font-size: 13px; color: var(--gray-500); line-height: 1.8; }
.quote-note { font-size: 12px; color: var(--gray-500); margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--gray-200); }

/* ========== 订单汇总 ========== */
.order-summary {
    background: var(--gray-50);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 16px;
    font-size: 14px;
    line-height: 2;
}
.order-summary strong { color: var(--gray-900); }

/* ========== 模态框 ========== */
.modal-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 200;
    align-items: center; justify-content: center;
}
.modal-overlay.active { display: flex; }
.modal {
    background: #fff;
    border-radius: 16px;
    padding: 32px;
    max-width: 420px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}
.modal h2 { text-align: center; margin-bottom: 16px; }
.modal-icon { font-size: 56px; text-align: center; margin-bottom: 8px; }
.modal-tip { font-size: 13px; color: var(--gray-500); text-align: center; margin-bottom: 4px; }
.order-number {
    font-size: 28px; font-weight: 800; text-align: center;
    color: var(--primary); margin: 12px 0;
    letter-spacing: 2px;
}
.modal .btn { margin-top: 8px; }

/* ========== 支付方式 ========== */
.payment-methods { display: flex; flex-direction: column; gap: 10px; margin: 20px 0; }
.payment-btn {
    padding: 14px 20px;
    border: 2px solid var(--gray-200);
    border-radius: 10px;
    background: #fff;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    transition: var(--transition);
    display: flex; align-items: center; gap: 10px;
}
.payment-btn:hover { border-color: var(--primary); background: var(--primary-light); }
.payment-btn small { color: var(--gray-500); font-size: 12px; margin-left: auto; }
.pay-icon { font-size: 24px; }

/* ========== 订单查询 ========== */
.track-card { max-width: 600px; margin: 0 auto; }
.search-row { display: flex; gap: 10px; margin-bottom: 12px; }
.search-input {
    flex: 1; padding: 10px 14px;
    border: 1px solid var(--gray-300); border-radius: 8px;
    font-size: 14px; font-family: inherit;
}
.search-input:focus { outline: none; border-color: var(--primary); }
.quick-demo { font-size: 13px; color: var(--gray-500); margin-bottom: 16px; }
.quick-demo a { color: var(--primary); cursor: pointer; text-decoration: underline; }
.track-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 16px 0; border-bottom: 1px solid var(--gray-200); margin-bottom: 20px;
}
.track-label { font-size: 13px; color: var(--gray-500); display: block; }
.track-value { font-size: 16px; font-weight: 600; }

/* ========== 状态标签 ========== */
.status-badge {
    padding: 4px 12px; border-radius: 20px; font-size: 13px; font-weight: 500;
}
.status-pending { background: var(--warning-light); color: var(--warning); }
.status-paying { background: var(--primary-light); color: var(--primary); }
.status-producing { background: #e0e7ff; color: #4338ca; }
.status-shipped { background: #cffafe; color: #0e7490; }
.status-completed { background: var(--success-light); color: var(--success); }
.status-cancelled { background: var(--danger-light); color: var(--danger); }

/* ========== 时间线 ========== */
.timeline { position: relative; padding-left: 30px; }
.timeline::before {
    content: '';
    position: absolute; left: 8px; top: 8px; bottom: 8px;
    width: 2px; background: var(--gray-200);
}
.timeline-item {
    position: relative; padding: 8px 0 20px;
}
.timeline-item:last-child { padding-bottom: 0; }
.timeline-dot {
    position: absolute; left: -22px; top: 10px;
    width: 14px; height: 14px; border-radius: 50%;
    background: var(--gray-300); border: 2px solid #fff;
}
.timeline-item.active .timeline-dot { background: var(--primary); box-shadow: 0 0 0 4px rgba(37,99,235,0.2); }
.timeline-item.current .timeline-dot { background: var(--warning); box-shadow: 0 0 0 4px rgba(217,119,6,0.2); animation: pulse 2s infinite; }
@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 4px rgba(217,119,6,0.2); }
    50% { box-shadow: 0 0 0 8px rgba(217,119,6,0.1); }
}
.timeline-time { font-size: 12px; color: var(--gray-500); }
.timeline-content { font-size: 14px; font-weight: 500; margin-top: 2px; }
.timeline-item.active .timeline-content { color: var(--gray-900); }
.timeline-item:not(.active) .timeline-content { color: var(--gray-500); }

/* ========== 管理端 ========== */
.admin-header { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; margin-bottom: 16px; }
.filter-row { display: flex; gap: 10px; flex-wrap: wrap; }
.filter-select, .filter-input {
    padding: 8px 12px; border: 1px solid var(--gray-300); border-radius: 8px;
    font-size: 13px; font-family: inherit;
}
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th {
    text-align: left; padding: 12px 14px;
    background: var(--gray-50); color: var(--gray-500);
    font-weight: 500; font-size: 13px;
    border-bottom: 1px solid var(--gray-200);
    white-space: nowrap;
}
.data-table td {
    padding: 12px 14px; border-bottom: 1px solid var(--gray-100);
}
.data-table tr:hover td { background: var(--gray-50); }
.link { color: var(--primary); cursor: pointer; text-decoration: none; font-size: 13px; }
.link:hover { text-decoration: underline; }

/* ========== 抽屉 ========== */
.drawer-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,0.4); z-index: 150;
}
.drawer-overlay.active { display: block; }
.drawer {
    position: fixed; top: 0; right: -480px; width: 460px; height: 100%;
    background: #fff; z-index: 151; transition: right 0.3s ease;
    box-shadow: -4px 0 20px rgba(0,0,0,0.1);
    display: flex; flex-direction: column;
}
@media (max-width: 500px) { .drawer { width: 100%; right: -100%; } }
.drawer.open { right: 0; }
.drawer-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 20px 24px; border-bottom: 1px solid var(--gray-200);
}
.drawer-body { flex: 1; overflow-y: auto; padding: 24px; }
.drawer-body .info-row { display: flex; justify-content: space-between; padding: 8px 0; font-size: 14px; border-bottom: 1px solid var(--gray-100); }
.drawer-body .info-row .label { color: var(--gray-500); }
.drawer-body .info-row .value { font-weight: 500; }
.drawer-actions { margin-top: 20px; display: flex; gap: 10px; flex-wrap: wrap; }

/* ========== 统计卡片 ========== */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.stat-card {
    background: #fff; border-radius: var(--radius); box-shadow: var(--shadow);
    padding: 20px 24px;
}
.stat-label { font-size: 13px; color: var(--gray-500); margin-bottom: 4px; }
.stat-value { font-size: 28px; font-weight: 700; color: var(--gray-900); }
.stat-change { font-size: 13px; margin-top: 4px; color: var(--gray-500); }
.stat-change.up { color: var(--success); }

/* ========== 响应式 ========== */
@media (max-width: 640px) {
    .sub-nav { flex-wrap: wrap; }
    .sub-nav-btn { flex: 1; text-align: center; padding: 8px 12px; font-size: 13px; }
    .search-row { flex-direction: column; }
    .filter-row { flex-direction: column; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .stat-value { font-size: 22px; }
}
