/* ============================================================
   style.css — 全局样式 v5（横向多图滚动轮播）
   ============================================================ */

/* ─── 重置 ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    /* ── 核心主色：深蓝 ── */
    --primary:      #3a5a8c;
    --primary-dark: #2c4a7a;
    --primary-dim:  rgba(58,90,140,0.10);

    /* ── 辅色：橙色 ── */
    --orange:       #e8855a;
    --orange-dark:  #d47244;
    --orange-dim:   rgba(232,133,90,0.12);

    /* ── 背景层次（浅色） ── */
    --bg-base:      #dfe6ef;        /* 页面底层，浅灰蓝 */
    --bg-card:      #ffffff;        /* 卡片 */
    --bg-card2:     #f4f7fa;        /* 次级背景 */
    --bg-input:     #f8fafc;        /* 输入框 */

    /* ── 文字 ── */
    --text-main:    #1e293b;
    --text-sub:     #5a6a7e;
    --text-muted:   #8e9faf;

    /* ── 边框 ── */
    --border:       #dce4ed;
    --border-hover: #b8c8de;

    /* ── 语义色 ── */
    --green:  #27ae60;
    --red:    #e05555;
    --blue:   #3a5a8c;

    --radius: 10px;
}

html { -webkit-text-size-adjust: 100%; }

body {
    font-family: 'Microsoft YaHei', 'PingFang SC', sans-serif;
    background: var(--bg-base);
    color: var(--text-main);
    min-height: 100vh;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

/* ============================================================
   前端 — Header（带登录+注册按钮）
   ============================================================ */
.header {
    background: linear-gradient(135deg, #2c4a7a 0%, #3a5a8c 50%, #2c4a7a 100%);
    padding: 50px 16px 20px;
    position: relative;
    overflow: hidden;
}
.header::before {
    content: '';
    position: absolute;
    top: -50px; left: 50%;
    transform: translateX(-50%);
    width: 280px; height: 150px;
    background: radial-gradient(ellipse, rgba(255,255,255,0.08) 0%, transparent 70%);
    pointer-events: none;
}
.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    z-index: 1;
    max-width: 1200px;
    margin: 0 auto;
}
.header-left h1 { 
    font-size: 22px; 
    font-weight: 700; 
    color: #fff; 
}
.header-left p { 
    font-size: 12px; 
    color: rgba(255,255,255,0.72); 
    margin-top: 4px; 
}
.header-right {
    flex-shrink: 0;
    display: flex;
    gap: 8px;
}
.header-btn {
    display: inline-block;
    padding: 7px 18px;
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
}
.header-btn:hover {
    background: rgba(255,255,255,0.25);
    border-color: rgba(255,255,255,0.5);
}
.header-btn-outline {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.4);
}
.header-btn-outline:hover {
    background: rgba(255,255,255,0.12);
}

/* ============================================================
   前端 — 标签筛选栏（改为自动换行）
   ============================================================ */
.tag-bar {
    display: flex;
    flex-wrap: wrap; /* ✅ 关键：允许换行 */
    gap: 8px;
    padding: 12px 16px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 10;
    box-shadow: 0 2px 6px rgba(0,0,0,0.04);
    max-width: 1200px; /* ✅ 桌面端限制宽度 */
    margin: 0 auto;
}

.tag-pill {
    display: inline-block;
    white-space: nowrap;
    flex-shrink: 0;
    background: var(--bg-card2);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 6px 15px;
    font-size: 13px;
    color: var(--text-sub);
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    transition: all 0.2s;
}
.tag-pill.active {
    background: var(--primary-dim);
    border-color: var(--primary);
    color: var(--primary);
    font-weight: 600;
}

/* ============================================================
   前端 — 主内容区（限制最大宽度，居中显示）
   ============================================================ */
.main-content {
    max-width: 1200px; /* ✅ 桌面端最大宽度 */
    margin: 0 auto;    /* ✅ 居中显示 */
}

/* ============================================================
   前端 — 横向多图滚动轮播
   ============================================================ */
.multi-carousel-wrap {
    margin: 16px 16px 20px;
}
.multi-carousel-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 10px;
    padding-left: 2px;
}
.multi-carousel {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; /* Firefox */
    padding-bottom: 8px;
}
.multi-carousel::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
}
.multi-carousel-item {
    flex-shrink: 0;
    width: 130px; /* 手机端宽度 */
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.multi-carousel-item:active {
    transform: scale(0.96);
}
.multi-carousel-item img {
    width: 100%;
    height: 180px;
    object-fit: cover; /* ✅ 裁剪不拉伸 */
}
.multi-carousel-caption {
    padding: 8px 10px;
    font-size: 12px;
    color: var(--text-main);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ============================================================
   前端 — 区块标题
   ============================================================ */
.section-title {
    padding: 16px 16px 6px;
    font-size: 15px; font-weight: 700;
    color: var(--text-main);
}
.section-title em { color: var(--primary); font-style: normal; }

/* ============================================================
   前端 — 壁纸 Grid
   ============================================================ */
.wallpaper-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    padding: 0 16px 20px;
}
.wallpaper-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.wallpaper-card:active {
    border-color: var(--primary);
    box-shadow: 0 2px 10px rgba(58,90,140,0.18);
}
.wallpaper-card img {
    width: 100%;
    aspect-ratio: 9 / 16;
    object-fit: cover; /* ✅ 裁剪不拉伸 */
}
.wallpaper-card .card-info { padding: 8px 10px; }
.wallpaper-card .card-title {
    font-size: 12px; color: var(--text-main); font-weight: 500;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.wallpaper-card .card-tags { margin-top: 4px; display: flex; gap: 4px; flex-wrap: wrap; }
.wallpaper-card .card-tag {
    font-size: 10px; color: var(--primary);
    background: var(--primary-dim);
    border-radius: 4px; padding: 1px 6px;
}
.wallpaper-card .card-stats {
    margin-top: 5px; font-size: 11px; color: var(--text-muted);
    display: flex; gap: 10px;
}

/* ============================================================
   前端 — 加载更多 / 空状态 / 底部
   ============================================================ */
.load-more-wrap { text-align: center; padding: 10px 0 24px; }
.bottom-space { height: 30px; }

.empty-state { text-align: center; padding: 50px 20px; color: var(--text-muted); }
.empty-state .empty-icon { font-size: 38px; margin-bottom: 10px; }
.empty-state p { font-size: 14px; }

/* ============================================================
   通用 按钮
   ============================================================ */
.btn {
    display: block; width: 100%;
    padding: 11px 16px;
    border: none; border-radius: 8px;
    font-size: 14px; font-weight: 600;
    cursor: pointer; font-family: inherit;
    -webkit-tap-highlight-color: transparent;
    transition: opacity 0.2s, transform 0.1s;
}
.btn:active { transform: scale(0.96); }

.btn-primary {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
    color: #fff;
}
.btn-primary:hover { opacity: 0.88; }

.btn-orange {
    background: linear-gradient(135deg, var(--orange-dark), var(--orange));
    color: #fff;
}
.btn-orange:hover { opacity: 0.88; }

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-sub);
}
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }

.btn-danger {
    background: rgba(224,85,85,0.08);
    border: 1px solid rgba(224,85,85,0.25);
    color: var(--red);
}
.btn-sm { padding: 6px 12px; font-size: 12px; width: auto; display: inline-block; }

/* ============================================================
   通用 Toast
   ============================================================ */
.toast {
    position: fixed; top: 54px; left: 50%;
    transform: translateX(-50%) translateY(-100px);
    background: #fff;
    border: 1px solid var(--border);
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    border-radius: 8px; padding: 11px 22px;
    font-size: 14px; color: var(--text-main);
    z-index: 9999; transition: transform 0.3s;
    pointer-events: none; white-space: nowrap;
}
.toast.show { transform: translateX(-50%) translateY(0); }
.toast.success { border-color: rgba(39,174,96,0.4); color: var(--green); }
.toast.error   { border-color: rgba(224,85,85,0.4);  color: var(--red); }

/* ============================================================
   后台 — 整体布局
   ============================================================ */
.admin-page { min-height: 100vh; background: var(--bg-base); color: var(--text-main); }

.admin-header {
    background: linear-gradient(135deg, #2c4a7a, #3a5a8c);
    padding: 48px 18px 14px;
    display: flex; align-items: center; justify-content: space-between;
}
.admin-header h1 { font-size: 17px; font-weight: 700; color: #fff; }
.admin-header .logout-btn {
    font-size: 12px; color: rgba(255,255,255,0.75);
    border: 1px solid rgba(255,255,255,0.35); border-radius: 6px;
    padding: 5px 12px; cursor: pointer;
}
.admin-header .logout-btn:hover { background: rgba(255,255,255,0.12); }

/* 后台导航 */
.admin-nav {
    display: flex; gap: 5px;
    padding: 8px 14px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 2px 6px rgba(0,0,0,0.04);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.admin-nav::-webkit-scrollbar { display: none; }
.admin-nav a {
    white-space: nowrap; flex-shrink: 0;
    padding: 7px 13px; border-radius: 16px;
    font-size: 13px; color: var(--text-sub);
    background: transparent;
    border: 1px solid transparent;
    transition: all 0.2s;
}
.admin-nav a:hover { color: var(--primary); }
.admin-nav a.active {
    background: var(--primary-dim);
    border-color: var(--primary);
    color: var(--primary);
    font-weight: 600;
}

/* 后台内容区 */
.admin-content { padding: 18px 16px 40px; max-width: 760px; margin: 0 auto; }

/* 后台卡片 */
.admin-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 14px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}
.admin-card h2 {
    font-size: 15px; font-weight: 600; color: var(--text-main);
    border-bottom: 1px solid var(--border);
    padding-bottom: 8px; margin-bottom: 14px;
}

/* ============================================================
   后台 — 统计卡
   ============================================================ */
.stats-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 14px;
}
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px; text-align: center;
    box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}
.stat-card .stat-num {
    font-size: 24px; font-weight: 700;
    color: var(--primary);
}
.stat-card .stat-label { font-size: 12px; color: var(--text-muted); margin-top: 3px; }

/* ============================================================
   后台 — 表单
   ============================================================ */
.form-group { margin-bottom: 14px; }
.form-group label {
    display: block; font-size: 13px; color: var(--text-sub);
    margin-bottom: 5px; font-weight: 500;
}
.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 14px; color: var(--text-main);
    font-family: inherit; outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-dim);
}
.form-group textarea { resize: vertical; min-height: 60px; }
.form-group select option { background: #fff; color: var(--text-main); }

/* 标签多选 */
.tag-select { display: flex; gap: 6px; flex-wrap: wrap; }
.tag-select label {
    display: flex; align-items: center; gap: 4px;
    background: var(--bg-card2);
    border: 1px solid var(--border);
    border-radius: 16px; padding: 5px 12px;
    font-size: 13px; color: var(--text-sub);
    cursor: pointer; user-select: none; transition: all 0.2s;
}
.tag-select label:has(input:checked) {
    background: var(--primary-dim);
    border-color: var(--primary);
    color: var(--primary);
}
.tag-select input[type="checkbox"] { width: auto; accent-color: var(--primary); }

/* 上传预览 */
.upload-preview {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 28px 16px;
    text-align: center; cursor: pointer;
    min-height: 130px;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 8px;
    transition: border-color 0.2s, background 0.2s;
    background: var(--bg-card2);
}
.upload-preview:hover { border-color: var(--primary); background: var(--primary-dim); }
.upload-preview .upload-icon { font-size: 30px; }
.upload-preview .upload-text { font-size: 13px; color: var(--text-sub); }
.upload-preview .upload-text span { color: var(--primary); font-weight: 600; }
.upload-preview img { max-height: 150px; border-radius: 8px; object-fit: contain; }
.upload-preview input[type="file"] { display: none; }

/* ============================================================
   后台 — 壁纸表格
   ============================================================ */
.wp-table { width: 100%; border-collapse: collapse; }
.wp-table th {
    text-align: left; font-size: 12px; font-weight: 600;
    color: var(--text-muted); padding: 0 0 8px;
    border-bottom: 2px solid var(--border);
}
.wp-table td {
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    vertical-align: middle; font-size: 13px;
}
.wp-table tr:last-child td { border-bottom: none; }
.wp-thumb {
    width: 48px; height: 64px;
    object-fit: cover; border-radius: 6px;
    border: 1px solid var(--border);
}
.wp-table .col-title { color: var(--text-main); font-weight: 500; }
.wp-table .col-meta { color: var(--text-muted); font-size: 11px; margin-top: 2px; }
.wp-table .col-tags { color: var(--primary); font-size: 11px; }
.wp-table .col-stats { color: var(--text-muted); font-size: 11px; white-space: nowrap; }
.wp-table .col-actions { display: flex; gap: 6px; }

/* ============================================================
   后台 — 用户表格
   ============================================================ */
.user-table { width: 100%; border-collapse: collapse; }
.user-table th {
    text-align: left; font-size: 12px; font-weight: 600;
    color: var(--text-muted); padding: 0 0 8px;
    border-bottom: 2px solid var(--border);
}
.user-table td {
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    vertical-align: middle; font-size: 13px;
}
.user-table tr:last-child td { border-bottom: none; }
.user-status-badge {
    display: inline-block; font-size: 11px; font-weight: 600;
    padding: 2px 8px; border-radius: 10px;
}
.badge-active { background: rgba(39,174,96,0.10); color: var(--green); }
.badge-banned { background: rgba(224,85,85,0.10); color: var(--red); }

/* ============================================================
   后台 — 标签管理
   ============================================================ */
.tag-list { display: flex; flex-wrap: wrap; gap: 8px; }
.tag-list-item {
    display: flex; align-items: center; gap: 8px;
    background: var(--bg-card2);
    border: 1px solid var(--border);
    border-radius: 18px; padding: 6px 12px;
    font-size: 13px; color: var(--text-main);
}
.tag-list-item .tag-del {
    color: var(--red); cursor: pointer; font-size: 16px;
    line-height: 1; opacity: 0.6;
}
.tag-list-item .tag-del:hover { opacity: 1; }

/* ============================================================
   后台 — 提示盒子
   ============================================================ */
.tip-box {
    background: var(--primary-dim);
    border-left: 3px solid var(--primary);
    border-radius: 0 8px 8px 0;
    padding: 10px 14px;
    font-size: 13px; color: var(--primary);
    margin: 10px 0; line-height: 1.6;
}

/* ============================================================
   后台 — 登录页
   ============================================================ */
.login-wrap {
    min-height: 100vh;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    padding: 0 24px;
    background: linear-gradient(150deg, #2c4a7a 0%, #3a5a8c 35%, #dfe6ef 35%);
}
.login-card {
    width: 100%; max-width: 360px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 16px; padding: 34px 24px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.10);
}
.login-card .login-title {
    text-align: center; font-size: 21px; font-weight: 700;
    color: var(--primary); margin-bottom: 24px;
}
.alert-box {
    background: rgba(224,85,85,0.08);
    border: 1px solid rgba(224,85,85,0.25);
    border-radius: 8px; padding: 10px 14px;
    color: var(--red); font-size: 13px;
    margin-bottom: 14px; text-align: center;
}
.success-box {
    background: rgba(39,174,96,0.08);
    border: 1px solid rgba(39,174,96,0.25);
    border-radius: 8px; padding: 10px 14px;
    color: var(--green); font-size: 13px;
    margin-bottom: 14px; text-align: center;
}

/* ============================================================
   壁纸详情页样式
   ============================================================ */
.detail-wrap {
    max-width: 600px;
    margin: 0 auto;
    padding: 16px;
}
.detail-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.detail-image {
    width: 100%;
    max-height: 70vh;
    object-fit: contain; /* ✅ 完整显示图片 */
    background: #f5f5f5;
}
.detail-info {
    padding: 16px;
}
.detail-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 10px;
}
.detail-tags {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}
.detail-tag {
    font-size: 12px;
    color: var(--primary);
    background: var(--primary-dim);
    border-radius: 14px;
    padding: 4px 12px;
}
.detail-stats {
    display: flex;
    gap: 16px;
    font-size: 13px;
    color: var(--text-muted);
    padding: 12px 0;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    margin-bottom: 16px;
}
.detail-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}
.back-link {
    display: inline-block;
    padding: 10px 16px;
    background: var(--bg-card2);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    color: var(--text-sub);
    text-align: center;
    margin-bottom: 16px;
    transition: all 0.2s;
}
.back-link:hover {
    border-color: var(--primary);
    color: var(--primary);
}

/* ============================================================
   壁纸详情页 — 相关推荐
   ============================================================ */
.related-section {
    margin-top: 24px;
}
.related-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 12px;
    padding-left: 2px;
}
.related-carousel {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; /* Firefox */
    padding-bottom: 8px;
}
.related-carousel::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
}
.related-item {
    flex-shrink: 0;
    width: 130px; /* 手机端宽度 */
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.related-item:active {
    transform: scale(0.96);
}
.related-item img {
    width: 100%;
    height: 180px;
    object-fit: cover;
}
.related-caption {
    padding: 8px 10px;
}
.related-item-title {
    font-size: 12px;
    color: var(--text-main);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.related-item-stats {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ============================================================
   响应式 — 桌面端
   ============================================================ */
@media (min-width: 640px) {
    .wallpaper-grid { grid-template-columns: repeat(3, 1fr); }
    .stats-row      { grid-template-columns: repeat(4, 1fr); }
    .admin-wp-list  { grid-template-columns: repeat(3, 1fr); }
    
    /* 桌面端多图轮播每张更宽 */
    .multi-carousel-item {
        width: 180px;
    }
    .multi-carousel-item img {
        height: 240px;
    }
    
    /* 桌面端相关推荐每张更宽 */
    .related-item {
        width: 160px;
    }
    .related-item img {
        height: 220px;
    }
}

@media (min-width: 1024px) {
    .wallpaper-grid { grid-template-columns: repeat(4, 1fr); }
    
    .multi-carousel-item {
        width: 200px;
    }
}