/* ============================================================
   快递面单管理系统 - 全局样式
   ============================================================ */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --success: #16a34a;
    --warning: #d97706;
    --danger: #dc2626;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-500: #6b7280;
    --gray-700: #374151;
    --gray-900: #111827;
    --radius: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,0.1);
}

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;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- 按钮 ---- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius);
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}
.btn:hover { opacity: 0.9; text-decoration: none; }
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-danger  { background: var(--danger); color: #fff; }
.btn-gray    { background: var(--gray-200); color: var(--gray-700); }
.btn-block   { width: 100%; }
.btn-sm      { padding: 6px 12px; font-size: 13px; }
.btn-lg      { padding: 14px 28px; font-size: 17px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---- 表单 ---- */
.form-group { margin-bottom: 16px; }
.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: var(--gray-700);
    font-size: 14px;
}
.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="number"],
.form-group input[type="date"],
.form-group input[type="email"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 15px;
    transition: border-color 0.2s;
    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);
}

/* ---- 提示框 ---- */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    font-size: 14px;
}
.alert-error   { background: #fef2f2; color: var(--danger); border: 1px solid #fecaca; }
.alert-success { background: #f0fdf4; color: var(--success); border: 1px solid #bbf7d0; }
.alert-warning { background: #fffbeb; color: var(--warning); border: 1px solid #fde68a; }
.alert-info    { background: #eff6ff; color: var(--primary); border: 1px solid #bfdbfe; }

/* ---- 标签 ---- */
.tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    margin-right: 6px;
}
.tag-success { background: #dcfce7; color: var(--success); }
.tag-failed  { background: #fee2e2; color: var(--danger); }
.tag-pending { background: #fef3c7; color: var(--warning); }
.tag-skipped { background: var(--gray-200); color: var(--gray-500); }
.tag-admin   { background: #ede9fe; color: #7c3aed; }
.tag-user    { background: #e0f2fe; color: #0284c7; }

/* ============================================================
   登录页
   ============================================================ */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px;
}
.login-box {
    background: #fff;
    padding: 40px 32px;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
    width: 100%;
    max-width: 380px;
    text-align: center;
}
.login-logo { font-size: 48px; margin-bottom: 12px; }
.login-box h1 { font-size: 22px; margin-bottom: 4px; color: var(--gray-900); }
.login-sub { color: var(--gray-500); font-size: 14px; margin-bottom: 28px; }
.login-form { text-align: left; }
.login-tip { margin-top: 20px; font-size: 12px; color: var(--gray-500); }

/* ============================================================
   移动端页面 - 高端简约
   ============================================================ */
.mobile-page {
    max-width: 640px;
    margin: 0 auto;
    min-height: 100vh;
    background: #f7f8fa;
    padding-bottom: 40px;
}

/* 顶部导航 */
.mobile-header {
    background: #1a2742;
    color: #fff;
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}
.header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}
.header-logo {
    width: 32px;
    height: 32px;
    background: #c9a96e;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #1a2742;
}
.header-logo svg { width: 18px; height: 18px; }
.header-text { display: flex; flex-direction: column; }
.header-title {
    font-size: 15px;
    font-weight: 600;
    color: #fff;
    letter-spacing: 0.3px;
}
.header-sub {
    font-size: 9px;
    color: rgba(255,255,255,0.4);
    letter-spacing: 1px;
    text-transform: uppercase;
    margin-top: 1px;
}
.header-user {
    display: flex;
    align-items: center;
    gap: 8px;
}
.user-name {
    font-size: 12px;
    color: rgba(255,255,255,0.75);
}
.logout-btn {
    font-size: 11px;
    color: rgba(255,255,255,0.6);
    text-decoration: none;
    padding: 3px 8px;
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 4px;
}
.logout-btn:hover { text-decoration: none; color: #fff; }

.mobile-main { padding: 14px 14px; }

/* 统计卡片 */
.stats-row {
    display: flex;
    gap: 10px;
    margin-bottom: 14px;
}
.stat-card {
    flex: 1;
    background: #fff;
    border-radius: 10px;
    padding: 12px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid #eef0f3;
}
.stat-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.stat-today .stat-icon { background: #f0f3f8; color: #1a2742; }
.stat-total .stat-icon { background: #faf6ed; color: #b8943f; }
.stat-icon svg { width: 16px; height: 16px; }
.stat-content { flex: 1; min-width: 0; }
.stat-num {
    font-size: 20px;
    font-weight: 700;
    color: #1a2742;
    line-height: 1.1;
}
.stat-label {
    font-size: 11px;
    color: #9aa2b1;
    margin-top: 2px;
}

/* 区块通用 */
.upload-section, .recent-section {
    background: #fff;
    border-radius: 12px;
    padding: 14px;
    margin-bottom: 12px;
    border: 1px solid #eef0f3;
}
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}
.section-title {
    font-size: 14px;
    font-weight: 600;
    color: #1a2742;
    margin: 0;
}
.section-badge {
    font-size: 10px;
    color: #9aa2b1;
    font-weight: 500;
}

/* 上传按钮 */
.upload-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.upload-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 10px;
    cursor: pointer;
    transition: opacity 0.2s;
    text-decoration: none;
}
.upload-btn:active { opacity: 0.85; }
.upload-btn-camera {
    background: #1a2742;
}
.upload-btn-album {
    background: #fff;
    border: 1px solid #e2e5ea;
}
.upload-btn-goods {
    background: linear-gradient(135deg, #1a2742 0%, #2a4a7a 100%);
    border: 1px solid #c9a96e;
}
.upload-btn-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.upload-btn-camera .upload-btn-icon {
    background: rgba(201, 169, 110, 0.15);
    color: #c9a96e;
}
.upload-btn-album .upload-btn-icon {
    background: #f5f6f8;
    color: #1a2742;
}
.upload-btn-goods .upload-btn-icon {
    background: rgba(201, 169, 110, 0.2);
    color: #c9a96e;
}
.upload-btn-icon svg { width: 18px; height: 18px; }
.upload-btn-text { flex: 1; }
.upload-btn-title {
    font-size: 14px;
    font-weight: 600;
}
.upload-btn-camera .upload-btn-title { color: #fff; }
.upload-btn-album .upload-btn-title { color: #1a2742; }
.upload-btn-goods .upload-btn-title { color: #c9a96e; }
.upload-btn-desc {
    font-size: 11px;
    margin-top: 1px;
}
.upload-btn-camera .upload-btn-desc { color: rgba(255,255,255,0.45); }
.upload-btn-album .upload-btn-desc { color: #9aa2b1; }
.upload-btn-goods .upload-btn-desc { color: rgba(201, 169, 110, 0.7); }

/* 上传队列 */
.upload-queue {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid #f0f2f5;
}
.queue-header {
    margin-bottom: 8px;
}
.queue-header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}
.queue-title {
    font-size: 12px;
    font-weight: 600;
    color: #1a2742;
}
.queue-progress-text {
    font-size: 11px;
    font-weight: 600;
    color: #1a2742;
}
/* 整体进度条 */
.queue-total-bar {
    height: 4px;
    background: #e8eaed;
    border-radius: 2px;
    overflow: hidden;
}
.queue-total-progress {
    height: 100%;
    background: linear-gradient(90deg, #1a2742, #c9a96e);
    border-radius: 2px;
    transition: width 0.3s ease;
}
.queue-total-progress.complete {
    background: #15803d;
}
.queue-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    transition: max-height 0.3s ease;
}
.queue-item {
    background: #fafbfc;
    border-radius: 8px;
    padding: 8px 10px;
}
.queue-item-name {
    font-size: 11px;
    color: #6b7280;
    margin-bottom: 4px;
    word-break: break-all;
}
.queue-item-bar {
    height: 3px;
    background: #eef0f3;
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 3px;
}
.queue-item-progress {
    height: 100%;
    background: #1a2742;
    border-radius: 2px;
    transition: width 0.3s;
}
.queue-status { font-size: 10px; font-weight: 600; }
.queue-status.waiting  { color: #9aa2b1; }
.queue-status.uploading { color: #1a2742; }
.queue-status.success   { color: #16a34a; }
.queue-status.failed    { color: #dc2626; }

/* 最近上传列表 */
.empty-tip {
    text-align: center;
    color: #9aa2b1;
    padding: 28px 16px;
    font-size: 13px;
}
.empty-icon {
    font-size: 32px;
    margin-bottom: 8px;
    opacity: 0.4;
}
.recent-list {
    display: flex;
    flex-direction: column;
}
.recent-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid #f3f4f6;
    cursor: pointer;
}
.recent-item:last-child { border-bottom: none; }
.recent-thumb {
    width: 52px;
    height: 52px;
    flex-shrink: 0;
    border-radius: 8px;
    overflow: hidden;
    background: #f0f2f5;
}
.recent-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.recent-info { flex: 1; min-width: 0; }
.recent-number {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 3px;
}
.tracking-no {
    font-size: 13px;
    font-weight: 600;
    color: #1a2742;
    font-family: "SF Mono", "Menlo", monospace;
}
.recent-meta {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    color: #9aa2b1;
}
.recent-time { font-weight: 500; }
.recent-dot { color: #d5d9e0; }
.recent-size { color: #b5bcc8; }
.recent-arrow {
    color: #d5d9e0;
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.recent-arrow svg { width: 14px; height: 14px; }

/* 标签 */
.mobile-page .tag {
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
}
.mobile-page .tag-success { background: #f0fdf4; color: #15803d; }
.mobile-page .tag-pending { background: #fffbeb; color: #b45309; }
.mobile-page .tag-failed  { background: #fef2f2; color: #b91c1c; }

/* 浮动刷新按钮 */
.fab-refresh {
    position: fixed;
    right: 20px;
    bottom: 24px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #1a2742;
    color: #c9a96e;
    border: none;
    box-shadow: 0 4px 16px rgba(26, 39, 66, 0.35);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999;
    transition: all 0.2s;
}
.fab-refresh:active {
    transform: scale(0.9);
    background: #243b6b;
}
.fab-refresh svg {
    width: 22px;
    height: 22px;
}
.fab-refresh.spinning svg {
    animation: spin 0.8s linear infinite;
}
.fab-refresh:disabled {
    opacity: 0.7;
    cursor: wait;
}
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ============================================================
   后台管理布局
   ============================================================ */
.admin-layout {
    display: flex;
    min-height: 100vh;
}
.admin-sidebar {
    width: 220px;
    background: var(--gray-900);
    color: #fff;
    flex-shrink: 0;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    overflow-y: auto;
    z-index: 50;
}
.admin-sidebar .logo {
    padding: 20px 16px;
    font-size: 16px;
    font-weight: 600;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}
.admin-sidebar .nav { padding: 12px 0; }
.admin-sidebar .nav a {
    display: block;
    padding: 11px 20px;
    color: rgba(255,255,255,0.7);
    font-size: 14px;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}
.admin-sidebar .nav a:hover {
    color: #fff;
    background: rgba(255,255,255,0.05);
    text-decoration: none;
}
.admin-sidebar .nav a.active {
    color: #fff;
    background: rgba(37,99,235,0.2);
    border-left-color: var(--primary);
}
.admin-sidebar .sidebar-user {
    padding: 16px;
    border-top: 1px solid rgba(255,255,255,0.1);
    font-size: 13px;
    color: rgba(255,255,255,0.6);
}
.admin-sidebar .sidebar-user a { color: rgba(255,255,255,0.6); font-size: 12px; }

.admin-main {
    flex: 1;
    margin-left: 220px;
    padding: 24px;
    min-width: 0;
}
.admin-page-title {
    font-size: 22px;
    font-weight: 600;
    margin-bottom: 20px;
    color: var(--gray-900);
}

/* 卡片 */
.card {
    background: #fff;
    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(--gray-900);
}

/* 统计卡片行 */
.stat-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}
.stat-card-big {
    background: #fff;
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
}
.stat-card-big .num { font-size: 32px; font-weight: 700; color: var(--primary); }
.stat-card-big .label { font-size: 14px; color: var(--gray-500); margin-top: 4px; }

/* 表格 */
.table-wrap { overflow-x: auto; }
table.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
table.data-table th,
table.data-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--gray-100);
}
table.data-table th {
    background: var(--gray-50);
    font-weight: 600;
    color: var(--gray-700);
    white-space: nowrap;
}
table.data-table tr:hover { background: var(--gray-50); }
table.data-table .thumb {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 4px;
    cursor: pointer;
}

/* 筛选栏 */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: flex-end;
    margin-bottom: 16px;
}
.filter-bar .form-group { margin-bottom: 0; min-width: 160px; }
.filter-bar .form-group input,
.filter-bar .form-group select { padding: 8px 10px; font-size: 14px; }

/* 分页 */
.pagination {
    display: flex;
    gap: 6px;
    margin-top: 16px;
    align-items: center;
    flex-wrap: wrap;
}
.pagination a, .pagination span {
    padding: 6px 12px;
    border: 1px solid var(--gray-200);
    border-radius: 4px;
    font-size: 13px;
    color: var(--gray-700);
}
.pagination a:hover { background: var(--gray-50); text-decoration: none; }
.pagination .current { background: var(--primary); color: #fff; border-color: var(--primary); }
.pagination .info { color: var(--gray-500); border: none; }

/* 图片预览模态框 */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.8);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.modal-overlay.show { display: flex; }
.modal-overlay img {
    max-width: 100%;
    max-height: 90vh;
    border-radius: 8px;
}
.modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    color: #fff;
    font-size: 30px;
    cursor: pointer;
    background: none;
    border: none;
}

/* 识别进度 */
.recognize-progress {
    margin: 16px 0;
    padding: 16px;
    background: var(--gray-50);
    border-radius: var(--radius);
    display: none;
}
.recognize-progress.show { display: block; }
.progress-bar-wrap {
    height: 8px;
    background: var(--gray-200);
    border-radius: 4px;
    overflow: hidden;
    margin: 8px 0;
}
.progress-bar-fill {
    height: 100%;
    background: var(--primary);
    transition: width 0.3s;
}
.progress-text { font-size: 13px; color: var(--gray-700); }

/* 响应式 */
@media (max-width: 768px) {
    .admin-sidebar { width: 60px; }
    .admin-sidebar .logo, .admin-sidebar .nav a span, .admin-sidebar .sidebar-user { display: none; }
    .admin-sidebar .nav a { text-align: center; padding: 12px 0; font-size: 20px; }
    .admin-main { margin-left: 60px; padding: 16px; }
}
