* { 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;
    line-height: 1.6;
}
a { color: #3b82f6; text-decoration: none; }
a:hover { text-decoration: underline; }

/* 头部 */
.header {
    background: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}
.header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 14px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.logo {
    font-size: 20px;
    font-weight: 700;
    color: #1e40af;
    display: flex;
    align-items: center;
    gap: 8px;
}
.nav-links { display: flex; gap: 20px; align-items: center; }
.nav-links a { color: #555; font-size: 14px; font-weight: 500; }
.nav-links a:hover { color: #3b82f6; text-decoration: none; }

/* 容器 */
.container { max-width: 1200px; margin: 0 auto; padding: 30px 20px; }
.container-sm { max-width: 600px; margin: 0 auto; padding: 30px 20px; }

/* 卡片 */
.card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    padding: 24px;
    margin-bottom: 20px;
}

/* 商品网格 */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}
.product-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    padding: 24px;
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
}
.product-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}
.product-title { font-size: 18px; font-weight: 700; margin-bottom: 8px; }
.product-desc { color: #666; font-size: 14px; flex: 1; margin-bottom: 16px; }
.product-price { font-size: 24px; font-weight: 700; color: #ef4444; margin-bottom: 12px; }
.product-stock { font-size: 13px; color: #999; margin-bottom: 16px; }

/* 按钮 */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}
.btn:hover { text-decoration: none; opacity: 0.9; }
.btn-primary { background: #3b82f6; color: #fff; }
.btn-success { background: #10b981; color: #fff; }
.btn-danger { background: #ef4444; color: #fff; }
.btn-warning { background: #f59e0b; color: #fff; }
.btn-gray { background: #6b7280; color: #fff; }
.btn-outline { background: transparent; border: 1px solid #d1d5db; color: #555; }
.btn-block { width: 100%; }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn:disabled { background: #d1d5db; cursor: not-allowed; }

/* 表单 */
.form-group { margin-bottom: 18px; }
.form-label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 6px; color: #444; }
.form-input, .form-textarea, .form-select {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}
.form-input:focus, .form-textarea:focus, .form-select:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}
.form-textarea { resize: vertical; min-height: 80px; }

/* 表格 */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 14px; text-align: left; border-bottom: 1px solid #e5e7eb; font-size: 14px; }
th { background: #f9fafb; font-weight: 600; color: #555; font-size: 13px; text-transform: uppercase; }
tr:hover { background: #f9fafb; }

/* 徽章 */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}
.badge-yellow { background: #fef3c7; color: #92400e; }
.badge-blue { background: #dbeafe; color: #1e40af; }
.badge-green { background: #d1fae5; color: #065f46; }
.badge-red { background: #fee2e2; color: #991b1b; }
.badge-gray { background: #f3f4f6; color: #4b5563; }

/* 提示消息 */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 14px;
}
.alert-success { background: #d1fae5; color: #065f46; }
.alert-error { background: #fee2e2; color: #991b1b; }
.alert-info { background: #dbeafe; color: #1e40af; }

/* 统计卡片 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.stat-card {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.stat-label { font-size: 13px; color: #888; margin-bottom: 6px; }
.stat-value { font-size: 28px; font-weight: 700; color: #1e40af; }

/* 后台布局 */
.admin-layout { display: flex; min-height: 100vh; }
.admin-sidebar {
    width: 220px;
    background: #1e293b;
    color: #cbd5e1;
    padding: 20px 0;
    flex-shrink: 0;
}
.admin-sidebar h3 {
    color: #fff;
    padding: 0 20px 16px;
    font-size: 16px;
    border-bottom: 1px solid #334155;
    margin-bottom: 12px;
}
.admin-sidebar a {
    display: block;
    padding: 10px 20px;
    color: #cbd5e1;
    font-size: 14px;
}
.admin-sidebar a:hover, .admin-sidebar a.active {
    background: #334155;
    color: #fff;
    text-decoration: none;
}
.admin-content { flex: 1; padding: 24px; overflow-x: auto; }
.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}
.admin-header h2 { font-size: 22px; }

/* 模态框 */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}
.modal {
    background: #fff;
    border-radius: 12px;
    padding: 24px;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
}
.modal h3 { margin-bottom: 16px; }

/* 二维码展示 */
.qr-list { display: flex; flex-wrap: wrap; gap: 20px; justify-content: center; }
.qr-item { text-align: center; }
.qr-item img { width: 180px; height: 180px; object-fit: contain; border: 1px solid #e5e7eb; border-radius: 8px; padding: 8px; background: #fff; }
.qr-item p { margin-top: 8px; font-size: 14px; font-weight: 600; }

/* 卡密显示 */
.code-box {
    background: #f0fdf4;
    border: 1px solid #86efac;
    border-radius: 8px;
    padding: 16px;
    margin: 16px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.code-text { font-family: monospace; font-size: 18px; font-weight: 700; color: #065f46; word-break: break-all; }

/* 截图预览 */
.screenshot-preview { max-width: 100%; max-height: 400px; border-radius: 8px; margin: 12px 0; }

/* 页脚 */
.footer {
    text-align: center;
    padding: 20px;
    color: #999;
    font-size: 13px;
}

/* 响应式 */
@media (max-width: 768px) {
    .admin-layout { flex-direction: column; }
    .admin-sidebar { width: 100%; padding: 10px 0; }
    .admin-sidebar a { display: inline-block; padding: 8px 14px; }
    .product-grid { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
