/* ============================================
 * 商品分享平台 - 七牛云风格样式
 * ============================================ */

/* ---------- CSS 变量 ---------- */
:root {
    --primary: #006EFF;
    --primary-hover: #005BD6;
    --primary-active: #004AB3;
    --primary-light: #E8F3FF;
    --primary-lighter: #F0F7FF;

    --bg-page: #F7F8FA;
    --bg-card: #FFFFFF;
    --bg-hover: #F2F3F5;
    --bg-input: #FFFFFF;

    --text-primary: #1D2129;
    --text-secondary: #4E5969;
    --text-tertiary: #86909C;
    --text-disabled: #C9CDD4;
    --text-inverse: #FFFFFF;

    --border: #E5E6EB;
    --border-light: #F2F3F5;
    --border-focus: #006EFF;

    --success: #00B42A;
    --success-light: #E8FFEA;
    --warning: #FF7D00;
    --warning-light: #FFF7E8;
    --danger: #F53F3F;
    --danger-light: #FFECE8;

    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 8px;
    --radius-xl: 12px;

    --shadow-sm: 0 1px 4px rgba(0,0,0,.04);
    --shadow-md: 0 2px 8px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
    --shadow-lg: 0 8px 24px rgba(0,0,0,.08), 0 2px 8px rgba(0,0,0,.04);
    --shadow-card: 0 1px 4px rgba(0,0,0,.04), 0 4px 12px rgba(0,0,0,.04);

    --navbar-h: 60px;
    --container-max: 1200px;
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; -webkit-text-size-adjust: 100%; }
body {
    font-family: var(--font);
    color: var(--text-primary);
    background: var(--bg-page);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
a { color: var(--primary); text-decoration: none; transition: color .2s; }
a:hover { color: var(--primary-hover); }
img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, textarea, select { font-family: inherit; font-size: inherit; }
ul, ol { list-style: none; }

/* ---------- 布局 ---------- */
.app { min-height: 100vh; display: flex; flex-direction: column; }
.main-content { flex: 1; padding-top: var(--navbar-h); }
.container { max-width: var(--container-max); margin: 0 auto; padding: 24px 24px 48px; }

/* ---------- 导航栏 ---------- */
.navbar {
    position: fixed; top: 0; left: 0; right: 0; z-index: 1000;
    height: var(--navbar-h);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}
.navbar-inner {
    max-width: var(--container-max); height: 100%;
    margin: 0 auto; padding: 0 24px;
    display: flex; align-items: center; gap: 32px;
}
.navbar-brand { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.brand-icon { border-radius: var(--radius-lg); }
.brand-text { font-size: 18px; font-weight: 600; color: var(--text-primary); }
.navbar-brand:hover .brand-text { color: var(--primary); }
.navbar-nav { display: flex; gap: 4px; flex: 1; }
.nav-link {
    padding: 8px 16px; border-radius: var(--radius-md);
    color: var(--text-secondary); font-size: 14px; font-weight: 500;
    transition: all .2s;
}
.nav-link:hover { color: var(--primary); background: var(--primary-light); }
.nav-link.active { color: var(--primary); background: var(--primary-light); }
.navbar-actions { display: flex; align-items: center; gap: 12px; }
.user-info { display: flex; align-items: center; gap: 6px; color: var(--text-secondary); font-size: 14px; }
.navbar-toggle { display: none; flex-direction: column; gap: 4px; padding: 8px; }
.navbar-toggle span { width: 20px; height: 2px; background: var(--text-primary); border-radius: 1px; transition: .3s; }

/* ---------- 按钮 ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 8px 16px; border-radius: var(--radius-md);
    font-size: 14px; font-weight: 500; line-height: 1.5;
    border: 1px solid transparent; transition: all .2s;
    white-space: nowrap; user-select: none;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--primary); color: var(--text-inverse); }
.btn-primary:hover { background: var(--primary-hover); color: var(--text-inverse); }
.btn-outline { background: var(--bg-card); color: var(--text-primary); border-color: var(--border); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-lighter); }
.btn-text { background: transparent; color: var(--primary); padding: 4px 8px; }
.btn-text:hover { background: var(--primary-light); }
.btn-danger-text, .btn-text.text-danger { color: var(--danger); }
.btn-danger-text:hover, .btn-text.text-danger:hover { background: var(--danger-light); }
.btn-text.text-success { color: var(--success); }
.btn-text.text-success:hover { background: var(--success-light); }
.btn-text.text-warning { color: var(--warning); }
.btn-text.text-warning:hover { background: var(--warning-light); }
.btn-block { display: flex; width: 100%; }
.btn-lg { padding: 12px 24px; font-size: 15px; }
.btn-sm { padding: 5px 12px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- 表单 ---------- */
.form-group { margin-bottom: 20px; }
.form-label {
    display: block; margin-bottom: 6px;
    font-size: 14px; font-weight: 500; color: var(--text-primary);
}
.form-label.required::after { content: " *"; color: var(--danger); }
.form-input, .form-textarea {
    width: 100%; padding: 10px 12px;
    border: 1px solid var(--border); border-radius: var(--radius-md);
    background: var(--bg-input); color: var(--text-primary);
    font-size: 14px; transition: all .2s;
    outline: none;
}
.form-input::placeholder, .form-textarea::placeholder { color: var(--text-disabled); }
.form-input:focus, .form-textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0,110,255,.1);
}
.form-textarea { resize: vertical; min-height: 80px; line-height: 1.6; }
.form-hint { margin-top: 4px; font-size: 12px; color: var(--text-tertiary); }
.input-wrap { position: relative; }
.input-icon {
    position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
    color: var(--text-tertiary); pointer-events: none;
}
.form-input.has-icon { padding-left: 40px; }
.input-toggle {
    position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
    padding: 4px; color: var(--text-tertiary); border-radius: var(--radius-sm);
}
.input-toggle:hover { color: var(--text-secondary); background: var(--bg-hover); }

/* ---------- 卡片 ---------- */
.card { background: var(--bg-card); border-radius: var(--radius-lg); box-shadow: var(--shadow-card); }

/* ---------- 提示 ---------- */
.alert { padding: 10px 14px; border-radius: var(--radius-md); font-size: 14px; margin-bottom: 16px; }
.alert-error { background: var(--danger-light); color: var(--danger); }
.alert-success { background: var(--success-light); color: var(--success); }
.alert-warning { background: var(--warning-light); color: var(--warning); }

/* ---------- 搜索栏 ---------- */
.search-bar { background: var(--bg-card); border-bottom: 1px solid var(--border); }
.search-bar-inner { max-width: var(--container-max); margin: 0 auto; padding: 20px 24px; }
.search-form { display: flex; gap: 12px; }
.search-input-wrap { position: relative; flex: 1; max-width: 500px; }
.search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-tertiary); }
.search-input {
    width: 100%; padding: 10px 36px 10px 40px;
    border: 1px solid var(--border); border-radius: var(--radius-md);
    background: var(--bg-page); transition: all .2s; outline: none; font-size: 14px;
}
.search-input:focus { border-color: var(--primary); background: var(--bg-card); box-shadow: 0 0 0 3px rgba(0,110,255,.1); }
.search-clear { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); padding: 4px; color: var(--text-tertiary); border-radius: 50%; display: flex; }
.search-clear:hover { color: var(--text-secondary); background: var(--bg-hover); }

/* ---------- 区块标题 ---------- */
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.section-title { font-size: 20px; font-weight: 600; color: var(--text-primary); display: flex; align-items: center; gap: 8px; }
.section-count { font-size: 14px; color: var(--text-tertiary); font-weight: 400; }

/* ---------- 商品列表 ---------- */
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 20px; }
.product-card {
    background: var(--bg-card); border-radius: var(--radius-lg); overflow: hidden;
    box-shadow: var(--shadow-card); transition: all .3s; border: 1px solid transparent;
    display: block;
}
.product-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: var(--primary-light); }
.product-card-image { width: 100%; aspect-ratio: 1; overflow: hidden; background: var(--bg-page); position: relative; }
.product-card-image img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s; }
.product-card:hover .product-card-image img { transform: scale(1.06); }
.product-card-placeholder { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; }
.product-card-badge { position: absolute; right: 8px; bottom: 8px; background: rgba(0,0,0,.6); color: #fff; font-size: 12px; padding: 2px 8px; border-radius: var(--radius-sm); }
.product-card-body { padding: 14px 16px; }
.product-card-name { font-size: 15px; font-weight: 500; color: var(--text-primary); margin-bottom: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.product-card:hover .product-card-name { color: var(--primary); }
.product-card-spec { font-size: 13px; color: var(--text-tertiary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- 分页 ---------- */
.pagination { display: flex; justify-content: center; gap: 6px; margin-top: 40px; flex-wrap: wrap; }
.page-btn {
    min-width: 36px; height: 36px; padding: 0 10px;
    display: inline-flex; align-items: center; justify-content: center;
    border: 1px solid var(--border); border-radius: var(--radius-md);
    background: var(--bg-card); color: var(--text-secondary); font-size: 14px;
    transition: all .2s;
}
.page-btn:hover { border-color: var(--primary); color: var(--primary); }
.page-btn.active { background: var(--primary); color: var(--text-inverse); border-color: var(--primary); }

/* ---------- 空状态 ---------- */
.empty-state { text-align: center; padding: 60px 20px; }
.empty-title { font-size: 16px; color: var(--text-secondary); margin-top: 16px; font-weight: 500; }
.empty-desc { font-size: 14px; color: var(--text-tertiary); margin-top: 8px; }
.mt-16 { margin-top: 16px; }

/* ---------- 面包屑 ---------- */
.breadcrumb { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text-tertiary); margin-bottom: 20px; }
.breadcrumb a { color: var(--text-secondary); }
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb-sep { color: var(--text-disabled); }
.breadcrumb-current { color: var(--text-primary); font-weight: 500; }

/* ---------- 商品详情 ---------- */
.product-detail { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; background: var(--bg-card); border-radius: var(--radius-xl); padding: 32px; box-shadow: var(--shadow-card); }
.product-detail-name { font-size: 26px; font-weight: 600; color: var(--text-primary); margin-bottom: 20px; line-height: 1.4; }
.product-detail-section { margin-bottom: 24px; }
.product-detail-label { font-size: 14px; color: var(--text-tertiary); margin-bottom: 8px; font-weight: 500; }
.product-detail-spec { font-size: 15px; color: var(--text-primary); line-height: 1.8; }
.product-detail-desc { font-size: 15px; color: var(--text-secondary); line-height: 1.8; }
.product-detail-meta { display: flex; gap: 20px; margin: 24px 0; padding-top: 20px; border-top: 1px solid var(--border-light); }
.meta-item { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-tertiary); }
.product-detail-actions { display: flex; gap: 12px; }

/* ---------- 图片轮播 ---------- */
.product-detail-gallery { max-width: 524px; }
.carousel-main { position: relative; width: 100%; max-width: 524px; aspect-ratio: 1; border-radius: var(--radius-lg); overflow: hidden; background: var(--bg-page); margin: 0 auto; }
.carousel-track { width: 100%; height: 100%; position: relative; }
.carousel-slide { position: absolute; inset: 0; opacity: 0; transition: opacity .4s ease; }
.carousel-slide.active { opacity: 1; }
.carousel-slide img { width: 100%; height: 100%; object-fit: cover; }
.carousel-btn {
    position: absolute; top: 50%; transform: translateY(-50%);
    width: 40px; height: 40px; border-radius: 50%;
    background: rgba(255,255,255,.85); color: var(--text-secondary);
    display: flex; align-items: center; justify-content: center;
    backdrop-filter: blur(4px); transition: all .2s; z-index: 2;
}
.carousel-btn:hover { background: #fff; color: var(--primary); box-shadow: var(--shadow-md); }
.carousel-btn-prev { left: 12px; }
.carousel-btn-next { right: 12px; }
.carousel-indicators { position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%); display: flex; gap: 6px; z-index: 2; }
.carousel-dot { width: 8px; height: 8px; border-radius: 50%; background: rgba(255,255,255,.5); cursor: pointer; transition: all .2s; }
.carousel-dot.active { background: var(--primary); width: 24px; border-radius: 4px; }
.carousel-thumbs-wrap { position: relative; margin-top: 12px; max-width: 524px; }
.carousel-thumbs { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; -ms-overflow-style: none; }
.carousel-thumbs::-webkit-scrollbar { display: none; }
.carousel-thumbs-btn {
    position: absolute; top: 50%; transform: translateY(-50%);
    width: 28px; height: 28px; border-radius: 50%;
    background: rgba(255,255,255,.9); color: var(--text-secondary);
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 1px 4px rgba(0,0,0,.12); border: 1px solid var(--border);
    cursor: pointer; z-index: 2; opacity: 0; transition: opacity .2s; pointer-events: none;
}
.carousel-thumbs-wrap:hover .carousel-thumbs-btn.visible,
.carousel-thumbs-wrap:focus-within .carousel-thumbs-btn.visible { opacity: 1; pointer-events: auto; }
.carousel-thumbs-btn:hover { background: #fff; color: var(--primary); }
.carousel-thumbs-btn:active { transform: translateY(-50%) scale(.92); }
.carousel-thumbs-btn.visible { opacity: 1 !important; pointer-events: auto !important; }
.carousel-thumbs-prev { left: 4px; }
.carousel-thumbs-next { right: 4px; }
.carousel-thumb { flex-shrink: 0; width: 64px; height: 64px; border-radius: var(--radius-md); overflow: hidden; border: 2px solid transparent; opacity: .6; transition: all .2s; }
.carousel-thumb.active { border-color: var(--primary); opacity: 1; }
.carousel-thumb img { width: 100%; height: 100%; object-fit: cover; }
.product-detail-no-image { width: 100%; aspect-ratio: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; background: var(--bg-page); border-radius: var(--radius-lg); color: var(--text-disabled); gap: 12px; }

/* ---------- 登录页 ---------- */
.auth-page { display: flex; align-items: center; justify-content: center; min-height: calc(100vh - var(--navbar-h)); padding: 40px 20px; }
.auth-card { width: 100%; max-width: 400px; background: var(--bg-card); border-radius: var(--radius-xl); box-shadow: var(--shadow-lg); padding: 40px; }
.auth-header { text-align: center; margin-bottom: 32px; }
.auth-header svg { margin: 0 auto 16px; }
.auth-header h1 { font-size: 24px; font-weight: 600; color: var(--text-primary); }
.auth-header p { font-size: 14px; color: var(--text-tertiary); margin-top: 8px; }
.auth-form .form-group { margin-bottom: 18px; }
.auth-footer { text-align: center; margin-top: 24px; font-size: 14px; }

/* ---------- 管理后台 ---------- */
.admin-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.status-tabs { display: flex; gap: 4px; background: var(--bg-card); padding: 4px; border-radius: var(--radius-lg); border: 1px solid var(--border); }
.status-tab { display: flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: var(--radius-md); font-size: 14px; color: var(--text-secondary); font-weight: 500; transition: all .2s; white-space: nowrap; flex-shrink: 0; }
.status-tab:hover { background: var(--bg-hover); }
.status-tab.active { background: var(--primary); color: var(--text-inverse); }
.tab-count { font-size: 12px; padding: 1px 6px; border-radius: 10px; background: var(--bg-hover); color: var(--text-tertiary); }
.status-tab.active .tab-count { background: rgba(255,255,255,.25); color: var(--text-inverse); }
.admin-toolbar-right { display: flex; gap: 12px; align-items: center; }
.admin-search { display: flex; gap: 8px; }
.admin-search-input { width: 200px; padding: 7px 12px; }

.admin-table-wrap { background: var(--bg-card); border-radius: var(--radius-lg); box-shadow: var(--shadow-card); overflow: hidden; overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.admin-table th { padding: 12px 16px; text-align: left; font-size: 13px; font-weight: 500; color: var(--text-tertiary); background: var(--bg-page); border-bottom: 1px solid var(--border); white-space: nowrap; }
.admin-table td { padding: 12px 16px; font-size: 14px; color: var(--text-primary); border-bottom: 1px solid var(--border-light); vertical-align: middle; }
/* PC端列宽定义 */
.admin-table .col-check   { width: 40px; text-align: center; }
.admin-table .col-thumb   { width: 64px; text-align: center; }
.admin-table .col-name    { width: auto; }
.admin-table .col-category { width: 12%; text-align: center; }
.admin-table .col-spec    { width: 28%; text-align: center; }
.admin-table .col-actions { width: 200px; text-align: right; }
.admin-table .col-category .category-tag { margin: 0 auto; }
.admin-table .col-spec .admin-spec-cell {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}
.admin-table .col-actions .admin-actions { justify-content: flex-end; }
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tbody tr:hover { background: var(--primary-lighter); }

/* 缩略图：固定52x52方形容器 + object-fit cover 居中裁切 */
.admin-thumb-wrap {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--bg-hover);
    display: block;
    margin: 0 auto;
    position: relative;
    flex-shrink: 0;
}
.admin-thumb-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.admin-thumb-wrap svg {
    width: 24px;
    height: 24px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}
.admin-thumb-empty {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 批量操作栏 */
.batch-bar {
    display: none;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    margin-bottom: 12px;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    border: 1px solid var(--primary-light);
}
.batch-bar.active { display: flex; }
.batch-bar-info { font-size: 14px; color: var(--text-secondary); }
.batch-bar-info b { color: var(--primary); }
.batch-bar-actions { display: flex; gap: 8px; margin-left: auto; }
.batch-bar .btn { font-size: 13px; }

/* 复选框样式 */
.admin-checkbox {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--primary);
    vertical-align: middle;
}
.col-check .admin-checkbox { margin: 0 auto; display: block; }
.admin-product-name { color: var(--text-primary); font-weight: 500; }
.admin-product-name:hover { color: var(--primary); }
.admin-spec-cell { color: var(--text-tertiary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.admin-time-cell { color: var(--text-tertiary); font-size: 13px; white-space: nowrap; }
.admin-actions { display: flex; gap: 4px; white-space: nowrap; }

/* ---------- 分类标签 ---------- */
.category-tag {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 500;
    line-height: 1.5;
    white-space: nowrap;
}
.category-tag-empty {
    color: var(--text-tertiary);
    background: var(--bg-hover);
    border: 1px solid var(--border);
    padding: 2px 10px;
    border-radius: var(--radius-sm);
    font-size: 12px;
}
.category-tag-sm {
    display: inline-flex;
    align-items: center;
    padding: 1px 8px;
    border-radius: var(--radius-sm);
    font-size: 11px;
    font-weight: 500;
    line-height: 1.4;
    white-space: nowrap;
    margin-top: 6px;
}

/* ---------- 分类选择器 ---------- */
.category-selector {
    display: flex;
    gap: 8px;
    align-items: center;
}
.category-selector select {
    flex: 1;
    min-width: 0;
}

/* ---------- 分类管理列表（弹窗内）---------- */
.category-manage-list {
    max-height: 240px;
    overflow-y: auto;
    margin-bottom: 16px;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 4px;
}
.category-manage-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    transition: background .2s;
}
.category-manage-item:hover { background: var(--bg-hover); }
.category-manage-item-info { display: flex; align-items: center; gap: 8px; }
.category-manage-color { width: 14px; height: 14px; border-radius: 50%; flex-shrink: 0; }
.category-manage-name { font-size: 14px; color: var(--text-primary); }
.category-manage-delete {
    width: 28px; height: 28px;
    display: flex; align-items: center; justify-content: center;
    border-radius: var(--radius-sm);
    color: var(--danger);
    transition: all .2s;
    flex-shrink: 0;
}
.category-manage-delete:hover { background: var(--danger-light); }
.category-manage-delete:disabled { color: var(--text-disabled); cursor: not-allowed; }
.category-manage-delete:disabled:hover { background: none; }

/* ---------- 颜色选择器 ---------- */
.color-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.color-option {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 2px solid transparent;
    transition: all .2s;
    background: var(--c);
}
.color-option:hover {
    transform: scale(1.1);
}
.color-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}
.color-option:has(input:checked) {
    border-color: var(--text-primary);
    box-shadow: 0 0 0 2px var(--bg-card), 0 0 0 4px var(--text-primary);
}

/* ---------- 模态框 ---------- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}
.modal-card {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 420px;
    animation: modalIn .2s ease;
}
@keyframes modalIn {
    from { opacity: 0; transform: scale(.95); }
    to { opacity: 1; transform: scale(1); }
}
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 0;
}
.modal-header h3 {
    font-size: 18px;
    font-weight: 600;
}
.modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    font-size: 20px;
    color: var(--text-tertiary);
    background: none;
    border: none;
    cursor: pointer;
    transition: all .2s;
}
.modal-close:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}
.modal-body {
    padding: 20px 24px;
}
.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 0 24px 20px;
}

/* ---------- 商品详情分类 ---------- */
.product-detail-category {
    margin-bottom: 16px;
}

/* ---------- 状态标签 ---------- */
.status-badge { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: var(--radius-sm); font-size: 12px; font-weight: 500; white-space: nowrap; }
.status-badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; margin-right: 6px; }
.status-published { background: var(--success-light); color: var(--success); }
.status-published::before { background: var(--success); }
.status-draft { background: var(--bg-hover); color: var(--text-tertiary); }
.status-draft::before { background: var(--text-tertiary); }
.status-offline { background: var(--warning-light); color: var(--warning); }
.status-offline::before { background: var(--warning); }

/* ---------- 编辑页 ---------- */
.edit-layout { display: grid; grid-template-columns: 1fr 380px; gap: 24px; align-items: start; }
.edit-form-area { background: var(--bg-card); border-radius: var(--radius-lg); padding: 28px; box-shadow: var(--shadow-card); }
.edit-upload-area { position: sticky; top: calc(var(--navbar-h) + 24px); }
.upload-panel { background: var(--bg-card); border-radius: var(--radius-lg); padding: 24px; box-shadow: var(--shadow-card); }
.upload-title { font-size: 16px; font-weight: 600; color: var(--text-primary); margin-bottom: 4px; }
.upload-hint { font-size: 12px; color: var(--text-tertiary); margin-bottom: 16px; }

.upload-zone { border: 2px dashed var(--border); border-radius: var(--radius-lg); padding: 32px 20px; text-align: center; cursor: pointer; transition: all .2s; background: var(--bg-page); }
.upload-zone:hover, .upload-zone.dragover { border-color: var(--primary); background: var(--primary-lighter); }
.upload-zone-content { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.upload-zone-text { font-size: 14px; color: var(--text-tertiary); }
.upload-zone-link { color: var(--primary); }

.upload-progress { margin-top: 12px; }
.upload-progress-bar { width: 100%; height: 6px; background: var(--bg-hover); border-radius: 3px; overflow: hidden; }
.upload-progress-fill { height: 100%; background: var(--primary); border-radius: 3px; width: 0%; transition: width .3s; }
.upload-progress-text { font-size: 12px; color: var(--text-tertiary); margin-top: 4px; display: block; }

.image-list { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.image-item { position: relative; width: 90px; height: 90px; border-radius: var(--radius-md); overflow: hidden; border: 1px solid var(--border); }
.image-item img { width: 100%; height: 100%; object-fit: cover; }
.image-item-overlay { position: absolute; inset: 0; background: rgba(0,0,0,.5); display: flex; align-items: center; justify-content: center; gap: 4px; opacity: 0; transition: opacity .2s; }
.image-item:hover .image-item-overlay { opacity: 1; }
.image-item-btn { width: 28px; height: 28px; border-radius: var(--radius-sm); background: rgba(255,255,255,.9); color: var(--text-secondary); display: flex; align-items: center; justify-content: center; transition: all .2s; }
.image-item-btn:hover { background: #fff; color: var(--primary); }
.image-item-btn.image-delete:hover { color: var(--danger); }
.image-item-btn:disabled { opacity: .3; cursor: not-allowed; }
.image-item-badge { position: absolute; top: 4px; left: 4px; background: var(--primary); color: #fff; font-size: 11px; padding: 1px 6px; border-radius: var(--radius-sm); }

.status-selector { display: flex; gap: 12px; }
.radio-card { flex: 1; cursor: pointer; }
.radio-card input { display: none; }
.radio-card-content { display: block; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-md); transition: all .2s; }
.radio-card:hover .radio-card-content { border-color: var(--primary); }
.radio-card input:checked + .radio-card-content { border-color: var(--primary); background: var(--primary-lighter); }
.radio-card-title { display: block; font-size: 14px; font-weight: 500; color: var(--text-primary); }
.radio-card-desc { display: block; font-size: 12px; color: var(--text-tertiary); margin-top: 2px; }

.edit-actions { display: flex; align-items: center; justify-content: space-between; margin-top: 24px; padding: 16px 24px; background: var(--bg-card); border-radius: var(--radius-lg); box-shadow: var(--shadow-card); position: sticky; bottom: 16px; }
.edit-actions-right { display: flex; gap: 12px; }

/* ---------- 安装页 ---------- */
.install-page { background: var(--bg-page); min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.install-container { width: 100%; max-width: 480px; }
.install-card { background: var(--bg-card); border-radius: var(--radius-xl); box-shadow: var(--shadow-lg); padding: 40px; }
.install-logo { text-align: center; margin-bottom: 32px; }
.install-logo svg { margin: 0 auto 12px; }
.install-logo h1 { font-size: 22px; font-weight: 600; }
.install-steps { display: flex; align-items: center; justify-content: center; gap: 8px; margin-bottom: 28px; font-size: 13px; }
.install-steps .step { color: var(--text-tertiary); }
.install-steps .step.active { color: var(--primary); font-weight: 600; }
.step-arrow { color: var(--text-disabled); }
.install-section p { margin-bottom: 12px; color: var(--text-secondary); }
.install-hint { font-size: 13px; color: var(--text-tertiary); }
.install-done { text-align: center; }
.install-done svg { margin: 0 auto 16px; }
.install-done h2 { font-size: 20px; margin-bottom: 8px; }
.install-done p { color: var(--text-secondary); margin-bottom: 20px; }
.install-done code { background: var(--bg-hover); padding: 2px 6px; border-radius: var(--radius-sm); font-size: 13px; }

/* ---------- Toast ---------- */
.toast-container { position: fixed; top: calc(var(--navbar-h) + 16px); left: 50%; transform: translateX(-50%); z-index: 9999; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast { padding: 12px 20px; border-radius: var(--radius-md); background: var(--text-primary); color: #fff; font-size: 14px; box-shadow: var(--shadow-lg); animation: toastIn .3s ease; pointer-events: auto; }
.toast.toast-success { background: var(--success); }
.toast.toast-error { background: var(--danger); }
.toast.toast-warning { background: var(--warning); }
@keyframes toastIn { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }

/* ---------- 弹窗 ---------- */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 2000; display: flex; align-items: center; justify-content: center; padding: 20px; animation: fadeIn .2s; }
.modal-box { background: var(--bg-card); border-radius: var(--radius-xl); box-shadow: var(--shadow-lg); padding: 28px; max-width: 420px; width: 100%; animation: modalIn .3s; }
.modal-title { font-size: 17px; font-weight: 600; margin-bottom: 8px; }
.modal-desc { font-size: 14px; color: var(--text-secondary); margin-bottom: 24px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 12px; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalIn { from { opacity: 0; transform: scale(.95); } to { opacity: 1; transform: scale(1); } }

/* ---------- Spinner ---------- */
.spinner { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 页脚 ---------- */
.footer { border-top: 1px solid var(--border); background: var(--bg-card); padding: 20px 0; }
.footer-inner { max-width: var(--container-max); margin: 0 auto; padding: 0 24px; text-align: center; font-size: 13px; color: var(--text-tertiary); }

/* ============================================
 * 图片放大弹窗 (Lightbox)
 * ============================================ */
.lightbox {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
}
.lightbox.active { display: flex; }

.lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,.85);
    backdrop-filter: blur(4px);
    cursor: zoom-out;
}

.lightbox-content {
    position: relative;
    z-index: 1;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-img {
    max-width: 90vw;
    max-height: 85vh;
    object-fit: contain;
    border-radius: var(--radius-md);
    box-shadow: 0 8px 32px rgba(0,0,0,.3);
    transition: opacity .3s;
}

.lightbox-counter {
    position: absolute;
    bottom: -36px;
    left: 50%;
    transform: translateX(-50%);
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    text-shadow: 0 1px 4px rgba(0,0,0,.5);
    letter-spacing: 1px;
}

.lightbox-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(255,255,255,.15);
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all .2s;
    backdrop-filter: blur(4px);
}
.lightbox-btn:hover { background: rgba(255,255,255,.3); }
.lightbox-btn:active { transform: translateY(-50%) scale(.92); }
.lightbox-prev { left: 20px; }
.lightbox-next { right: 20px; }

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255,255,255,.15);
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all .2s;
    backdrop-filter: blur(4px);
    z-index: 2;
}
.lightbox-close:hover { background: rgba(255,255,255,.3); }

@media (max-width: 900px) {
    .product-detail { grid-template-columns: 1fr; gap: 24px; }
    .edit-layout { grid-template-columns: 1fr; }
    .edit-upload-area { position: static; }
    .navbar-inner { gap: 12px; }
    .navbar-nav { gap: 2px; }
    .nav-link { padding: 6px 10px; font-size: 13px; }
}

/* ============================================
 * 响应式 - 平板/手机
 * ============================================ */
@media (max-width: 768px) {
    /* 工具类：移动端隐藏 */
    .hide-mobile { display: none !important; }

    .lightbox-btn { width: 40px; height: 40px; }
    .lightbox-prev { left: 8px; }
    .lightbox-next { right: 8px; }
    .lightbox-close { top: 12px; right: 12px; width: 40px; height: 40px; }
    .lightbox-img { max-width: 95vw; max-height: 75vh; }

    /* 导航栏紧凑化 */
    .navbar-inner { padding: 0 12px; gap: 8px; }
    .navbar-actions { gap: 4px; }
    .nav-link { padding: 6px 8px; font-size: 13px; }

    /* 管理后台工具栏 */
    .admin-toolbar { flex-direction: column; align-items: stretch; gap: 12px; }
    .admin-toolbar-right { flex-direction: column; align-items: stretch; gap: 8px; }
    .admin-search { flex-direction: row; flex-wrap: wrap; gap: 6px; width: 100%; }
    .admin-search-input { flex: 1; width: auto; min-width: 0; }
    .admin-search select { width: auto; min-width: 90px; flex-shrink: 0; }
    .admin-search .btn-outline, .admin-search .btn-text { flex-shrink: 0; }
    .admin-search .form-input { font-size: 13px; }
    .admin-toolbar-right .btn { justify-content: center; }

    /* 状态标签可横向滚动 */
    .status-tabs { overflow-x: auto; -webkit-overflow-scrolling: touch; padding: 4px; }
    .status-tab { padding: 6px 10px; font-size: 13px; }

    /* 管理表格 → 卡片布局 */
    .admin-table-wrap { background: transparent; box-shadow: none; overflow: visible; }
    .admin-table { table-layout: auto !important; }
    .admin-table thead { display: none; }
    .admin-table tbody tr {
        display: block;
        background: var(--bg-card);
        border-radius: var(--radius-lg);
        box-shadow: var(--shadow-card);
        margin-bottom: 12px;
        border: 1px solid var(--border-light);
        border-left-width: 4px;
    }
    .admin-table tbody tr[data-status="published"] { border-left-color: var(--success); }
    .admin-table tbody tr[data-status="draft"]     { border-left-color: var(--text-tertiary); }
    .admin-table tbody tr[data-status="offline"]   { border-left-color: var(--warning); }
    .admin-table tbody tr:hover { background: var(--bg-card); }
    .admin-table td {
        display: flex;
        align-items: center;
        padding: 6px 12px;
        border-bottom: 1px solid var(--border-light);
        font-size: 14px;
        gap: 12px;
        width: auto !important;
    }
    .admin-table tr:last-child td { border-bottom: none; }
    .admin-table td::before {
        content: attr(data-label);
        font-size: 12px;
        color: var(--text-tertiary);
        font-weight: 500;
        min-width: 40px;
        flex-shrink: 0;
    }
    .admin-table td[data-label="图片"] { justify-content: center; padding-top: 10px; padding-bottom: 10px; }
    .admin-table td[data-label="图片"]::before { display: none; }
    .admin-table td[data-label="名称"] { font-size: 15px; font-weight: 500; }
    .admin-table td[data-label="名称"]::before,
    .admin-table td[data-label="规格"]::before,
    .admin-table td[data-label="分类"]::before {
        min-width: 48px;
        text-align: left;
        flex-shrink: 0;
    }
    .admin-table td[data-label="分类"] .category-tag,
    .admin-table td[data-label="分类"] .category-tag-empty { margin: 0 !important; }
    .admin-table td[data-label="操作"]::before { display: none; }
    .admin-table td[data-label="操作"] .admin-actions { width: 100%; justify-content: space-around; }

    /* 编辑页 */
    .edit-form-area { padding: 20px 16px; }
    .upload-panel { padding: 16px; }
    .upload-zone { padding: 24px 16px; }
    .edit-actions { flex-direction: column; gap: 12px; padding: 12px 16px; }
    .edit-actions-right { width: 100%; }
    .edit-actions-right .btn { flex: 1; }
    .status-selector { flex-direction: column; }
    .image-item { width: 72px; height: 72px; }
    .category-selector { flex-direction: column; align-items: stretch; gap: 8px; }
    .category-selector .btn { width: 100%; }

    /* 商品详情 */
    .product-detail { padding: 16px; border-radius: var(--radius-lg); }
    .product-detail-name { font-size: 20px; }
    .carousel-thumb { width: 52px; height: 52px; }
    .product-detail-meta { flex-wrap: wrap; gap: 12px; }
    /* 移动端轮播图宽度跟随屏幕，不做 524px 限制 */
    .product-detail-gallery { max-width: none; width: 100%; }
    .carousel-main { max-width: none; width: 100%; }
    .carousel-thumbs-wrap { max-width: none; width: 100%; }

    /* 搜索栏 */
    .search-bar-inner { padding: 12px 16px; }
    .search-form { gap: 8px; }
    .search-input-wrap { max-width: none; }
    .search-input { font-size: 13px; }

    /* 分页 */
    .pagination { gap: 4px; }
    .page-btn { min-width: 32px; height: 32px; font-size: 13px; }

    /* 模态框 */
    .modal-card { max-width: 100%; margin: 16px; }
    .modal-body { padding: 16px 20px; }
    .modal-header { padding: 16px 20px 0; }
    .modal-footer { padding: 0 20px 16px; }

    /* 登录页 */
    .auth-card { padding: 28px 20px; }
}

/* ============================================
 * 响应式 - 手机
 * ============================================ */
@media (max-width: 640px) {
    :root { --navbar-h: 56px; }
    .container { padding: 16px 16px 32px; }
    .navbar-inner { padding: 0 16px; gap: 16px; }
    .navbar-brand .brand-text { display: none; }
    .user-info { display: none; }
    .navbar-actions { margin-left: auto; }

    .search-bar-inner { padding: 16px; }
    .search-form { flex-direction: column; }
    .search-input-wrap { max-width: none; }
    .section-title { font-size: 18px; }

    .product-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
    .product-card-body { padding: 10px 12px; }
    .product-card-name { font-size: 14px; }

    .auth-card { padding: 28px 24px; }

    .admin-thumb { width: 40px; height: 40px; }
}

/* ============================================
 * 响应式 - 小屏手机
 * ============================================ */
/* ============================================
 * 分享卡片弹窗
 * ============================================ */
.share-modal {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,.5);
    backdrop-filter: blur(4px);
    animation: fadeIn .2s;
}
.share-modal.active { display: flex; }

.share-modal-box {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 420px;
    padding: 28px 24px 20px;
    animation: modalIn .3s;
}

.share-modal-title {
    text-align: center;
    font-size: 17px;
    font-weight: 600;
    margin-bottom: 20px;
}

/* 分享卡片本体 */
.share-card {
    display: flex;
    gap: 12px;
    padding: 14px;
    background: var(--bg-page);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
}
.share-card-thumb {
    width: 72px;
    height: 72px;
    border-radius: var(--radius-md);
    object-fit: cover;
    background: var(--bg-hover);
    flex-shrink: 0;
}
.share-card-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}
.share-card-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.4;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
}
.share-card-desc {
    font-size: 13px;
    color: var(--text-tertiary);
    line-height: 1.5;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.share-card-source {
    font-size: 11px;
    color: var(--text-disabled);
    display: flex;
    align-items: center;
    gap: 4px;
}
.share-card-source svg { flex-shrink: 0; }

.share-modal-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}
.share-modal-actions .btn { flex: 1; }
.share-modal-close {
    width: 100%;
    margin-top: 10px;
    padding: 10px;
    text-align: center;
    font-size: 14px;
    color: var(--text-tertiary);
    background: none;
    border: none;
    cursor: pointer;
    transition: color .2s;
}
.share-modal-close:hover { color: var(--text-primary); }

/* 移动端：隐藏批量选择列 */
@media (max-width: 768px) {
    .admin-table .col-check { display: none !important; }
    .batch-bar { display: none !important; }
    .share-card-thumb { width: 60px; height: 60px; }
    .share-modal-box { max-width: 100%; margin: 16px; }
}

@media (max-width: 380px) {
    .product-grid { grid-template-columns: 1fr; }
}

/* ============================================
 * 图片加载过渡（解决访问慢的视觉体验）
 * ============================================ */
.product-card-image img,
.carousel-main img,
.share-card-thumb {
    transition: opacity .3s;
}

/* 移动端适配 admin-thumb-wrap */
@media (max-width: 768px) {
    .admin-thumb-wrap {
        width: 48px;
        height: 48px;
    }
}

/* ============================================
 * 海报分享弹窗
 * ============================================ */
.poster-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,.6);
}
.poster-modal.active { display: flex; }

.poster-modal-box {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    width: 90%;
    max-width: 400px;
    padding: 20px 16px 14px;
    text-align: center;
    position: relative;
}

.poster-modal-title {
    font-size: 15px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 14px;
}

.poster-wrap {
    width: 100%;
    background: #fff;
    border-radius: var(--radius-lg);
    overflow: hidden;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.poster-wrap canvas,
.poster-wrap img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: var(--radius-lg);
}

.poster-loading {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background: #f5f5f5;
    z-index: 2;
    min-height: 200px;
}
.poster-loading.hidden { display: none; }

.poster-modal-actions {
    display: flex;
    gap: 12px;
    margin-top: 14px;
    align-items: center;
}
.poster-modal-actions .btn { flex: 1; }
.poster-modal-actions .share-modal-close {
    margin-top: 0;
    padding: 10px 16px;
    width: auto;
    flex: 1;
}

@media (max-width: 768px) {
    .poster-modal-box { max-width: 100%; margin: 12px; padding: 16px 12px 10px; }
}
