/* Comment System Styles */

.comment-section {
    margin: 20px 0;
    border-top: 1px solid #eaeaea;
    padding-top: 15px;
}

.comment-count {
    font-size: 14px;
    color: #666;
    margin-bottom: 15px;
}

.comment-item {
    display: flex;
    margin-bottom: 15px;
    position: relative;
}

.reply-item {
    margin-left: 30px;
}

.comment-avatar {
    width: 40px;
    height: 40px;
    margin-right: 2px !important;
    flex-shrink: 0;
}

.comment-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.comment-content {
    flex: 1;
    background-color: #f5f5f5;
    border-radius: 18px;
    padding: 10px 10px 10px 5px !important;
    position: relative;
}

.comment-header {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 5px;
}

.comment-author {
    font-weight: 600;
    margin-right: 8px;
}

.comment-time {
    font-size: 12px;
    color: #666;
}

.edited-indicator {
    font-size: 12px;
    color: #888;
    margin-left: 5px;
}

.comment-text {
    word-break: break-word;
    line-height: 1.4;
}

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

.comment-image img {
    max-width: 100%;
    max-height: 300px;
    border-radius: 8px;
    cursor: pointer;
}

.comment-video video {
    max-width: 100%;
    max-height: 300px;
    border-radius: 8px;
}

.comment-actions {
    margin-top: 8px;
    display: flex;
}

.comment-reactions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* Reaction summary icons (shown in summary) */
.reaction-summary-icon {
    width: 14px;
    height: 14px;
    margin-right: 2px;
    vertical-align: middle;
}

/* Reaction icon in button (when user has reacted) */
.reaction-icon-small {
    width: 14px;
    height: 14px;
    vertical-align: middle;
    margin-right: 3px;
}

/* Comment reaction summary - inline after like button */
.comment-reaction-summary {
    display: inline-flex;
    align-items: center;
    font-size: 12px;
    color: #65676B;
    margin-left: 4px;
}

.comment-reaction-summary .reaction-summary-icons {
    display: inline-flex;
    align-items: center;
}

.comment-reaction-summary .reaction-summary-total {
    margin-left: 3px;
    font-size: 12px;
}


.btn-reaction,
.btn-delete-comment,
.btn-reply {
    background: none;
    border: none;
    padding: 5px 8px;
    font-size: 13px;
    color: #555;
    cursor: pointer;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.btn-reaction:hover,
.btn-delete-comment:hover,
.btn-reply:hover {
    background-color: #e9e9e9;
}

.btn-reaction.active {
    color: #1877f2;
    font-weight: 600;
}

.btn-delete-comment {
    color: #dc3545;
}

.btn-view-replies,
.btn-view-all-comments {
    border: none;
    background: none;
    color: #1877f2;
    cursor: pointer;
    font-size: 13px;
    padding: 4px 8px;
    border-radius: 4px;
}

.btn-view-replies:hover,
.btn-view-all-comments:hover {
    background-color: rgba(24, 119, 242, 0.1);
}

.view-more-comments {
    margin: 10px 0 15px;
    text-align: center;
}

.replies-container {
    margin-top: 10px;
    margin-left: 20px;
    display: block;
    border: none !important;
}

.replies-container.hidden {
    display: none !important;
}

/* Comment Form */
.comment-form-container,
.reply-form-container {
    margin-top: 15px;
}

.comment-form {
    width: 100%;
}

.comment-input-wrapper {
    display: flex;
    align-items: flex-start;
}

.comment-input-container {
    flex: 1;
    position: relative;
}

.comment-input {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 20px;
    resize: none;
    font-family: inherit;
    font-size: 14px;
    outline: none;
    transition: border-color 0.3s;
    min-height: 40px;
    max-height: 120px;
    overflow-y: auto;
    display: block;
}

.comment-input:focus {
    border-color: #1877f2;
}

.comment-form-actions {
    position: absolute;
    top: 50% !important;
    transform: translateY(-50%);
    right: 10px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.btn-attach {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background-color: #f0f2f5;
    color: #65676b;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.btn-attach:hover {
    background-color: #e4e6eb;
    color: #1877f2;
}

.btn-submit-comment {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background-color: #1877f2;
    color: white;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.btn-submit-comment:hover {
    background-color: #166fe5;
    transform: scale(1.05);
}

.btn-submit-comment:disabled {
    background-color: #ccc;
    cursor: not-allowed;
    transform: none;
}

/* Media preview */
.comment-media-preview {
    margin-top: 10px;
    margin-bottom: 10px;
}

.media-items {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.media-preview-item {
    position: relative;
    width: 100px;
    height: 100px;
    border-radius: 8px;
    overflow: hidden;
}

.media-preview-item img,
.media-preview-item video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.btn-remove-media {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(0, 0, 0, 0.6);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-remove-media:hover {
    background-color: rgba(0, 0, 0, 0.8);
}

.latest-comments-container,
.all-comments-container {
    margin-bottom: 15px;
}

.no-comments {
    text-align: center;
    padding: 15px;
    color: #888;
    font-style: italic;
}

.load-more-container {
    margin: 10px 0 15px;
    text-align: center;
}

.btn-load-more {
    border: 1px solid #1877f2;
    background: none;
    color: #1877f2;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.btn-load-more:hover {
    background-color: rgba(24, 119, 242, 0.1);
}

.btn-load-more:disabled {
    border-color: #ccc;
    color: #888;
    cursor: not-allowed;
}

/* Media preview */
.comment-media-preview {
    margin-top: 10px;
    display: none;
    background-color: #f9f9f9;
    border-radius: 12px;
    padding: 10px;
}

/* Comment Modal Styles */
#commentModal .modal-dialog {
    max-width: 700px;
}

#commentModal .modal-body {
    overflow-y: auto;
    padding-bottom: 0;
}

#commentModal .modal-footer {
    padding-top: 10px;
    border-top: 1px solid #eaeaea;
    position: sticky;
    bottom: 0;
    background: white;
    z-index: 1;
}

#modalPostContent {
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eaeaea;
}

.modal-comment-section {
    margin-top: 15px;
}

.modal-comments-container {
    margin-bottom: 15px;
}

.load-previous-container {
    position: sticky;
    top: 0;
    background: white;
    z-index: 1;
    padding: 10px 0;
    margin-top: -10px;
    border-bottom: 1px solid #f5f5f5;
}

.btn-load-previous {
    background-color: #f8f9fa;
    border-color: #ddd;
    color: #555;
    font-size: 13px;
    padding: 5px 15px;
    border-radius: 20px;
}

.btn-load-previous:hover {
    background-color: #e9ecef;
    border-color: #ccc;
    color: #333;
}

.modal-comment-form-container {
    padding: 10px 0;
}

.modal-comment-form .comment-input-wrapper {
    display: flex;
    align-items: flex-start;
}

.modal-comment-form .comment-avatar {
    margin-right: 10px;
    width: 36px;
    height: 36px;
}

.modal-comment-form .comment-input-container {
    flex: 1;
}

/* Comment count display */
.comment-count-display {
    display: inline-flex;
    align-items: center;
    margin-right: 15px;
    margin-left: 5px;
    cursor: pointer;
    padding: 3px 8px;
    border-radius: 4px;
    transition: background-color 0.2s;
    font-size: 0.9rem;
    color: #555;
}

.comment-count-display i {
    margin-right: 5px;
    font-size: 1.1em;
}

.comment-count-display:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

/* Modal styling improvements */
.modal-post-content {
    max-width: 100%;
    border: none;
    box-shadow: none;
    padding: 0;
    margin: 0 0 20px 0;
    border-bottom: 1px solid #eee;
    padding-bottom: 15px;
}

.modal-comment-section {}

.modal-comments-container {
    padding-right: 5px;
}

/* Comment count in likes-info */
.likes-info .comment-count-display {
    cursor: pointer;
    transition: opacity 0.2s;
}

.likes-info .comment-count-display:hover {
    opacity: 0.8;
}

.likes-info .comment-count-display i {
    margin-right: 3px;
}

.float-end {
    float: right !important;
}

/* ================================
   FACEBOOK-STYLE REPLY THREADING
   ================================ */

/* Replies container with vertical thread line */
.replies-container {
    position: relative;
    margin-top: 10px;
    margin-left: 40px;
    padding-left: 20px;
}

/* Vertical thread line removed - switched to background style */
.replies-container::before {
    display: none;
}

.replies-container.hidden {
    display: none !important;
}

/* Reply item styling - ensure flex layout stays on one row */
.reply-item {
    display: flex !important;
    flex-wrap: nowrap !important;
    align-items: flex-start;
    position: relative;
    margin-left: 0 !important;
    padding-left: 0 !important;
    border-left: none !important;
    margin-bottom: 10px;
}

/* Reply item styling - Full-width with background and dashed border */
.reply-item {
    background-color: #f8f9fa;
    border: 1px dashed #dee2e6;
    border-radius: 0;
    padding: 10px 0;
    margin-bottom: 12px;
    margin-left: 0;
    margin-right: 0;
    width: 100%;
    box-sizing: border-box;
}

/* Horizontal connectors removed */
.reply-item::before {
    display: none;
}

/* Nested reply styling (replies to replies) */
.nested-reply-item {
    margin-left: 0;
}

/* Hide redundant badges - rely on visual indentation */
.reply-badge {
    display: none !important;
}

/* Reply form inside comment-content */
.comment-content .reply-form-container {
    width: 100%;
    margin-top: 10px;
    margin-bottom: 10px;
    border-top: 1px solid #f0f0f0;
    padding-top: 10px;
}

/* Replies container inside comment-content - full width aligned left */
.comment-content .replies-container {
    width: 100%;
    margin-top: 15px;
    margin-left: 0;
    margin-right: 0;
    padding-left: 0;
    padding-right: 0;
    border-top: none;
    display: block;
}

/* Remove redundant vertical line rules */
.replies-container .replies-container::before {
    display: none;
}

.comment-content .replies-container.hidden {
    display: none !important;
}

.btn-view-replies {
    color: #65676B;
    background: none;
    border: none;
    padding: 4px 8px;
    font-size: 0.85em;
    font-weight: 600;
    cursor: pointer;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.btn-view-replies:hover {
    background-color: #f0f2f5;
    text-decoration: none;
}

/* Smaller avatar for replies */
.reply-item .comment-avatar {
    width: 28px;
    height: 28px;
    min-width: 28px;
    flex-shrink: 0;
    margin-right: 2px !important;
}

.reply-item .comment-avatar img {
    width: 28px;
    height: 28px;
}

/* Smaller comment bubble for replies - ensure it takes remaining space */
.reply-item .comment-content {
    flex: 1;
    min-width: 0;
    background-color: #f8f9fa;
    padding: 6px 10px 6px 5px !important;
}

/* Ensure comment header in replies stays on one line */
.reply-item .comment-header {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 6px;
    overflow: visible;
}

.reply-item .comment-author {
    white-space: nowrap;
    font-size: 13px;
}

.reply-item .comment-time {
    white-space: nowrap;
    font-size: 11px;
}

/* More button in replies - ensure right alignment */
.reply-item .comment-more-options {
    margin-left: auto;
    flex-shrink: 0;
}