/* ===== 全局样式 - 复刻 Element UI 视觉风格 ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
    font-family: "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", Arial, sans-serif;
    font-size: 14px;
    color: #303133;
    background: #f0f2f5;
    -webkit-font-smoothing: antialiased;
}
a { color: #1890ff; text-decoration: none; }
a:hover { color: #46a6ff; }
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
ul, ol { list-style: none; }
img { vertical-align: middle; }

/* ===== 主色与变量 ===== */
:root {
    --primary: #1890ff;
    --primary-hover: #46a6ff;
    --primary-active: #096dd9;
    --success: #52c41a;
    --warning: #faad14;
    --danger: #ff4d4f;
    --info: #909399;
    --text-primary: #303133;
    --text-regular: #606266;
    --text-secondary: #909399;
    --text-placeholder: #c0c4cc;
    --border-base: #dcdfe6;
    --border-light: #e4e7ed;
    --border-lighter: #ebeef5;
    --bg-white: #fff;
    --bg-page: #f0f2f5;
}

/* ===== 按钮 ===== */
.btn {
    display: inline-block;
    line-height: 1;
    white-space: nowrap;
    cursor: pointer;
    background: #fff;
    border: 1px solid var(--border-base);
    color: var(--text-regular);
    -webkit-appearance: none;
    text-align: center;
    box-sizing: border-box;
    outline: none;
    margin: 0;
    transition: .1s;
    font-weight: 500;
    padding: 9px 20px;
    font-size: 14px;
    border-radius: 4px;
}
.btn + .btn { margin-left: 10px; }
.btn:hover { color: var(--primary); border-color: #b3d8ff; background: #ecf5ff; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); color: #fff; }
.btn-success { background: var(--success); border-color: var(--success); color: #fff; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-text { border: none; background: transparent; color: var(--primary); padding: 0; }
.btn-text:hover { color: var(--primary-hover); background: transparent; }
.btn-text-danger { color: var(--danger); }
.btn-sm { padding: 7px 15px; font-size: 12px; }
.btn-mini { padding: 5px 10px; font-size: 12px; }
.btn[disabled] { background: #f5f7fa; border-color: #e4e7ed; color: #c0c4cc; cursor: not-allowed; }
.btn[disabled]:hover { color: #c0c4cc; border-color: #e4e7ed; background: #f5f7fa; }

/* ===== 表单 ===== */
.form-item { margin-bottom: 22px; display: flex; align-items: flex-start; }
.form-label {
    text-align: right; vertical-align: middle; float: left; font-size: 14px;
    color: var(--text-regular); line-height: 32px; padding: 0 12px 0 0;
    box-sizing: border-box; width: 130px; flex-shrink: 0;
}
.form-label.required::before { content: '*'; color: var(--danger); margin-right: 4px; }
.form-content { flex: 1; line-height: 32px; }
.form-tips { font-size: 12px; color: var(--text-secondary); line-height: 1.5; margin-top: 4px; }

/* 输入框 */
.input, .textarea, .select {
    background-color: #fff;
    background-image: none;
    border: 1px solid var(--border-base);
    border-radius: 4px;
    box-sizing: border-box;
    color: var(--text-primary);
    display: inline-block;
    font-size: inherit;
    height: 32px;
    line-height: 32px;
    outline: none;
    padding: 0 15px;
    transition: border-color .2s;
    width: 100%;
}
.textarea { height: auto; line-height: 1.5; padding: 5px 15px; }
.input:focus, .textarea:focus, .select:focus { border-color: var(--primary); }
.input::placeholder, .textarea::placeholder { color: var(--text-placeholder); }
.input-sm { height: 28px; line-height: 28px; padding: 0 10px; }
.input-num { width: 120px; }
.input-suffix { display: inline-flex; align-items: center; }
.input-suffix .suffix { margin-left: 8px; color: var(--text-regular); white-space: nowrap; }

/* 单选/复选 */
.radio-group, .checkbox-group { display: inline-flex; align-items: center; line-height: 32px; }
.radio, .checkbox { display: inline-flex; align-items: center; cursor: pointer; margin-right: 20px; user-select: none; }
.radio input, .checkbox input { margin-right: 6px; accent-color: var(--primary); width: 14px; height: 14px; }
.radio.checked { color: var(--primary); }

/* 开关 switch */
.switch { display: inline-flex; align-items: center; cursor: pointer; }
.switch-track { width: 36px; height: 18px; border-radius: 10px; background: #dcdfe6; position: relative; transition: background .2s; }
.switch-thumb { width: 14px; height: 14px; border-radius: 50%; background: #fff; position: absolute; top: 2px; left: 2px; transition: left .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.switch.on .switch-track { background: var(--primary); }
.switch.on .switch-thumb { left: 20px; }

/* ===== 卡片 ===== */
.card { border: 1px solid var(--border-lighter); background: #fff; border-radius: 4px; box-shadow: 0 0 0 0 transparent; }
.card-body { padding: 20px; }

/* ===== 布局 ===== */
.page-header { background: #fff; border-bottom: 1px solid var(--border-lighter); padding: 0 20px; height: 50px; display: flex; align-items: center; justify-content: space-between; }
.page-header .title { font-size: 16px; font-weight: 500; }
.page-header .header-nav { display: flex; align-items: center; margin-left: 24px; flex: 1; }
.page-header .header-nav .link-btn { font-size: 14px; margin-left: 0; }
.page-header .header-nav .link-btn + .link-btn { margin-left: 20px; }
.page-header .header-right { display: flex; align-items: center; }
.main-wrap { padding: 16px; }
.main-wrap .card { margin-bottom: 16px; }

/* ===== 表格 ===== */
.table { width: 100%; border-collapse: collapse; background: #fff; }
.table th, .table td { border: 1px solid var(--border-lighter); padding: 8px 10px; font-size: 13px; text-align: center; }
.table th { background: #fafafa; color: var(--text-regular); font-weight: 500; white-space: nowrap; }
.table td input, .table td select { border: 1px solid var(--border-lighter); border-radius: 3px; height: 28px; padding: 0 8px; width: 100%; min-width: 60px; text-align: center; }
.table td input:focus, .table td select:focus { border-color: var(--primary); }
.table td .td-img { width: 40px; height: 40px; object-fit: cover; }

/* ===== 标签 tag ===== */
.tag { display: inline-block; padding: 0 8px; height: 24px; line-height: 22px; border-radius: 4px; font-size: 12px; border: 1px solid; }
.tag-info { background: #f4f4f5; border-color: #e9e9eb; color: #909399; }
.tag-primary { background: #ecf5ff; border-color: #d9ecff; color: var(--primary); }
.tag-success { background: #f0f9eb; border-color: #e1f3d8; color: var(--success); }
.tag-warning { background: #fdf6ec; border-color: #faecd8; color: var(--warning); }
.tag-danger { background: #fef0f0; border-color: #fde2e2; color: var(--danger); }

/* 规格值标签（可删除） */
.spec-tag { display: inline-flex; align-items: center; padding: 2px 8px; background: #ecf5ff; border: 1px solid #d9ecff; color: var(--primary); border-radius: 4px; margin: 0 6px 6px 0; font-size: 12px; }
.spec-tag .del { margin-left: 6px; cursor: pointer; color: #c0c4cc; }
.spec-tag .del:hover { color: var(--danger); }

/* ===== 分页 ===== */
.pagination { display: flex; align-items: center; justify-content: center; margin-top: 16px; gap: 6px; }
.pagination .pager { min-width: 30px; height: 30px; line-height: 28px; text-align: center; border: 1px solid var(--border-base); border-radius: 3px; padding: 0 6px; cursor: pointer; background: #fff; }
.pagination .pager.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.pagination .pager.disabled { color: var(--text-placeholder); cursor: not-allowed; }

/* ===== 上传/拖拽区 ===== */
.upload-box {
    width: 60px; height: 60px; border: 1px dashed var(--border-base); border-radius: 4px;
    display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
    color: var(--text-placeholder); font-size: 24px; margin-right: 8px; vertical-align: middle;
    position: relative; overflow: hidden;
}
.upload-box:hover { border-color: var(--primary); color: var(--primary); }
.upload-box input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.img-thumb { width: 60px; height: 60px; border: 1px solid var(--border-lighter); border-radius: 4px; object-fit: cover; margin-right: 8px; vertical-align: middle; position: relative; }
.img-thumb .del { position: absolute; top: -6px; right: -6px; width: 16px; height: 16px; line-height: 16px; text-align: center; background: var(--danger); color: #fff; border-radius: 50%; cursor: pointer; font-size: 10px; }

/* 商品类型卡片 */
.type-card { width: 180px; border: 1px solid var(--border-base); border-radius: 4px; padding: 12px; cursor: pointer; position: relative; display: inline-block; margin-right: 12px; }
.type-card.active { border-color: var(--primary); }
.type-card .tc-top { font-size: 14px; color: var(--text-primary); }
.type-card .tc-bottom { font-size: 12px; color: var(--text-secondary); margin-top: 4px; }
.type-card .check { position: absolute; right: 8px; bottom: 8px; width: 16px; height: 16px; color: var(--primary); font-size: 16px; display: none; }
.type-card.active .check { display: block; }

/* 模态弹窗 */
.modal-mask { position: fixed; inset: 0; background: rgba(0,0,0,.5); display: none; align-items: center; justify-content: center; z-index: 2000; }
.modal-mask.show { display: flex; }
.modal { background: #fff; border-radius: 4px; min-width: 400px; max-width: 80%; max-height: 80vh; display: flex; flex-direction: column; }
.modal-header { padding: 16px 20px; border-bottom: 1px solid var(--border-lighter); font-weight: 500; display: flex; justify-content: space-between; align-items: center; }
.modal-body { padding: 20px; overflow: auto; }
.modal-footer { padding: 12px 20px; border-top: 1px solid var(--border-lighter); text-align: right; }

/* 提示消息 */
.toast { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); z-index: 3000; padding: 10px 20px; border-radius: 4px; color: #fff; font-size: 14px; box-shadow: 0 2px 12px rgba(0,0,0,.15); display: none; }
.toast.show { display: block; }
.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }
.toast-warning { background: var(--warning); }

/* 必填星号 */
.required-star { color: var(--danger); margin-right: 4px; }

/* 链接按钮 */
.link-btn { color: var(--primary); cursor: pointer; font-size: 13px; background: none; border: none; padding: 0; }
.link-btn + .link-btn { margin-left: 10px; }
.link-btn:hover { color: var(--primary-hover); }
.link-btn-danger { color: var(--danger); }
