/**
 * 悦己知识付费系统 - 移动端公共样式
 * 基准 375px 移动端尺寸，rem 自适应布局
 */

/* CSS Reset & 基础设置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px; /* 基准字体大小 */
}

@media (max-width: 375px) {
    html {
        font-size: 14.67px;
    }
}

@media (min-width: 414px) {
    html {
        font-size: 17.78px;
    }
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.5;
    padding-bottom: constant(safe-area-inset-bottom);
    padding-bottom: env(safe-area-inset-bottom);
}

a {
    text-decoration: none;
    color: inherit;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

button, input, textarea, select {
    font-family: inherit;
    font-size: inherit;
    border: none;
    outline: none;
}

/* 通用容器 */
.container {
    padding: 0.75rem;
}

.page-container {
    min-height: 100vh;
    padding-bottom: 3.5rem; /* 底部导航栏高度 */
}

/* 顶部导航栏 */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 2.75rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.125rem;
    font-weight: 600;
    z-index: 1000;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.navbar .back-btn {
    position: absolute;
    left: 0.75rem;
    font-size: 1.25rem;
    cursor: pointer;
}

.navbar .right-btn {
    position: absolute;
    right: 0.75rem;
    font-size: 0.875rem;
    cursor: pointer;
}

/* 底部导航栏 */
.tabbar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3.5rem;
    background: #fff;
    display: flex;
    justify-content: space-around;
    align-items: center;
    border-top: 1px solid #eee;
    z-index: 1000;
    padding-bottom: constant(safe-area-inset-bottom);
    padding-bottom: env(safe-area-inset-bottom);
}

.tabbar-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #999;
    font-size: 0.625rem;
    cursor: pointer;
    transition: all 0.3s;
}

.tabbar-item.active {
    color: #667eea;
}

.tabbar-item .icon {
    font-size: 1.25rem;
    margin-bottom: 0.25rem;
}

/* 卡片样式 */
.card {
    background: #fff;
    border-radius: 0.75rem;
    padding: 1rem;
    margin-bottom: 0.75rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.card-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #333;
}

/* 按钮样式 */
.btn {
    display: inline-block;
    padding: 0.625rem 1.5rem;
    border-radius: 1.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
}

.btn-primary:active {
    opacity: 0.8;
    transform: scale(0.98);
}

.btn-outline {
    background: transparent;
    border: 1px solid #667eea;
    color: #667eea;
}

.btn-block {
    display: block;
    width: 100%;
}

.btn-sm {
    padding: 0.375rem 1rem;
    font-size: 0.75rem;
}

/* Tab 切换 */
.tab-switch {
    display: flex;
    background: #fff;
    border-radius: 0.5rem;
    padding: 0.25rem;
    margin-bottom: 0.75rem;
}

.tab-item {
    flex: 1;
    text-align: center;
    padding: 0.5rem;
    font-size: 0.875rem;
    color: #666;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: all 0.3s;
}

.tab-item.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    font-weight: 500;
}

/* 内容列表 */
.content-list {
    background: #fff;
    border-radius: 0.75rem;
    overflow: hidden;
}

.content-item {
    display: flex;
    padding: 0.75rem;
    border-bottom: 1px solid #f5f5f5;
}

.content-item:last-child {
    border-bottom: none;
}

.content-cover {
    width: 5rem;
    height: 5rem;
    border-radius: 0.5rem;
    object-fit: cover;
    margin-right: 0.75rem;
    flex-shrink: 0;
}

.content-info {
    flex: 1;
    overflow: hidden;
}

.content-title {
    font-size: 0.9375rem;
    font-weight: 500;
    margin-bottom: 0.375rem;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.content-meta {
    font-size: 0.75rem;
    color: #999;
}

.vip-tag {
    display: inline-block;
    padding: 0.125rem 0.375rem;
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    color: #fff;
    font-size: 0.625rem;
    border-radius: 0.25rem;
    margin-left: 0.375rem;
}

/* 达人卡片 */
.daren-card {
    display: flex;
    align-items: center;
    padding: 1rem;
    background: #fff;
    border-radius: 0.75rem;
    margin-bottom: 0.75rem;
}

.daren-avatar {
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    object-fit: cover;
    margin-right: 0.75rem;
}

.daren-info {
    flex: 1;
}

.daren-name {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.daren-desc {
    font-size: 0.75rem;
    color: #999;
}

.online-status {
    display: inline-block;
    width: 0.5rem;
    height: 0.5rem;
    background: #10b981;
    border-radius: 50%;
    margin-right: 0.25rem;
}

/* 表单样式 */
.form-group {
    margin-bottom: 1rem;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.375rem;
    color: #333;
}

.form-input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 0.5rem;
    font-size: 0.9375rem;
    background: #fff;
}

.form-input:focus {
    border-color: #667eea;
}

/* 弹窗样式 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: #fff;
    border-radius: 1rem;
    padding: 1.5rem;
    width: 85%;
    max-width: 20rem;
    transform: scale(0.9);
    transition: all 0.3s;
}

.modal-overlay.show .modal-content {
    transform: scale(1);
}

.modal-title {
    font-size: 1.125rem;
    font-weight: 600;
    text-align: center;
    margin-bottom: 1rem;
}

.modal-body {
    font-size: 0.9375rem;
    color: #666;
    margin-bottom: 1.5rem;
}

.modal-actions {
    display: flex;
    gap: 0.75rem;
}

.modal-actions .btn {
    flex: 1;
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: #999;
}

.empty-state .icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.empty-state .text {
    font-size: 0.9375rem;
}

/* 加载动画 */
.loading {
    text-align: center;
    padding: 2rem;
    color: #999;
}

.loading-spinner {
    display: inline-block;
    width: 1.5rem;
    height: 1.5rem;
    border: 2px solid #eee;
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 悬浮按钮 */
.float-btn {
    position: fixed;
    right: 1rem;
    bottom: 4.5rem;
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
    z-index: 999;
    cursor: pointer;
}

/* 黑卡标识 */
.black-card-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    background: linear-gradient(135deg, #1f2937 0%, #000 100%);
    color: #fbbf24;
    font-size: 0.625rem;
    font-weight: 600;
    border-radius: 0.25rem;
    margin-left: 0.375rem;
}

/* 直播标签 */
.live-tag {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.5rem;
    background: #ef4444;
    color: #fff;
    font-size: 0.625rem;
    font-weight: 600;
    border-radius: 0.25rem;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* ==================== 直播模块样式 ==================== */

/* 直播列表页面 */
.live-header {
    padding: 1rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    text-align: center;
}

.live-header h1 {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
}

.live-list {
    padding: 1rem;
}

/* 直播卡片 */
.live-card {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 1rem;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
    cursor: pointer;
    transition: transform 0.2s;
}

.live-card:active {
    transform: scale(0.98);
}

.live-cover {
    width: 100%;
    aspect-ratio: 16/9;
    object-fit: cover;
    background: #f5f5f5;
    position: relative;
}

/* 直播状态标识 - 红点闪烁效果 */
.live-status {
    position: absolute;
    top: 0.5rem;
    left: 0.5rem;
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: #fff;
    padding: 0.25rem 0.6rem;
    border-radius: 1rem;
    font-size: 0.75rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    animation: pulse-red 2s infinite;
}

@keyframes pulse-red {
    0%, 100% { 
        opacity: 1;
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
    }
    50% { 
        opacity: 0.8;
        box-shadow: 0 0 0 6px rgba(239, 68, 68, 0);
    }
}

.live-status i {
    font-size: 0.6rem;
}

/* 在线人数显示样式 */
.viewer-count {
    position: absolute;
    bottom: 0.5rem;
    right: 0.5rem;
    background: rgba(0,0,0,0.6);
    color: #fff;
    padding: 0.25rem 0.5rem;
    border-radius: 1rem;
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    backdrop-filter: blur(10px);
}

.live-info {
    padding: 0.75rem;
}

.daren-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.daren-avatar {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    object-fit: cover;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1rem;
    font-weight: 600;
}

.daren-name {
    font-size: 1rem;
    font-weight: 600;
    color: #333;
}

.live-title {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 0.5rem;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.live-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
    color: #999;
}

/* 直播间观看页面 */
.live-container {
    position: relative;
    width: 100%;
    height: 100vh;
    overflow: hidden;
    background: #000;
}

/* 视频播放区域样式 */
.video-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
}

#liveVideo {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* 顶部信息栏 */
.top-bar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    padding: 1rem;
    background: linear-gradient(to bottom, rgba(0,0,0,0.7), transparent);
    z-index: 100;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.back-btn {
    width: 2.5rem;
    height: 2.5rem;
    background: rgba(0,0,0,0.5);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    backdrop-filter: blur(10px);
}

.back-btn i {
    color: #fff;
    font-size: 1.25rem;
}

.live-info-overlay {
    position: absolute;
    top: 3.5rem;
    left: 1rem;
    z-index: 100;
}

.daren-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.daren-avatar-lg {
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    object-fit: cover;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.25rem;
    font-weight: 600;
    border: 2px solid rgba(255,255,255,0.3);
}

.daren-name-lg {
    font-size: 1.1rem;
    font-weight: 600;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

/* 关注按钮样式 */
.follow-btn {
    padding: 0.4rem 1rem;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff;
    border: none;
    border-radius: 1.5rem;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.follow-btn.followed {
    background: rgba(255,255,255,0.3);
}

.follow-btn:active {
    transform: scale(0.95);
}

/* 在线人数徽章 */
.viewer-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    background: rgba(0,0,0,0.5);
    padding: 0.25rem 0.6rem;
    border-radius: 1rem;
    font-size: 0.8rem;
    backdrop-filter: blur(10px);
    color: #fff;
}

/* 右侧互动按钮样式 */
.side-actions {
    position: absolute;
    right: 1rem;
    bottom: 8rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    z-index: 100;
}

.action-btn-lg {
    width: 3rem;
    height: 3rem;
    background: rgba(0,0,0,0.5);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    backdrop-filter: blur(10px);
    transition: transform 0.2s;
}

.action-btn-lg:active {
    transform: scale(0.9);
}

.action-btn-lg i {
    color: #fff;
    font-size: 1.25rem;
}

/* 点赞按钮激活动画 */
.action-btn-lg.like-active {
    animation: likeAnimation 0.5s ease;
}

@keyframes likeAnimation {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

/* 底部评论区域 */
.bottom-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 1rem;
    background: linear-gradient(to top, rgba(0,0,0,0.8), transparent);
    z-index: 100;
}

.comment-list {
    max-height: 150px;
    overflow-y: auto;
    margin-bottom: 0.75rem;
    -webkit-overflow-scrolling: touch;
}

.comment-item {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

.comment-avatar {
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 50%;
    background: rgba(255,255,255,0.3);
    flex-shrink: 0;
}

.comment-content {
    flex: 1;
}

.comment-user {
    font-weight: 600;
    margin-bottom: 0.1rem;
    color: rgba(255,255,255,0.9);
}

.comment-text {
    color: rgba(255,255,255,0.9);
}

/* 评论输入框样式 */
.comment-input-box {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.comment-input {
    flex: 1;
    background: rgba(255,255,255,0.2);
    border: none;
    border-radius: 1.5rem;
    padding: 0.6rem 1rem;
    color: #fff;
    font-size: 0.9rem;
    outline: none;
    backdrop-filter: blur(10px);
}

.comment-input::placeholder {
    color: rgba(255,255,255,0.6);
}

.send-btn {
    width: 2.5rem;
    height: 2.5rem;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s;
}

.send-btn:active {
    transform: scale(0.9);
}

.send-btn i {
    color: #fff;
    font-size: 1rem;
}

/* 直播结束遮罩 */
.ended-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.8);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 200;
}

.ended-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.8;
}

.ended-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #fff;
}

.ended-desc {
    font-size: 1rem;
    color: rgba(255,255,255,0.7);
    margin-bottom: 1.5rem;
}

.back-live-list-btn {
    padding: 0.75rem 2rem;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff;
    border: none;
    border-radius: 2rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s;
}

.back-live-list-btn:active {
    transform: scale(0.95);
}

/* 点赞飘心动画 */
.like-animation {
    position: absolute;
    right: 4rem;
    bottom: 8rem;
    z-index: 99;
    pointer-events: none;
}

.like-heart {
    position: absolute;
    font-size: 1.5rem;
    color: #ff4757;
    animation: floatUp 1s ease-out forwards;
    opacity: 0;
}

@keyframes floatUp {
    0% {
        transform: translateY(0) scale(0.5);
        opacity: 1;
    }
    100% {
        transform: translateY(-100px) scale(1.5);
        opacity: 0;
    }
}

/* 响应式调整 */
@media (min-width: 768px) {
    .page-container {
        max-width: 414px;
        margin: 0 auto;
    }
    
    .tabbar {
        max-width: 414px;
        left: 50%;
        transform: translateX(-50%);
    }
    
    .navbar {
        max-width: 414px;
        left: 50%;
        transform: translateX(-50%);
    }
}

/* 安全区域适配 */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .tabbar {
        padding-bottom: env(safe-area-inset-bottom);
    }
}