/* 蔬果超市订货系统 - 全局样式 */
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif; background: #f5f7fa; color: #333; font-size: 14px; }
a { text-decoration: none; color: inherit; }
ul, ol { list-style: none; }

/* 登录页 */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #4CAF50 0%, #2E7D32 100%); padding: 20px; }
.login-box { background: #fff; border-radius: 12px; box-shadow: 0 8px 32px rgba(0,0,0,.15); width: 100%; max-width: 400px; padding: 40px 35px; }
.login-box h1 { text-align: center; color: #4CAF50; font-size: 22px; margin-bottom: 8px; }
.login-box .subtitle { text-align: center; color: #999; font-size: 13px; margin-bottom: 30px; }
.login-box .form-group { margin-bottom: 20px; }
.login-box label { display: block; margin-bottom: 8px; font-weight: 600; color: #555; }
.login-box input { width: 100%; padding: 12px 15px; border: 1px solid #ddd; border-radius: 8px; font-size: 14px; transition: all .3s; }
.login-box input:focus { outline: none; border-color: #4CAF50; box-shadow: 0 0 0 3px rgba(76,175,80,.1); }
.login-box .btn-login { width: 100%; padding: 12px; background: #4CAF50; color: #fff; border: none; border-radius: 8px; font-size: 16px; cursor: pointer; transition: background .3s; margin-top: 10px; }
.login-box .btn-login:hover { background: #45a049; }
.login-box .error-msg { background: #fff2f0; border: 1px solid #ffccc7; color: #cf1322; padding: 10px 15px; border-radius: 6px; margin-bottom: 20px; font-size: 13px; text-align: center; }
.login-box .admin-link { text-align: center; margin-top: 20px; font-size: 13px; color: #999; }
.login-box .admin-link a { color: #4CAF50; }

/* 顶部导航 */
.header { background: #fff; box-shadow: 0 2px 8px rgba(0,0,0,.06); position: sticky; top: 0; z-index: 100; }
.header-inner { max-width: 1400px; margin: 0 auto; padding: 0 25px; height: 60px; display: flex; align-items: center; justify-content: space-between; }
.header .logo { font-size: 18px; font-weight: bold; color: #4CAF50; display: flex; align-items: center; gap: 8px; }
.header .logo::before { content: "🥬"; font-size: 22px; }
.header .nav { display: flex; gap: 5px; }
.header .nav a { padding: 8px 18px; border-radius: 6px; color: #666; font-size: 14px; transition: all .2s; }
.header .nav a:hover, .header .nav a.active { background: #f0f9eb; color: #4CAF50; }
.header .user-info { display: flex; align-items: center; gap: 15px; }
.header .store-select { padding: 6px 12px; border: 1px solid #ddd; border-radius: 6px; font-size: 13px; background: #fff; cursor: pointer; }
.header .user-name { color: #666; font-size: 13px; }
.header .logout { color: #999; font-size: 13px; cursor: pointer; }
.header .logout:hover { color: #cf1322; }
.user-avatar-link { display: flex; align-items: center; gap: 6px; cursor: pointer; text-decoration: none; color: inherit; }
.user-avatar-link:hover { opacity: .8; }
.user-avatar-sm { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; background: #f0f0f0; flex-shrink: 0; }

/* 主内容区 */
.main { max-width: 1400px; margin: 0 auto; padding: 20px 25px; }
.page-title { font-size: 20px; font-weight: 600; margin-bottom: 20px; color: #333; display: flex; align-items: center; justify-content: space-between; }

/* 卡片 */
.card { background: #fff; border-radius: 10px; box-shadow: 0 2px 12px rgba(0,0,0,.05); padding: 20px; margin-bottom: 20px; }

/* 筛选栏 */
.filter-bar { display: flex; flex-wrap: wrap; gap: 15px; align-items: center; margin-bottom: 20px; }
.filter-bar select, .filter-bar input { padding: 8px 14px; border: 1px solid #ddd; border-radius: 6px; font-size: 14px; background: #fff; }
.filter-bar select:focus, .filter-bar input:focus { outline: none; border-color: #4CAF50; }
.filter-bar .search-input { min-width: 220px; }

/* 按钮 */
.btn { display: inline-block; padding: 8px 20px; border: none; border-radius: 6px; font-size: 14px; cursor: pointer; transition: all .2s; text-align: center; }
.btn-primary { background: #4CAF50; color: #fff; }
.btn-primary:hover { background: #45a049; }
.btn-default { background: #f5f5f5; color: #333; border: 1px solid #ddd; }
.btn-default:hover { background: #e8e8e8; }
.btn-warning { background: #faad14; color: #fff; }
.btn-warning:hover { background: #d48806; }
.btn-danger { background: #ff4d4f; color: #fff; }
.btn-danger:hover { background: #d9363e; }
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-lg { padding: 12px 32px; font-size: 16px; }

/* 表格 */
.data-table { width: 100%; border-collapse: collapse; background: #fff; }
.data-table th { background: #fafafa; padding: 12px 10px; text-align: left; font-weight: 600; color: #555; border-bottom: 2px solid #f0f0f0; font-size: 13px; white-space: nowrap; }
.data-table td { padding: 10px; border-bottom: 1px solid #f5f5f5; font-size: 14px; }
.data-table tr:hover { background: #fafafa; }
.data-table .product-img { width: 50px; height: 50px; max-width: 50px; max-height: 50px; object-fit: cover; border-radius: 6px; display: block; }
.data-table td:first-child .product-img { margin: 0 auto; }
.data-table .modified { font-weight: bold; color: #faad14; }

/* 数量控制器 */
.qty-control { display: flex; align-items: center; gap: 0; }
.qty-control button { width: 32px; height: 32px; border: 1px solid #ddd; background: #fafafa; cursor: pointer; font-size: 16px; color: #666; transition: all .2s; display: flex; align-items: center; justify-content: center; }
.qty-control button:hover { background: #4CAF50; color: #fff; border-color: #4CAF50; }
.qty-control button:first-child { border-radius: 6px 0 0 6px; }
.qty-control button:last-child { border-radius: 0 6px 6px 0; }
.qty-control input { width: 60px; height: 32px; text-align: center; border: 1px solid #ddd; border-left: none; border-right: none; font-size: 14px; -moz-appearance: textfield; }
.qty-control input::-webkit-outer-spin-button, .qty-control input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.qty-control input:focus { outline: none; border-color: #4CAF50; }

/* 备注输入 */
.remark-input { width: 100%; max-width: 180px; padding: 6px 10px; border: 1px solid #e0e0e0; border-radius: 4px; font-size: 13px; }
.remark-input:focus { outline: none; border-color: #4CAF50; }

/* 底部操作栏 */
.action-bar { position: sticky; bottom: 0; background: #fff; padding: 15px 25px; border-top: 1px solid #eee; display: flex; justify-content: space-between; align-items: center; box-shadow: 0 -2px 10px rgba(0,0,0,.05); margin: 0 -25px -20px; }
.action-bar .summary { font-size: 15px; color: #666; }
.action-bar .summary b { color: #4CAF50; font-size: 18px; }
.action-bar .btns { display: flex; gap: 12px; }

/* 标签 */
.tag { display: inline-block; padding: 2px 10px; border-radius: 12px; font-size: 12px; }
.tag-success { background: #f6ffed; color: #52c41a; border: 1px solid #b7eb8f; }
.tag-warning { background: #fffbe6; color: #faad14; border: 1px solid #ffe58f; }
.tag-danger { background: #fff2f0; color: #ff4d4f; border: 1px solid #ffccc7; }
.tag-default { background: #f5f5f5; color: #666; border: 1px solid #d9d9d9; }

/* 表单 */
.form-group { margin-bottom: 18px; }
.form-group label { display: block; margin-bottom: 6px; font-weight: 600; color: #555; font-size: 14px; }
.form-group input[type="text"], .form-group input[type="password"], .form-group input[type="number"], .form-group select, .form-group textarea { width: 100%; padding: 9px 14px; border: 1px solid #ddd; border-radius: 6px; font-size: 14px; }
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { outline: none; border-color: #4CAF50; box-shadow: 0 0 0 3px rgba(76,175,80,.1); }
.form-group textarea { resize: vertical; min-height: 80px; }
.form-row { display: flex; gap: 15px; }
.form-row .form-group { flex: 1; }
.form-hint { font-size: 12px; color: #999; margin-top: 4px; }

/* 弹窗 */
.modal-mask { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,.5); display: none; align-items: center; justify-content: center; z-index: 1000; }
.modal-mask.show { display: flex; }
.modal { background: #fff; border-radius: 10px; width: 100%; max-width: 500px; max-height: 90vh; overflow-y: auto; }
.modal-header { padding: 18px 25px; border-bottom: 1px solid #f0f0f0; display: flex; justify-content: space-between; align-items: center; }
.modal-header h3 { font-size: 17px; color: #333; }
.modal-close { cursor: pointer; color: #999; font-size: 20px; background: none; border: none; }
.modal-body { padding: 25px; }
.modal-footer { padding: 15px 25px; border-top: 1px solid #f0f0f0; text-align: right; display: flex; justify-content: flex-end; gap: 10px; }

/* 统计卡片 */
.stat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 15px; margin-bottom: 20px; }
.stat-card { background: #fff; border-radius: 10px; padding: 20px; box-shadow: 0 2px 12px rgba(0,0,0,.05); }
.stat-card .label { color: #999; font-size: 13px; margin-bottom: 8px; }
.stat-card .value { font-size: 28px; font-weight: bold; color: #333; }
.stat-card.green .value { color: #4CAF50; }
.stat-card.orange .value { color: #faad14; }
.stat-card.blue .value { color: #1890ff; }
.stat-card.red .value { color: #ff4d4f; }

/* 空状态 */
.empty { text-align: center; padding: 60px 20px; color: #999; }
.empty .icon { font-size: 48px; margin-bottom: 15px; }

/* 分页 */
.pagination { display: flex; justify-content: center; gap: 5px; margin-top: 20px; }
.pagination a, .pagination span { padding: 6px 12px; border: 1px solid #ddd; border-radius: 4px; color: #666; font-size: 13px; }
.pagination a:hover { background: #4CAF50; color: #fff; border-color: #4CAF50; }
.pagination .current { background: #4CAF50; color: #fff; border-color: #4CAF50; }

/* 打印样式 */
@media print {
    body { background: #fff; }
    .header, .action-bar, .filter-bar, .no-print { display: none !important; }
    .main { max-width: 100%; padding: 0; }
    .card { box-shadow: none; padding: 0; }
    .data-table th { background: #f0f0f0 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .data-table .modified { font-weight: bold; }
    .print-title { display: block !important; text-align: center; font-size: 22px; font-weight: bold; margin-bottom: 15px; }
    .print-info { display: block !important; margin-bottom: 15px; font-size: 14px; }
}
.print-title, .print-info { display: none; }

/* 响应式 */
@media (max-width: 768px) {
    body { font-size: 13px; }
    
    /* 顶部导航 */
    .header-inner { padding: 0 10px; height: auto; min-height: 50px; flex-wrap: wrap; gap: 5px; }
    .header .logo { font-size: 15px; }
    .header .logo::before { font-size: 18px; }
    .header .logo img { max-height: 28px !important; }
    .header .nav { gap: 2px; order: 3; width: 100%; justify-content: center; border-top: 1px solid #f0f0f0; padding-top: 5px; }
    .header .nav a { padding: 6px 14px; font-size: 13px; }
    .header .user-info { gap: 8px; }
    .header .store-select { padding: 4px 8px; font-size: 12px; max-width: 100px; }
    .header .user-name { font-size: 12px; max-width: 80px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .header .logout { font-size: 12px; }
    .bell-icon { font-size: 18px; margin-right: 8px; }
    .bell-icon .badge { font-size: 10px; padding: 0 4px; min-width: 14px; }
    
    /* 主内容 */
    .main { padding: 10px; }
    .page-title { font-size: 16px; flex-direction: column; align-items: flex-start; gap: 8px; }
    .page-title span { font-size: 12px; }
    
    /* 卡片 */
    .card { padding: 12px; margin-bottom: 12px; border-radius: 8px; }
    
    /* 筛选栏 */
    .filter-bar { gap: 8px; }
    .filter-bar select, .filter-bar input { padding: 6px 10px; font-size: 13px; }
    .filter-bar .search-input { min-width: 150px; flex: 1; }
    
    /* 表格 - 横向滚动 + 最小宽度 */
    .data-table { font-size: 12px; min-width: 600px; }
    .data-table th, .data-table td { padding: 8px 6px; }
    .data-table th { font-size: 12px; }
    /* 手机端隐藏条码列（可选，通过class控制） */
    .col-barcode { display: table-cell; }
    
    /* 数量控制器 */
    .qty-control button { width: 28px; height: 28px; font-size: 14px; }
    .qty-control input { width: 40px; height: 28px; font-size: 13px; }
    
    /* 备注输入 */
    .remark-input { max-width: 80px; padding: 5px 8px; font-size: 12px; }
    
    /* 底部操作栏 */
    .action-bar { padding: 10px 15px; flex-direction: column; gap: 10px; margin: 0 -10px -10px; }
    .action-bar .summary { font-size: 13px; width: 100%; text-align: center; }
    .action-bar .summary b { font-size: 16px; }
    .action-bar .btns { width: 100%; gap: 8px; }
    .action-bar .btns .btn { flex: 1; padding: 10px; font-size: 14px; }
    
    /* 按钮 */
    .btn-lg { padding: 10px 20px; font-size: 14px; }
    .btn-sm { padding: 4px 10px; font-size: 11px; }
    
    /* 表单 */
    .form-row { flex-direction: column; gap: 0; }
    .form-group { margin-bottom: 12px; }
    .form-group label { font-size: 13px; }
    
    /* 弹窗 */
    .modal { max-width: 95%; margin: 10px; }
    .modal-body { padding: 15px; }
    .modal-header { padding: 12px 15px; }
    .modal-footer { padding: 10px 15px; }
    
    /* 消息面板 */
    .msg-panel { width: calc(100% - 20px); right: 10px; left: 10px; top: 50px; max-height: 70vh; }
    
    /* 统计卡片 */
    .stat-cards { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .stat-card { padding: 12px; }
    .stat-card .value { font-size: 22px; }
    .stat-card .icon { font-size: 24px; }
    
    /* 登录页 */
    .login-box { padding: 25px 20px; }
    .login-box h1 { font-size: 18px; }
    
    /* 公告滚动条 */
    .announcement-bar .ann-content { font-size: 12px; }
    
    /* 打印标题 */
    .print-title { font-size: 18px; }
}

/* 超小屏幕 */
@media (max-width: 480px) {
    .header .user-name { display: none; }
    .header .store-select { max-width: 80px; }
    .data-table { min-width: 550px; }
    .remark-input { max-width: 60px; }
}
