/* ===== ОСНОВНЫЕ СТИЛИ ===== */
.comments-list {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    color: #2d3748;
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 15px;
}

/* ===== КАРТОЧКА КОММЕНТАРИЯ ===== */
.comment.card {
    border: none;
    border-radius: 10px;
    background-color: #fff;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    margin-bottom: 1rem;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.comment.card:hover {
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
    transform: translateY(-3px);
}

.card-body {
    padding: 1rem;
}

/* ===== ЗАГОЛОВОК КОММЕНТАРИЯ ===== */
.comment-header {
    display: flex;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #f1f5f9;
}

.comment-author {
    font-weight: 600;
    color: #334155;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: 10px;
}

.comment-date {
    font-size: 0.8rem;
    color: #94a3b8;
    margin-left: auto;
}

/* ===== СОДЕРЖИМОЕ КОММЕНТАРИЯ ===== */
.comment-content {
    padding: 0.75rem 0;
    font-size: 0.95rem;
    line-height: 1.7;
    color: #475569;
}

/* ===== ФУТЕР КОММЕНТАРИЯ ===== */
.comment-footer {
    display: flex;
    justify-content: flex-end;
    padding-top: 1rem;
    margin-top: 0.75rem;
    border-top: 1px solid #f1f5f9;
    position: relative;
}

/* ===== КНОПКА "ОТВЕТИТЬ" ===== */
.reply-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.82rem;
    padding: 0.4rem 1rem;
    border-radius: 8px;
    background-color: #f8f8f9;
    color: #475569;
    border: 1px solid #e2e8f0;
    text-decoration: none;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    width: auto;
    min-width: 90px;
    white-space: nowrap;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
    font-weight: 500;
}

.reply-link:hover {
    background-color: #eff6ff;
    color: #2563eb;
    border-color: #bfdbfe;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    transform: translateY(-1px);
}

.reply-link:active {
    transform: translateY(0);
}

.reply-link:hover::after {
    transform: translateX(2px);
}

/* ===== ОТВЕТЫ (ВЛОЖЕННЫЕ КОММЕНТАРИИ) ===== */
.replies {
    margin-top: 1.25rem;
    padding-left: 2rem;
    border-left: 2px solid #e2e8f0;
    margin-left: 1.5rem;
}

.reply.card {
    background-color: #f8f8f9;
    border: none;
    border-radius: 10px;
    margin-bottom: 1rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.reply .card-body {
    padding: 1rem;
}

.reply .comment-header {
    padding-bottom: 0.3rem;
    margin-bottom: 0.3rem;
}

.reply .comment-author {
    font-size: 0.85rem;
    color: #475569;
}

.reply .comment-author::before {
    background: #94a3b8;
}

.reply .comment-date {
    font-size: 0.75rem;
}

.reply .comment-content {
    font-size: 0.88rem;
    padding: 0.3rem 0;
    color: #64748b;
}

/* ===== ФОРМА КОММЕНТАРИЯ ===== */
#comment-form {
    background: #fff;
    padding: 1.75rem;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    margin-bottom: 1rem;
}

#comment-form *{
    box-sizing: border-box;
}

#comment_content {
    width: 100%;
    min-height: 120px;
    padding: 0.9rem;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.95rem;
    transition: all 0.25s ease;
    resize: vertical;
    background: #f8f8f9;
    line-height: 1.6;
}

#comment_content:focus {
    outline: none;
    border-color: #3fa6c5;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
    background: #fff;
}

/* Кнопка отправки */
button[type="submit"] {
    background-color: #3fa6c5;
    color: white;
    border: none;
    padding: 0.65rem 1.5rem;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    margin-top: 0.75rem;
    font-size: 0.95rem;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

button[type="submit"]:hover {
    background-color: #70c3db;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.08);
}

button[type="submit"]:active {
    transform: translateY(0);
}

/*    КНОПКИ РЕДАКТИРОВАНИЯ     */
button.save-edit,
button.cancel-edit,
button.edit-btn
{
    width: auto;

    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.82rem;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    background-color: #f8f8f9;
    color: #475569;
    border: 1px solid #e2e8f0;
    border-top-color: rgb(226, 232, 240);
    border-right-color: rgb(226, 232, 240);
    border-bottom-color: rgb(226, 232, 240);
    border-left-color: rgb(226, 232, 240);
    text-decoration: none;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    min-width: 90px;
    white-space: nowrap;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
    font-weight: 500;
}

button.save-edit:hover,
button.cancel-edit:hover,
button.edit-btn:hover
{
    background-color: #eff6ff;
    color: #2563eb;
    border-color: #bfdbfe;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    transform: translateY(-1px);
}

div.comment-edit textarea,
div.reply-edit textarea
{
    width: 100%;
    min-height: 120px;
    padding: 0.9rem;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.95rem;
    transition: all 0.25s ease;
    resize: vertical;
    background: #f8f8f9;
    line-height: 1.6;
    box-sizing: border-box; /* Учитываем padding в общей ширине */
}

div.reply-edit textarea
{
    background-color: #FFFFFF;
}

.comment-edit {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.edit-textarea {
    width: 100%;
}

.comment-edit-buttons {
    margin-top: 10px;
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

/* PAGINATION */
.pagination {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
}

.page-item {
    list-style: none;
}

.page-link {
    display: block;
    padding: 0.5rem 0.75rem;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    color: #3b82f6;
    text-decoration: none;
    transition: all 0.2s ease;
    font-size: 0.9rem;
}

.page-link:hover {
    background-color: #f1f5f9;
    border-color: #bfdbfe;
}

.page-item.active .page-link {
    background-color: #3b82f6;
    color: white;
    border-color: #3b82f6;
}

.page-item.disabled .page-link {
    color: #94a3b8;
    pointer-events: none;
    opacity: 0.7;
}

/* ===== АНИМАЦИИ ===== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.comment.card {
    animation: fadeIn 0.35s ease-out forwards;
}

/* ===== АДАПТИВНОСТЬ ===== */
@media (max-width: 768px) {
    .replies {
        padding-left: 1.25rem;
        margin-left: 1rem;
    }

    .comment.card {
        border-radius: 10px;
    }

    .card-body {
        padding: 1.25rem;
    }

    #comment-form {
        padding: 1.5rem;
    }
}

@media (max-width: 480px) {
    .reply-link {
        padding: 0.35rem 0.8rem;
        font-size: 0.8rem;
        min-width: 80px;
    }

    .replies {
        padding-left: 1rem;
        margin-left: 0.75rem;
    }

    .comment-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }

    .comment-date {
        align-self: flex-end;
        margin-left: auto;
    }
}

/* аватарки */
.comment-avatar {
    flex-shrink: 0; /* Предотвращает сжатие */
    display: inline-flex; /* Для правильного выравнивания */
}

.avatar-container {
    /* Общие стили для контейнера */
    width: 32px;
    height: 32px;
    border-radius: 50%;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f0f0f0; /* Фон по умолчанию */
    position: relative;
}

/* Стили для аватара-изображения */
.avatar-container[style*="background-image"] {
    background-size: cover; /* Масштабирует с сохранением пропорций */
    background-repeat: no-repeat;
    background-position: center center;
}

/* Альтернативный вариант с тегом img (если решите вернуться к нему) */
.avatar-container img {
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
    object-fit: cover; /* Сохраняет пропорции */
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* Стили для инициала */
.avatar-initial {
    font-size: 18px;
    line-height: 1;
    color: white;
    font-weight: bold;
    text-align: center;
    user-select: none;
}
