/* ========== 基础变量与重置 ========== */
:root {
    --primary: #ff4d4f;
    --primary-dark: #cf1322;
    --bg: #f5f5f5;
    --card-bg: #fff;
    --text: #333;
    --text-secondary: #999;
    --border: #eee;
    --radius: 10px;
    --shadow: 0 2px 12px rgba(0,0,0,0.08);
    --header-h: 48px;
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: #000;
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
    padding-top: var(--header-h);
    padding-bottom: calc(60px + var(--safe-bottom));
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
input, button, textarea, select { font: inherit; outline: none; border: none; }
button { cursor: pointer; }

/* ========== 顶部导航 ========== */
.header {
    position: fixed; top: 0; left: 0; right: 0; z-index: 100;
    height: var(--header-h); background: #111;
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 16px; box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}
.header .logo { font-size: 18px; font-weight: 700; color: var(--primary); }
.header .user-area { display: flex; align-items: center; gap: 10px; font-size: 14px; color: #ccc; }
.header .user-area .nickname { color: #fff; }
.header .user-area .tag { font-size: 11px; padding: 2px 8px; border-radius: 10px; }
.header .user-area .tag.member { background: #fff7e6; color: #fa8c16; }
.header .user-area .tag.non-member { background: #333; color: #999; }
.header .user-area .logout { color: #999; font-size: 13px; }

/* ========== 底部导航 ========== */
.tabbar {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 100;
    background: #ffcee2; display: flex;
    padding-bottom: var(--safe-bottom);
    box-shadow: 0 -1px 4px rgba(0,0,0,0.06);
}
.tabbar .tab {
    flex: 1; text-align: center; padding: 3px 0;
    font-size: 13px; color: #999;
}
.tabbar .tab.active { color: var(--primary); }
.tabbar .tab .icon { font-size: 22px; display: block; margin-bottom: 2px; }

/* ========== 轮播图 ========== */
.banner-carousel {
    position: relative; width: 100%;
    padding-top: 40%;
    overflow: hidden; background: #e8e8e8;
}
.banner-slides {
    position: absolute; top: 0; left: 0; right: 0; bottom: 0;
    display: flex; transition: transform .4s ease;
}
.banner-slide {
    flex: 0 0 100%; width: 100%; height: 100%;
    background-size: cover; background-position: center;
    background-repeat: no-repeat;
}
.banner-dots {
    position: absolute; bottom: 10px; left: 0; right: 0;
    display: flex; justify-content: center; gap: 6px; z-index: 5;
}
.banner-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: rgba(255,255,255,0.5); cursor: pointer;
    transition: all .2s;
}
.banner-dot.active { background: #fff; width: 20px; border-radius: 4px; }

/* ========== 导航栏 ========== */
.nav-grid {
    display: grid; grid-template-columns: repeat(6, 1fr);
    gap: 4px; padding: 8px 8px 4px; background: #111;
}
.nav-grid-item {
    display: flex; flex-direction: column; align-items: center;
    gap: 4px; cursor: pointer; padding: 4px 2px;
    min-width: 0;
}
.nav-grid-item .nav-icon {
    width: 56px; height: 56px; border-radius: 8px;
    background: #222; display: flex; align-items: center;
    justify-content: center; overflow: hidden;
}
.nav-grid-item .nav-icon img {
    width: 100%; height: 100%; object-fit: cover; border-radius: 8px;
}
.nav-grid-item .nav-text {
    font-size: 13px; color: #ccc; text-align: center;
    max-width: 100%; overflow: hidden; text-overflow: ellipsis;
    white-space: nowrap;
}

/* ========== 分类标签 ========== */
.category-tabs {
    display: flex; gap: 10px; padding: 12px 16px;
    overflow-x: auto; white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.category-tabs::-webkit-scrollbar { display: none; }
.category-tab {
    flex-shrink: 0; padding: 6px 16px; border-radius: 20px;
    font-size: 14px; background: #fff; color: #666;
    transition: all .2s;
}
.category-tab.active { background: var(--primary); color: #fff; }

/* ========== 视频卡片列表 ========== */
.video-grid {
    display: grid; grid-template-columns: repeat(2, 1fr);
    gap: 12px; padding: 0 16px 20px;
}
.video-card {
    background: var(--card-bg); border-radius: var(--radius);
    overflow: hidden; box-shadow: var(--shadow);
    transition: transform .2s;
}
.video-card:active { transform: scale(0.97); }
.video-card.first { grid-column: 1 / -1; }
.video-card.first .cover-wrap { padding-top: 50%; }
.video-card .cover-wrap {
    position: relative; width: 100%; padding-top: 90.25%; /* 16:9 */
    background: #e8e8e8; overflow: hidden;
}
.video-card .cover-wrap img {
    position: absolute; top: 0; left: 0;
    width: 100%; height: 100%; object-fit: cover;
}
.video-card .cover-wrap .play-icon {
    position: absolute; top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 36px; height: 36px; border-radius: 50%;
    background: rgba(0,0,0,0.55); display: flex;
    align-items: center; justify-content: center;
}
.video-card .cover-wrap .play-icon::after {
    content: ''; display: block;
    border: 8px solid transparent;
    border-left: 14px solid #fff;
    margin-left: 3px;
}
.video-card .cover-wrap .name-tag {
    position: absolute; top: 6px; left: 6px; z-index: 5;
    background: rgba(0,0,0,0.55); color: #fff;
    font-size: 12px; padding: 4px 10px; border-radius: 4px;
}
.video-card .cover-wrap .duration {
    position: absolute; bottom: 6px; right: 6px;
    background: rgba(0,0,0,0.6); color: #fff;
    font-size: 11px; padding: 1px 6px; border-radius: 4px;
}
/* 正在播放徽章 */
.playing-badge {
    position: absolute; top: 8px; right: 8px; z-index: 5;
    background: rgba(0,0,0,0.65); color: #4caf50;
    font-size: 11px; padding: 3px 10px 3px 6px;
    border-radius: 12px; display: flex; align-items: center; gap: 4px;
}
.playing-badge .dot {
    width: 6px; height: 6px; background: #4caf50;
    border-radius: 50%; animation: dot-pulse 1.5s infinite;
}
@keyframes dot-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }
.video-card .info { padding: 8px 10px; }
.video-card .info .title { font-size: 14px; font-weight: 500; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.video-card .info .meta { font-size: 11px; color: var(--text-secondary); margin-top: 4px; display: flex; justify-content: space-between; }

/* ========== 空状态 ========== */
.empty-state {
    text-align: center; padding: 60px 20px; color: #999;
}
.empty-state .icon { font-size: 48px; margin-bottom: 12px; }
.empty-state .text { font-size: 14px; }

/* ========== 视频播放页 ========== */
.player-page { padding: 0; }
.player-container {
    position: relative; width: 100%; background: #000;
}
.player-container video {
    width: 100%; display: block;
    -webkit-user-select: none; user-select: none;
    pointer-events: auto;
}
/* 全面隐藏移动端原生播放器控件 */
.player-container video::-webkit-media-controls { display: none !important; }
.player-container video::-webkit-media-controls-enclosure { display: none !important; }
.player-container video::--webkit-media-controls-play-button { display: none !important; }
.player-info { padding: 16px; }
.player-info .title { font-size: 17px; font-weight: 600; margin-bottom: 8px; }
.player-info .meta { font-size: 13px; color: #999; }

/* ========== 会员弹窗 ========== */
.modal-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5); z-index: 200;
    display: flex; align-items: center; justify-content: center;
    animation: fadeIn .2s;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal-box {
    background: #fff; border-radius: 16px; width: 85%;
    max-width: 340px; padding: 28px 24px 24px; text-align: center;
    animation: slideUp .3s;
}
@keyframes slideUp { from { transform: translateY(30px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.modal-box .icon-lock { font-size: 48px; margin-bottom: 12px; }
.modal-box h3 { font-size: 18px; margin-bottom: 8px; }
.modal-box p { font-size: 14px; color: #666; margin-bottom: 20px; line-height: 1.6; }
.modal-box .btn-primary {
    display: block; width: 100%; padding: 12px;
    background: var(--primary); color: #fff;
    border-radius: 24px; font-size: 16px; font-weight: 500;
    margin-bottom: 10px;
}
.modal-box .btn-close {
    background: none; color: #999; font-size: 14px;
}

/* ========== 支付页 ========== */
.pay-page { padding: 16px; }
.pay-card {
    background: #fff; border-radius: var(--radius);
    padding: 24px 20px; box-shadow: var(--shadow);
}
.pay-card .price { text-align: center; margin-bottom: 20px; }
.pay-card .price .amount { font-size: 40px; font-weight: 700; color: var(--primary); }
.pay-card .price .amount small { font-size: 18px; }
.pay-card .price .desc { font-size: 13px; color: #999; margin-top: 4px; }
.pay-card .qrcode-section { text-align: center; margin-bottom: 16px; }
.pay-card .qrcode-section .label { font-size: 14px; color: #666; margin-bottom: 12px; }
.pay-card .qrcode-section img { width: 180px; margin: 0 auto; border-radius: 8px; border: 1px solid #eee; }
.pay-card .upload-section { margin-top: 16px; }
.pay-card .upload-section .label { font-size: 14px; color: #666; margin-bottom: 8px; }
.pay-card .upload-box {
    border: 2px dashed #ddd; border-radius: 10px;
    padding: 24px; text-align: center; color: #999;
    cursor: pointer; transition: border-color .2s;
}
.pay-card .upload-box:hover, .pay-card .upload-box.has-file { border-color: var(--primary); }
.pay-card .upload-box input[type=file] { display: none; }
.pay-card .upload-box .preview { max-width: 200px; margin-top: 10px; display: none; }
.pay-card .upload-box.has-file .preview { display: block; }
.pay-card .btn-submit { margin-top: 20px; }
.pay-card .tips {
    margin-top: 16px; padding: 12px; background: #fff7e6;
    border-radius: 8px; font-size: 12px; color: #ad6800;
    line-height: 1.6;
}

/* ========== 状态标签 ========== */
.status-badge {
    display: inline-block; padding: 3px 10px; border-radius: 12px; font-size: 12px;
}
.status-badge.pending { background: #fff7e6; color: #fa8c16; }
.status-badge.approved { background: #f6ffed; color: #52c41a; }
.status-badge.rejected { background: #fff2f0; color: #ff4d4f; }

/* ========== 我的页面 ========== */
.profile-page { padding: 20px 16px; }
.profile-card {
    background: #fff; border-radius: var(--radius);
    padding: 24px; text-align: center; box-shadow: var(--shadow);
    margin-bottom: 16px;
}
.profile-card .avatar { font-size: 48px; margin-bottom: 8px; }
.profile-card .avatar img { width: 80px; height: 80px; border-radius: 50%; object-fit: cover; display: inline-block; }
.profile-card .name { font-size: 18px; font-weight: 600; }
.profile-card .member-badge {
    display: inline-block; margin-top: 8px; padding: 4px 14px;
    border-radius: 14px; font-size: 12px;
}
.member-badge.active { background: #fff7e6; color: #fa8c16; }
.member-badge.inactive { background: #f0f0f0; color: #999; }

/* ========== 登录/注册页 ========== */
.auth-page {
    display: flex; align-items: center; justify-content: center;
    min-height: 100vh; padding: 20px;
    background: url('../img/login-bg.jpg') center/cover no-repeat fixed;
}
.auth-card {
    width: 100%; max-width: 360px; background: #fff; opacity: 0.9;
    border-radius: 16px; padding: 32px 24px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.15);
}
.auth-card h2 { text-align: center; margin-bottom: 24px; font-size: 22px; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 14px; color: #666; margin-bottom: 6px; }
.form-group input {
    width: 100%; padding: 12px; border: 1px solid #ddd;
    border-radius: 8px; font-size: 15px; transition: border-color .2s;
}
.form-group input:focus { border-color: var(--primary); }
.btn-block {
    width: 100%; padding: 13px; border-radius: 8px;
    font-size: 16px; font-weight: 500; margin-top: 8px;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-outline { background: #fff; color: var(--primary); border: 1px solid var(--primary); }
.auth-link { text-align: center; margin-top: 16px; font-size: 14px; color: #666; }
.auth-link a { color: var(--primary); }

/* ========== Toast ========== */
.toast {
    position: fixed; top: 60px; left: 50%; transform: translateX(-50%);
    background: rgba(0,0,0,0.75); color: #fff; padding: 10px 24px;
    border-radius: 20px; font-size: 14px; z-index: 999;
    animation: toastIn .3s;
}
@keyframes toastIn { from { opacity: 0; transform: translateX(-50%) translateY(-10px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }

/* ========== 加载动画 ========== */
.loading-wrap { text-align: center; padding: 30px; }
.spinner { width: 28px; height: 28px; border: 3px solid #eee; border-top-color: var(--primary); border-radius: 50%; animation: spin .6s linear infinite; margin: 0 auto; }
@keyframes spin { to { transform: rotate(360deg); } }

/* 回到顶部 */
.back-top { position: fixed; bottom: 80px; right: 16px; z-index: 50; }
.back-top a { display: flex; align-items: center; }
