/* ============================================================
   小离短视频 —— 个人主页（仿抖音「我」页面）
   ============================================================ */

.profile-page {
    height:100%;
    overflow-y:auto;
    background:#000;
    color:#fff;
    padding-bottom: calc(var(--nav-h) + 12px);
    -webkit-overflow-scrolling:touch;
    overscroll-behavior: contain;
}

/* ---------- 封面 ---------- */
.profile-cover {
    position:relative;
    width:100%;
    height:180px;
    background: linear-gradient(135deg,#1c1c1e,#0a0a0a);
    overflow:hidden;
    cursor:pointer;
}
.profile-cover::after {
    content:'';
    position:absolute; inset:0;
    background: linear-gradient(180deg, rgba(0,0,0,.28) 0%, rgba(0,0,0,0) 38%, rgba(0,0,0,.4) 100%);
    pointer-events:none;
}
.profile-cover img { width:100%; height:100%; object-fit:cover; }
.cover-change-hint {
    position:absolute; bottom:12px; right:14px;
    background: rgba(0,0,0,.5);
    backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    color:#fff; padding:6px 13px; border-radius:99px; font-size:12px;
    opacity:.9; pointer-events:none;
    display:flex; align-items:center; gap:5px;
    z-index:2;
}

/* ---------- 头部 ---------- */
.profile-header { padding:0 16px 16px; position:relative; }

.profile-avatar {
    width:88px; height:88px;
    border-radius:50%;
    overflow:hidden;
    margin-top:-44px;
    margin-bottom:12px;
    border:3px solid #000;
    box-shadow: 0 0 0 1.5px rgba(255,255,255,.18), 0 4px 16px rgba(0,0,0,.6);
    cursor:pointer;
    position:relative;
    z-index:2;
    background:#0a0a0a;
}
.profile-avatar img { width:100%; height:100%; object-fit:cover; }
.profile-avatar::after {
    content:"";
    position:absolute; bottom:3px; right:3px;
    width:26px; height:26px;
    border-radius:50%;
    background-color: rgba(0,0,0,.62);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23ffffff'%3E%3Cpath d='M12 15.2c1.77 0 3.2-1.43 3.2-3.2s-1.43-3.2-3.2-3.2-3.2 1.43-3.2 3.2 1.43 3.2 3.2 3.2zM9 2 7.17 4H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2h-3.17L15 2H9zm3 15c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5z'/%3E%3C/svg%3E");
    background-size:14px 14px;
    background-position:center;
    background-repeat:no-repeat;
    opacity:0;
    transition: opacity .2s var(--dy-ease);
}
.profile-avatar:hover::after { opacity:1; }

.profile-nickname { font-size:22px; font-weight:700; margin:0 0 5px; color:#fff; letter-spacing:.2px; }
.profile-id {
    font-size:12.5px; color: var(--dy-text-3); margin:0 0 8px;
    display:inline-flex; align-items:center; gap:5px;
    background: rgba(255,255,255,.07);
    border:1px solid rgba(255,255,255,.08);
    padding:3px 10px; border-radius:99px;
}
.profile-bio { font-size:13.5px; color: var(--dy-text-2); margin:8px 0 16px; line-height:1.45; }

.edit-profile-btn {
    position:absolute; top:20px; right:16px;
    background: rgba(255,255,255,.14);
    backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    border:1px solid rgba(255,255,255,.2);
    border-radius:99px;
    padding:8px 20px;
    font-size:13.5px; font-weight:600; color:#fff;
    cursor:pointer;
    transition: transform .16s var(--dy-ease), background .2s;
}
.edit-profile-btn:active { transform: scale(.94); }
.edit-profile-btn:hover { background: rgba(255,255,255,.2); }

/* ---------- 数据统计 ---------- */
.profile-stats {
    display:flex;
    justify-content:space-around;
    padding:14px 0;
    border-top:1px solid rgba(255,255,255,.07);
    border-bottom:1px solid rgba(255,255,255,.07);
    margin:0 16px;
}
.stat-item { text-align:center; flex:1; cursor:default; }
.stat-value { display:block; font-size:19px; font-weight:700; color:#fff; font-variant-numeric: tabular-nums; }
.stat-label { font-size:12.5px; color: var(--dy-text-3); margin-top:4px; }

/* ---------- Tab ---------- */
.profile-tabs {
    display:flex;
    justify-content:center;
    gap:32px;
    padding:6px 16px 0;
    border-bottom:1px solid rgba(255,255,255,.07);
    background:#000;
    position:sticky; top:0; z-index:5;
}
.profile-tabs .tab-item {
    text-align:center;
    padding:12px 2px;
    font-size:15px;
    font-weight:500;
    color: var(--dy-text-3);
    cursor:pointer;
    border-bottom:2px solid transparent;
    transition: color .2s var(--dy-ease), border-color .2s var(--dy-ease);
    background:transparent;
    border-radius:0;
}
.profile-tabs .tab-item.active { color:#fff; font-weight:700; border-bottom-color:#fff; }

.profile-content { padding:12px 8px; }
.profile-content .tab-pane { display:none; }
.profile-content .tab-pane.active { display:block; animation: fadeUp .26s var(--dy-ease); }
@keyframes fadeUp { from { opacity:0; transform: translateY(8px); } to { opacity:1; transform: translateY(0); } }

/* ---------- 子 Tab ---------- */
.history-sub-tabs { display:flex; margin-bottom:16px; gap:8px; padding:0 8px; }
.sub-tab {
    flex:1; text-align:center;
    padding:10px;
    background: #1c1c1e;
    color: var(--dy-text-2);
    border-radius:99px;
    font-size:13.5px;
    cursor:pointer;
    transition: all .2s var(--dy-ease);
    display:flex; align-items:center; justify-content:center; gap:6px;
}
.sub-tab svg { fill: currentColor; }
.sub-tab.active { background: var(--dy-red); color:#fff; box-shadow:0 4px 14px rgba(254,44,85,.3); }
.sub-tab-content { display:none; }
.sub-tab-content.active { display:block; }
.list-container { padding:0 4px; }
.list-container .video-card { background:#141416; border-color: rgba(255,255,255,.07); }

/* ---------- 瀑布流 ---------- */
.waterfall-grid { display:grid; grid-template-columns:repeat(3,1fr); gap:5px; }
.waterfall-grid .empty-state { grid-column: span 3; text-align:center; color: var(--dy-text-3); padding:44px 0; font-size:14px; }
.waterfall-grid .video-card {
    display:block; background:transparent; padding:0; border:none;
    border-radius:8px; overflow:hidden; margin-bottom:0; position:relative;
}
.waterfall-grid .video-card:active { background:transparent; opacity:.82; }
.waterfall-grid .card-thumb {
    width:100%; height:auto; aspect-ratio:9/16;
    border-radius:8px; margin-right:0; border:1px solid rgba(255,255,255,.07);
    background:#1c1c1e;
}
.waterfall-grid .card-info { padding:6px 2px; }
.waterfall-grid .card-title {
    font-size:12px; font-weight:500;
    white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
    color: var(--dy-text-2);
}
.waterfall-grid .card-status { top:5px; right:5px; }
.waterfall-grid .card-status .status-icon { width:20px; height:20px; }
.waterfall-grid .card-status .status-icon svg { width:11px; height:11px; }

/* ---------- 通用卡片 ---------- */
.video-card {
    display:flex; align-items:center;
    background:#141416;
    border-radius:14px; padding:10px; margin-bottom:10px;
    border:1px solid rgba(255,255,255,.07);
    cursor:pointer;
    transition: background .2s var(--dy-ease), transform .16s var(--dy-ease);
    user-select:none;
    position:relative;
}
.video-card:active { background:#1f1f22; transform: scale(.99); }
.card-thumb {
    width:78px; height:106px;
    background:#242428;
    border-radius:10px; margin-right:13px;
    object-fit:cover; flex-shrink:0;
    border:1px solid rgba(255,255,255,.07);
}
.card-info { flex:1; overflow:hidden; }
.card-title {
    font-size:15px; font-weight:500; margin-bottom:7px;
    white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
    color:#fff;
}
.card-tag {
    display:inline-block; background: rgba(255,255,255,.09);
    padding:4px 11px; border-radius:99px; font-size:11.5px; color: var(--dy-text-2);
}
.card-status { position:absolute; top:9px; right:9px; display:flex; gap:4px; z-index:5; }
.card-status .status-icon {
    background: rgba(0,0,0,.62);
    backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
    width:22px; height:22px; border-radius:50%;
    display:flex; align-items:center; justify-content:center;
}
.card-status .status-icon svg { width:12px; height:12px; fill:#fff; }
.card-status .status-icon.liked svg { fill: var(--dy-red); }
.card-status .status-icon.collected svg { fill:#FFC107; }

.empty, .empty-state { text-align:center; color: var(--dy-text-3); margin-top:60px; font-size:14px; }
.thumb-placeholder {
    background:#1c1c1e; display:flex; align-items:center; justify-content:center;
    color: rgba(255,255,255,.28);
}
.thumb-placeholder svg { width:30px; height:30px; fill: currentColor; }

/* ---------- 右上角菜单 ---------- */
.profile-menu-container { position:absolute; top:20px; right:16px; z-index:10; }
.profile-menu-btn {
    background: rgba(255,255,255,.14);
    backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    border:1px solid rgba(255,255,255,.2);
    border-radius:50%;
    width:36px; height:36px;
    display:flex; align-items:center; justify-content:center;
    color:#fff; cursor:pointer; padding:0;
    transition: background .2s, transform .16s var(--dy-ease);
}
.profile-menu-btn svg { fill:#fff; }
.profile-menu-btn:hover { background: rgba(255,255,255,.22); }
.profile-menu-btn:active { transform: scale(.92); }

.profile-dropdown-menu {
    position:absolute; top:44px; right:0;
    background: rgba(28,28,30,.97);
    backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
    border:1px solid rgba(255,255,255,.1);
    border-radius:14px; min-width:160px;
    padding:5px;
    box-shadow: 0 12px 32px rgba(0,0,0,.55);
    display:none; z-index:100;
    animation: menuIn .16s var(--dy-ease);
}
.profile-dropdown-menu.show { display:block; }
.dropdown-item {
    padding:11px 14px; color:#e5e5ea; font-size:14.5px; cursor:pointer;
    display:flex; align-items:center; gap:10px;
    border-radius:10px;
    transition: background .15s;
}
.dropdown-item svg { fill: var(--dy-text-3); width:16px; height:16px; flex-shrink:0; }
.dropdown-item:hover { background: rgba(255,255,255,.09); color:#fff; }
.dropdown-item:hover svg { fill:#fff; }
.dropdown-item:active { background: rgba(255,255,255,.14); }

/* ---------- 主题设置弹窗 ---------- */
.theme-settings-overlay {
    position:fixed; inset:0; background: rgba(0,0,0,.72);
    z-index:1000; display:flex; align-items:center; justify-content:center;
    backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
    animation: fadeIn .2s ease;
}
@keyframes fadeIn { from { opacity:0; } to { opacity:1; } }
.theme-settings-dialog {
    background: var(--dy-panel); border-radius:22px;
    width:90%; max-width:320px; padding:0;
    box-shadow: 0 20px 50px rgba(0,0,0,.6);
    border:1px solid rgba(255,255,255,.1);
    color:#fff;
    animation: slideUp .3s var(--dy-ease);
}
@keyframes slideUp { from { transform: translateY(30px); opacity:0; } to { transform: translateY(0); opacity:1; } }
.theme-settings-header {
    display:flex; align-items:center; justify-content:space-between;
    padding:16px 20px; border-bottom:1px solid rgba(255,255,255,.09);
}
.theme-settings-header h3 { margin:0; font-size:17px; font-weight:700; display:flex; align-items:center; gap:8px; }
.theme-settings-header h3 svg { fill:#FFC107; }
.theme-settings-close {
    background:none; border:none; color: var(--dy-text-3); cursor:pointer; padding:2px;
    display:flex; align-items:center; justify-content:center;
    transition: color .2s, transform .2s;
}
.theme-settings-close svg { fill: currentColor; }
.theme-settings-close:hover { color:#fff; transform: rotate(90deg); }
.theme-settings-body { padding:20px; }
.theme-switch-row { display:flex; align-items:center; justify-content:space-between; padding:12px 0; }
.theme-switch-label { font-size:15.5px; font-weight:500; color:#e5e5ea; display:flex; align-items:center; gap:9px; }
.theme-switch-label svg { fill: var(--dy-text-2); }
.theme-switch { position:relative; display:inline-block; width:52px; height:28px; }
.theme-switch input { opacity:0; width:0; height:0; }
.theme-slider { position:absolute; cursor:pointer; inset:0; background-color:#48484a; transition:.3s var(--dy-ease); border-radius:28px; }
.theme-slider:before { position:absolute; content:""; height:22px; width:22px; left:3px; bottom:3px; background-color:#fff; transition:.3s var(--dy-ease); border-radius:50%; }
input:checked + .theme-slider { background-color: var(--dy-red); }
input:checked + .theme-slider:before { transform: translateX(24px); }
.theme-switch-hint { text-align:center; color: var(--dy-text-3); font-size:12.5px; margin-top:16px; }

/* ============================================================
   浅色模式
   ============================================================ */
body.light-mode .profile-page { background:#fff; color:#1c1c1e; }
body.light-mode .profile-nickname { color:#1c1c1e; }
body.light-mode .profile-id { background: rgba(0,0,0,.05); border-color: rgba(0,0,0,.06); color:#8e8e93; }
body.light-mode .profile-bio { color:#3a3a3c; }
body.light-mode .profile-stats { border-color:#eee; }
body.light-mode .stat-value { color:#1c1c1e; }
body.light-mode .stat-label { color:#8e8e93; }
body.light-mode .profile-tabs { background:#fff; border-color:#eee; }
body.light-mode .profile-tabs .tab-item { color:#8e8e93; }
body.light-mode .profile-tabs .tab-item.active { color:#1c1c1e; border-bottom-color:#1c1c1e; }
body.light-mode .sub-tab { background:#f2f2f7; color:#3a3a3c; }
body.light-mode .sub-tab.active { background: var(--dy-red); color:#fff; }
body.light-mode .list-container .video-card { background:#f7f7f9; border-color:#ececef; }
body.light-mode .video-card { background:#f7f7f9; border-color:#ececef; }
body.light-mode .card-title { color:#1c1c1e; }
body.light-mode .card-tag { background:#ececef; color:#3a3a3c; }
body.light-mode .waterfall-grid .card-title { color:#3a3a3c; }
body.light-mode .waterfall-grid .card-thumb { background:#f2f2f7; border-color:#ececef; }
body.light-mode .empty, body.light-mode .empty-state { color:#8e8e93; }
body.light-mode .thumb-placeholder { background:#f2f2f7; color:#c7c7cc; }
body.light-mode .profile-cover { background: linear-gradient(135deg,#e9e9ee,#d8d8de); }
body.light-mode .profile-avatar { border-color:#fff; box-shadow: 0 0 0 1.5px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.12); }
body.light-mode .edit-profile-btn,
body.light-mode .profile-menu-btn { background: rgba(0,0,0,.06); border-color: rgba(0,0,0,.08); color:#1c1c1e; }
body.light-mode .edit-profile-btn:hover,
body.light-mode .profile-menu-btn:hover { background: rgba(0,0,0,.11); }
body.light-mode .profile-menu-btn svg { fill:#1c1c1e; }
body.light-mode .profile-dropdown-menu { background:#fff; border-color:#ececef; box-shadow: 0 12px 32px rgba(0,0,0,.14); }
body.light-mode .dropdown-item { color:#1c1c1e; }
body.light-mode .dropdown-item svg { fill:#8e8e93; }
body.light-mode .dropdown-item:hover { background:#f2f2f7; }
body.light-mode .dropdown-item:hover svg { fill:#1c1c1e; }

/* 底部导航保持深色（抖音风格） */
body.light-mode .nav { background:#000 !important; color: rgba(255,255,255,.55) !important; border-top-color: rgba(255,255,255,.07) !important; }
body.light-mode .nav .item.active { color:#fff !important; }

/* ============================================================
   用户资料卡片（点击视频作者头像弹出）
   —— 此前缺少样式，本次补齐并统一为抖音风格
   ============================================================ */
.user-profile-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,.72);
    z-index: 500;
    display: flex; align-items: center; justify-content: center;
    backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
    animation: fadeIn .2s ease;
    padding: 20px;
}
.user-profile-card {
    background: var(--dy-panel);
    border-radius: 20px;
    width: 100%; max-width: 340px;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,.1);
    box-shadow: 0 20px 50px rgba(0,0,0,.6);
    animation: popIn .28s var(--dy-ease);
    max-height: 86vh;
    display: flex; flex-direction: column;
}
.user-profile-cover {
    width: 100%; height: 108px;
    background: linear-gradient(135deg,#242428,#0f0f11);
    overflow: hidden; flex-shrink: 0;
    position: relative;
}
.user-profile-cover img { width:100%; height:100%; object-fit: cover; }
.user-profile-body {
    padding: 0 20px 20px;
    text-align: center;
    margin-top: -42px;
    overflow-y: auto;
}
.user-profile-avatar {
    width: 84px; height: 84px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--dy-panel);
    box-shadow: 0 0 0 1.5px rgba(255,255,255,.16), 0 4px 16px rgba(0,0,0,.5);
    background: #0a0a0a;
    margin-bottom: 10px;
}
.user-profile-name { font-size: 18px; font-weight: 700; color: #fff; margin-bottom: 4px; }
.user-profile-username { font-size: 13px; color: var(--dy-text-3); margin-bottom: 10px; }
.user-profile-group { margin-bottom: 10px; }
.profile-group-badge {
    display: inline-block;
    font-size: 11.5px; font-weight: 600;
    padding: 3px 12px; border-radius: 99px;
    background: rgba(255,255,255,.1);
    color: var(--dy-text-2);
    border: 1px solid rgba(255,255,255,.1);
}
.profile-group-badge.admin   { background: rgba(254,44,85,.16); color: #ff8fa6; border-color: rgba(254,44,85,.32); }
.profile-group-badge.vip     { background: rgba(255,193,7,.16); color: #ffd75e; border-color: rgba(255,193,7,.32); }
.profile-group-badge.regular { background: rgba(37,244,238,.14); color: #7ff5f1; border-color: rgba(37,244,238,.28); }
.profile-group-badge.guest   { background: rgba(255,255,255,.08); color: var(--dy-text-3); }
.user-profile-uid {
    display: inline-flex; align-items: center; gap: 5px;
    font-size: 12px; color: var(--dy-text-3);
    background: rgba(255,255,255,.06);
    border: 1px solid rgba(255,255,255,.08);
    padding: 4px 12px; border-radius: 99px;
    margin-bottom: 12px;
}
.user-profile-uid svg { fill: var(--dy-text-3); }
.user-profile-bio {
    font-size: 13.5px; color: var(--dy-text-2);
    line-height: 1.5; margin-bottom: 18px;
    word-break: break-word;
}
.user-profile-close-btn {
    width: 100%; padding: 11px;
    background: rgba(255,255,255,.1);
    border: 1px solid rgba(255,255,255,.14);
    border-radius: 99px;
    color: #fff; font-size: 14.5px; font-weight: 600;
    cursor: pointer;
    transition: background .2s, transform .16s var(--dy-ease);
}
.user-profile-close-btn:hover { background: rgba(255,255,255,.16); }
.user-profile-close-btn:active { transform: scale(.97); }
.user-profile-loading, .user-profile-error {
    padding: 50px 20px; text-align: center;
    color: var(--dy-text-3); font-size: 14px;
}
body.light-mode .user-profile-card { background: #fff; border-color: #ececef; }
body.light-mode .user-profile-name { color: #1c1c1e; }
body.light-mode .user-profile-avatar { border-color: #fff; }
body.light-mode .user-profile-close-btn { background: rgba(0,0,0,.06); border-color: rgba(0,0,0,.08); color: #1c1c1e; }
body.light-mode .user-profile-close-btn:hover { background: rgba(0,0,0,.11); }
