/* TikTok风格评论样式 - 嵌入在详情模态框内 */

/* 详情页评论区容器 */
.detail-comments-section {
    border-top: 1px solid #f0f0f0;
    background: #fff;
    display: flex;
    flex-direction: column;
    max-height: 50vh;
    transition: all 0.3s ease;
}

/* 评论头部 - 始终可见 */
.dcs-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid #f0f0f0;
    background: #fafafa;
    flex-shrink: 0;
    transition: border-bottom-color 0.3s ease;
}

.dcs-header.no-content {
    border-bottom-color: transparent;
}

/* 评论内容区域 - 可折叠 */
.dcs-content {
    display: flex;
    flex-direction: column;
    max-height: 45vh;
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.3s ease;
}

.dcs-content.collapsed {
    max-height: 0;
    opacity: 0;
    pointer-events: none;
}

.dcs-title {
    font-size: 16px;
    font-weight: 700;
    color: #000;
    display: flex;
    align-items: center;
    gap: 8px;
}

.dcs-count {
    color: #666;
    font-size: 14px;
    font-weight: 400;
}

.dcs-toggle {
    background: none;
    border: 0;
    cursor: pointer;
    padding: 8px;
    color: #666;
    font-size: 18px;
    line-height: 1;
    transition: all 0.2s;
}

.dcs-toggle:hover {
    color: #000;
}

.dcs-toggle.collapsed i {
    transform: rotate(180deg);
}

/* 评论列表容器 */
.dcs-list {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0 16px 16px;
    min-height: 200px;
    max-height: 35vh;
    -webkit-overflow-scrolling: touch;
}

/* 评论项 */
.tcs-item {
    display: flex;
    padding: 16px 0;
    border-bottom: 1px solid #f5f5f5;
    position: relative;
}

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

/* 评论高亮效果 */
.tcs-item.highlighted {
    background: linear-gradient(135deg, rgba(102, 187, 106, 0.15) 0%, rgba(102, 187, 106, 0.05) 100%);
    border-radius: 12px;
    padding: 16px 12px;
    margin: 0 -12px;
    animation: commentHighlight 3s ease-out;
    border: none;
    box-shadow: none;
    outline: none;
}

@keyframes commentHighlight {
    0% {
        background: rgba(102, 187, 106, 0.3);
        transform: scale(1.01);
    }
    30% {
        background: rgba(102, 187, 106, 0.2);
        transform: scale(1.005);
    }
    100% {
        background: linear-gradient(135deg, rgba(102, 187, 106, 0.15) 0%, rgba(102, 187, 106, 0.05) 100%);
        transform: scale(1);
    }
}

/* 评论头像 */
.tcs-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    margin-right: 12px;
    flex-shrink: 0;
    background: #fafafa;
    transition: transform 0.2s;
}

.tcs-avatar:hover {
    transform: scale(1.1);
}

/* 评论主体 */
.tcs-body {
    flex: 1;
    min-width: 0;
    cursor: pointer;
    transition: background-color 0.2s;
    border-radius: 8px;
    padding: 4px 8px;
    margin: -4px -8px;
}

.tcs-body:hover {
    background-color: rgba(0, 0, 0, 0.02);
}

.tcs-body:active {
    background-color: rgba(0, 0, 0, 0.05);
}

/* 评论第一行：用户名 + 时间 + 点赞 */
.tcs-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.tcs-name {
    font-size: 15px;
    font-weight: 700;
    color: #000;
    flex-shrink: 0;
    transition: color 0.2s;
}

.tcs-name:hover {
    color: #ff2d55;
}

.tcs-time {
    font-size: 13px;
    color: #999;
    margin-left: auto;
    flex-shrink: 0;
}

/* 点赞按钮 */
.tcs-like-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px 8px;
    margin-left: 12px;
    flex-shrink: 0;
}

.tcs-like-btn i {
    font-size: 20px;
    color: #999;
    transition: all 0.2s;
}

.tcs-like-btn.liked i {
    color: #ff2d55;
}

.tcs-like-btn span {
    font-size: 12px;
    color: #999;
}

.tcs-like-btn.liked span {
    color: #ff2d55;
}

/* 评论内容 */
.tcs-text {
    font-size: 15px;
    color: #000;
    line-height: 1.5;
    word-break: break-word;
    margin-top: 4px;
}

/* 长文本折叠 */
.tcs-text.collapsed {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.tcs-expand-btn {
    background: none;
    border: none;
    color: #666;
    font-size: 14px;
    cursor: pointer;
    padding: 4px 0;
    margin-top: 4px;
}

.tcs-expand-btn:hover {
    color: #000;
}

/* 评论媒体网格 */
.tcs-media-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: 10px;
    max-width: 300px;
}

.tcs-media-item {
    position: relative;
    width: 100%;
    padding-bottom: 100%;
    border-radius: 8px;
    overflow: hidden;
    background: #f5f5f5;
    cursor: pointer;
}

.tcs-media-item img,
.tcs-media-item video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.tcs-media-play {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 36px;
    height: 36px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 18px;
}

/* 评论操作按钮 */
.tcs-actions {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 8px;
}

.tcs-action-btn {
    background: none;
    border: none;
    color: #666;
    font-size: 14px;
    cursor: pointer;
    padding: 4px 8px;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: color 0.2s;
}

.tcs-action-btn:hover {
    color: #000;
}

.tcs-action-btn i {
    font-size: 16px;
}

/* 回复区域 - 竖式@标注设计 */
.tcs-replies-section {
    margin-top: 12px;
}

/* 查看回复按钮 */
.tcs-view-replies {
    background: none;
    border: none;
    color: #ff2d55;
    font-size: 14px;
    cursor: pointer;
    padding: 8px 0;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
    font-weight: 500;
}

.tcs-view-replies:hover {
    opacity: 0.8;
}

.tcs-view-replies i {
    font-size: 12px;
    transition: transform 0.2s;
}

.tcs-view-replies.expanded i {
    transform: rotate(180deg);
}

.tcs-replies-count {
    color: #ff2d55;
}

/* 回复列表 - 竖向排列 */
.tcs-replies-list {
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* 回复项 - 竖式设计 */
.tcs-reply-item {
    padding: 12px 0;
    display: flex;
    gap: 10px;
    cursor: pointer;
    transition: background-color 0.2s;
    border-radius: 8px;
    padding: 10px 8px;
    margin: 0 -8px;
    border-bottom: 1px solid #f8f8f8;
}

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

.tcs-reply-item:hover {
    background-color: rgba(0, 0, 0, 0.02);
}

.tcs-reply-item:active {
    background-color: rgba(0, 0, 0, 0.05);
}

/* 回复高亮效果 */
.tcs-reply-item.highlighted {
    background: linear-gradient(135deg, rgba(102, 187, 106, 0.15) 0%, rgba(102, 187, 106, 0.05) 100%);
    border-radius: 8px;
    padding: 10px 12px;
    margin: 0 -12px;
    animation: commentHighlight 3s ease-out;
    border: none;
    box-shadow: none;
    outline: none;
}

.tcs-reply-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    transition: transform 0.2s;
}

.tcs-reply-avatar:hover {
    transform: scale(1.1);
}

.tcs-reply-content {
    flex: 1;
    min-width: 0;
}

/* 回复头部：用户名 @ 被回复人 */
.tcs-reply-header {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
    flex-wrap: wrap;
}

.tcs-reply-name {
    font-size: 14px;
    font-weight: 600;
    color: #000;
    transition: color 0.2s;
    cursor: pointer;
}

.tcs-reply-name:hover {
    color: #ff2d55;
}

/* @标注样式 */
.tcs-reply-at {
    font-size: 14px;
    color: #ffb6c1;
    font-weight: 400;
}

.tcs-reply-text {
    font-size: 14px;
    color: #000;
    line-height: 1.5;
    margin-top: 2px;
    word-break: break-word;
}

/* 回复底部：时间 + 回复按钮 */
.tcs-reply-footer {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 6px;
}

.tcs-reply-time {
    font-size: 12px;
    color: #999;
}

.tcs-reply-action {
    font-size: 12px;
    color: #999;
    cursor: pointer;
    transition: color 0.2s;
}

.tcs-reply-action:hover {
    color: #ff2d55;
}

/* 更多回复提示 */
.tcs-more-replies {
    text-align: center;
    padding: 12px;
    color: #999;
    font-size: 13px;
    background: #fafafa;
    border-radius: 8px;
    margin-top: 8px;
}

/* 回复输入框 */
.tcs-reply-form {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: #f8f8f8;
    border-radius: 12px;
    padding: 12px;
}

/* 回复目标信息 */
.tcs-reply-to-info {
    font-size: 13px;
    color: #666;
    padding-left: 4px;
}

.tcs-reply-to-name {
    color: #ff2d55;
    font-weight: 500;
}

/* 回复输入框包装器 */
.tcs-reply-input-wrapper {
    display: flex;
    gap: 8px;
    align-items: flex-end;
    position: relative;
}

.tcs-reply-input {
    flex: 1;
    min-height: 36px;
    max-height: 100px;
    padding: 8px 40px 8px 12px;
    border: 1px solid #e0e0e0;
    border-radius: 18px;
    resize: none;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
    background: #fff;
}

.tcs-reply-input:focus {
    border-color: #ff2d55;
}

.tcs-reply-emoji-btn {
    position: absolute;
    right: 8px;
    bottom: 6px;
    background: transparent;
    border: none;
    font-size: 18px;
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    transition: all 0.2s;
    z-index: 5;
    color: #666;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tcs-reply-emoji-btn:hover {
    background: #e8f4ff;
    color: #0095f6;
    transform: scale(1.1);
}

.tcs-reply-submit {
    align-self: flex-end;
    background: #ff2d55;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 18px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    transition: all 0.2s;
}

.tcs-reply-submit:hover {
    background: #ff1a44;
    transform: scale(1.05);
}

.tcs-reply-submit:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

/* 底部评论输入框 */
.dcs-input-area {
    border-top: 1px solid #f0f0f0;
    padding: 12px 16px;
    background: #fff;
    flex-shrink: 0;
}

.dcs-input-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
}

.dcs-input-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.dcs-input-container {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
}

.dcs-main-input {
    flex: 1;
    width: 100%;
    height: 40px;
    border: 1px solid #e0e0e0;
    border-radius: 20px;
    padding: 0 80px 0 16px;
    font-size: 15px;
    outline: none;
    transition: border-color 0.2s;
}

.dcs-main-input:focus {
    border-color: #ff2d55;
}

/* 输入框操作按钮区域 */
.dcs-input-actions {
    position: absolute;
    right: 8px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.dcs-action-btn {
    background: transparent;
    border: none;
    font-size: 18px;
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    color: #666;
}

.dcs-action-btn:hover {
    background: #e8f4ff;
    color: #0095f6;
}

.dcs-attach-btn {
    cursor: pointer;
}

.dcs-attach-btn i {
    font-size: 18px;
}

/* 媒体预览区域 */
.dcs-media-preview {
    margin-top: 12px;
    padding: 12px;
    background: #f8f8f8;
    border-radius: 12px;
}

.dcs-preview-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.dcs-preview-item {
    position: relative;
    width: 80px;
    height: 80px;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
    border: 1px solid #e0e0e0;
}

.dcs-preview-item img,
.dcs-preview-item video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.dcs-preview-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 20px;
    height: 20px;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.dcs-preview-remove:hover {
    background: rgba(255, 45, 85, 0.9);
}

.dcs-clear-media {
    margin-top: 8px;
    background: none;
    border: none;
    color: #999;
    font-size: 13px;
    cursor: pointer;
    padding: 4px 8px;
    transition: color 0.2s;
}

.dcs-clear-media:hover {
    color: #ff2d55;
}

.dcs-main-submit {
    background: #66bb6a;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    white-space: nowrap;
    transition: all 0.2s;
}

.dcs-main-submit:hover {
    background: #4caf50;
    transform: scale(1.05);
}

.dcs-main-submit:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

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

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

.tcs-empty-text {
    font-size: 15px;
}

/* 加载状态 */
.dcs-loading, .tcs-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.dcs-spinner, .tcs-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #f0f0f0;
    border-top-color: #ff2d55;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* 移动端优化 */
@media (max-width: 768px) {
    .detail-comments-section {
        max-height: 60vh;
    }
    
    .dcs-list {
        max-height: 45vh;
    }
    
    .tcs-avatar {
        width: 36px;
        height: 36px;
    }
    
    .tcs-name {
        font-size: 14px;
    }
    
    .tcs-text {
        font-size: 14px;
    }
    
    .tcs-reply-avatar {
        width: 28px;
        height: 28px;
    }
    
    .tcs-reply-name,
    .tcs-reply-at {
        font-size: 13px;
    }
    
    .tcs-reply-text {
        font-size: 13px;
    }
}

/* 小屏幕手机 */
@media (max-width: 375px) {
    .dcs-header {
        padding: 10px 12px;
    }
    
    .dcs-list {
        padding: 0 12px 12px;
    }
    
    .dcs-input-area {
        padding: 10px 12px;
    }
}

/* 暗色模式支持 */
@media (prefers-color-scheme: dark) {
    .detail-comments-section {
        background: #1a1a1a;
        border-top-color: #333;
    }
    
    .dcs-header {
        background: #222;
        border-bottom-color: #333;
    }
    
    .dcs-title {
        color: #fff;
    }
    
    .dcs-count {
        color: #999;
    }
    
    .dcs-toggle {
        color: #999;
    }
    
    .tcs-item {
        border-bottom-color: #333;
    }
    
    .tcs-avatar {
        background: #333;
    }
    
    .tcs-name {
        color: #fff;
    }
    
    .tcs-text {
        color: #fff;
    }
    
    .tcs-action-btn,
    .tcs-expand-btn,
    .tcs-view-replies {
        color: #999;
    }
    
    .tcs-action-btn:hover,
    .tcs-expand-btn:hover,
    .tcs-view-replies:hover {
        color: #fff;
    }
    
    .tcs-reply-item {
        border-bottom-color: #333;
    }
    
    .tcs-reply-name {
        color: #fff;
    }
    
    .tcs-reply-text {
        color: #fff;
    }
    
    .tcs-reply-form {
        background: #2a2a2a;
    }
    
    .tcs-reply-input,
    .dcs-main-input {
        background: #2a2a2a;
        border-color: #444;
        color: #fff;
    }
    
    .dcs-input-area {
        border-top-color: #333;
        background: #1a1a1a;
    }
    
    .tcs-empty {
        color: #666;
    }
}

/* 评论表情面板 */
.comment-emoji-panel {
    position: fixed;
    width: 320px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.15);
    z-index: 10000;
    padding: 12px;
    display: none;
    animation: emojiSlideUp 0.2s ease-out;
}

.comment-emoji-panel.active {
    display: block;
}

@keyframes emojiSlideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.emoji-categories {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #e9ecef;
}

.emoji-category {
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    border-radius: 8px;
    cursor: pointer;
    font-size: 20px;
    transition: all 0.2s;
}

.emoji-category:hover {
    background: #f1f3f5;
}

.emoji-category.active {
    background: #ffe7ef;
}

.emoji-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 4px;
    max-height: 240px;
    overflow-y: auto;
}

.emoji-item {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.15s;
    user-select: none;
}

.emoji-item:hover {
    background: #f1f3f5;
    transform: scale(1.15);
}

/* 移动端表情面板 */
@media (max-width: 768px) {
    .comment-emoji-panel {
        width: calc(100% - 32px);
        left: 16px;
        right: 16px;
        transform: none;
    }
    
    @keyframes emojiSlideUp {
        from { opacity: 0; transform: translateY(20px); }
        to { opacity: 1; transform: translateY(0); }
    }
}

/* 暗色模式表情面板 */
@media (prefers-color-scheme: dark) {
    .comment-emoji-panel {
        background: #2a2a2a;
        box-shadow: 0 8px 32px rgba(0,0,0,0.4);
    }
    
    .emoji-categories {
        border-bottom-color: #444;
    }
    
    .emoji-category:hover {
        background: #3a3a3a;
    }
    
    .emoji-category.active {
        background: #4a2a35;
    }
    
    .emoji-item:hover {
        background: #3a3a3a;
    }
}
