/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'PingFang SC', 'Helvetica Neue', Arial, sans-serif;
}

:root {
    --primary-color: #000;
    --secondary-color: #333;
    --accent-color: #ff4d4d;
    --text-color: #333;
    --light-text: #fff;
    --border-color: #eee;
    --bg-color: #f5f5f5;
    --card-bg: #fff;
    --shadow-color: rgba(0, 0, 0, 0.1);
    --header-height: 60px;
    --footer-height: 0px;
    --animation-speed: 0.3s;
    --card-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    --card-border: 1px solid #f0f0f0;
    --section-spacing: 30px;
    --element-spacing: 15px;
    --border-radius: 12px;
    --small-radius: 8px;
}

html, body {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    color: var(--text-color);
    line-height: 1.5;
    min-height: 100vh;
    margin: 0;
    padding: 0;
    /* 移除固定高度，允许内容自然扩展 */
    height: auto;
    /* 确保在移动设备上可以正常滚动 */
    overflow-x: hidden;
    overflow-y: auto;
    /* 改进移动设备滚动体验 */
    -webkit-overflow-scrolling: touch;
}

body {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    /* 移除固定高度限制 */
    min-height: 100vh;
    height: auto;
}

/* 应用容器 */
.app-container {
    width: 100%;
    max-width: 500px;
    /* 移除固定高度，允许内容自然扩展 */
    min-height: 100vh;
    height: auto;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    background-color: transparent;
    position: relative;
    /* 移除overflow: hidden，允许内容滚动 */
    overflow: visible;
}

/* 顶部导航栏样式 - 透明设计 */
.top-navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 15px;
    background-color: transparent;
    color: white;
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 500px;
    z-index: 1000; /* 增加z-index确保在内容之上 */
    transition: background-color 0.3s ease;
    backdrop-filter: blur(0px);
    pointer-events: none; /* 使导航栏本身不阻挡点击 */
    box-sizing: border-box;
    background: none !important; /* 确保完全透明 */
}

/* 导航栏内的元素需要能够接收点击事件 */
.top-navbar * {
    pointer-events: auto;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 6px;
}

.logo {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1.5px solid rgba(255, 255, 255, 0.7);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    flex-shrink: 0;
}

.app-title {
    font-size: 13px;
    font-weight: 600;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
    color: white;
    margin: 0;
    line-height: 1;
}

.app-tagline {
    font-size: 10px;
    color: white;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
    margin-top: 0;
    display: flex;
    align-items: center;
    opacity: 0.9;
    line-height: 1;
}

.app-tagline i {
    margin-right: 3px;
    font-size: 8px;
}

.nav-links {
    display: flex;
    gap: 15px;
    align-items: center;
}

.nav-link {
    color: white;
    text-decoration: none;
    font-size: 16px;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 主内容区域 */
.main-content {
    flex: 1;
    /* 确保内容可以正常滚动 */
    overflow-y: visible;
    overflow-x: hidden;
    padding: 0;
    background-color: transparent;
    /* 确保内容可以自然扩展 */
    min-height: calc(100vh - 80px);
    height: auto;
    /* 改进移动设备滚动体验 */
    -webkit-overflow-scrolling: touch;
}

/* 动态内容容器 */
.moments-container {
    display: flex;
    flex-direction: column;
    width: 100%;
    padding: 5px 10px;
    padding-top: 0; /* 确保内容从顶部开始 */
    box-sizing: border-box;
    margin-top: 0; /* 移除负边距 */
    /* 确保内容可以正常滚动 */
    overflow: visible;
    /* 允许内容自然扩展 */
    height: auto;
    min-height: auto;
}

/* 类别标签样式 */
.category-tag {
    display: inline-block;
    padding: 6px 12px;
    background-color: #3498db;
    color: white;
    border-radius: 20px;
    font-size: 14px;
    margin: 10px;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 10;
}

/* 动态卡片样式 */
.moment-card {
    width: 100%;
    position: relative;
    margin-bottom: 15px;
    border: none;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    background-color: #fff;
    z-index: 10; /* 确保在导航栏下方 */
}

/* 媒体容器样式 */
.media-container {
    width: 100%;
    padding-bottom: 133.33%; /* 严格3:4比例 */
    position: relative;
    overflow: hidden;
}

/* 图片样式 */
.carousel-item img,
.carousel-item video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    top: 0;
    left: 0;
}

/* 标题样式 */
.moment-title {
    position: absolute;
    bottom: 20px;
    left: 20px;
    color: white;
    font-size: 20px;
    font-weight: bold;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.7);
    z-index: 2;
}

/* 水印样式 */
.watermark {
    position: absolute;
    bottom: 10px;
    right: 10px;
    display: flex;
    align-items: center;
    color: rgba(255,255,255,0.8);
    font-size: 12px;
    z-index: 2;
}

.watermark img {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    margin-right: 5px;
}

/* 加载中样式 */
.loading-moments {
    text-align: center;
    padding: 20px;
    color: #666;
}

/* 添加微信小程序提示样式 */
.weixin-tip {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.weixin-tip-content {
    background-color: #fff;
    padding: 20px;
    border-radius: 10px;
    text-align: center;
    max-width: 80%;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* 骨架屏样式 - Instagram风格 */
.skeleton-card {
    width: 100%;
    min-width: 100%;
    border-radius: 0;
    overflow: hidden;
    background-color: #fff;
    margin-bottom: 0;
    box-shadow: none;
}

.skeleton-media {
    width: 100%;
    position: relative;
    padding-top: 133.33%; /* 3:4比例 */
    background-color: #f0f0f0;
}

.skeleton-content {
    padding: 12px;
}

.skeleton-line {
    height: 12px;
    background-color: #f0f0f0;
    margin-bottom: 8px;
    border-radius: 4px;
}

.skeleton-line.medium {
    width: 70%;
}

.skeleton-line.short {
    width: 40%;
}

.skeleton-social {
    padding: 12px;
    border-top: 1px solid #f0f0f0;
}

.skeleton-actions {
    display: flex;
    gap: 15px;
}

.skeleton-action {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background-color: #f0f0f0;
}

.skeleton-animation {
    animation: pulse 1.5s infinite ease-in-out;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
}

@keyframes pulse {
    0% {
        background-position: 0% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* 媒体查询 - 桌面设备适配 */
@media screen and (min-width: 768px) {
    body {
        background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    }
    
    .app-container {
        border-radius: 0;
        box-shadow: 0 0 30px rgba(0, 0, 0, 0.1);
        margin: 0 auto;
        overflow: hidden;
    }
    
    /* 确保导航栏在大屏幕上与内容区域宽度一致 */
    .top-navbar {
        width: 100%;
        max-width: 500px;
        left: 50%;
        transform: translateX(-50%);
    }
    
    /* 添加一个背景遮罩，在桌面上看起来更好 */
    body::before {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.03);
        z-index: -1;
    }
}

/* 内容区域样式 */
.content-area {
    padding: 15px;
    position: relative;
}

/* 内容包装器样式 */
.content-wrapper {
    margin-bottom: 10px;
    position: relative;
}

/* 内容文本样式 */
.content-text {
    font-size: 14px;
    color: #333;
    line-height: 1.5;
    margin-bottom: 5px;
    word-break: break-word;
    transition: all 0.3s ease;
}

/* 折叠/展开按钮样式 */
.toggle-content-button {
    background: none;
    border: none;
    color: #3498db;
    font-size: 13px;
    padding: 0;
    margin: 0 0 8px 0;
    cursor: pointer;
    display: block;
    text-align: left;
    font-weight: 500;
}

.toggle-content-button:hover {
    color: #2980b9;
    text-decoration: underline;
}

/* 翻译按钮样式 */
.translate-button {
    background: none;
    border: none;
    color: #888;
    font-size: 12px;
    padding: 0;
    margin: 0 0 10px 0;
    cursor: pointer;
    display: flex;
    align-items: center;
}

.translate-button:hover {
    color: #555;
}

.translate-icon {
    display: inline-block;
    width: 14px;
    height: 14px;
    margin-right: 5px;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23888"><path d="M12.87 15.07l-2.54-2.51.03-.03A17.52 17.52 0 0014.07 6H17V4h-7V2H8v2H1v2h11.17C11.5 7.92 10.44 9.75 9 11.35 8.07 10.32 7.3 9.19 6.69 8h-2c.73 1.63 1.73 3.17 2.98 4.56l-5.09 5.02L4 19l5-5 3.11 3.11.76-2.04zM18.5 10h-2L12 22h2l1.12-3h4.75L21 22h2l-4.5-12zm-2.62 7l1.62-4.33L19.12 17h-3.24z"/></svg>');
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
}

.translate-loading {
    display: inline-block;
    width: 14px;
    height: 14px;
    margin-right: 5px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #888;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 时间和位置信息样式 */
.time-info {
    display: flex;
    align-items: center;
    font-size: 12px;
    color: #888;
    margin-top: 10px;
    flex-wrap: wrap;
}

.time-icon, .location-icon {
    display: inline-block;
    width: 12px;
    height: 12px;
    margin-right: 4px;
}

.time-icon {
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23888"><path d="M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8zm.5-13H11v6l5.25 3.15.75-1.23-4.5-2.67z"/></svg>');
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
}

.location-icon {
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23888"><path d="M12 2C8.13 2 5 5.13 5 9c0 5.25 7 13 7 13s7-7.75 7-13c0-3.87-3.13-7-7-7zm0 9.5c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5z"/></svg>');
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
}

.time-text {
    margin-right: 15px;
}

.location-info {
    display: flex;
    align-items: center;
}

/* 社交互动栏样式 */
.social-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    border-top: 1px solid #f0f0f0;
}

.left-buttons, .right-buttons {
    display: flex;
    gap: 15px;
}

.social-button {
    display: flex;
    align-items: center;
    background: none;
    border: none;
    color: #666;
    font-size: 12px;
    padding: 0;
    cursor: pointer;
}

.social-icon {
    width: 18px;
    height: 18px;
    margin-right: 4px;
}

.social-count {
    font-size: 12px;
}

.social-button.active {
    color: #e74c3c;
}

.social-button.active .social-icon {
    filter: invert(40%) sepia(79%) saturate(2476%) hue-rotate(330deg) brightness(95%) contrast(96%);
}

/* 轮播指示器样式 */
.carousel-indicators {
    position: absolute;
    bottom: 15px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    gap: 6px;
    z-index: 3;
}

.carousel-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: all 0.3s ease;
}

.carousel-dot.active {
    background-color: white;
    transform: scale(1.2);
}

/* 轮播计数器样式 */
.carousel-counter {
    position: absolute;
    bottom: 15px;
    right: 15px;
    background-color: rgba(0, 0, 0, 0.5);
    color: white;
    font-size: 12px;
    padding: 3px 8px;
    border-radius: 10px;
    z-index: 3;
}

/* 轮播容器样式 */
.carousel-container {
    display: flex;
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
}

.carousel-container::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
}

.carousel-item {
    flex: 0 0 100%;
    width: 100%;
    height: 100%;
    scroll-snap-align: start;
    position: relative;
}

/* 视频播放按钮样式 */
.video-play-button {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    background-color: rgba(0, 0, 0, 0.5);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2;
}

.video-play-button:before {
    content: '';
    width: 0;
    height: 0;
    border-top: 15px solid transparent;
    border-bottom: 15px solid transparent;
    border-left: 25px solid white;
    margin-left: 5px;
}

/* 分享弹窗样式 */
.share-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.share-modal.active {
    display: flex;
}

.share-container {
    background-color: white;
    border-radius: 10px;
    padding: 20px;
    width: 80%;
    max-width: 350px;
    position: relative;
}

.share-title {
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 15px;
    text-align: center;
}

.share-close {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 24px;
    color: #999;
    cursor: pointer;
}

.share-qrcode {
    width: 200px;
    height: 200px;
    margin: 0 auto 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #f9f9f9;
}

.share-url-container {
    display: flex;
    margin-top: 15px;
}

.share-url {
    flex: 1;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px 0 0 4px;
    font-size: 14px;
}

.copy-btn {
    background-color: #3498db;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 0 4px 4px 0;
    cursor: pointer;
}

.copy-btn:hover {
    background-color: #2980b9;
}

/* 灯箱样式 */
.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    touch-action: none; /* 防止触摸事件冲突 */
}

.lightbox.active {
    display: flex;
}

.lightbox-content {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.lightbox-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    transition: transform 0.3s ease;
    transform-origin: center;
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    background-color: rgba(0, 0, 0, 0.5);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    z-index: 10001;
}

.lightbox-close:before,
.lightbox-close:after {
    content: '';
    position: absolute;
    width: 20px;
    height: 2px;
    background-color: white;
}

.lightbox-close:before {
    transform: rotate(45deg);
}

.lightbox-close:after {
    transform: rotate(-45deg);
}

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    background-color: rgba(0, 0, 0, 0.5);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    z-index: 10001;
}

.lightbox-prev {
    left: 20px;
}

.lightbox-next {
    right: 20px;
}

.lightbox-prev:before,
.lightbox-next:before {
    content: '';
    width: 0;
    height: 0;
    border-top: 10px solid transparent;
    border-bottom: 10px solid transparent;
}

.lightbox-prev:before {
    border-right: 15px solid white;
    margin-right: 5px;
}

.lightbox-next:before {
    border-left: 15px solid white;
    margin-left: 5px;
}

.lightbox-counter {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.5);
    color: white;
    padding: 5px 10px;
    border-radius: 15px;
    font-size: 14px;
    z-index: 10001;
}

/* 确保导航栏始终完全透明 */
.top-navbar.scrolled {
    background-color: transparent !important;
    backdrop-filter: blur(0px);
}

/* 导航栏背景 - 用于桌面版 */
.navbar-bg {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background-color: transparent;
    z-index: 999;
    transition: background-color 0.3s ease, backdrop-filter 0.3s ease;
    pointer-events: none;
}

.navbar-bg.scrolled {
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
}

/* 移动设备滚动优化 */
@media (max-width: 768px) {
    /* 确保在移动设备上可以正常滚动 */
    html, body {
        overflow-x: hidden;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        /* 防止iOS橡皮筋效果影响滚动 */
        overscroll-behavior: none;
        -webkit-overscroll-behavior: none;
    }
    
    /* 主内容区域移动设备优化 */
    .main-content {
        
        min-height: calc(100vh - 70px);
        /* 确保滚动正常工作 */
        overflow-y: visible;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
    }
    
    /* 动态容器移动设备优化 */
    .moments-container {
        padding: 3px 8px;
        /* 确保内容可以正常滚动 */
        overflow: visible;
        height: auto;
        min-height: auto;
    }
    
    /* 动态卡片移动设备优化 */
    .moment-card {
        margin-bottom: 12px;
        /* 确保卡片不会阻止滚动 */
        position: relative;
        z-index: 1;
    }
    
    /* 媒体容器移动设备优化 */
    .media-container {
        /* 调整移动设备上的比例 */
        padding-bottom: 120%; /* 稍微减少高度 */
    }
    
    /* 顶部导航栏移动设备优化 */
    .top-navbar {
        padding: 4px 12px;
        /* 确保导航栏不会阻止触摸事件 */
        pointer-events: none;
    }
    
    .top-navbar * {
        pointer-events: auto;
    }
}

/* 触摸设备滚动优化 */
@media (hover: none) and (pointer: coarse) {
    /* 触摸设备上的滚动优化 */
    .main-content {
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
        -webkit-overscroll-behavior: contain;
    }
    
    .moments-container {
        -webkit-overflow-scrolling: touch;
    }
    
    /* 确保触摸事件正常工作 */
    .moment-card {
        touch-action: pan-y;
    }
    
    .media-container {
        touch-action: pan-y;
    }
}

/* 防止iOS Safari的橡皮筋效果 */
@supports (-webkit-touch-callout: none) {
    html, body {
        /* iOS Safari特定优化 */
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: none;
        -webkit-overscroll-behavior: none;
    }
    
    .main-content {
        -webkit-overflow-scrolling: touch;
    }
}