.comments-section {
    max-width: 800px;
    margin: 20px auto;
    padding: 15px;
    border-radius: 8px;
}

.comments-title {
    font-size: 28px;
    margin-bottom: 20px;
    color: #333;
}

.messages {
    margin-bottom: 20px;
}

.message {
    padding: 12px 20px;
    border-radius: 4px;
    margin-bottom: 10px;
}

.message.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.message.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.comment-form-wrapper {
    background: white;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.comment-form-title {
    font-size: 20px;
    margin-bottom: 15px;
    color: #333;
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.comment-form-title::after {
    content: '▼';
    font-size: 14px;
    transition: transform 0.3s;
}

.comment-form-title.collapsed::after {
    transform: rotate(-90deg);
}

.comment-form-title:hover {
    color: #007bff;
}

.comment-form {
    transition: max-height 0.3s ease, opacity 0.3s ease;
    overflow: hidden;
}

.comment-form.hidden {
    max-height: 0;
    opacity: 0;
    margin: 0;
}

.comment-form .form-group {
    margin-bottom: 15px;
}

.comment-form label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #555;
}

.comment-input,
.comment-textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.3s;
}

.comment-input:focus,
.comment-textarea:focus {
    outline: none;
    border-color: #007bff;
}

.comment-input.readonly-field,
.comment-textarea.readonly-field {
    background-color: #f8f9fa;
    cursor: not-allowed;
    color: #6c757d;
}

.comment-textarea {
    resize: vertical;
    min-height: 120px;
}

.help-text {
    display: block;
    margin-top: 5px;
    font-size: 12px;
    color: #6c757d;
}

.error-message {
    color: #dc3545;
    font-size: 13px;
    margin-top: 5px;
}

.submit-button {
    background-color: #0056b3;
    color: white;
    padding: 12px 30px;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s;
    display: block;
    margin-left: auto;
}

.submit-button:hover {
    background-color: #004085;
}

.cancel-button {
    background-color: #6c757d;
    color: white;
    padding: 12px 30px;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s;
    margin-left: 10px;
}

.cancel-button:hover {
    background-color: #5a6268;
}

.comments-list {
    margin-top: 20px;
}

.comments-count {
    font-size: 20px;
    margin-bottom: 15px;
    color: #333;
}

.no-comments {
    text-align: center;
    color: #6c757d;
    font-style: italic;
    padding: 40px 0;
}

.comment {
    background: white;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 15px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.comment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

.comment-author {
    font-weight: 600;
    color: #333;
    font-size: 16px;
}

.comment-date {
    color: #6c757d;
    font-size: 13px;
}

.comment-body {
    color: #555;
    line-height: 1.6;
    margin-bottom: 10px;
}

.comment-actions {
    margin-top: 10px;
}

.reply-button {
    background-color: #0056b3;
    border: none;
    color: white;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    padding: 10px 24px;
    transition: background-color 0.3s;
    display: block;
    margin-left: auto;
    border-radius: 4px;
}

.reply-button:hover {
    background-color: #004085;
}

.reply-form-wrapper {
    margin-top: 15px;
    padding: 15px;
    border-radius: 6px;
    border-left: 4px solid #0056b3;
}

.reply-form-title {
    font-size: 16px;
    margin-bottom: 15px;
    color: #333;
}

.reply-form .form-group {
    margin-bottom: 15px;
}

.reply-form .comment-textarea {
    min-height: 100px;
}

.reply-form-buttons {
    display: flex;
    gap: 10px;
}

.comment-replies {
    margin-top: 15px;
    padding-left: 25px;
    border-left: 3px solid #0056b3;
}

.comment-reply {
    margin-bottom: 15px;
}

/* Счётчик символов */
.character-counter {
    text-align: right;
    font-size: 12px;
    color: #6c757d;
    margin-top: 5px;
}

.character-counter.counter-warning {
    color: #ffc107;
}

.character-counter.counter-danger {
    color: #dc3545;
}

/* Анимация появления комментариев */
.comment-fade-in {
    animation: fadeInUp 0.5s ease forwards;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Подсветка комментария */
.comment-highlight {
    background-color: #fff3cd;
    transition: background-color 0.5s ease;
}

/* Адаптивность */
@media (max-width: 768px) {
    .comments-section {
        padding: 10px;
    }
    
    .comment-form-wrapper {
        padding: 20px;
    }
    
    .comment-replies {
        padding-left: 15px;
    }
    
    .comment-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .comment-date {
        margin-top: 5px;
    }
    
    .reply-form-buttons {
        flex-direction: column;
    }
    
    .cancel-button {
        margin-left: 0;
        margin-top: 10px;
    }
}
