/* pages.css — 组件与页面样式：壁纸 / 玻璃层 / 导航 / 头像 / 裁剪 / 问候语 / 时间 / 子页面 */

/* ===== 壁纸层 ===== */
.wallpaper {
    position: fixed;
    inset: 0;
    z-index: -2;
    pointer-events: none;
}
/* 玻璃遮罩：主题颜色 + 模糊度控制深度，隔一层玻璃看壁纸 */
.wallpaper-glass {
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
}
/* 视频壁纸（在壁纸层内全屏铺满） */
.wallpaper-video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* ===== 首页右下角：四个子模块占位块 ===== */
.home-modules {
    position: fixed;
    right: 24px;
    bottom: 92px;
    z-index: 900;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}
.home-module {
    width: 108px;
    height: 64px;
    border-radius: 14px;
    background: var(--c, #5b8def);
    color: #fff;
    font-weight: 700;
    font-size: 14px;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow-md);
    transition: transform 0.2s ease, filter 0.2s ease;
}
.home-module:hover { transform: scale(1.03); filter: brightness(1.05); }

/* ===== 子页面左侧返回按钮 ===== */
.back-btn {
    position: fixed;
    left: 24px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 900;
    padding: 10px 18px;
    border-radius: 60px;
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    color: var(--ink);
    font-weight: 600;
    font-size: 14px;
    box-shadow: var(--shadow-md);
    transition: transform 0.2s ease;
}
.back-btn:hover { transform: translateY(-50%) scale(1.04); }

/* ===== 左上角头像（点击选择本地图片） ===== */
.avatar-uploader {
    position: fixed;
    top: 104px;
    left: 42px;
    z-index: 950;
    width: 112px;
    height: 112px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    cursor: pointer;
    user-select: none;
    animation: avatarSpin 12s linear infinite;
}
@keyframes avatarSpin { to { transform: rotate(360deg); } }
.avatar-uploader:hover { box-shadow: var(--shadow-md); }
.avatar-uploader img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar-placeholder { font-size: 34px; color: rgba(255, 255, 255, 0.9); }

/* ===== 头像裁剪弹窗 ===== */
.avatar-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(0, 0, 0, 0.45);
}
.avatar-modal-box {
    width: min(360px, 92vw);
    padding: 24px;
    border-radius: var(--radius-lg);
    text-align: center;
    color: var(--ink);
}
.avatar-modal-title { font-weight: 700; font-size: 16px; margin-bottom: 16px; }
.crop-wrap {
    width: 240px;
    height: 240px;
    margin: 0 auto;
    position: relative;
    overflow: hidden;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.06);
    border: 2px solid var(--glass-border);
    cursor: grab;
    touch-action: none;
}
.crop-wrap:active { cursor: grabbing; }
.crop-wrap img {
    position: absolute;
    left: 0;
    top: 0;
    max-width: none;
    pointer-events: none;
    user-select: none;
}
.crop-zoom {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin: 14px 0 4px;
    font-size: 13px;
    color: var(--ink-soft);
}
.crop-zoom input { width: 200px; accent-color: var(--accent); }
.crop-hint { font-size: 12px; color: var(--muted); margin-bottom: 12px; }

/* ===== 问候语：页面中上部（颜色由主题-标题颜色控制） ===== */
.greet {
    position: fixed;
    left: 50%;
    top: 21vh;
    transform: translateX(-50%);
    z-index: 900;
    font-size: 52px;
    font-weight: 800;
    color: #1a1a2e;
    letter-spacing: 6px;
    text-shadow: 0 2px 14px rgba(0, 0, 0, 0.15);
    user-select: none;
}

/* ===== 时间：页面右边，中间偏上一点点 ===== */
.time-box {
    position: fixed;
    right: 36px;
    top: 38vh;
    z-index: 900;
    text-align: right;
    color: var(--ink);
    text-shadow: 0 2px 12px rgba(255, 255, 255, 0.4);
    user-select: none;
}
.time-date { font-size: 14px; letter-spacing: 1px; opacity: 0.9; margin-bottom: 6px; }
.time-clock {
    font-size: 42px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    letter-spacing: 2px;
}

/* ===== 壁纸设置按钮 ===== */
.bg-fab {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 950;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    border: 1px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    font-size: 22px;
    cursor: pointer;
    box-shadow: var(--shadow-md);
    transition: transform 0.2s ease;
}
.bg-fab:hover { transform: scale(1.06); }

/* 访客（未登录）隐藏编辑入口 */
body:not([data-owner="1"]) .bg-fab { display: none; }
body:not([data-owner="1"]) .avatar-uploader { cursor: default; }

/* 左下角：所有者登录入口（低调） */
.owner-login {
    position: fixed;
    left: 24px;
    bottom: 24px;
    z-index: 950;
    padding: 8px 16px;
    border-radius: 60px;
    border: 1px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.45);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: var(--ink-soft);
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    opacity: 0.55;
    transition: opacity 0.2s ease;
}
.owner-login:hover { opacity: 1; }

/* ===== 壁纸设置弹窗（毛玻璃透风格） ===== */
.bg-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(0, 0, 0, 0.28);
}
.bg-modal-box {
    position: relative;
    width: min(950px, 94vw);
    min-height: 380px;
    max-height: 90vh;
    padding: 24px;
    border-radius: var(--radius-lg);
    color: var(--ink);
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: rgba(255, 255, 255, 0.34);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.4);
    box-shadow: var(--shadow-lg);
    overflow-y: auto;
    overflow-x: hidden;
}
.bg-modal-title { font-weight: 700; font-size: 16px; margin-bottom: 16px; }
.bg-close-x {
    position: absolute;
    top: 14px;
    right: 16px;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--ink-soft);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    transition: background 0.2s ease;
}
.bg-close-x:hover { background: rgba(255, 255, 255, 0.6); }
.bg-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 14px;
    padding: 4px;
    border-radius: 60px;
    background: rgba(255, 255, 255, 0.4);
}
.bg-tab {
    flex: 1;
    padding: 8px 6px;
    border: none;
    border-radius: 60px;
    background: transparent;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    color: var(--ink-soft);
}
.bg-tab.is-active { background: var(--ink); color: #fff; }
.bg-tab-panel {
    flex: 0 0 300px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 10px;
    overflow-y: auto;
    overflow-x: hidden;
}

.bg-upload {
    width: 100%;
    padding: 10px;
    border: 1px dashed rgba(26, 26, 46, 0.25);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.4);
    cursor: pointer;
    font-weight: 600;
    color: var(--ink-soft);
}
.bg-upload:hover { background: rgba(255, 255, 255, 0.7); }

/* 分页的缩略图网格：每页 3 个；横纵比跟随视口；占满上传按钮上方空间 */
.bg-my-list {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    flex: 1 1 auto;
    min-height: 0;
    align-content: start;
    overflow-y: auto;
    overflow-x: hidden;
}
.bg-my-item {
    aspect-ratio: var(--preview-ar, 16 / 9);
    border-radius: 14px;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    border: 2px solid rgba(255, 255, 255, 0.7);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}
.bg-my-item.is-active { border-color: var(--ink); }
.bg-my-item:hover { transform: scale(1.02); }
.bg-del {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 20px;
    height: 20px;
    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    font-size: 13px;
    line-height: 20px;
    text-align: center;
    cursor: pointer;
    padding: 0;
}
.bg-del:hover { background: #000; }
.bg-empty { font-size: 13px; color: var(--muted); grid-column: 1 / -1; text-align: center; padding-top: 40px; }
.bg-msg { font-size: 13px; color: #e5484d; margin: 0 0 8px; }
/* 动态列表里的内嵌视频预览 */
.bg-video-prev {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    pointer-events: none;
}

/* 翻页器：◀ 页码 ▶（只显示当前页数） */
.bg-pager {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 16px;
}
.bg-page-btn {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    border: 1px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    font-size: 14px;
    color: var(--ink);
}
.bg-page-btn:disabled { opacity: 0.35; cursor: default; }
.bg-page-num {
    min-width: 22px;
    text-align: center;
    font-weight: 700;
    color: var(--ink);
    font-size: 14px;
}

/* 主题预览：颜色 + 亮度 + 模糊度 */
.bg-field {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 8px 0;
    font-size: 13px;
    color: var(--ink-soft);
}
.bg-field input[type="color"] {
    flex: 1;
    height: 34px;
    border: none;
    border-radius: 8px;
    padding: 0;
    background: none;
    cursor: pointer;
}
.bg-text {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.6);
    color: var(--ink);
    font-size: 14px;
}
.bg-hex {
    font-variant-numeric: tabular-nums;
    color: var(--muted);
    min-width: 70px;
    text-align: right;
}
.bg-slider {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    margin: 8px 0;
    padding: 0 8px;
    font-size: 13px;
    color: var(--ink-soft);
}
.bg-ctrl-label { width: 96px; flex: 0 0 auto; }
.bg-range-wrap { position: relative; flex: 1; padding-top: 24px; }
.bg-range-val {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    min-width: 40px;
    padding: 2px 6px;
    border-radius: 8px;
    background: #555;
    color: #fff;
    font-size: 11px;
    text-align: center;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.15s ease;
    pointer-events: none;
}
.bg-range-wrap.is-dragging .bg-range-val { opacity: 1; }
.bg-range-wrap input {
    width: 100%;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    border-radius: 999px;
    background: linear-gradient(90deg, #fff 0%, #fff 0%, #d8d8d8 0%, #d8d8d8 100%);
    border: none;
    outline: none;
    cursor: pointer;
}
/* 键盘聚焦时仍给出可见提示（上面把默认 outline 去掉了） */
.bg-range-wrap input:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 4px;
}
.bg-range-wrap input::-webkit-slider-runnable-track {
    background: transparent;
    border-radius: 999px;
}
.bg-range-wrap input::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid #888;
    cursor: pointer;
}
.bg-range-wrap input::-moz-range-track {
    height: 6px;
    border-radius: 999px;
    background: #d8d8d8;
}
.bg-range-wrap input::-moz-range-progress {
    height: 6px;
    border-radius: 999px;
    background: #fff;
}
.bg-range-wrap input::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid #888;
    cursor: pointer;
}

.bg-modal-actions { display: flex; gap: 10px; justify-content: center; margin-top: 14px; }
.bg-publish-status { font-size: 12px; color: var(--muted); text-align: center; min-height: 1em; margin-top: 8px; }
.bg-publish-status.is-busy { color: var(--ink-soft); }
.bg-publish-status.is-ok { color: #1a9e57; font-weight: 600; }
.bg-publish-status.is-err { color: #e5484d; font-weight: 600; }

/* ===== 弹窗内：本地草稿 / 线上状态提示条 ===== */
.bg-notice {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 10px;
    background: rgba(255, 214, 102, 0.18);
    border: 1px solid rgba(240, 180, 40, 0.45);
    color: var(--ink-soft);
    font-size: 12px;
    line-height: 1.5;
}
.bg-notice-text { flex: 1; }
.bg-notice-btn {
    flex: 0 0 auto;
    padding: 4px 10px;
    border-radius: 8px;
    border: 1px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.75);
    color: var(--ink);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}
.bg-notice-btn:hover { background: #fff; }

/* ===== 发布反馈：角落提示条 ===== */
.md-toast {
    position: fixed;
    left: 50%;
    bottom: 28px;
    transform: translateX(-50%);
    z-index: 1100;
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: min(560px, 92vw);
    padding: 10px 14px;
    border-radius: 60px;
    background: rgba(255, 255, 255, 0.74);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-md);
    color: var(--ink);
    font-size: 13px;
}
.md-toast-text { flex: 1; }
.md-toast-icon {
    flex: 0 0 auto;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--muted);
    box-sizing: border-box;
}
.md-toast.is-busy .md-toast-icon {
    background: transparent;
    border: 2px solid rgba(26, 26, 46, 0.22);
    border-top-color: var(--ink);
    animation: mdSpin 0.8s linear infinite;
}
.md-toast.is-ok .md-toast-icon { background: #22c55e; }
.md-toast.is-err .md-toast-icon { background: #e5484d; }
@keyframes mdSpin { to { transform: rotate(360deg); } }
.md-toast-action {
    flex: 0 0 auto;
    padding: 4px 10px;
    border-radius: 8px;
    border: 1px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.8);
    color: var(--ink);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}
.md-toast-action:hover { background: #fff; }
.md-toast-close {
    flex: 0 0 auto;
    padding: 0 2px;
    border: none;
    background: transparent;
    color: var(--ink-soft);
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
}
.md-toast-close:hover { color: var(--ink); }

/* ===== 通用按钮 ===== */
.btn-ghost, .btn-solid {
    padding: 9px 22px;
    border-radius: 60px;
    border: 1px solid var(--glass-border);
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
}
.btn-ghost { background: rgba(255, 255, 255, 0.6); color: var(--ink-soft); }
.btn-ghost:hover { background: #fff; }
.btn-solid { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn-solid:hover { background: #000; }

/* ===== 子页面（占位）卡片 ===== */
.card {
    max-width: 640px;
    width: 100%;
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: var(--radius-lg);
    padding: 48px 40px;
    box-shadow: var(--shadow-lg);
    text-align: center;
    border: 1px solid var(--glass-border);
}
.page-card {
    min-height: 40vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
.page-title { font-size: 28px; color: var(--ink); margin-bottom: 16px; }
.coming-soon { color: var(--muted); font-size: 16px; line-height: 1.9; }

/* ===== 手机适配 ===== */
@media (max-width: 480px) {
    .home-modules { right: 16px; bottom: 74px; gap: 8px; }
    .home-module { width: 88px; height: 52px; font-size: 13px; }
    .back-btn { left: 16px; padding: 8px 14px; font-size: 13px; }

    .avatar-uploader { top: 84px; left: 18px; width: 88px; height: 88px; }
    .avatar-placeholder { font-size: 26px; }

    .greet { top: 18vh; font-size: 40px; letter-spacing: 4px; }

    .time-box { right: 18px; top: 38vh; }
    .time-date { font-size: 12px; }
    .time-clock { font-size: 30px; }

    .bg-fab { right: 16px; bottom: 16px; width: 46px; height: 46px; }

    .avatar-modal-box, .bg-modal-box { padding: 18px; }
    .bg-modal-box { min-height: 0; gap: 12px; }
    .crop-wrap { width: 220px; height: 220px; }

    .md-toast { bottom: 84px; font-size: 12px; padding: 8px 12px; max-width: 94vw; }

    .page-card { padding: 32px 20px; }
}
