/* 押运管理系统 - 全局样式 */
:root {
    --primary: #283593;
    --primary-light: #3949ab;
    --primary-dark: #1a237e;
    --success: #2e7d32;
    --danger: #c62828;
    --warning: #e65100;
    --info: #0277bd;
    --gray-50: #fafafa;
    --gray-100: #f5f5f5;
    --gray-200: #eeeeee;
    --gray-300: #e0e0e0;
    --gray-400: #bdbdbd;
    --gray-500: #9e9e9e;
    --gray-600: #757575;
    --gray-700: #616161;
    --gray-800: #424242;
    --gray-900: #212121;
    --sidebar-width: 260px;
    --header-height: 64px;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
    --shadow-lg: 0 8px 30px rgba(0,0,0,0.15);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--gray-100);
    color: var(--gray-800);
    font-size: 14px;
    line-height: 1.6;
}

/* 布局 */
.app-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, var(--primary-dark) 0%, var(--primary) 100%);
    color: #fff;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 1000;
    transition: transform 0.3s ease;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 24px 20px;
    text-align: center;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    flex-shrink: 0;
}

.sidebar-logo {
    font-size: 36px;
    margin-bottom: 5px;
}

.sidebar-header h2 {
    font-size: 17px;
    font-weight: 600;
    letter-spacing: 1px;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 0;
    overflow-y: auto;
}

.nav-section {
    margin-bottom: 8px;
    padding: 0 14px;
}

.nav-section-title {
    font-size: 11px;
    color: rgba(255,255,255,0.45);
    text-transform: uppercase;
    letter-spacing: 2px;
    padding: 8px 14px 6px;
    font-weight: 700;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 11px 14px;
    border-radius: var(--radius-sm);
    color: rgba(255,255,255,0.78);
    text-decoration: none;
    transition: all 0.25s ease;
    cursor: pointer;
    font-size: 14px;
    gap: 11px;
    position: relative;
}

.nav-item:hover,
.nav-item.active {
    background: rgba(255,255,255,0.15);
    color: #fff;
}

.nav-item.active {
    background: rgba(255,255,255,0.22);
    box-shadow: inset 3px 0 0 0 #64b5f6;
}

.nav-icon {
    width: 20px;
    text-align: center;
    font-size: 18px;
    flex-shrink: 0;
}

.nav-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
    flex-shrink: 0;
}

.user-info-mini {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border-radius: var(--radius-sm);
    background: rgba(0,0,0,0.15);
}

.user-avatar-mini {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255,255,255,0.3);
}

.user-name-mini {
    font-size: 13px;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-role-mini {
    font-size: 11px;
    opacity: 0.7;
}

/* 主内容区 */
.main-wrapper {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-width: 0;
}

.top-header {
    height: var(--header-height);
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--gray-700);
    padding: 8px;
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--gray-500);
}

.breadcrumb a { color: var(--primary); text-decoration: none; }
.breadcrumb span:last-child { color: var(--gray-800); font-weight: 500; }
.breadcrumb .sep { color: var(--gray-400); }

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--gray-600);
    position: relative;
    padding: 8px;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
    font-size: 19px;
}

.header-btn:hover { background: var(--gray-100); color: var(--primary); }

.page-content {
    padding: 26px;
}

/* 页面标题 */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 15px;
}

.page-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--gray-900);
    display: flex;
    align-items: center;
    gap: 10px;
}

.page-title .icon { font-size: 26px; }

/* 卡片 */
.card {
    background: #fff;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: box-shadow 0.3s;
}

.card:hover { box-shadow: var(--shadow-md); }

.card-header {
    padding: 18px 24px;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.card-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--gray-900);
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-body { padding: 24px; }

.card-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--gray-200);
    background: var(--gray-50);
}

/* 统计卡片 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.stat-card {
    background: #fff;
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.stat-card .stat-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin-bottom: 16px;
}

.stat-card .stat-value {
    font-size: 30px;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 4px;
}

.stat-card .stat-label {
    font-size: 13px;
    color: var(--gray-500);
}

.stat-blue .stat-icon { background: #e8eaf6; color: var(--primary); }
.stat-green .stat-icon { background: #e8f5e9; color: var(--success); }
.stat-orange .stat-icon { background: #fff3e0; color: var(--warning); }
.stat-red .stat-icon { background: #ffebee; color: var(--danger); }
.stat-cyan .stat-icon { background: #e0f7fa; color: var(--info); }

.stat-blue .stat-value { color: var(--primary); }
.stat-green .stat-value { color: var(--success); }
.stat-orange .stat-value { color: var(--warning); }
.stat-red .stat-value { color: var(--danger); }
.stat-cyan .stat-value { color: var(--info); }

/* 按钮 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 18px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all 0.25s ease;
    text-decoration: none;
    line-height: 1.4;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: #fff;
}
.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(40,53,147,0.35);
}

.btn-success {
    background: linear-gradient(135deg, var(--success), #43a047);
    color: #fff;
}
.btn-success:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(46,125,50,0.35);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger), #d32f2f);
    color: #fff;
}
.btn-warning {
    background: linear-gradient(135deg, var(--warning), #f57c00);
    color: #fff;
}
.btn-secondary {
    background: var(--gray-200);
    color: var(--gray-700);
}
.btn-secondary:hover { background: var(--gray-300); }
.btn-outline {
    background: transparent;
    border: 2px solid var(--gray-300);
    color: var(--gray-700);
}
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-sm { padding: 6px 13px; font-size: 13px; }
.btn-lg { padding: 12px 26px; font-size: 16px; }
.btn-block { width: 100%; }

/* 表格 */
.table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.data-table th {
    background: var(--gray-50);
    padding: 13px 16px;
    text-align: left;
    font-weight: 600;
    color: var(--gray-700);
    border-bottom: 2px solid var(--gray-200);
    white-space: nowrap;
}

.data-table td {
    padding: 13px 16px;
    border-bottom: 1px solid var(--gray-200);
    vertical-align: middle;
}

.data-table tr:hover td { background: var(--gray-50); }
.data-table tr:last-child td { border-bottom: none; }

/* 表单 */
.form-group { margin-bottom: 20px; }
.form-group label {
    display: block;
    margin-bottom: 7px;
    font-weight: 600;
    font-size: 13px;
    color: var(--gray-700);
}
.form-label-required::after { content: ' *'; color: var(--danger); }

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid var(--gray-300);
    border-radius: var(--radius-sm);
    font-size: 14px;
    outline: none;
    transition: all 0.25s;
    background: #fff;
}
.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(40,53,147,0.08);
}
textarea.form-control { min-height: 90px; resize: vertical; }
select.form-control { appearance: auto; }

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}

/* 状态标签 */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.badge-primary { background: #e8eaf6; color: var(--primary); }
.badge-success { background: #e8f5e9; color: var(--success); }
.badge-danger { background: #ffebee; color: var(--danger); }
.badge-warning { background: #fff3e0; color: var(--warning); }
.badge-info { background: #e1f5fe; color: var(--info); }
.badge-default { background: var(--gray-200); color: var(--gray-600); }

/* 提示框 */
.alert {
    padding: 14px 20px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    margin-bottom: 18px;
    border-left: 4px solid transparent;
}
.alert-error { background: #ffebee; color: #b71c1c; border-left-color: var(--danger); }
.alert-success { background: #e8f5e9; color: #1b5e20; border-left-color: var(--success); }
.alert-warning { background: #fff3e0; color: #e65100; border-left-color: var(--warning); }
.alert-info { background: #e3f2fd; color: #01579b; border-left-color: var(--info); }

/* 分页 */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 5px;
    margin-top: 24px;
    flex-wrap: wrap;
}
.pagination a, .pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    text-decoration: none;
    border: 1px solid var(--gray-300);
    color: var(--gray-700);
    transition: all 0.2s;
}
.pagination a:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
.pagination .active { background: var(--primary); color: #fff; border-color: var(--primary); }
.pagination .disabled { opacity: 0.5; pointer-events: none; }

/* 模态框/弹窗 */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.2s ease;
}

.modal-box {
    background: #fff;
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 25px 70px rgba(0,0,0,0.3);
    animation: slideUp 0.3s ease;
}

.modal-header {
    padding: 22px 26px;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 { font-size: 18px; font-weight: 600; }
.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--gray-500);
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
}
.modal-close:hover { background: var(--gray-100); color: var(--danger); }
.modal-body { padding: 26px; }
.modal-footer {
    padding: 18px 26px;
    border-top: 1px solid var(--gray-200);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(20px); } to { transform: translateY(0); } }

/* 搜索栏 */
.search-bar {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}
.search-input-wrap {
    position: relative;
    flex: 1;
    min-width: 200px;
}
.search-input {
    width: 100%;
    padding: 9px 14px 9px 38px;
    border: 2px solid var(--gray-300);
    border-radius: var(--radius-sm);
    outline: none;
    font-size: 14px;
    transition: all 0.25s;
}
.search-input:focus { border-color: var(--primary); }
.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-400);
    font-size: 16px;
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 50px 20px;
    color: var(--gray-500);
}
.empty-state .empty-icon { font-size: 56px; margin-bottom: 14px; }
.empty-state p { font-size: 15px; margin-bottom: 18px; }

/* 操作按钮组 */
.action-btns { display: flex; gap: 6px; flex-wrap: wrap; }
.action-btn {
    padding: 5px 11px;
    border: none;
    border-radius: 5px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.action-btn-edit { background: #e3f2fd; color: #1565c0; }
.action-btn-edit:hover { background: #bbdefb; }
.action-btn-delete { background: #ffebee; color: #c62828; }
.action-btn-delete:hover { background: #ffcdd2; }
.action-btn-view { background: #e8f5e9; color: #2e7d32; }
.action-btn-view:hover { background: #c8e6c9; }
.action-btn-scan { background: #fff3e0; color: #e65100; }
.action-btn-scan:hover { background: #ffe0b2; }
.action-btn-depart { background: #e8eaf6; color: #303f9f; }
.action-btn-depart:hover { background: #c5cae9; }
.action-btn-confirm { background: #e0f2f1; color: #00796b; }
.action-btn-confirm:hover { background: #b2dfdb; }

/* 头像 */
.avatar { 
    width: 38px; height: 38px; 
    border-radius: 50%; 
    object-fit: cover; 
    border: 2px solid var(--gray-200);
}
.avatar-sm { width: 30px; height: 30px; }
.avatar-lg { width: 56px; height: 56px; }

/* 下拉菜单 */
.dropdown { position: relative; display: inline-block; }
.dropdown-menu {
    position: absolute;
    right: 0;
    top: 100%;
    margin-top: 6px;
    background: #fff;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    min-width: 180px;
    z-index: 1100;
    display: none;
}
.dropdown.open .dropdown-menu { display: block; }
.dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    font-size: 14px;
    color: var(--gray-700);
    text-decoration: none;
    transition: all 0.15s;
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
}
.dropdown-item:hover { background: var(--gray-100); color: var(--primary); }
.dropdown-divider { height: 1px; background: var(--gray-200); margin: 4px 0; }

/* 标签页 */
.tabs {
    display: flex;
    border-bottom: 2px solid var(--gray-200);
    margin-bottom: 20px;
    gap: 4px;
    overflow-x: auto;
}
.tab-item {
    padding: 11px 20px;
    font-size: 14px;
    font-weight: 500;
    color: var(--gray-600);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
    white-space: nowrap;
    background: none;
    border-top: none;
    border-left: none;
    border-right: none;
}
.tab-item:hover { color: var(--primary); }
.tab-item.active { color: var(--primary); border-bottom-color: var(--primary); }

/* 工具提示 */
.tooltip-trigger {
    position: relative;
    cursor: help;
}
[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--gray-900);
    color: #fff;
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s;
    pointer-events: none;
    z-index: 1200;
}
[data-tooltip]:hover::after {
    opacity: 1;
    visibility: visible;
}

/* 响应式设计 */
@media (max-width: 1024px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    :root {
        --sidebar-width: 0px;
    }
    
    .sidebar {
        transform: translateX(-100%);
        width: 280px;
    }
    
    .sidebar.open {
        transform: translateX(0);
        box-shadow: var(--shadow-lg);
    }
    
    .main-wrapper { margin-left: 0; }
    
    .menu-toggle { display: block; }
    
    .page-content { padding: 16px; }
    
    .page-header { flex-direction: column; align-items: flex-start; }
    
    .form-row { grid-template-columns: 1fr; }
    
    .search-bar { flex-direction: column; }
    .search-input-wrap { width: 100%; }
    
    .card-body { padding: 16px; }
    .card-header { padding: 14px 16px; }
    
    .data-table th, .data-table td { padding: 10px 12px; font-size: 13px; }
    
    .modal-box { margin: 10px; max-width: none; }
    
    .header-left .breadcrumb { display: none; }
    
    .stats-grid { grid-template-columns: 1fr; }
    
    .action-btns { flex-direction: column; }
    
    /* 移动端侧边栏遮罩 */
    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.5);
        z-index: 999;
    }
    .sidebar-overlay.show { display: block; }
}

@media print {
    .sidebar, .top-header, .btn, .action-btns { display: none !important; }
    .main-wrapper { margin-left: 0 !important; }
    body { background: #fff; }
    .card { box-shadow: none; border: 1px solid #ddd; }
}
