/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #f5f7fa;
    color: #333;
}

/* 布局 */
.admin-container {
    display: flex;
    min-height: 100vh;
}

/* 侧边栏 */
.sidebar {
    width: 240px;
    background: #2c3e50;
    color: #fff;
    position: fixed;
    height: 100vh;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s;
    z-index: 100;
}

.sidebar.collapsed {
    transform: translateX(-240px);
}

.sidebar-header {
    padding: 24px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-header h2 {
    font-size: 20px;
    font-weight: 600;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 0;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 14px 24px;
    color: #bdc3c7;
    text-decoration: none;
    transition: all 0.2s;
}

.nav-item:hover,
.nav-item.active {
    background: rgba(255,255,255,0.1);
    color: #fff;
}

.nav-icon {
    margin-right: 12px;
    font-size: 18px;
}

.sidebar-footer {
    border-top: 1px solid rgba(255,255,255,0.1);
    padding: 16px 0;
}

/* 主内容区 */
.main-content {
    flex: 1;
    margin-left: 240px;
    transition: margin-left 0.3s;
}

.main-content.expanded {
    margin-left: 0;
}

/* 顶部栏 */
.top-bar {
    background: #fff;
    padding: 16px 24px;
    display: flex;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    position: sticky;
    top: 0;
    z-index: 50;
}

.toggle-sidebar {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    margin-right: 16px;
    padding: 4px;
}

.page-title {
    font-size: 20px;
    font-weight: 600;
}

/* 内容区域 */
.content-area {
    padding: 24px;
}

/* 卡片 */
.card {
    background: #fff;
    border-radius: 8px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.card-body {
    padding: 0;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid #eee;
}

.card-title {
    font-size: 18px;
    font-weight: 600;
}

/* 统计卡片 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.stat-card {
    background: #fff;
    border-radius: 8px;
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.stat-card h3 {
    font-size: 14px;
    color: #666;
    margin-bottom: 8px;
}

.stat-card .value {
    font-size: 32px;
    font-weight: 700;
    color: #333;
}

.stat-card .label {
    font-size: 12px;
    color: #999;
    margin-top: 4px;
}

/* 表格 */
.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 14px 16px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

th {
    background: #f8f9fa;
    font-weight: 600;
    color: #555;
    font-size: 14px;
}

tr:hover {
    background: #f8f9fa;
}

/* 按钮 */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
    text-decoration: none;
}

.btn-primary {
    background: #3498db;
    color: #fff;
}

.btn-primary:hover {
    background: #2980b9;
}

.btn-success {
    background: #2ecc71;
    color: #fff;
}

.btn-success:hover {
    background: #27ae60;
}

.btn-danger {
    background: #e74c3c;
    color: #fff;
}

.btn-danger:hover {
    background: #c0392b;
}

.btn-warning {
    background: #f39c12;
    color: #fff;
}

.btn-warning:hover {
    background: #d68910;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

/* 表单 */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: #555;
}

.form-control {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: #3498db;
}

textarea.form-control {
    min-height: 100px;
    resize: vertical;
}

/* 搜索栏 */
.search-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

.search-bar .form-control {
    width: 300px;
}

/* 状态标签 */
.status-tag {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.status-0 { background: #fff3cd; color: #856404; }
.status-1 { background: #d4edda; color: #155724; }
.status-2 { background: #cce5ff; color: #004085; }
.status-3 { background: #d1d1d1; color: #555; }
.status-4 { background: #f8d7da; color: #721c24; }

/* 模态框 */
.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.active {
    display: flex;
}

.modal {
    background: #fff;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow: auto;
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 18px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #999;
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* 分页 */
.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 24px;
}

.pagination button {
    padding: 8px 14px;
    border: 1px solid #ddd;
    background: #fff;
    border-radius: 4px;
    cursor: pointer;
}

.pagination button.active {
    background: #3498db;
    color: #fff;
    border-color: #3498db;
}

/* 商品详情页 */
.back-btn {
    display: inline-block;
    padding: 8px 16px;
    background: #f5f5f5;
    border-radius: 6px;
    color: #333;
    text-decoration: none;
    transition: background 0.2s;
}

.back-btn:hover {
    background: #eee;
    color: #333;
}

.form-row {
    display: flex;
    gap: 20px;
}

.form-row .form-group {
    flex: 1;
}

.required {
    color: #e74c3c;
}

.image-upload-area {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.image-upload-area .upload-placeholder {
    width: 150px;
    height: 150px;
    border: 2px dashed #ddd;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: border-color 0.2s;
}

.image-upload-area .upload-placeholder:hover {
    border-color: #3498db;
}

.image-upload-area .upload-icon {
    font-size: 32px;
    color: #999;
}

.image-upload-area .upload-text {
    color: #666;
    font-size: 14px;
    margin-top: 8px;
}

.image-upload-area .upload-hint {
    color: #999;
    font-size: 12px;
    margin-top: 4px;
}

.image-upload-area .image-preview {
    width: 150px;
    height: 150px;
    position: relative;
}

.image-upload-area .image-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
}

.image-upload-area .remove-image {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 22px;
    height: 22px;
    background: #e74c3c;
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    cursor: pointer;
}

/* 副图区域 */
.sub-images-area {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid #eee;
}

/* 响应式 */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-240px);
    }
    .sidebar.expanded {
        transform: translateX(0);
    }
    .main-content {
        margin-left: 0;
    }
}

/* 加载动画 */
.loading {
    text-align: center;
    padding: 40px;
    color: #999;
}

.loading::after {
    content: '加载中...';
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

.empty-state .icon {
    font-size: 48px;
    margin-bottom: 16px;
}

/* 操作按钮组 */
.action-btns {
    display: flex;
    gap: 8px;
}

/* 登录页面 */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-box {
    background: #fff;
    padding: 40px;
    border-radius: 12px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

.login-box h1 {
    text-align: center;
    margin-bottom: 32px;
    font-size: 24px;
    color: #333;
}

.login-box .form-group {
    margin-bottom: 20px;
}

.login-box .btn {
    width: 100%;
    padding: 14px;
    font-size: 16px;
}

/* 图片上传 */
.image-upload-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.main-image-upload {
    width: 200px;
    height: 200px;
}

.main-image-upload .upload-placeholder,
.main-image-upload .image-preview {
    width: 200px;
    height: 200px;
    border: 2px dashed #ddd;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: border-color 0.2s;
}

.main-image-upload .upload-placeholder:hover {
    border-color: #3498db;
}

.main-image-upload .upload-icon {
    font-size: 40px;
    color: #999;
}

.main-image-upload .upload-text {
    color: #999;
    font-size: 14px;
    margin-top: 8px;
}

.main-image-upload .image-preview {
    position: relative;
    border: none;
}

.main-image-upload .image-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
}

.main-image-upload .remove-image {
    position: absolute;
    top: -10px;
    right: -10px;
    width: 24px;
    height: 24px;
    background: #e74c3c;
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    cursor: pointer;
}

.sub-images-upload {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.sub-images-upload .upload-placeholder {
    width: 100px;
    height: 100px;
    border: 2px dashed #ddd;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: border-color 0.2s;
}

.sub-images-upload .upload-placeholder:hover {
    border-color: #3498db;
}

.sub-images-upload .upload-icon {
    font-size: 24px;
    color: #999;
}

.sub-images-upload .upload-text {
    color: #999;
    font-size: 12px;
    margin-top: 4px;
}

.sub-images-upload .sub-image {
    width: 100px;
    height: 100px;
}

.sub-images-upload .image-preview {
    position: relative;
    width: 100px;
    height: 100px;
}

.sub-images-upload .image-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
}
