/* 
 * Comments & Threads
 * Message threads, public comments, and chat bubbles.
 */

.thread-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.thread-applicant-name {
    font-weight: bold;
    max-width: 180px;
    display: inline-block;
    vertical-align: middle;
}

.thread-meta {
    font-size: 0.85em;
    color: #888;
}

.thread-excerpt {
    display: block;
    margin-top: 2px;
}

span.thread-excerpt {
    color: #666;
    text-decoration: none !important;
}

a.thread-excerpt {
    color: #337ab7;
    text-decoration: underline !important;
}

a.thread-excerpt:hover {
    color: #23527c;
}

.thread-badges {
    margin-top: 5px;
}

.thread-badges .badge,
.thread-badges .label {
    margin-right: 4px;
    font-size: 0.8em;
    padding: 2px 5px;
}

.thread-actions {
    margin-top: 5px;
    text-align: right;
}

.thread-actions .btn-link {
    font-size: 0.9em;
    padding: 0 5px;
    color: #999;
    text-decoration: none;
}

.thread-actions .btn-link:hover {
    color: #d9534f;
}

@media (max-width: 767px) {
    .thread-item {
        padding-left: 20px !important;
    }

    .thread-applicant-name {
        max-width: 120px;
    }
}

/* ── Messenger-style message thread ── */
.msg-thread {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 15px 0;
    width: 100%;
    min-width: 0;
    overflow: hidden;
}

.msg-row {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    max-width: 80%;
}

.msg-row.is-mine {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.msg-row.is-theirs {
    align-self: flex-start;
    flex-direction: row;
}

.msg-bubble {
    padding: 10px 14px;
    border-radius: 18px;
    word-break: break-word;
    line-height: 1.5;
    font-size: 14px;
}

.msg-row.is-mine .msg-bubble {
    background: #d9edf7;
    border-bottom-right-radius: 4px;
    color: #2a5f7a;
}

.msg-row.is-theirs .msg-bubble {
    background: #f0f0f0;
    border-bottom-left-radius: 4px;
    color: #333;
}

.msg-time {
    font-size: 0.7em;
    color: #999;
    white-space: nowrap;
    flex-shrink: 0;
    align-self: flex-end;
    padding-bottom: 2px;
}

.msg-thread-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
    border-bottom: 1px solid #eee;
    margin-bottom: 5px;
    clear: both;
    overflow: hidden;
}

.msg-thread-header .counterpart-name {
    font-weight: bold;
    font-size: 1.1em;
}

.msg-moderated {
    align-self: center;
    max-width: 90%;
    text-align: center;
    font-size: 0.85em;
    color: #999;
    padding: 4px 0;
}

/* Ignore toggle button in thread header */
.msg-ignore-btn {
    font-size: 0.8em;
    padding: 2px 10px;
    border-radius: 12px;
    border: 1px solid #ccc;
    background: #fff;
    color: #888;
    cursor: pointer;
    transition: all 0.2s;
    margin-left: auto;
}

.msg-ignore-btn:hover {
    background: #f5f5f5;
}

.msg-ignore-btn.is-ignored {
    background: #f2dede;
    border-color: #d9534f;
    color: #d9534f;
}

/* Messenger-style reply form */
.msg-reply-bar {
    display: flex;
    gap: 8px;
    align-items: flex-end;
    padding: 10px 0;
    border-top: 1px solid #eee;
    margin-top: 10px;
}

.msg-reply-bar textarea {
    flex: 1;
    border: 1px solid #ddd;
    border-radius: 18px;
    padding: 8px 14px;
    font-size: 14px;
    resize: vertical;
    line-height: 1.4;
    outline: none;
}

.msg-reply-bar textarea:focus {
    border-color: #66afe9;
    box-shadow: 0 0 0 2px rgba(102, 175, 233, 0.2);
}

.msg-reply-bar .msg-send-btn {
    background: #5cb85c;
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 38px;
    height: 38px;
    font-size: 16px;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.msg-reply-bar .msg-send-btn:hover {
    background: #449d44;
}

.msg-reply-caution {
    font-size: 0.75em;
    color: #999;
    padding: 4px 0 0;
}

@media (max-width: 767px) {
    .msg-row {
        max-width: 90%;
    }
}

/* ── Public comment cards ── */
.comment-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.comment-card {
    padding: 12px 14px;
    border-bottom: 1px solid #eee;
}

.comment-card-header {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
    flex-wrap: wrap;
}

.comment-card-header .comment-serial {
    font-size: 0.8em;
    color: #aaa;
}

.comment-card-header .comment-author {
    font-weight: 600;
    font-size: 0.9em;
    color: #333;
}

.comment-card-header .comment-poster-badge {
    display: inline-block;
    font-size: 0.75em;
    padding: 1px 6px;
    border-radius: 3px;
    background: #e8f5e9;
    color: #2e7d32;
    font-weight: 600;
}

.comment-card-header .comment-time {
    margin-left: auto;
    font-size: 0.8em;
    color: #999;
}

.comment-card-body {
    font-size: 13px;
    line-height: 1.6;
    padding: 6px 0 6px 12px;
    border-left: 3px solid #e0e0e0;
    color: #444;
}

.comment-card.is-poster .comment-card-body {
    border-left-color: #a5d6a7;
}

.comment-card-body.is-moderated {
    color: #999;
    font-style: italic;
    border-left-color: #eee;
}

.comment-card-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 4px;
}

.comment-card-actions a {
    font-size: 0.8em;
    color: #999;
    text-decoration: none;
}

.comment-card-actions a:hover {
    color: #555;
}

/* Public comment form */
.comment-form-public {
    border: 1px solid #ffe082;
    border-radius: 8px;
    background: #fffde7;
    padding: 14px 18px;
    margin-top: 15px;
}

.comment-form-public .public-label {
    font-size: 0.85em;
    color: #e65100;
    font-weight: 600;
    margin-bottom: 8px;
}

.comment-form-public textarea {
    width: 100%;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 14px;
    resize: vertical;
    line-height: 1.5;
    outline: none;
    box-sizing: border-box;
}

.comment-form-public textarea:focus {
    border-color: #ffb74d;
    box-shadow: 0 0 0 2px rgba(255, 183, 77, 0.2);
}

.comment-form-public .comment-form-caution {
    font-size: 0.75em;
    color: #888;
    margin-top: 6px;
    line-height: 1.5;
}

.comment-form-public .comment-submit-btn {
    background: #ef6c00;
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 6px 18px;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s;
    margin-top: 8px;
}

.comment-form-public .comment-submit-btn:hover {
    background: #e65100;
}

.comment-section-title {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 15px 0 10px;
    font-size: 1.1em;
    font-weight: 600;
}

/* ===== Redesigned Public Comments ===== */

/* Excerpt View */
.comment-excerpt-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 15px;
}

.comment-excerpt-item {
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

.comment-excerpt-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.comment-excerpt-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
    color: #888;
    margin-bottom: 4px;
}

.comment-excerpt-author {
    font-weight: bold;
    color: #555;
}

.comment-excerpt-author.author-owner {
    color: #2e7d32;
}

.comment-excerpt-author .owner-badge {
    background-color: #e8f5e9;
    color: #2e7d32;
    padding: 1px 4px;
    border-radius: 3px;
    font-size: 10px;
    margin-right: 4px;
}

.comment-excerpt-body {
    font-size: 12px;
    line-height: 1.5;
    color: #444;
}

.comment-excerpt-body .is-moderated-text {
    color: #999;
    font-style: italic;
}

.comment-excerpt-empty {
    font-size: 12px;
    color: #666;
    line-height: 1.6;
}

/* Bubble View */
.comment-bubble-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
    padding: 15px 0;
    width: 100%;
}

.comment-thread-group {
    display: flex;
    flex-direction: column;
}

.comment-thread-replies {
    margin-left: 30px;
    border-left: 2px solid #e8e8e8;
    padding-left: 15px;
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.comment-bubble-row {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    max-width: 80%;
}

.comment-bubble-row.is-owner {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.comment-bubble-row.is-other {
    align-self: flex-start;
    flex-direction: row;
}

.comment-bubble {
    padding: 12px 16px;
    border-radius: 18px;
    word-break: break-word;
    line-height: 1.5;
    font-size: 14px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.comment-bubble-row.is-owner .comment-bubble {
    background: #e8f5e9;
    border-bottom-right-radius: 4px;
    color: #1b5e20;
    border: 1px solid #c8e6c9;
}

.comment-bubble-row.is-other .comment-bubble {
    background: #e3f2fd;
    border-bottom-left-radius: 4px;
    color: #0d47a1;
    border: 1px solid #bbdefb;
}

.comment-bubble-header {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
    font-size: 0.85em;
    flex-wrap: wrap;
}

.comment-bubble-header .comment-serial {
    opacity: 0.7;
}

.comment-name-badge {
    font-weight: bold;
    padding: 1px 6px;
    border-radius: 4px;
}

.comment-name-badge.is-owner {
    background: #c8e6c9;
    color: #1b5e20;
}

.comment-name-badge.is-owner a {
    color: #1b5e20;
    text-decoration: underline;
}

.comment-name-badge.is-other {
    background: #bbdefb;
    color: #0d47a1;
}

.comment-name-badge.is-other a {
    color: #0d47a1;
    text-decoration: underline;
}

.comment-bubble-header .owner-indicator-badge {
    background: #2e7d32;
    color: #fff;
    font-size: 0.8em;
    padding: 1px 5px;
    border-radius: 3px;
    font-weight: bold;
}

.comment-bubble-body {
    margin-bottom: 6px;
}

.comment-bubble-body .is-moderated-text {
    opacity: 0.7;
    font-style: italic;
}

.comment-bubble-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    border-top: 1px dashed rgba(0,0,0,0.1);
    padding-top: 6px;
    margin-top: 6px;
}

.comment-bubble-actions a {
    font-size: 0.8em;
    text-decoration: none;
    font-weight: bold;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.comment-bubble-actions a:hover {
    opacity: 1;
}

.comment-bubble-row.is-owner .comment-bubble-actions a {
    color: #2e7d32;
}

.comment-bubble-row.is-other .comment-bubble-actions a {
    color: #1565c0;
}

.comment-bubble-time {
    font-size: 0.7em;
    color: #999;
    white-space: nowrap;
    flex-shrink: 0;
    align-self: flex-end;
    padding-bottom: 2px;
}

.comment-list-empty {
    padding: 20px;
    text-align: center;
    color: #888;
    background: #f9f9f9;
    border-radius: 8px;
    border: 1px dashed #ddd;
}

.comment-you-badge {
    font-size: 0.75em;
    font-weight: normal;
    color: #0d47a1;
    background: #e3f2fd;
    border: 1px solid #bbdefb;
    border-radius: 3px;
    padding: 0px 4px;
    margin-left: 5px;
    display: inline-block;
    vertical-align: middle;
}
.comment-bubble-row.is-owner .comment-you-badge {
    color: #1b5e20;
    background: #e8f5e9;
    border: 1px solid #c8e6c9;
}

@media (max-width: 767px) {
    .comment-bubble-row {
        max-width: 95%;
    }
}

/* Reply target banner styling matching the comment themes */
.reply-target-banner {
    margin-bottom: 10px;
    padding: 8px 12px;
    font-size: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 4px;
}

.reply-target-banner.is-owner {
    background-color: #e8f5e9;
    color: #1b5e20;
    border: 1px solid #c8e6c9;
}

.reply-target-banner.is-other {
    background-color: #e3f2fd;
    color: #0d47a1;
    border: 1px solid #bbdefb;
}

.reply-target-banner .close {
    line-height: 1;
    float: none;
    opacity: 0.7;
    transition: opacity 0.2s;
    background: none;
    border: none;
    font-size: 16px;
    font-weight: bold;
    padding: 0;
    cursor: pointer;
}

.reply-target-banner.is-owner .close {
    color: #1b5e20;
}

.reply-target-banner.is-other .close {
    color: #0d47a1;
}

.reply-target-banner .close:hover {
    opacity: 1;
}

