/* 댓글 부품. 게시글 화면(post-view)과 서적 권 화면이 함께 쓴다. post-view.css 에서 분리(원장 261022) */

@media (max-width: 768px) {
    .comments-section {
        margin-top: 2rem;
        padding-top: 1.5rem;
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }

    .comments-section h3 {
        font-size: 1.3rem;
        margin-bottom: 1rem;
    }

    .comment {
        background: white;
        border-radius: 8px;
        padding: 0.8rem;
        margin-bottom: 0;
        border: 1px solid #e9ecef;
    }

    .comment-form textarea {
        padding: 0.8rem;
        font-size: 0.9rem;
    }

    .comment-form .btn {
        padding: 0.6rem 1.2rem;
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .comments-section {
        padding-left: 0.25rem;
        padding-right: 0.25rem;
        margin-top: 1.5rem;
    }

    .comments-section h3 {
        font-size: 1.2rem;
    }

    .comment {
        padding: 0.6rem;
        margin-bottom: 0;
        border-radius: 6px;
    }

    .comment-form textarea {
        padding: 0.6rem;
        font-size: 0.85rem;
    }

    .comment-form .btn {
        padding: 0.5rem 1rem;
        font-size: 0.85rem;
    }
}

/* 댓글 섹션 스타일 */
.comments-section {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 2px solid #eee;
}

.comments-section h3 {
    font-size: 1.5rem;
    color: var(--primary-color);
    margin-bottom: 1.5rem;
}

.comment-form {
    margin-bottom: 2rem;
}

.comment-form textarea {
    width: 100%;
    padding: 1rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    resize: vertical;
    font-family: inherit;
    font-size: 0.95rem;
    margin-bottom: 1rem;
    transition: border-color 0.3s ease;
}

.comment-form textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

.comment-form .btn {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 0.7rem 1.5rem;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
}

.comment-form .btn:hover {
    background-color: var(--primary-color-dark, #2563eb);
}

.comments-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.comment {
    background: white;
    border-radius: 12px;
    padding: 0.8rem;
    border: 1px solid #e9ecef;
    margin-bottom: 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.comment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.6rem;
}

.comment-author {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.comment-author img {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
}

.comment-author-name {
    font-weight: 500;
    color: #333;
    font-size: 0.9rem;
}

.comment-date {
    color: #666;
    font-size: 0.85rem;
}

.comment-content {
    color: #555;
    line-height: 1.5;
    margin-bottom: 0.8rem;
    font-size: 0.95rem;
    white-space: pre-wrap;
    word-break: break-word;
    overflow-wrap: break-word;
}

.comment-actions {
    display: flex;
    gap: 0.8rem;
}

.comment-action-btn {
    background: none;
    border: none;
    color: #888;
    cursor: pointer;
    font-size: 0.8rem;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    transition: all 0.2s ease;
    font-weight: 500;
}

.comment-action-btn:hover {
    background-color: #f8f9fa;
    color: #333;
    transform: none;
    box-shadow: none;
}

.comment-action-btn.reply-btn:hover {
    color: #28a745;
    transform: none;
}

.comment-action-btn.edit-btn:hover {
    color: #fd7e14;
    transform: none;
}

.comment-action-btn.delete-btn:hover {
    color: #dc3545;
    transform: none;
}

.reply-form {
    margin-top: 0.8rem;
    border: 1px solid #e4e9ef;
    border-radius: 14px;
    background: #ffffff;
    padding: 0.9rem;
}

.reply-form textarea {
    width: 100%;
    min-height: 104px;
    border: 0;
    border-radius: 11px;
    background: #f4f7f8;
    color: #1f2937;
    font-size: 0.85rem;
    line-height: 1.6;
    padding: 0.7rem 0.78rem;
    resize: none;
    outline: none;
    margin-bottom: 0;
}

.reply-form textarea:focus {
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.reply-form .pv-comment-profile {
    display: flex;
    align-items: center;
    gap: 0.62rem;
    margin-bottom: 0.65rem;
}

.reply-form .pv-comment-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #eaf2ff;
    color: #1e40af;
    font-size: 0.78rem;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.reply-form .pv-comment-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.reply-form .pv-comment-author strong {
    display: block;
    color: #24323c;
    font-size: 0.82rem;
    line-height: 1.2;
}

.reply-form .pv-comment-author span {
    display: block;
    margin-top: 0.08rem;
    color: #6b7280;
    font-size: 0.72rem;
}

.reply-form .pv-comment-bottom {
    margin-top: 0.58rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.45rem;
}

.reply-form .pv-comment-actions {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.reply-form .pv-comment-secret {
    border: 1px solid #e0e6ec;
    border-radius: 999px;
    background: #ffffff;
    color: #334155;
    height: 30px;
    padding: 0 0.6rem;
    font-size: 0.74rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 0.28rem;
    cursor: pointer;
}

.reply-form .pv-comment-submit,
.reply-form .pv-comment-cancel {
    border-radius: 999px;
    height: 30px;
    padding: 0 0.74rem;
    font-size: 0.76rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: 1px solid transparent;
}

.reply-form .pv-comment-submit {
    background: #3b82f6;
    color: #ffffff;
}

.reply-form .pv-comment-submit:hover {
    background: #2563eb;
}

.reply-form .pv-comment-cancel {
    border-color: #e0e6ec;
    background: #ffffff;
    color: #475467;
}

.replies {
    margin-top: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.reply {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 0.6rem;
    margin-bottom: 0;
    border: 1px solid #edf2f7;
    position: relative;
}

.reply::before {
    content: "└";
    position: absolute;
    left: -15px;
    top: 15px;
    color: #cbd5e0;
    font-size: 1.2rem;
    display: none;

    /* 플랫 레이아웃을 위해 숨김 */
}

.reply:last-child {
    margin-bottom: 0;
}

.edit-form {
    margin-top: 0.7rem;
    border: 1px solid #e4e9ef;
    border-radius: 14px;
    background: #ffffff;
    padding: 0.9rem;
}

.edit-form textarea {
    width: 100%;
    min-height: 104px;
    border: 0;
    border-radius: 11px;
    background: #f4f7f8;
    color: #1f2937;
    font-size: 0.85rem;
    line-height: 1.6;
    padding: 0.7rem 0.78rem;
    resize: none;
    outline: none;
    margin-bottom: 0;
}

.edit-form textarea:focus {
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.edit-form .pv-comment-bottom {
    margin-top: 0.58rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.45rem;
}

.edit-form .pv-comment-actions {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.edit-form .pv-comment-submit,
.edit-form .pv-comment-cancel {
    border-radius: 999px;
    height: 30px;
    padding: 0 0.74rem;
    font-size: 0.76rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: 1px solid transparent;
}

.edit-form .pv-comment-submit {
    background: #3b82f6;
    color: #ffffff;
}

.edit-form .pv-comment-submit:hover {
    background: #2563eb;
}

.edit-form .pv-comment-cancel {
    border-color: #e0e6ec;
    background: #ffffff;
    color: #475467;
}

.comments-section {
    border-top: 0;
    margin-top: 2.2rem;
    padding-top: 1.35rem;
}

.comments-section h3 {
    color: #344054;
    font-size: 1.1rem;
    margin-bottom: 0.85rem;
}

.comments-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0;
}

.comments-toolbar-left,
.comments-toolbar-right {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
}

.comments-divider {
    height: 1px;
    background: #e8edf3;
    margin: 0.7rem 0;
}

.comments-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.85rem;
}

.comments-head h3 {
    margin: 0;
}

.comments-count {
    margin-left: 0.35rem;
    color: #2563eb;
    font-size: 1.08rem;
    font-weight: 700;
    vertical-align: baseline;
}

.comments-empty-card {
    border: 1px solid #e5edf8;
    border-radius: 12px;
    background: #f8fbff;
    padding: 1rem 1.1rem;
    display: flex;
    align-items: flex-start;
    gap: 0.72rem;
    color: #334155;
}

.comments-empty-card i {
    margin-top: 0.08rem;
    color: #3b82f6;
    font-size: 0.95rem;
}

.comments-empty-card strong {
    display: block;
    font-size: 0.9rem;
    color: #1e293b;
    margin-bottom: 0.2rem;
}

.comments-empty-card p {
    margin: 0;
    font-size: 0.82rem;
    color: #64748b;
    line-height: 1.55;
}

.comments-sort-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    border: 1px solid #bfd5fb;
    border-radius: 999px;
    background: #eef4ff;
    color: #1d4ed8;
    height: 32px;
    padding: 0 0.72rem;
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.18s ease;
}

.comments-sort-btn:hover {
    border-color: #9cbcf3;
    background: #e4eeff;
    color: #1e40af;
}

.comment-form {
    margin-bottom: 1.15rem;
}

.pv-comment-shell {
    border: 1px solid #cdddf7;
    border-radius: 14px;
    background: #ffffff;
    padding: 0.95rem;
    box-shadow: inset 0 0 0 1px rgba(59, 130, 246, 0.08);
}

.pv-comment-profile {
    display: flex;
    align-items: center;
    gap: 0.62rem;
    margin-bottom: 0.75rem;
}

.pv-comment-avatar {
    position: relative;
    overflow: hidden;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: #eaf2ff;
    color: #1e40af;
    font-size: 0.85rem;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.pv-comment-avatar img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: none;
}

.pv-comment-avatar.has-photo img {
    display: block;
}

.pv-comment-avatar.has-photo {
    color: transparent;
}

.pv-comment-author strong {
    display: block;
    color: #24323c;
    font-size: 0.88rem;
    line-height: 1.2;
}

.pv-comment-author span {
    display: block;
    margin-top: 0.12rem;
    color: #6b7280;
    font-size: 0.76rem;
}

.pv-comment-shell textarea {
    width: 100%;
    min-height: 120px;
    border: 0;
    border-radius: 11px;
    background: #f4f7f8;
    color: #1f2937;
    font-size: 0.86rem;
    line-height: 1.6;
    padding: 0.72rem 0.78rem;
    resize: none;
    outline: none;
    margin-bottom: 0;
}

.pv-comment-shell textarea:focus {
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.pv-comment-bottom {
    margin-top: 0.62rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.pv-comment-secret {
    border: 1px solid #e0e6ec;
    border-radius: 999px;
    background: #ffffff;
    color: #334155;
    height: 32px;
    padding: 0 0.66rem;
    font-size: 0.78rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 0.32rem;
    cursor: default;
}

.pv-comment-submit {
    border: 1px solid transparent;
    border-radius: 999px;
    background: #3b82f6;
    color: #ffffff;
    height: 32px;
    padding: 0 0.85rem;
    font-size: 0.8rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.pv-comment-submit:hover {
    background: #2563eb;
}

.comment {
    border: 1px solid #e5e9ef;
    border-radius: 12px;
    background: linear-gradient(180deg, #ffffff 0%, #fbfcfe 100%);
    box-shadow: 0 6px 18px rgba(16, 24, 40, 0.04);
    padding: 0.85rem;
}

@media (max-width: 768px) {
    .comments-section {
        margin-top: 1.8rem;
        padding-top: 1.1rem;
    }
}

body[data-theme="dark"] .comments-divider {
    background: var(--dark-border);
}

body[data-theme="dark"] .comments-empty-card {
    border-color: #2e3a49;
    background: #1a222d;
    color: #c4d0de;
}

body[data-theme="dark"] .comments-empty-card strong {
    color: var(--dark-text);
}

body[data-theme="dark"] .comments-empty-card p {
    color: var(--dark-text-muted);
}

body[data-theme="dark"] .comments-sort-btn {
    border-color: var(--color-primary);
    background: color-mix(in srgb, var(--color-primary) 20%, transparent);
    color: #b8d0eb;
}

body[data-theme="dark"] .comments-sort-btn:hover {
    border-color: #4a7fbe;
    background: color-mix(in srgb, var(--color-primary) 28%, transparent);
    color: #d5e6f8;
}

body[data-theme="dark"] .pv-comment-shell {
    border-color: var(--dark-border);
    background: #1a1a1a;
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--color-primary) 16%, transparent);
}

body[data-theme="dark"] .pv-comment-avatar,
body[data-theme="dark"] .reply-form .pv-comment-avatar {
    background: #203044;
    color: #c5daf2;
}

body[data-theme="dark"] .pv-comment-author strong,
body[data-theme="dark"] .reply-form .pv-comment-author strong,
body[data-theme="dark"] .comment-author-name {
    color: var(--dark-text);
}

body[data-theme="dark"] .pv-comment-author span,
body[data-theme="dark"] .reply-form .pv-comment-author span,
body[data-theme="dark"] .comment-date,
body[data-theme="dark"] .comment-content {
    color: var(--dark-text-muted);
}

body[data-theme="dark"] .pv-comment-shell textarea,
body[data-theme="dark"] .reply-form textarea,
body[data-theme="dark"] .edit-form textarea {
    background: #202020;
    color: var(--dark-text);
}

body[data-theme="dark"] .pv-comment-shell textarea:focus,
body[data-theme="dark"] .reply-form textarea:focus,
body[data-theme="dark"] .edit-form textarea:focus {
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-primary) 30%, transparent);
}

body[data-theme="dark"] .pv-comment-secret,
body[data-theme="dark"] .reply-form .pv-comment-secret,
body[data-theme="dark"] .reply-form .pv-comment-cancel,
body[data-theme="dark"] .edit-form .pv-comment-cancel {
    border-color: var(--dark-border-2);
    background: #1f1f1f;
    color: var(--dark-text-muted);
}

body[data-theme="dark"] .comment {
    border-color: var(--dark-border);
    background: linear-gradient(180deg, #1b1b1b 0%, #171717 100%);
    box-shadow: none;
}

body[data-theme="dark"] .reply,
body[data-theme="dark"] .reply-form,
body[data-theme="dark"] .edit-form {
    border-color: var(--dark-border);
    background: #1a1a1a;
}

body[data-theme="dark"] .comment-action-btn {
    color: var(--dark-text-muted);
}

body[data-theme="dark"] .comment-action-btn:hover {
    background-color: #242424;
    color: var(--dark-text);
}

.comments-list {
    gap: 0;
}

.comment-group {
    padding: 13px 0 12px;
    border-top: 1px solid var(--ui-border);
}

.comment-group:first-child {
    margin-top: .5rem;
}

.comment,
.reply,
body[data-theme="dark"] .comment,
body[data-theme="dark"] .reply {
    border: 0;
    border-radius: 0;
    background: none;
    box-shadow: none;
    padding: 0;
}

.comment-header {
    justify-content: flex-start;
    gap: .45rem;
    margin-bottom: .1rem;
}

.comment-author img {
    width: 26px;
    height: 26px;
}

.comment-author-name {
    font-size: 13px;
    font-weight: 600;
}

.comment-mention {
    margin-left: 5px;
    font-size: 12px;
    font-weight: 400;
    color: var(--color-primary);
}

.comment-date {
    font-size: 12px;
    color: var(--ui-soft);
}

.comment-content,
.comment-actions {
    padding-left: 34px;
}

.comment-content {
    margin-bottom: 12px;
    font-size: 14px;
    line-height: 1.6;
    color: var(--ui-text);
}

.comment-actions {
    align-items: center;
    gap: .25rem;
    margin-left: -.4rem;
}

.comment-action-btn.reply-btn,
body[data-theme="dark"] .comment-action-btn.reply-btn {
    background: none;
    color: var(--ui-soft);
    font-size: 12px;
    line-height: 16px;
    padding: 0 .4rem;
}

.comment-action-btn.reply-btn:hover,
body[data-theme="dark"] .comment-action-btn.reply-btn:hover {
    background: var(--ui-hover);
    color: var(--ui-text);
}

.replies {
    margin-left: 34px;
    padding-top: .55rem;
    gap: .6rem;
}

/* 수정·삭제는 답글 행 오른쪽 끝 ⋮ 메뉴(공용 .ui-menu) */
.comment-more {
    display: flex;
    align-items: center;
    height: 16px;
    margin-left: auto;
    margin-right: -.3rem;
}

.comment-more-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
    width: 26px;
    height: 26px;
    border: 0;
    border-radius: 50%;
    background: none;
    color: var(--ui-soft);
    cursor: pointer;
}

.comment-more-btn:hover,
.comment-more-btn[aria-expanded="true"] {
    background: var(--ui-hover);
    color: var(--ui-text);
}

.comment-more .ui-menu {
    min-width: 132px;
}

/* 댓글 입력란만 테두리 상자 */
.pv-comment-shell,
body[data-theme="dark"] .pv-comment-shell {
    border: 1px solid var(--ui-border-2);
    background: var(--ui-surface);
    box-shadow: none;
}

/* 댓글 좋아요·싫어요(원장 261019 미리보기): Lucide 엄지 14px, 좋아요 수만 표시, 누른 쪽은 안을 칠한다.
 * 좋아요 엄지는 1px 위로(원장 261019 「살짝 위로」). 아이콘만 옮기므로 답글 행 높이 16px 는 그대로 */
.comment-react {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    height: 16px;
    padding: 0 .4rem;
    border: 0;
    border-radius: 6px;
    background: none;
    color: var(--ui-soft);
    font: inherit;
    font-size: 12px;
    line-height: 16px;
    cursor: pointer;
}

.comment-react:hover {
    background: var(--ui-hover);
    color: var(--ui-text);
}

.comment-react.is-on {
    color: var(--ui-text);
}

.comment-react svg {
    width: 14px;
    height: 14px;
    flex: none;
}

.comment-react[data-kind="like"] svg {
    transform: translateY(-1px);
}
