/* Новый дизайн комментариев для поста */
:root {
    --primary-color: #A81700;
    --secondary-color: #333333;
    --background-dark: #1a1a1a;
    --background-light: #f5f5f5;
    --background-post: #ffffff;
    --background-comment: #f9f9f9;
    --background-reply: #f2f2f2;
    --border-color: #e0e0e0;
    --text-primary: #333333;
    --text-secondary: #666666;
    --text-light: #999999;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}
body {
    background-color: var(--background-light);
    color: var(--text-primary);
}
.comments-section {
    background-color: var(--background-light);
    border-radius: 4px;
    overflow: hidden;
}
.comment {
    background-color: var(--background-comment);
    margin-bottom: 12px;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--border-color);
}
.comment-header {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
}
.comment-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    margin-right: 12px;
}
.comment-author {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.comment-author-name {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
}
.comment-content {
    padding: 12px 16px;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
}
.comment-content > img {
    cursor: pointer;
}
.comment-actions {
    display: flex;
    padding: 8px 14px 8px 22px;
    border-top: 1px solid var(--border-color);
    background-color: #f5f5f5;
    align-items: center;
}
.action-button {
    display: flex;
    align-items: center;
    margin-right: 24px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 14px;
    transition: color 0.2s;
}
.action-button i {
    margin-right: 6px;
    font-size: 18px;
    color: var(--text-secondary);
    transition: color 0.2s;
}
.action-button span {
    color: var(--text-secondary);
    transition: color 0.2s;
}
/* Hover и активный лайк/коммент */
.action-button:hover i,
.action-button.liked i,
.action-button:hover span,
.action-button.liked span {
    color: var(--primary-color);
}
.action-button.liked {
    color: var(--primary-color);
}
.action-button.liked i {
    animation: pulse 0.4s ease;
}
.action-button.liked span {
    color: var(--primary-color);
}
/* Для кнопки комментария (ответов) */
.action-button.comment_answers:hover i,
.action-button.comment_answers.liked i,
.action-button.comment_answers:hover span,
.action-button.comment_answers.liked span {
    color: var(--primary-color);
}
.reply-button {
    color: var(--text-secondary);
    background: none;
    border: none;
    cursor: pointer;
    font-size: 13px;
    margin-left: auto;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    height: 24px;
}
.reply-button:hover {
    color: var(--primary-color);
}
.reply-button i {
    margin-right: 4px;
    font-size: 14px;
    margin-top: -1px;
}
.delete-comment-modal {
    display: none;
    position: fixed;
    z-index: 1050;
    inset: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.4);
}
.delete-comment-modal .modal-content {
    background-color: #fff;
    margin: 15% auto;
    padding: 16px;
    border-radius: 10px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}
.delete-comment-modal .modal-footer {
    display: flex;
    justify-content: space-between;
    gap: 12px;
}
.replies {
    margin-left: 20px;
    margin-top: 8px;
    margin-bottom: 8px;
    padding-left: 16px;
    border-left: 2px solid var(--primary-color);
}
.reply {
    background-color: var(--background-reply);
    margin-bottom: 8px;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--border-color);
}
.reply-header {
    display: flex;
    align-items: center;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-color);
}
.reply-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    object-fit: cover;
    margin-right: 10px;
}
.reply-author {
    flex-grow: 1;
}
.reply-author-name {
    font-weight: 600;
    font-size: 13px;
    color: var(--text-primary);
}
.reply-content {
    padding: 10px 14px;
    font-size: 13px;
    line-height: 1.5;
}
.reply-actions {
    display: flex;
    padding: 6px 14px;
    border-top: 1px solid var(--border-color);
    background-color: #eef0f1;
}
.reply-to {
    color: var(--primary-color);
    font-weight: 500;
    margin-right: 4px;
}
@media (max-width: 768px) {
    .comment-header, .comment-content, .comment-actions {
        padding-left: 8px;
        padding-right: 8px;
    }
    .replies {
        margin-left: 10px;
        padding-left: 10px;
    }
    .comment-actions {
        padding-left: 13px !important;
        padding-right: 5px !important;
    }
}

/* Стили для формы нового комментария (перенесено из старого файла) */
.new-comment-bottom {
    position: relative;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin-top: 10px;
}

.post-comment,
.reply-comment{
    width: 100%;
    max-width: inherit;
    min-height: 100px;
    resize: none;
    overflow: hidden;
}
.post-comment-container .post-comment-submit{
    margin-top: 0;
}

.mentions-list-container {
    display: flex;
    flex-wrap: wrap;
    width: 100%;
}
.reply-btn {
    cursor: pointer;
}

.visible {
    display: block;
}

.mentions-list {
    display: none;
    position: absolute;
    background-color: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
    width: 100%;
    min-width: 260px;
    max-width: 420px;
    max-height: 240px;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 1050;
    bottom: 100%;
    left: 0;
    margin-bottom: 8px;
}

.mentions-list ul {
    list-style: none;
    padding: 4px;
    margin: 0;
}

.mentions-list li {
    padding: 0;
    margin: 0;
    cursor: pointer;
    transition: background-color 0.2s;
    border-radius: 4px;
}

.mentions-list li + li {
    margin-top: 0 !important;
}

.mentions-list li + li::before {
    content: none !important;
    display: none !important;
}

.mentions-list li:hover {
    background-color: rgba(168, 23, 0, 0.12);
}

.mention-item {
    padding: 6px 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    line-height: 1.2;
}

.mention-item-content {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    flex: 1;
}

.mention-item-avatar {
    width: 34px;
    height: 34px;
    min-width: 34px;
    border-radius: 50%;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    text-transform: uppercase;
    background: #e8edf3;
    color: #1f2a37;
}

.mention-item-avatar img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.mention-item-avatar--business {
    background: linear-gradient(135deg, #a81700 0%, #c8260d 100%);
    color: #ffffff;
}

.mention-item-avatar--user {
    background: linear-gradient(135deg, #526177 0%, #3f4d61 100%);
    color: #ffffff;
}

.mention-name {
    font-size: 14px;
    font-weight: 600;
    color: #1b1b1b;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mention-username {
    font-size: 12px;
    color: #7a7a7a;
    line-height: 1.1;
    font-weight: 400;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Inserted mention in comment text */
.mention-user {
    display: inline-block;
    color: #A81700;
    font-weight: 700;
    background: linear-gradient(135deg, #fff5f5 0%, #ffe8e8 100%);
    padding: 3px 10px;
    border-radius: 6px;
    border: 1px solid #ffdddd;
    cursor: default;
    user-select: none;
    transition: all 0.2s ease;
    font-size: 0.95em;
    line-height: 1.2;
    vertical-align: baseline;
    box-shadow: 0 1px 3px rgba(168, 23, 0, 0.1);
}

.mention-user:hover {
    background: linear-gradient(135deg, #ffe8e8 0%, #ffd8d8 100%);
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(168, 23, 0, 0.15);
}

/* Rendered mention links in saved comments */
.mention-link {
    color: #007bff !important;
    text-decoration: none !important;
    font-weight: 500;
    transition: color 0.2s ease;
}

.mention-link:hover {
    color: #0056b3 !important;
    text-decoration: underline !important;
}

/* Old format mentions without links */
.mention-text {
    color: #007bff !important;
    font-weight: 500;
}

/* Mentions inside reply forms */
.reply_comment .mention-user,
.reply-comment .mention-user,
.post_comment .mention-user,
.next_comment_area .mention-user {
    display: inline-block;
    color: #A81700;
    font-weight: 700;
    background: linear-gradient(135deg, #fff5f5 0%, #ffe8e8 100%);
    padding: 2px 8px;
    border-radius: 4px;
    border: 1px solid #ffdddd;
    cursor: default;
    user-select: none;
    transition: all 0.2s ease;
    font-size: 0.9em;
    line-height: 1.1;
    vertical-align: middle;
    box-shadow: 0 1px 3px rgba(168, 23, 0, 0.1);
}

.reply_comment .mention-user:hover,
.reply-comment .mention-user:hover,
.next_comment_area .mention-user:hover {
    background: linear-gradient(135deg, #ffe8e8 0%, #ffd8d8 100%);
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(168, 23, 0, 0.15);
}

.post-comment,
.post-comment:focus,
.reply-comment,
.reply-comment:focus{
    height: auto;
    border: 2px solid #666666 !important;
    border-radius: 4px !important;
    outline: none;
    padding: 10px;
    transition: border 0.3s;
}

.comment-file-upload {
    margin-right: 10px;
}
.comment-file-upload .upload-image-btn {

}
.post-comment-submit {
    margin-bottom: 0;
}

.new-comment-bottom .comment-file-names {
    position: absolute;
    left: 0;
    display: flex;
    justify-content: start;
}
.new-comment-bottom .comment-file-names > div {
    position: relative;
    display: flex;
    justify-content: center;
    width: 50px;
    height: 50px;
    margin-right: 10px;
}
.new-comment-bottom .comment-file-names > div > img{
    width: 50px;
    height: 50px;
    object-fit: cover;
    object-position: center;
}
.new-comment-bottom .comment-file-names > div > .remove-comment-image {
    position: absolute;
    top: 1px;
    right: 1px;
    width: 16px;
    height: 16px;
}
.remove-comment-image::before,
.remove-comment-image:after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 3px;
    background-color: #A81700;
    transform-origin: center;
}
.remove-comment-image::before {
    transform: translate(-50%, -50%) rotate(45deg);
}
.remove-comment-image:after {
    transform: translate(-50%, -50%) rotate(-45deg)
}

.comments-section-title {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin-bottom: 20px;
    text-align: center;
}
.comment-date {
    font-size: 12px;
    color: var(--text-light);
}
.comment-author {
    line-height: 16px;
}
.reply-form {
    padding: 8px 16px;
}
.comment-file-answer {
    margin-top: 5px;
}

.d2-spinner {
    animation: d2-rotate 1s linear infinite;
    vertical-align: middle;
}
.d2-spinner .path {
    stroke-linecap: round;
    animation: d2-dash 1.5s ease-in-out infinite;
}
@keyframes d2-rotate {
    100% { transform: rotate(360deg); }
}
@keyframes d2-dash {
    0% { stroke-dasharray: 1, 150; stroke-dashoffset: 0; }
    50% { stroke-dasharray: 90, 150; stroke-dashoffset: -35; }
    100% { stroke-dasharray: 90, 150; stroke-dashoffset: -124; }
}

/* Links in comment content */
.comment-content .text-link,
.reply-content .text-link {
    color: var(--primary-color, #A81700);
    text-decoration: underline;
    word-break: break-all;
    transition: color 0.2s ease;
}
.comment-content .text-link:hover,
.reply-content .text-link:hover {
    color: var(--secondary-color, #333333);
}
