/* ERP管理系统样式 */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: #333;
    background: #f5f7fa;
}

/* 布局 */
.container {
    display: flex;
    min-height: 100vh;
}

/* 侧边栏 */
.sidebar {
    width: 240px;
    background: #2c3e50;
    color: #fff;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
}

.logo {
    padding: 20px;
    text-align: center;
    border-bottom: 1px solid #34495e;
}

.logo h2 {
    font-size: 20px;
    font-weight: 600;
}

.menu {
    flex: 1;
    padding: 15px 0;
}

.menu a {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: #bdc3c7;
    text-decoration: none;
    transition: all 0.3s;
}

.menu a:hover,
.menu a.active {
    background: #34495e;
    color: #fff;
}

.menu a .icon {
    margin-right: 10px;
    font-size: 18px;
}

.user-info {
    padding: 15px 20px;
    border-top: 1px solid #34495e;
    font-size: 12px;
}

.user-info p {
    margin-bottom: 5px;
}

.user-info .role {
    color: #95a5a6;
    text-transform: uppercase;
}

.btn-logout {
    display: inline-block;
    margin-top: 10px;
    padding: 6px 12px;
    background: #e74c3c;
    color: #fff;
    text-decoration: none;
    border-radius: 4px;
    font-size: 12px;
}

/* 主内容区 */
.content {
    flex: 1;
    margin-left: 240px;
    padding: 20px;
}

/* 页面头部 */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e1e4e8;
}

.page-header h1 {
    font-size: 24px;
    font-weight: 600;
    color: #2c3e50;
}

/* 按钮 */
.btn {
    display: inline-block;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    text-decoration: none;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary {
    background: #3498db;
    color: #fff;
}

.btn-primary:hover {
    background: #2980b9;
}

.btn-secondary {
    background: #95a5a6;
    color: #fff;
}

.btn-secondary:hover {
    background: #7f8c8d;
}

.btn-success {
    background: #27ae60;
    color: #fff;
}

.btn-success:hover {
    background: #229954;
}

.btn-danger {
    background: #e74c3c;
    color: #fff;
}

.btn-danger:hover {
    background: #c0392b;
}

.btn-sm {
    padding: 4px 10px;
    font-size: 12px;
}

.btn-block {
    display: block;
    width: 100%;
}

/* 表格 */
.data-table {
    width: 100%;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #e1e4e8;
}

.data-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #2c3e50;
}

.data-table tr:hover {
    background: #f8f9fa;
}

.data-table .empty {
    text-align: center;
    padding: 40px;
    color: #95a5a6;
}

.data-table .warning-row {
    background: #fff3cd;
}

.data-table .thumb {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 4px;
}

.data-table .no-image {
    display: inline-block;
    width: 40px;
    height: 40px;
    background: #e1e4e8;
    border-radius: 4px;
    text-align: center;
    line-height: 40px;
    font-size: 12px;
    color: #95a5a6;
}

/* 徽章 */
.badge {
    display: inline-block;
    padding: 3px 8px;
    font-size: 11px;
    font-weight: 500;
    border-radius: 12px;
    text-transform: uppercase;
}

.badge-pending { background: #fff3cd; color: #856404; }
.badge-confirmed { background: #d1ecf1; color: #0c5460; }
.badge-shipped { background: #d4edda; color: #155724; }
.badge-completed { background: #28a745; color: #fff; }
.badge-cancelled { background: #f8d7da; color: #721c24; }
.badge-unpaid { background: #f8d7da; color: #721c24; }
.badge-partial { background: #fff3cd; color: #856404; }
.badge-paid { background: #28a745; color: #fff; }
.badge-active { background: #28a745; color: #fff; }
.badge-inactive { background: #6c757d; color: #fff; }
.badge-warning { background: #ffc107; color: #212529; }
.badge-role-admin { background: #e74c3c; color: #fff; }
.badge-role-manager { background: #f39c12; color: #fff; }
.badge-role-staff { background: #3498db; color: #fff; }

/* 表单 */
.form-container {
    background: #fff;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    max-width: 800px;
}

.form-row {
    display: flex;
    gap: 20px;
    margin-bottom: 15px;
}

.form-group {
    flex: 1;
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #2c3e50;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #3498db;
}

.form-actions {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e1e4e8;
}

.form-actions .btn {
    margin-right: 10px;
}

.help-text {
    font-size: 12px;
    color: #95a5a6;
    margin-top: 5px;
}

.permissions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
    margin-top: 10px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    font-weight: normal;
    cursor: pointer;
}

.checkbox-label input {
    width: auto;
    margin-right: 8px;
}

/* 筛选栏 */
.filter-bar {
    background: #fff;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.filter-form {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.filter-form input,
.filter-form select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.filter-form input {
    min-width: 200px;
}

/* 统计卡片 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    gap: 15px;
}

.stat-card.warning {
    background: #fff3cd;
}

.stat-icon {
    font-size: 32px;
}

.stat-info h3 {
    font-size: 24px;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 5px;
}

.stat-info p {
    font-size: 12px;
    color: #95a5a6;
}

/* 详情卡片 */
.detail-card {
    background: #fff;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.detail-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e1e4e8;
}

.detail-header h2 {
    font-size: 20px;
    color: #2c3e50;
}

.detail-image {
    width: 100px;
    height: 100px;
    object-fit: cover;
    border-radius: 8px;
}

.detail-body {
    margin-bottom: 20px;
}

.detail-row {
    padding: 10px 0;
    border-bottom: 1px solid #f0f0f0;
}

.detail-row span {
    display: inline-block;
    width: 100px;
    font-weight: 500;
    color: #95a5a6;
}

.detail-actions {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e1e4e8;
}

.detail-actions .btn {
    margin-right: 10px;
}

.company-tag {
    background: #e1e4e8;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
}

/* 订单商品行 */
.order-item-row {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
    align-items: center;
}

.order-item-row select,
.order-item-row input {
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.order-item-row .product-select {
    flex: 2;
}

.order-item-row .qty-input,
.order-item-row .price-input {
    flex: 1;
}

/* 警告框 */
.alert {
    padding: 12px 15px;
    border-radius: 4px;
    margin-bottom: 20px;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
}

/* 登录页面 */
.login-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

.login-box {
    background: #fff;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

.login-box h1 {
    text-align: center;
    color: #2c3e50;
    margin-bottom: 10px;
}

.login-box .subtitle {
    text-align: center;
    color: #95a5a6;
    margin-bottom: 30px;
}

.login-footer {
    margin-top: 20px;
    text-align: center;
    font-size: 12px;
    color: #95a5a6;
}

/* 仪表板区域 */
.dashboard-section {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.dashboard-section h2 {
    font-size: 18px;
    margin-bottom: 15px;
    color: #2c3e50;
}

/* 响应式 - 平板 */
@media (max-width: 992px) {
    .sidebar {
        width: 200px;
    }
    
    .content {
        margin-left: 200px;
    }
    
    .data-table th,
    .data-table td {
        padding: 10px 12px;
        font-size: 13px;
    }
}

/* 响应式 - 手机 */
@media (max-width: 768px) {
    /* 侧边栏变为底部导航 */
    .container {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
        flex-direction: row;
        overflow-x: auto;
        overflow-y: hidden;
    }
    
    .logo {
        display: none;
    }
    
    .menu {
        display: flex;
        flex-direction: row;
        padding: 0;
        flex: none;
    }
    
    .menu a {
        padding: 12px 15px;
        white-space: nowrap;
        flex-direction: column;
        font-size: 11px;
    }
    
    .menu a .icon {
        margin-right: 0;
        margin-bottom: 4px;
        font-size: 20px;
    }
    
    /* 移动端显示退出登录按钮 */
    .user-info {
        display: flex;
        flex-direction: row;
        align-items: center;
        padding: 12px 15px;
        margin-left: auto;
    }
    
    .user-info p {
        display: none;
    }
    
    .user-info .btn-logout {
        padding: 8px 12px;
        font-size: 12px;
        white-space: nowrap;
    }
    
    /* 主内容区 */
    .content {
        margin-left: 0;
        padding: 15px;
    }
    
    /* 页面头部 */
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .page-header h1,
    .page-header h2 {
        font-size: 20px;
    }
    
    /* 表格横向滚动 */
    .data-table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
    }
    
    .data-table th,
    .data-table td {
        padding: 10px 12px;
        font-size: 12px;
    }
    
    /* 筛选栏 */
    .filter-bar {
        flex-direction: column;
    }
    
    .filter-form {
        flex-direction: column;
        width: 100%;
    }
    
    .filter-form input,
    .filter-form select,
    .filter-form button {
        width: 100%;
        margin-bottom: 10px;
    }
    
    /* 表单 */
    .form-container {
        padding: 15px;
    }
    
    .form-row {
        flex-direction: column;
        gap: 0;
    }
    
    .form-group {
        margin-bottom: 15px;
    }
    
    .form-group input,
    .form-group select,
    .form-group textarea {
        font-size: 16px; /* 防止iOS自动缩放 */
    }
    
    /* 按钮 */
    .btn {
        padding: 10px 16px;
        font-size: 14px;
    }
    
    .btn-sm {
        padding: 6px 12px;
        font-size: 12px;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .form-actions .btn {
        width: 100%;
        margin-bottom: 10px;
    }
    
    /* 详情页 */
    .detail-container {
        padding: 15px;
    }
    
    .detail-row {
        flex-direction: column;
        padding: 10px 0;
    }
    
    .detail-row span:first-child {
        font-weight: 600;
        margin-bottom: 4px;
    }
    
    .detail-actions {
        flex-direction: column;
    }
    
    .detail-actions .btn {
        width: 100%;
        margin-bottom: 10px;
    }
    
    /* 统计卡片 */
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .stat-card {
        padding: 15px;
    }
    
    /* 弹窗 */
    .modal-content {
        width: 95%;
        margin: 20px auto;
    }
    
    /* 警告框 */
    .alert {
        padding: 12px 15px;
        font-size: 13px;
    }
}

/* 响应式 - 小手机 */
@media (max-width: 480px) {
    .content {
        padding: 10px;
    }
    
    .menu a {
        padding: 10px 12px;
        font-size: 10px;
    }
    
    .menu a .icon {
        font-size: 18px;
    }
    
    .data-table th,
    .data-table td {
        padding: 8px 10px;
        font-size: 11px;
    }
    
    .page-header h1,
    .page-header h2 {
        font-size: 18px;
    }
    
    .form-container {
        padding: 12px;
    }
    
    .btn {
        padding: 8px 14px;
        font-size: 13px;
    }
}
