/* ========================================
   FBA物流后台管理系统 - 样式表 (PHP版)
   ======================================== */

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #06b6d4;
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;
    --bg: #f0f2f5;
    --card-bg: #ffffff;
    --text: #1e293b;
    --text-secondary: #64748b;
    --border: #e2e8f0;
    --shadow: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-lg: 0 4px 16px rgba(0,0,0,0.12);
    --radius: 8px;
    --radius-lg: 12px;
    --sidebar-width: 240px;
    --sidebar-collapsed: 64px;
    --topbar-height: 56px;
    --status-yellow: #f59e0b;
    --status-red: #ef4444;
    --status-green: #10b981;
    --status-gray: #94a3b8;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", sans-serif;
    background: var(--bg); color: var(--text); line-height: 1.6; min-height: 100vh; display: flex;
}

/* 侧边栏 */
.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, #1a1d2e 0%, #252840 100%);
    color: #fff; position: fixed; top: 0; left: 0; bottom: 0;
    display: flex; flex-direction: column; transition: width 0.3s ease, transform 0.3s ease;
    z-index: 100; overflow-x: hidden;
}
.sidebar.collapsed { width: var(--sidebar-collapsed); }
.sidebar-header { padding: 16px 20px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid rgba(255,255,255,0.08); }
.sidebar-logo { display: flex; align-items: center; gap: 10px; }
.logo-icon { font-size: 28px; }
.logo-text { font-size: 18px; font-weight: 700; white-space: nowrap; letter-spacing: 1px; }
.sidebar.collapsed .logo-text { display: none; }
.sidebar-toggle { background: none; border: none; color: rgba(255,255,255,0.6); font-size: 20px; cursor: pointer; padding: 4px 8px; }
.sidebar-toggle:hover { color: #fff; }
.sidebar-nav { flex: 1; padding: 12px 0; }
.nav-item { display: flex; align-items: center; gap: 12px; padding: 12px 20px; color: rgba(255,255,255,0.65); text-decoration: none; transition: all 0.2s; white-space: nowrap; margin: 2px 8px; border-radius: var(--radius); }
.nav-item:hover { background: rgba(255,255,255,0.1); color: #fff; }
.nav-item.active { background: var(--primary); color: #fff; }
.nav-icon { font-size: 18px; flex-shrink: 0; width: 24px; text-align: center; }
.sidebar.collapsed .nav-text { display: none; }
.sidebar.collapsed .nav-item { justify-content: center; padding: 12px; }
.sidebar-footer { padding: 16px 20px; border-top: 1px solid rgba(255,255,255,0.08); }
.user-info { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.user-avatar { font-size: 22px; }
.user-name { font-size: 14px; color: rgba(255,255,255,0.8); }
.sidebar.collapsed .user-name { display: none; }
.logout-btn { display: flex; align-items: center; gap: 8px; color: rgba(255,255,255,0.45); text-decoration: none; padding: 8px 0; transition: color 0.2s; font-size: 14px; }
.logout-btn:hover { color: var(--danger); }
.sidebar.collapsed .logout-btn .nav-text { display: none; }
.sidebar-overlay { display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.4); z-index: 99; }
.sidebar-overlay.active { display: block; }

/* 主内容区 */
.main-content { flex: 1; margin-left: var(--sidebar-width); transition: margin-left 0.3s ease; min-height: 100vh; display: flex; flex-direction: column; }
.sidebar.collapsed ~ .main-content { margin-left: var(--sidebar-collapsed); }
.top-bar { height: var(--topbar-height); background: var(--card-bg); border-bottom: 1px solid var(--border); display: flex; align-items: center; padding: 0 24px; gap: 16px; position: sticky; top: 0; z-index: 50; }
.mobile-toggle { display: none; background: none; border: none; font-size: 24px; cursor: pointer; color: var(--text); }
.page-title { font-size: 18px; font-weight: 700; }
.top-bar-right { flex: 1; text-align: right; }
.current-time { font-size: 13px; color: var(--text-secondary); }
.content-wrapper { padding: 24px; flex: 1; }

/* 登录页 */
.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); }
.login-container { width: 100%; max-width: 420px; padding: 20px; }
.login-card { background: var(--card-bg); border-radius: var(--radius-lg); padding: 40px 32px; box-shadow: var(--shadow-lg); }
.login-header { text-align: center; margin-bottom: 32px; }
.login-logo { font-size: 56px; margin-bottom: 16px; }
.login-header h1 { font-size: 24px; color: var(--text); margin-bottom: 8px; }
.login-header p { color: var(--text-secondary); font-size: 14px; }
.login-form { display: flex; flex-direction: column; gap: 20px; }
.login-footer { text-align: center; margin-top: 24px; font-size: 13px; color: var(--text-secondary); }

/* 仪表盘 */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { background: var(--card-bg); border-radius: var(--radius-lg); padding: 20px; display: flex; align-items: center; gap: 16px; box-shadow: var(--shadow); transition: transform 0.2s, box-shadow 0.2s; }
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.stat-icon { font-size: 36px; }
.stat-info { display: flex; flex-direction: column; }
.stat-value { font-size: 28px; font-weight: 800; line-height: 1.2; }
.stat-label { font-size: 13px; color: var(--text-secondary); margin-top: 2px; }
.stat-yellow .stat-value { color: var(--status-yellow); }
.stat-red .stat-value { color: var(--status-red); }
.stat-green .stat-value { color: var(--status-green); }
.stat-gray .stat-value { color: var(--status-gray); }
.stat-total .stat-value { color: var(--primary); }
.stat-money .stat-value { color: #7c3aed; }
.dashboard-section { background: var(--card-bg); border-radius: var(--radius-lg); padding: 24px; margin-bottom: 24px; box-shadow: var(--shadow); }
.section-title { font-size: 16px; font-weight: 700; margin-bottom: 16px; }
.transport-stats { display: flex; flex-direction: column; gap: 16px; }
.transport-item { display: flex; flex-direction: column; gap: 6px; }
.transport-bar { height: 28px; background: var(--gray-200); border-radius: 14px; overflow: hidden; }
.transport-fill { height: 100%; border-radius: 14px; transition: width 0.6s ease; min-width: 2%; }
.transport-fill.sea { background: linear-gradient(90deg, #06b6d4, #0891b2); }
.transport-fill.air { background: linear-gradient(90deg, #f59e0b, #d97706); }
.transport-info { display: flex; justify-content: space-between; font-size: 14px; }
.transport-label { font-weight: 600; }
.transport-count { color: var(--text-secondary); }
.section-action { display: flex; gap: 12px; margin-top: 20px; }

/* 表格 */
.table-wrapper { background: var(--card-bg); border-radius: var(--radius-lg); box-shadow: var(--shadow); overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th { background: var(--gray-50); padding: 14px 16px; text-align: left; font-weight: 700; font-size: 13px; color: var(--text-secondary); border-bottom: 2px solid var(--border); white-space: nowrap; }
.data-table td { padding: 14px 16px; border-bottom: 1px solid var(--border); font-size: 14px; }
.data-table tr:hover td { background: rgba(37,99,235,0.03); }
.empty-text { text-align: center; color: var(--text-secondary); padding: 40px; }
.fba-no { font-weight: 700; color: var(--primary); }

/* 状态颜色 */
.status-yellow { color: var(--status-yellow); font-weight: 600; }
.status-red { color: var(--status-red); font-weight: 600; }
.status-green { color: var(--status-green); font-weight: 600; }
.status-gray { color: var(--status-gray); }
.status-badge { display: inline-block; padding: 3px 10px; border-radius: 6px; font-size: 12px; font-weight: 600; margin-left: 6px; }
.status-yellow.status-badge { background: #fef3c7; color: #92400e; }
.status-red.status-badge { background: #fee2e2; color: #991b1b; }
.status-green.status-badge { background: #d1fae5; color: #065f46; }
.status-gray.status-badge { background: #f1f5f9; color: #475569; }
.transport-tag { display: inline-block; padding: 5px 14px; border-radius: 6px; font-size: 13px; font-weight: 600; }
.transport-tag.sea { background: #cffafe; color: #0e7490; }
.transport-tag.air { background: #fef3c7; color: #92400e; }
.total-price-link { color: var(--primary); text-decoration: none; font-weight: 700; cursor: pointer; }
.total-price-link:hover { text-decoration: underline; }
.total-row td { font-weight: 700; background: var(--gray-50); }

/* 操作栏 */
.action-bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; flex-wrap: wrap; gap: 12px; }
.action-left { display: flex; gap: 12px; }
.filter-group { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.search-input { padding: 10px 16px; border: 2px solid var(--border); border-radius: var(--radius); font-size: 14px; width: 260px; transition: border-color 0.2s; outline: none; }
.search-input:focus { border-color: var(--primary); }
.filter-select { padding: 10px 14px; border: 2px solid var(--border); border-radius: var(--radius); font-size: 14px; background: var(--card-bg); outline: none; }
.filter-select:focus { border-color: var(--primary); }

/* 表单 */
.form-page { max-width: 960px; }
.form-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.form-header h2 { font-size: 20px; }
.edit-form { background: var(--card-bg); border-radius: var(--radius-lg); padding: 32px; box-shadow: var(--shadow); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 20px; margin-bottom: 24px; }
.form-group { display: flex; flex-direction: column; gap: 8px; }
.form-group.full-width { grid-column: 1 / -1; }
.form-group label { font-size: 13px; font-weight: 700; color: var(--text-secondary); }
.required { color: var(--danger); }
.form-group input, .form-group select, .form-group textarea { padding: 10px 14px; border: 2px solid var(--border); border-radius: var(--radius); font-size: 14px; transition: border-color 0.2s; background: var(--card-bg); outline: none; }
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,0.12); }
.form-group input[readonly] { background: var(--gray-100); color: var(--text-secondary); border-color: var(--gray-200); }
/* 时效范围输入组 */
.time-range-group .time-range-inputs { display: flex; align-items: center; gap: 8px; }
.time-range-group .time-range-inputs input { width: 100px; text-align: center; }
.range-separator { font-size: 18px; font-weight: 700; color: var(--text-secondary); }
.range-unit { font-size: 14px; font-weight: 600; color: var(--text-secondary); }

.arrival-date-display { font-weight: 700; }
.box-input-section { background: var(--gray-50); border-radius: var(--radius); padding: 20px; margin-bottom: 24px; border: 2px solid var(--border); }
.section-subtitle { font-size: 16px; font-weight: 700; margin-bottom: 16px; }
.box-input-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.box-input-item { display: flex; flex-direction: column; gap: 6px; }
.box-input-item label { font-size: 12px; font-weight: 600; color: var(--text-secondary); }
.box-input-item input { padding: 10px 12px; border: 2px solid var(--border); border-radius: var(--radius); font-size: 14px; outline: none; }
.box-input-item input:focus { border-color: var(--primary); }
.total-weight-display { margin-top: 16px; padding: 14px 16px; background: var(--card-bg); border-radius: var(--radius); font-weight: 700; font-size: 15px; border: 1px solid var(--border); }
.form-actions { display: flex; gap: 12px; margin-top: 16px; }

/* 详情页 */
.detail-page { max-width: 960px; }
.detail-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; flex-wrap: wrap; gap: 12px; }
.detail-actions { display: flex; gap: 8px; }
.detail-content { background: var(--card-bg); border-radius: var(--radius-lg); box-shadow: var(--shadow); }
.detail-section { padding: 24px; border-bottom: 1px solid var(--border); }
.detail-section:last-child { border-bottom: none; }
.detail-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
.detail-item { display: flex; flex-direction: column; gap: 4px; }
.detail-label { font-size: 12px; color: var(--text-secondary); font-weight: 600; }
.detail-value { font-size: 15px; font-weight: 700; }
.detail-summary { display: flex; gap: 32px; margin-bottom: 16px; padding: 14px 16px; background: var(--gray-50); border-radius: var(--radius); }
.summary-item { display: flex; flex-direction: column; gap: 4px; }
.summary-label { font-size: 12px; color: var(--text-secondary); }
.summary-value { font-size: 20px; font-weight: 800; }
.summary-value.highlight { color: #7c3aed; }
.remark-content { padding: 14px; background: var(--gray-50); border-radius: var(--radius); font-size: 14px; line-height: 1.8; }

/* 按钮 */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 18px; border-radius: var(--radius); font-size: 14px; font-weight: 600; text-decoration: none; cursor: pointer; border: 2px solid transparent; transition: all 0.2s; white-space: nowrap; }
.btn:hover { opacity: 0.85; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-outline { background: var(--card-bg); color: var(--text); border-color: var(--border); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-text { background: none; color: var(--text-secondary); border: none; }
.btn-text:hover { color: var(--primary); }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 16px; }
.btn-block { width: 100%; }

/* 提示 */
.alert { padding: 14px 18px; border-radius: var(--radius); margin-bottom: 16px; font-size: 14px; }
.alert-success { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.alert-error { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }

/* 模态框 */
.modal-overlay { display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.5); z-index: 200; justify-content: center; align-items: center; }
.modal-overlay.active { display: flex; }
.modal-container { background: var(--card-bg); border-radius: var(--radius-lg); width: 90%; max-width: 600px; max-height: 80vh; overflow-y: auto; box-shadow: var(--shadow-lg); animation: modalIn 0.25s ease; }
@keyframes modalIn { from { transform: scale(0.95); opacity:0; } to { transform: scale(1); opacity:1; } }
.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 18px 24px; border-bottom: 1px solid var(--border); }
.modal-header h3 { font-size: 18px; font-weight: 700; }
.modal-close { background: none; border: none; font-size: 22px; cursor: pointer; color: var(--text-secondary); padding: 4px; }
.modal-close:hover { color: var(--text); }
.modal-body { padding: 24px; }
.box-detail-header { margin-bottom: 16px; }
.box-detail-header h4 { font-size: 16px; margin-bottom: 8px; }
.box-summary { font-size: 13px; color: var(--text-secondary); }

/* Toast */
.toast-container { position: fixed; top: 24px; right: 24px; z-index: 300; display: flex; flex-direction: column; gap: 8px; }
.toast { padding: 14px 20px; border-radius: var(--radius); background: var(--card-bg); box-shadow: var(--shadow-lg); font-size: 14px; font-weight: 600; animation: slideIn 0.3s ease; min-width: 200px; }
.toast.success { border-left: 4px solid var(--success); color: var(--success); }
.toast.error { border-left: 4px solid var(--danger); color: var(--danger); }
@keyframes slideIn { from { transform: translateX(100%); opacity:0; } to { transform: translateX(0); opacity:1; } }

/* 操作下拉菜单 */
.action-dropdown { position: relative; display: inline-block; }
.action-toggle { min-width: 72px; }
.action-menu {
    display: none; position: absolute; right: 0; top: calc(100% + 6px);
    background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow-lg); min-width: 140px; z-index: 50; padding: 6px 0;
    animation: menuIn 0.15s ease;
}
.action-menu.active { display: block; }
.action-menu::before {
    content: ''; position: absolute; top: -6px; right: 18px; width: 10px; height: 10px;
    background: var(--card-bg); border-left: 1px solid var(--border); border-top: 1px solid var(--border);
    transform: rotate(45deg);
}
.action-item {
    display: flex; align-items: center; gap: 8px; padding: 8px 16px;
    font-size: 13px; color: var(--text); text-decoration: none; cursor: pointer;
    background: none; border: none; width: 100%; text-align: left; transition: all 0.15s;
}
.action-item:hover { background: var(--gray-50); color: var(--primary); }
.action-item .action-icon { font-size: 14px; }
.action-item.action-danger { color: var(--danger); }
.action-item.action-danger:hover { background: #fee2e2; color: var(--danger); }
.action-divider { height: 1px; background: var(--border); margin: 4px 0; }
.action-form { margin: 0; }
@keyframes menuIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }

/* 分页 */
.pagination { display: flex; justify-content: space-between; align-items: center; margin-top: 16px; padding: 16px 0; }
.pagination-info { font-size: 13px; color: var(--text-secondary); }
.pagination-links { display: flex; gap: 4px; flex-wrap: wrap; }

/* 响应式 */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.mobile-open { transform: translateX(0); }
    .main-content { margin-left: 0 !important; }
    .mobile-toggle { display: block; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .form-grid { grid-template-columns: 1fr; }
    .detail-grid { grid-template-columns: 1fr 1fr; }
    .box-input-grid { grid-template-columns: repeat(2, 1fr); }
    .action-bar { flex-direction: column; }
    .filter-group { flex-direction: column; width: 100%; }
    .search-input, .filter-select { width: 100%; }
    .detail-actions { flex-wrap: wrap; }
    .detail-summary { flex-direction: column; gap: 12px; }
    .data-table th, .data-table td { padding: 10px 8px; font-size: 12px; }
    .fba-table { min-width: 900px; }
    .content-wrapper { padding: 16px; }
    .pagination { flex-direction: column; gap: 12px; align-items: center; }
}
@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
    .box-input-grid { grid-template-columns: 1fr; }
    .login-card { padding: 24px 16px; }
    .edit-form { padding: 20px; }
    .form-actions { flex-direction: column; }
    .detail-grid { grid-template-columns: 1fr; }
}
@media print {
    .sidebar, .top-bar, .action-bar, .sidebar-overlay { display: none; }
    .main-content { margin-left: 0; }
    .content-wrapper { padding: 0; }
}
