/* ============================================
   华冠众汇供应链管理系统 By-黄国友
   ============================================ */
/* ===== CSS变量定义 ===== */
/* 后台管理系统样式 */

* { margin: 0; padding: 0; box-sizing: border-box; }

html { font-size: 14px; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: #f0f2f5;
    color: #333;
    line-height: 1.6;
}

/* 登录页 */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-card {
    background: white;
    padding: 2.5rem;
    border-radius: 12px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.login-card h1 {
    text-align: center;
    margin-bottom: 0.5rem;
    color: #2c3e50;
}

.login-card .subtitle {
    text-align: center;
    color: #999;
    margin-bottom: 2rem;
}

.form-item {
    margin-bottom: 1.25rem;
}

.form-item label {
    display: block;
    margin-bottom: 0.5rem;
    color: #666;
    font-weight: 500;
}

.form-item input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 1rem;
}

.form-item input:focus {
    outline: none;
    border-color: #667eea;
}

.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover { background: #5a6fd6; }
.btn-success { background: #27ae60; color: white; }
.btn-success:hover { background: #219a52; }
.btn-danger { background: #e74c3c; color: white; }
.btn-danger:hover { background: #c0392b; }
.btn-secondary { background: #95a5a6; color: white; }
.btn-secondary:hover { background: #7f8c8d; }

.btn-block { width: 100%; }
.btn-sm { padding: 0.5rem 1rem; font-size: 0.875rem; }

.alert {
    padding: 0.75rem 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    font-size: 0.875rem;
}

.alert-error { background: #fee; color: #e74c3c; }
.alert-success { background: #efe; color: #27ae60; }

/* 后台布局 */
.admin-layout {
    display: flex;
    min-height: 100vh;
}

/* 侧边栏 */
.sidebar {
    width: 240px;
    background: #2c3e50;
    color: white;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-header {
    padding: 1.25rem;
    background: rgba(0,0,0,0.2);
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-header h1 {
    font-size: 1.125rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sidebar-nav { padding: 1rem 0; }

.nav-item {
    display: flex;
    align-items: center;
    padding: 0.875rem 1.25rem;
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    transition: all 0.3s;
    gap: 0.75rem;
}

.nav-item:hover,
.nav-item.active {
    background: rgba(255,255,255,0.1);
    color: white;
}

.nav-item.active {
    background: #667eea;
}

.nav-divider {
    height: 1px;
    background: rgba(255,255,255,0.1);
    margin: 1rem 0;
}

.nav-section-title {
    padding: 0.5rem 1.25rem;
    font-size: 0.75rem;
    color: rgba(255,255,255,0.4);
    text-transform: uppercase;
}

/* 主内容区 */
.main-content {
    flex: 1;
    margin-left: 240px;
}

/* 顶部栏 */
.topbar {
    background: white;
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    position: sticky;
    top: 0;
    z-index: 100;
}

.topbar-left { display: flex; align-items: center; gap: 1rem; }

.breadcrumb {
    color: #999;
    font-size: 0.875rem;
}

.breadcrumb a { color: #667eea; text-decoration: none; }

.topbar-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #667eea;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 页面内容 */
.page-content {
    padding: 1.5rem;
}

/* 统计卡片 */
.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.stat-card .icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.stat-card .value {
    font-size: 2rem;
    font-weight: bold;
    color: #2c3e50;
}

.stat-card .label {
    color: #999;
    font-size: 0.875rem;
}

/* 卡片面板 */
.panel {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    margin-bottom: 1.5rem;
}

.panel-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel-header h3 {
    font-size: 1.125rem;
    font-weight: 600;
}

.panel-body { padding: 1.5rem; }

/* 表格 */
.table-responsive { overflow-x: auto; }

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 0.875rem 1rem;
    text-align: left;
    border-bottom: 1px solid #eee;
}

th {
    background: #f9f9f9;
    font-weight: 600;
    color: #666;
}

tr:hover { background: #fafafa; }

.table-img {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 6px;
}

.status-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
}

.status-badge.active { background: #efe; color: #27ae60; }
.status-badge.pending { background: #ffe; color: #f39c12; }
.status-badge.disabled { background: #fee; color: #e74c3c; }

/* 表单 */
.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}

.form-group { margin-bottom: 1rem; }

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #666;
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 1rem;
}

.form-control:focus {
    outline: none;
    border-color: #667eea;
}

textarea.form-control { min-height: 100px; resize: vertical; }

.form-help {
    font-size: 0.75rem;
    color: #999;
    margin-top: 0.25rem;
}

/* 分页 */
.pagination {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem;
}

.pagination a,
.pagination span {
    padding: 0.5rem 0.875rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    color: #666;
    text-decoration: none;
}

.pagination a:hover { background: #667eea; color: white; border-color: #667eea; }
.pagination .active { background: #667eea; color: white; border-color: #667eea; }

/* 模态框 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    display: none;
}

.modal-overlay.show { display: flex; }

.modal {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 { font-size: 1.125rem; }

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #999;
}

.modal-body { padding: 1.5rem; }
.modal-footer { padding: 1rem 1.5rem; border-top: 1px solid #eee; display: flex; justify-content: flex-end; gap: 0.5rem; }

/* 工具栏 */
.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.toolbar-left { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.toolbar-right { display: flex; gap: 0.5rem; }

.search-box {
    display: flex;
    gap: 0.5rem;
}

.search-box input {
    padding: 0.5rem 1rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    width: 250px;
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: #999;
}

/* 移动端响应 */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s;
        z-index: 1000;
    }
    
    .sidebar.show { transform: translateX(0); }
    
    .main-content { margin-left: 0; }
    
    .topbar { padding: 0.75rem 1rem; }
    
    .page-content { padding: 1rem; }
    
    .form-row { grid-template-columns: 1fr; }
    
    .stats-row { grid-template-columns: repeat(2, 1fr); }
}

/* 图片上传预览 */
.upload-preview {
    width: 120px;
    height: 120px;
    border: 2px dashed #ddd;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    overflow: hidden;
}

.upload-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.upload-preview .placeholder {
    color: #999;
    text-align: center;
}

.upload-preview input {
    display: none;
}

/* Tab切换 */
.tabs {
    display: flex;
    border-bottom: 2px solid #eee;
    margin-bottom: 1rem;
}

.tab {
    padding: 0.75rem 1.5rem;
    background: none;
    border: none;
    cursor: pointer;
    color: #666;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
}

.tab.active { color: #667eea; border-bottom-color: #667eea; }

/* 操作按钮 */
.actions { display: flex; gap: 0.5rem; }

/* 排序拖拽手柄 */
.drag-handle { cursor: move; color: #ccc; }
