/**
 * StackBlog Emlog Comment Style - GitHub Inspired
 * 文件名: stackblog-comment.css
 */

/* 评论容器 */
.so-comments-container {
    margin-top: 40px;
    padding: 20px;
    border: 1px solid var(--so-border-color, #e1e4e8);
    border-radius: 6px;
    background-color: var(--so-bg-color-light, #f6f8fa);
}

/* 评论表单区域 */
.so-comment-post {
    margin-bottom: 30px;
    padding: 20px;
    border: 1px solid var(--so-border-color, #e1e4e8);
    border-radius: 6px;
    background-color: var(--so-bg-color, #fff);
}

.so-comment-form {
    display: flex;
    flex-direction: column;
}

/* 评论输入框 */
.so-comment-textarea {
    width: 100%;
    min-height: 150px;
    padding: 10px;
    margin-bottom: 15px;
    border: 1px solid var(--so-border-color, #e1e4e8);
    border-radius: 6px;
    resize: vertical;
    font-size: 14px;
    box-sizing: border-box;
    transition: border-color 0.2s;
}

.so-comment-textarea:focus {
    border-color: var(--so-primary-color, #0366d6);
    outline: none;
    box-shadow: 0 0 0 3px rgba(3, 102, 214, 0.3);
}

/* 用户信息输入组 */
.so-comment-info-group {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    flex-wrap: wrap; /* 允许换行以适应小屏幕 */
}

.so-comment-input {
    flex: 1 1 45%; /* 确保在 flex 容器中每个输入框至少占据 45% 宽度，以实现两列布局 */
    min-width: 150px; /* 最小宽度，防止过小 */
    padding: 8px 10px;
    border: 1px solid var(--so-border-color, #e1e4e8);
    border-radius: 6px;
    font-size: 14px;
    box-sizing: border-box;
    transition: border-color 0.2s;
}

.so-comment-input:focus {
    border-color: var(--so-primary-color, #0366d6);
    outline: none;
    box-shadow: 0 0 0 3px rgba(3, 102, 214, 0.3);
}

/* 提交按钮 */
.so-comment-submit {
    align-self: flex-end;
    padding: 8px 16px;
    background-color: var(--so-primary-color, #2c974b);
    color: #fff;
    border: 1px solid var(--so-primary-color-dark, #227c3e);
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: background-color 0.2s;
}

.so-comment-submit:hover {
    background-color: var(--so-primary-color-hover, #268c43);
}

/* 评论列表项 */
.so-comment-item {
    display: flex;
    padding: 15px 0;
    border-bottom: 1px solid var(--so-border-color-light, #eaecef);
}

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

/* 评论头像 */
.so-comment-avatar {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    margin-right: 15px;
}

.so-comment-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

/* 评论内容区 */
.so-comment-content {
    flex-grow: 1;
    min-width: 0; /* 解决 flex 布局下内容溢出问题 */
}

/* 评论头部 */
.so-comment-header {
    display: flex;
    align-items: center;
    margin-bottom: 5px;
}

.so-comment-author {
    font-weight: 600;
    color: var(--so-text-color-dark, #24292e);
    margin-right: 10px;
}

.so-comment-date {
    font-size: 12px;
    color: var(--so-text-color-light, #586069);
}

/* 评论文本 */
.so-comment-text {
    font-size: 14px;
    line-height: 1.6;
    color: var(--so-text-color, #24292e);
    word-wrap: break-word;
    overflow-wrap: break-word;
    margin-bottom: 10px;
}

/* 回复按钮 */
.so-comment-reply {
    font-size: 12px;
    color: var(--so-primary-color, #0366d6);
    text-decoration: none;
    cursor: pointer;
    font-weight: 500;
}

.so-comment-reply:hover {
    text-decoration: underline;
}

/* 子评论/嵌套评论 */
.so-comment-children {
    margin-top: 10px;
    padding-left: 20px;
    border-left: 2px solid var(--so-border-color-light, #eaecef);
}

.so-comment-children .so-comment-item {
    padding-top: 10px;
    padding-bottom: 10px;
}

/* 验证码区域 */
.so-comment-verify-group {
    display: flex;
    align-items: center;
    margin-top: 10px;
    gap: 10px;
    flex-wrap: wrap; /* 允许换行 */
}

.so-comment-verify-group label {
    font-weight: 600;
    color: var(--so-text-color-dark, #24292e);
}

.so: 4px;
    vertical-align: middle;
}

.so-comment-verify-group .verify-code-group img {
    border: 1px solid var(--so-border-color, #e1e4e8);
    border-radius: 4px;
    cursor: pointer;
}

/* 登录用户提示 */
.so-comment-logged-in {
    font-size: 14px;
    color: var(--so-text-color-light, #586069);
    margin-bottom: 15px;
}

.so-comment-logged-in a {
    color: var(--so-primary-color, #0366d6);
    text-decoration: none;
}

/* 评论分页 */
.so-comment-pagination {
    margin-top: 20px;
    text-align: center;
}

.so-comment-pagination a,
.so-comment-pagination span {
    display: inline-block;
    padding: 5px 10px;
    margin: 0 3px;
    border: 1px solid var(--so-border-color, #e1e4e8);
    border-radius: 4px;
    text-decoration: none;
    color: var(--so-text-color, #24292e);
    transition: background-color 0.2s;
}

.so-comment-pagination a:hover {
    background-color: var(--so-bg-color-light, #f6f8fa);
}

.so-comment-pagination .current {
    background-color: var(--so-primary-color, #0366d6);
    color: #fff;
    border-color: var(--so-primary-color, #0366d6);
}

/* 响应式调整 */
@media (max-width: 768px) {
    .so-comments-container {
        padding: 10px;
    }

    .so-comment-post {
        padding: 10px;
    }

    .so-comment-info-group {
        flex-direction: column;
        gap: 10px;
    }

    .so-comment-input {
        width: 100%;
    }

    .so-comment-submit {
        align-self: stretch;
    }

    .so-comment-item {
        padding: 10px 0;
    }

    .so-comment-avatar {
        width: 30px;
        height: 30px;
        margin-right: 10px;
    }

    .so-comment-children {
        padding-left: 15px;
    }
}

/* 表情按钮和容器 */
.so-comment-toolbar {
    display: flex;
    align-items: center;
    justify-content: flex-start; /* 靠左对齐 */
    margin-bottom: 15px;
    position: relative; /* 确保表情列表定位正确 */
    z-index: 10000; /* 确保表情列表在验证码之上 */
}

.so-emoticon-button {
    padding: 5px 10px;
    background-color: var(--so-bg-color-light, #f6f8fa);
    border: 1px solid var(--so-border-color, #e1e4e8);
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.2s;
}

.so-emoticon-button:hover {
    background-color: var(--so-bg-color-hover, #eaecef);
}

.so-emoticon-container {
    position: absolute;
    top: 35px; /* 调整位置，避免与按钮重叠 */
    left: 0;
    z-index: 10001; /* 确保表情列表在工具栏之上 */
    padding: 10px;
    background-color: var(--so-bg-color, #fff);
    border: 1px solid var(--so-border-color, #e1e4e8);
    border-radius: 6px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    display: none;
    max-width: 300px;
    max-height: 200px;
    overflow-y: auto;
}

.so-emoticon-container span {
    display: inline-block;
    padding: 5px;
    margin: 2px;
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
}

/* 验证码样式 */
.so-verify-code img {
    border: 1px solid var(--so-border-color, #e1e4e8);
    border-radius: 4px;
    cursor: pointer;
}
