/* 详情页面特定样式 */
.detail-content {
    background-color: var(--background-color);
    min-height: calc(100vh - 44px);
    padding-bottom: 60px;
}

.detail-post {
    background-color: var(--card-color);
    margin-bottom: 8px;
}

.detail-header {
    padding: 16px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
}

.detail-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    margin-right: 12px;
    object-fit: cover;
    background-color: var(--primary-color);
}

.detail-user-info {
    flex: 1;
}

.detail-username {
    font-weight: 600;
    font-size: 16px;
    color: var(--text-color);
    margin-bottom: 4px;
}

.detail-time {
    font-size: 13px;
    color: var(--text-secondary-color);
}

.detail-content-text {
    padding: 16px;
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-color);
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* 表情图片大小限制 */
.detail-content-text img.emoji,
.detail-content-text img[src*="emoji"] {
    width: 20px;
    height: 20px;
    vertical-align: middle;
    margin: -2px 2px;
}

.detail-content-text img {
    max-width: 100%;
    height: auto;
}

/* 图片展示 */
.detail-images {
    padding: 0 16px 16px;
}

.detail-image-grid {
    display: grid;
    gap: 4px;
}

.detail-image-grid.single {
    grid-template-columns: 1fr;
}

.detail-image-grid.double {
    grid-template-columns: 1fr 1fr;
}

.detail-image-grid.triple {
    grid-template-columns: 1fr 1fr 1fr;
}

.detail-image {
    width: 100%;
    height: auto;
    border-radius: 8px;
    object-fit: cover;
    cursor: pointer;
    background-color: var(--background-color);
    /* 懒加载占位效果 */
    min-height: 120px;
    transition: opacity 0.3s ease;
}

.detail-image[src] {
    opacity: 1;
}

/* 单张图片：完整显示，限制最大高度 */
.detail-image-grid.single .detail-image {
    aspect-ratio: auto;
    max-height: 320px;
    object-fit: contain;
}

/* 多张图片：保持正方形但可点击查看完整 */
.detail-image-grid:not(.single) .detail-image {
    aspect-ratio: 1;
    object-fit: cover;
}

/* 图片点击波纹效果 */
.detail-image:active {
    opacity: 0.8;
}

/* 视频展示 */
.detail-videos {
    padding: 0 16px 16px;
    display: flex;
    justify-content: center;
}

/* 转发预览 */
.detail-repost {
    margin: 0 16px 16px;
    padding: 16px;
    background-color: var(--background-color);
    border-radius: 8px;
    font-size: 15px;
}

.detail-repost-link {
    text-decoration: none;
    color: var(--text-secondary-color);
}

/* 帖子操作 */
.detail-actions {
    padding: 12px 16px;
    display: flex;
    justify-content: space-around;
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    margin: 0 16px;
}

.detail-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    background: none;
    border: none;
    padding: 8px 0;
    color: var(--text-secondary-color);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.detail-action-btn:hover,
.detail-action-btn:active {
    color: var(--primary-color);
}

.detail-action-btn.liked {
    color: var(--danger-color);
}

.detail-action-btn.favorited {
    color: var(--accent-color);
}

.detail-action-icon {
    font-size: 18px;
    margin-right: 6px;
}

.detail-action-count {
    font-size: 13px;
}

/* 评论区 */
.comments-section {
    background-color: var(--card-color);
    margin-bottom: 8px;
}

.comments-header {
    padding: 16px;
    font-weight: 600;
    font-size: 16px;
    color: var(--text-color);
    border-bottom: 1px solid var(--border-color);
}

.comment-item {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
}

.comment-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    margin-right: 12px;
    object-fit: cover;
    background-color: var(--primary-color);
    flex-shrink: 0;
}

.comment-content {
    flex: 1;
}

.comment-user {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-color);
    margin-bottom: 4px;
}

.comment-text {
    font-size: 14px;
    line-height: 1.4;
    color: var(--text-color);
    margin-bottom: 8px;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.comment-text img.emoji {
    width: 20px;
    height: 20px;
    vertical-align: middle;
    margin: -2px 2px;
}

.comment-time {
    font-size: 12px;
    color: var(--text-secondary-color);
    margin-bottom: 8px;
}

.comment-actions {
    display: flex;
    gap: 16px;
}

.comment-action {
    font-size: 12px;
    color: var(--text-secondary-color);
    text-decoration: none;
    cursor: pointer;
    transition: color 0.3s ease;
}

.comment-action:hover {
    color: var(--primary-color);
}

/* 评论输入 */
.comment-input-section {
    position: fixed;
    bottom: 50px;
    left: 0;
    right: 0;
    background-color: var(--card-color);
    border-top: 1px solid var(--border-color);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 90;
}

.comment-input {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    font-size: 14px;
    color: var(--text-color);
    background-color: var(--background-color);
    outline: none;
}

.comment-input::placeholder {
    color: var(--text-secondary-color);
}

.comment-submit {
    padding: 8px 16px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.comment-submit:hover {
    background-color: #0066CC;
}

.comment-submit:disabled {
    background-color: var(--border-color);
    cursor: not-allowed;
}

/* 空评论状态 */
.empty-comments {
    padding: 40px 20px;
    text-align: center;
    color: var(--text-secondary-color);
    font-size: 14px;
}

/* 空状态 */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
}

.empty-icon {
    font-size: 48px;
    opacity: 0.6;
    margin-bottom: 16px;
}

.empty-text {
    font-size: 16px;
    color: var(--text-color);
    margin-bottom: 8px;
}

.empty-subtext {
    font-size: 14px;
    color: var(--text-secondary-color);
}

/* 匿名发布样式 */
.anonymous-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
    flex-shrink: 0;
}

.anonymous-avatar svg {
    width: 24px;
    height: 24px;
    fill: white;
}

/* 图片查看器样式 */
.image-viewer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.95);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

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

.image-viewer-container {
    position: relative;
    width: 100%;
    height: 100%;
}

.image-viewer-close {
    position: absolute;
    top: max(env(safe-area-inset-top), 20px);
    right: 20px;
    width: 44px;
    height: 44px;
    background: #e53935;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    border: none;
    box-shadow: 0 2px 8px rgba(229, 57, 53, 0.4);
}

.image-viewer-close svg {
    width: 24px;
    height: 24px;
    fill: #fff;
}

.image-viewer-swiper {
    width: 100%;
    height: 100%;
    display: flex;
    transition: transform 0.3s ease;
}

.image-viewer-slide {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 100%;
}

.image-viewer-image {
    max-width: 100%;
    max-height: 100vh;
    object-fit: contain;
    cursor: pointer;
}

.image-viewer-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    background: rgba(255,255,255,0.1);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 16px;
    cursor: pointer;
    z-index: 10;
}

.image-viewer-prev {
    left: 20px;
}

.image-viewer-next {
    right: 20px;
}

.image-viewer-indicator {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.5);
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
}

.image-viewer-zoom-controls {
    position: absolute;
    bottom: 20px;
    right: 20px;
    display: flex;
    gap: 8px;
}

.zoom-btn {
    width: 36px;
    height: 36px;
    background: rgba(255,255,255,0.1);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 14px;
    cursor: pointer;
}

/* 适配暗黑模式 */
@media (prefers-color-scheme: dark) {
    .detail-post,
    .comments-section {
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    }
}

/* 响应式调整 */
@media (max-width: 320px) {
    .detail-header {
        padding: 12px;
    }

    .detail-avatar {
        width: 40px;
        height: 40px;
    }

    .anonymous-avatar {
        width: 40px;
        height: 40px;
    }

    .anonymous-avatar svg {
        width: 20px;
        height: 20px;
    }

    .detail-content-text {
        padding: 12px;
        font-size: 15px;
    }

    .detail-images {
        padding: 0 12px 12px;
    }

    .detail-repost {
        margin: 0 12px 12px;
        padding: 12px;
        font-size: 14px;
    }

    .detail-actions {
        padding: 10px 12px;
        margin: 0 12px;
    }

    .comments-header {
        padding: 12px;
        font-size: 15px;
    }

    .comment-item {
        padding: 12px;
    }

    .comment-avatar {
        width: 32px;
        height: 32px;
    }

    .comment-input-section {
        padding: 10px 12px;
    }

    .comment-input {
        padding: 8px 10px;
        font-size: 13px;
    }

    .comment-submit {
        padding: 6px 12px;
        font-size: 13px;
    }
}