/* PMTNM Comments System Styles */

/* Comment Thread Container */
.comments-section {
    margin-top: 20px;
    padding: 20px 0;
    border-top: 1px solid #e9ecef;
}

/* Collapsed state: hide form and thread until expanded */
.comments-section.comments-collapsed .comment-form,
.comments-section.comments-collapsed .comments-thread {
    display: none;
}

.comments-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.comments-count {
    font-size: 0.95em;
    color: #6c757d;
}

.toggle-comments {
    background: none;
    border: none;
    color: #183661;
    cursor: pointer;
    font-size: 0.9em;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.toggle-comments:hover {
    background-color: #f8f9fa;
}

/* Comment Form */
.comment-form {
    background: #f8f9fa;
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    border: 1px solid #e9ecef;
}

.comment-form textarea {
    width: 100%;
    min-height: 60px;
    padding: 10px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-family: inherit;
    font-size: 0.9em;
    resize: vertical;
    box-sizing: border-box;
}

.comment-form textarea:focus {
    outline: none;
    border-color: #183661;
    box-shadow: 0 0 0 2px rgba(24, 54, 97, 0.1);
}

.comment-form-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 12px;
    flex-wrap: wrap;
    gap: 12px;
}

.comment-labels {
    display: flex;
    gap: 12px;
    align-items: center;
}

.label-option {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85em;
    cursor: pointer;
}

.label-option input[type="radio"] {
    margin: 0;
}

.comment-form-actions {
    display: flex;
    gap: 8px;
}

.btn-comment {
    background: #183661;
    color: white;
    border: none;
    padding: 6px 16px;
    border-radius: 4px;
    font-size: 0.85em;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-comment:hover {
    background: #0f2847;
}

.btn-comment:disabled {
    background: #6c757d;
    cursor: not-allowed;
}

.btn-comment-cancel {
    background: #6c757d;
    color: white;
    border: none;
    padding: 6px 16px;
    border-radius: 4px;
    font-size: 0.85em;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-comment-cancel:hover {
    background: #5a6268;
}

/* Comments List */
.comments-thread {
    margin-top: 16px;
}

.comment {
    border: 1px solid #e9ecef;
    border-radius: 8px;
    margin-bottom: 12px;
    background: white;
    overflow: hidden;
}

.comment-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 12px 16px 8px;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
}

.comment-author-info {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}

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

.comment-time {
    font-size: 0.8em;
    color: #6c757d;
}

.comment-label {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75em;
    font-weight: 500;
    white-space: nowrap;
}

.comment-label.further_reading {
    background: rgba(24, 54, 97, 0.1);
    color: #183661;
    border: 1px solid rgba(24, 54, 97, 0.2);
}

.comment-label.enthusiasm {
    background: rgba(253, 126, 20, 0.1);
    color: #fd7e14;
    border: 1px solid rgba(253, 126, 20, 0.2);
}

.comment-content {
    padding: 12px 16px;
    line-height: 1.5;
    font-size: 0.9em;
    color: #333;
}

.comment-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 16px;
    border-top: 1px solid #e9ecef;
    background: #f8f9fa;
}

.comment-engagement {
    display: flex;
    gap: 12px;
    align-items: center;
}

.like-button {
    background: none;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: #6c757d;
    font-size: 0.85em;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s;
}

.like-button:hover {
    background: rgba(220, 53, 69, 0.1);
    color: #dc3545;
}

.like-button.liked {
    color: #dc3545;
}

.like-button.liked .heart {
    color: #dc3545;
}

.heart {
    font-size: 1.1em;
    transition: color 0.2s;
}

.reply-button {
    background: none;
    border: none;
    color: #183661;
    font-size: 0.8em;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.reply-button:hover {
    background: rgba(24, 54, 97, 0.1);
}

.comment-moderation {
    display: flex;
    gap: 8px;
}

.moderate-button {
    background: none;
    border: none;
    color: #fd7e14;
    font-size: 0.75em;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 3px;
    transition: background-color 0.2s;
}

.moderate-button:hover {
    background: rgba(253, 126, 20, 0.1);
}

.moderate-button.danger {
    color: #dc3545;
}

.moderate-button.danger:hover {
    background: rgba(220, 53, 69, 0.1);
}

/* Replies */
.comment-replies {
    margin-left: 20px;
    margin-top: 12px;
    padding-left: 20px;
    border-left: 2px solid #e9ecef;
}

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

.comment.reply .comment-header {
    background: #f8f9fa;
}

/* Hidden/Moderated Comments */
.comment.hidden {
    opacity: 0.6;
    border-color: #fd7e14;
}

.comment.hidden .comment-content {
    background: #fff3cd;
    border-left: 3px solid #fd7e14;
    font-style: italic;
}

.moderation-notice {
    font-size: 0.8em;
    color: #fd7e14;
    background: #fff3cd;
    padding: 8px 12px;
    border-radius: 4px;
    margin-bottom: 8px;
    border-left: 3px solid #fd7e14;
}

/* Loading States */
.comments-loading {
    text-align: center;
    padding: 20px;
    color: #6c757d;
    font-size: 0.9em;
}

.comment-submitting {
    opacity: 0.6;
    pointer-events: none;
}

/* Empty State */
.comments-empty {
    text-align: center;
    padding: 30px 20px;
    color: #6c757d;
    font-size: 0.9em;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.comments-empty-icon {
    font-size: 2em;
    margin-bottom: 8px;
    opacity: 0.5;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .comments-section {
        padding: 16px 0;
    }
    
    .comment-form {
        padding: 12px;
    }
    
    .comment-form-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .comment-labels {
        justify-content: center;
    }
    
    .comment-form-actions {
        width: 100%;
        justify-content: center;
    }
    
    .comment {
        margin-bottom: 8px;
    }
    
    .comment-header {
        padding: 10px 12px 6px;
    }
    
    .comment-content {
        padding: 10px 12px;
    }
    
    .comment-actions {
        padding: 6px 12px;
        flex-direction: column;
        gap: 8px;
        align-items: stretch;
    }
    
    .comment-engagement {
        justify-content: center;
    }
    
    .comment-moderation {
        justify-content: center;
    }
    
    .comment-replies {
        margin-left: 12px;
        padding-left: 12px;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .comment-form {
        background: #2d3748;
        border-color: #4a5568;
    }
    
    .comment-form textarea {
        background: #1a202c;
        color: white;
        border-color: #4a5568;
    }
    
    .comment {
        background: #2d3748;
        border-color: #4a5568;
    }
    
    .comment-header {
        background: #1a202c;
        border-color: #4a5568;
    }
    
    .comment-content {
        color: #e2e8f0;
    }
    
    .comment-actions {
        background: #1a202c;
        border-color: #4a5568;
    }
}

/* Accessibility */
.comment-form textarea:focus,
.like-button:focus,
.reply-button:focus,
.moderate-button:focus,
.btn-comment:focus,
.btn-comment-cancel:focus {
    outline: 2px solid #183661;
    outline-offset: 2px;
}

/* Animation */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.comment {
    animation: slideIn 0.3s ease-out;
}

.comment-form {
    animation: slideIn 0.2s ease-out;
}