.comment-form {
    width: 840px;
    display: flex;
    height: 50px;
    flex-direction: column;
    justify-content: flex-end;
    align-items: flex-start;
    padding: 10px 15px;
    margin: 8px 0;
    box-sizing: border-box;
    background-color: #121212;
    border: 2px solid rgba(255, 255, 255, 0.14);
    border-radius: 12px;
    transition: height 0.2s ease;
    overflow: hidden;
    gap: 10px;
}

.textarea-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column-reverse;
    position: relative;
    width: 87%;
}

.comment-input {
    position: relative !important;
    z-index: 1 !important;
    width: 100% !important;
    height: 30px;
    max-height: -webkit-fill-available;
    line-height: 1.4;
    padding: 8px 10px;
    box-sizing: border-box;
    border: none !important;
    outline: none !important;
    resize: none !important;
    font-size: 14px !important;
    font-family: inherit !important;
    background: transparent !important;
    color: #fff !important;
    display: block !important;
    border-radius: 0px !important;
    overflow-y: hidden;
    white-space: pre-wrap; /* Убираем скролл */
}

.comment-input[contenteditable="true"] {
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: pre-wrap;
    cursor: text;
}

#commentText[data-placeholder]:empty:before {
  content: attr(data-placeholder);
  color: rgb(128, 128, 128);
}


.spoiler {
    position: relative;
    display: inline-block;
    cursor: pointer;
}

.spoiler .spoiler-content {
    display: inline-block;
    filter: blur(5px);
    transition: filter 0.3s ease;
}

.spoiler.revealed .spoiler-content {
    filter: blur(0);
}

.spoiler .particle {
    position: absolute;
    background-color: white;
    border-radius: 50%;
    opacity: 0.7;
    animation: particleAnimation 1s ease-out forwards;
}

@keyframes particleAnimation {
    0% {
        transform: scale(0) translate(0, 0);
        opacity: 0.7;
    }
    50% {
        transform: scale(1) translate(20px, -20px);
        opacity: 0.5;
    }
    100% {
        transform: scale(0) translate(40px, -40px);
        opacity: 0;
    }
}

/* Контейнер с кнопками */
.comment-controls {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    width: 100%;
    gap: 10px;
}

.comment-left-buttons,
.comment-right-buttons {
    display: flex;
    gap: 10px;
}

/* Кнопки */
.emoji-button,
.media-button,
.send-button-c {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
}

.emoji-button img,
.media-button img {
    width: 24px;
    height: 24px;
}

.send-button-c img {
    width: 27px;
    height: 27px;
}

/* Меню для форматирования текста */
.text-formatting-menu {
    display: none;
    position: absolute;
    background: #1e1e1e;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    padding: 6px;
    gap: 6px;
    z-index: 1000;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.text-formatting-menu button {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
}

.text-formatting-menu img {
    width: 20px;
    height: 20px;
}

/* Кнопки для форматирования */
.text-style-button {
    position: relative;
}

.text-style-button img {
    width: 24px;
    height: 24px;
}

.quote-button,
.emoji-button,
.media-button-c {
    background: none;
    display: flex;
    align-items: center;
    border: none;
    cursor: pointer;
    padding: 0;
}


.quote-button img,
.emoji-button img,
.media-button img {
    width: 24px;
    height: 24px;
}

.comment-previews {
    display: none;
    flex-wrap: wrap;
    gap: 10px;
    width: 100%;
}

.comment-previews.active {
    display: flex;
}

.preview-item {
    position: relative;
    width: 80px;
    height: 80px;
    border-radius: 12px;
    background: #1e1e1e;
    flex-shrink: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
    will-change: transform;
    cursor: grab;
    user-select: none;
    opacity: 1;
}

.preview-item.dragging {
    opacity: 0.5;
    -webkit-grabbing
    cursor: grabbing !important;
}

.preview-item img,
.preview-item video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    pointer-events: none;
    user-drag: none;
    -webkit-user-drag: none;
    border-radius: 12px;
}

.remove-preview {
    position: absolute;
    top: -6px;
    right: -6px;
    background: #fff;
    border: 3px solid #121212;
    color: #121212;
    font-size: 14px;
    font-weight: 600;
    line-height: 1;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    justify-content: center;
}

/* Удаление */
.preview-item.removing {
    animation: removeItem 300ms forwards;
}

@keyframes removeItem {
    0% {
        opacity: 1;
        transform: scale(1);
    }
    100% {
        opacity: 0;
        transform: scale(0.5) rotate(5deg);
    }
}

/* Прием drag-n-drop файлов */
.comment-form.drag-over {
    outline: 2px dashed #666;
    outline-offset: -6px;
    background-color: rgba(255, 255, 255, 0.03);
    cursor: default !important;
}

.preview-item::after {
    pointer-events: none;
}
