/* ==========================================================
   评论区 v2 —— 表单在上、列表在下（参考现代博客布局）
   ========================================================== */

.comment-section {
    max-width: 860px;
    margin: 3.2em auto 0;
    padding: 0 1.6em 3em;
}

/* ---------- 通用标题 ---------- */
.cmt-form-title,
.cmt-list-title {
    display: flex;
    align-items: center;
    gap: .45em;
    font-size: 1.08em;
    font-weight: 700;
    color: var(--tech-text, #2E3447);
    margin: 0 0 1.15em;
}

.cmt-title-ic {
    width: 1.15em;
    height: 1.15em;
    color: var(--tech-primary, #5B8DEF);
    fill: currentColor;
}

/* ---------- 表单 ---------- */
.cmt-form-wrap {
    padding-bottom: 2.2em;
    border-bottom: 1px solid var(--tech-line, rgba(127, 168, 245, .12));
    margin-bottom: 2.2em;
}

.cmt-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1em;
    margin-bottom: 1em;
}

.cmt-field {
    display: flex;
    flex-direction: column;
    gap: .45em;
}

.cmt-field label {
    font-size: .86em;
    color: var(--tech-text-soft, #8A93A8);
    font-weight: 500;
}

.cmt-field label .cmt-req {
    display: inline;
    color: #ff6b6b;
    font-style: normal;
    font-weight: 700;
    font-size: 1em;
    font-family: inherit;
    margin-left: .12em;
    background: none;
    border: 0;
    line-height: 1;
}

.cmt-field input,
.cmt-field textarea {
    width: 100%;
    box-sizing: border-box;
    padding: .72em .95em;
    font-size: .93em;
    font-family: inherit;
    color: var(--tech-text, #2E3447);
    background: rgba(150, 163, 205, 0.035);
    border: 1px solid rgba(127, 168, 245, .14);
    border-radius: 8px;
    outline: none;
    transition: border-color .2s ease, background-color .2s ease;
}

.cmt-field input::placeholder,
.cmt-field textarea::placeholder {
    color: #63798a;
}

.cmt-field input:focus,
.cmt-field textarea:focus {
    border-color: var(--tech-primary, #5B8DEF);
    background: rgba(127, 168, 245, .05);
}

.cmt-field-full { margin-bottom: 0; }

.cmt-field textarea {
    resize: vertical;
    min-height: 140px;
    line-height: 1.75;
}

/* ---------- 底部操作行 ---------- */
.cmt-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 1.1em;
    position: relative;
}

.cmt-emoji-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25em;
    height: 2.25em;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: #8A93A8;
    cursor: pointer;
    transition: color .2s ease, background-color .2s ease;
}

.cmt-emoji-btn:hover {
    color: var(--tech-primary, #5B8DEF);
    background: rgba(127, 168, 245, .08);
}

.cmt-emoji-btn .ic {
    width: 1.25em;
    height: 1.25em;
    fill: currentColor;
}

.cmt-submit {
    padding: .72em 2.1em;
    font-size: .93em;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, #ff5f6d, #ff3d54);
    border: 0;
    border-radius: 8px;
    cursor: pointer;
    letter-spacing: .03em;
    transition: transform .18s ease, box-shadow .18s ease, filter .18s ease;
    box-shadow: 0 6px 18px rgba(255, 61, 84, .28);
}

.cmt-submit:hover {
    transform: translateY(-1px);
    filter: brightness(1.06);
    box-shadow: 0 8px 22px rgba(255, 61, 84, .36);
}

.cmt-submit:active { transform: translateY(0); }

/* ---------- 表情面板 ---------- */
/* hidden 属性必须显式覆盖 display:grid，否则面板默认就展示 */
.cmt-emoji-panel[hidden] {
    display: none !important;
}

.cmt-emoji-panel {
    position: absolute;
    left: 0;
    top: 100%;
    margin-top: .55em;
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    gap: .15em;
    padding: .6em;
    background: #FFFFFF;
    border: 1px solid rgba(127, 168, 245, .2);
    border-radius: 10px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, .55);
    z-index: 20;
}

.cmt-emoji {
    width: 2em;
    height: 2em;
    padding: 0;
    font-size: 1.05em;
    line-height: 1;
    background: transparent;
    border: 0;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color .15s ease, transform .15s ease;
}

.cmt-emoji:hover {
    background: rgba(127, 168, 245, .14);
    transform: scale(1.15);
}

/* ---------- 留言列表 ---------- */
.cmt-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.85em;
    height: 1.55em;
    padding: 0 .45em;
    margin-left: .2em;
    font-size: .74em;
    font-weight: 600;
    color: #6B7488;
    background: rgba(127, 168, 245, .08);
    border-radius: 999px;
}

.cmt-list {
    display: flex;
    flex-direction: column;
    gap: 1.55em;
}

.cmt-item {
    display: flex;
    gap: .95em;
    align-items: flex-start;
}

.cmt-avatar {
    flex: 0 0 auto;
    width: 44px;
    height: 44px;
    border-radius: 10px;
    overflow: hidden;
    background: #F1F3FA;
    border: 1px solid rgba(127, 168, 245, .16);
}

.cmt-avatar img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.cmt-main {
    flex: 1;
    min-width: 0;
}

.cmt-meta-top {
    display: flex;
    align-items: center;
    gap: .5em;
    margin-bottom: .2em;
}

.cmt-author {
    font-size: .96em;
    font-weight: 700;
    color: var(--tech-text, #2E3447);
    text-decoration: none;
}

a.cmt-author:hover { color: var(--tech-primary, #5B8DEF); }

.cmt-lv {
    display: inline-block;
    padding: .1em .5em;
    font-size: .68em;
    font-weight: 600;
    color: #8A93A8;
    background: rgba(150, 163, 205, 0.06);
    border-radius: 4px;
    line-height: 1.6;
}

.cmt-meta-sub {
    display: flex;
    align-items: center;
    gap: .35em;
    font-size: .78em;
    color: #9AA3B5;
    margin-bottom: .55em;
}

.cmt-dot { opacity: .5; }

.cmt-reply a {
    color: #9AA3B5;
    text-decoration: none;
    transition: color .18s ease;
}

.cmt-reply a:hover { color: var(--tech-primary, #5B8DEF); }

.cmt-content {
    font-size: .95em;
    line-height: 1.85;
    color: #4A5268;
    word-break: break-word;
}

.cmt-content p { margin: 0 0 .6em; }
.cmt-content p:last-child { margin-bottom: 0; }
.cmt-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: .5em 0;
}
.cmt-content blockquote {
    margin: .6em 0;
    padding: .5em .9em;
    border-left: 3px solid rgba(127, 168, 245, .45);
    background: rgba(127, 168, 245, .05);
    border-radius: 0 6px 6px 0;
    color: #5C6478;
    font-size: .94em;
}
.cmt-content code {
    padding: .12em .4em;
    font-size: .9em;
    background: rgba(127, 168, 245, .08);
    border-radius: 4px;
    color: #5B8DEF;
}
.cmt-content pre {
    padding: .8em 1em;
    overflow-x: auto;
    background: #F4F6FC;
    border: 1px solid rgba(127, 168, 245, .12);
    border-radius: 8px;
    font-size: .88em;
}

.cmt-empty {
    padding: 2em 0;
    text-align: center;
    color: #9AA3B5;
    font-size: .92em;
}

/* 分页 */
.cmt-pager {
    margin-top: 1.8em;
    text-align: center;
    font-size: .9em;
}
.cmt-pager a,
.cmt-pager span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.1em;
    height: 2.1em;
    margin: 0 .15em;
    padding: 0 .55em;
    color: #5C6478;
    text-decoration: none;
    background: rgba(127, 168, 245, .05);
    border: 1px solid rgba(127, 168, 245, .14);
    border-radius: 6px;
}
.cmt-pager a:hover {
    color: #FFFFFF;
    background: var(--tech-primary, #5B8DEF);
    border-color: var(--tech-primary, #5B8DEF);
}

/* 评论关闭提示 */
.comment-closed {
    padding: 1.6em;
    text-align: center;
    color: #9AA3B5;
    background: rgba(150, 163, 205, 0.03);
    border: 1px solid rgba(127, 168, 245, .1);
    border-radius: 10px;
}

/* ---------- 响应式 ---------- */
@media screen and (max-width: 720px) {
    .comment-section { padding: 0 1em 2.4em; }

    .cmt-grid {
        grid-template-columns: 1fr;
        gap: .8em;
    }

    .cmt-emoji-panel {
        grid-template-columns: repeat(8, 1fr);
    }

    .cmt-submit {
        padding: .68em 1.6em;
        font-size: .9em;
    }

    .cmt-avatar {
        width: 38px;
        height: 38px;
        border-radius: 8px;
    }

    .cmt-item { gap: .75em; }
}
