/* ========================================
   FACEBOOK-STYLE COMMENTS
   ======================================== */

/* Container */
.comments-wrapper {
    background: #ffffff;
    border-radius: 12px;
    padding: 20px 0;
    margin-top: 30px;
    border-top: 1px solid #e4e6eb;
}

.comments-container {
    max-width: 100%;
    padding: 0 16px;
}

/* ========================================
   HEADER - Facebook Style
   ======================================== */
.comments-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0 12px 0;
    border-bottom: 1px solid #e4e6eb;
    margin-bottom: 16px;
}

.comments-title {
    font-size: 18px;
    font-weight: 600;
    color: #050505;
    margin: 0;
}

.comments-title span {
    color: #1b74e4;
}

/* Sort Dropdown - Facebook Style */
.sort-dropdown {
    position: relative;
    display: inline-block;
}

.sort-toggle {
    background: transparent;
    border: none;
    color: #65676b;
    font-size: 14px;
    font-weight: 500;
    padding: 8px 12px;
    border-radius: 20px;
    cursor: pointer;
    transition: background-color 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.sort-toggle:hover {
    background: #f0f2f5;
}

.sort-toggle i {
    font-size: 13px;
}

.sort-toggle .fa-chevron-down {
    font-size: 10px;
}

.sort-menu {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    margin-top: 4px;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
    min-width: 180px;
    padding: 8px 0;
    list-style: none;
    z-index: 1000;
}

.sort-menu.show {
    display: block;
}

.sort-item {
    display: block;
    padding: 8px 16px;
    color: #050505;
    text-decoration: none;
    font-size: 14px;
    transition: background-color 0.2s;
    cursor: pointer;
}

.sort-item:hover {
    background: #f0f2f5;
}

.sort-item.active {
    font-weight: 600;
    color: #1b74e4;
}

.sort-item.active::before {
    content: "✓ ";
}

/* ========================================
   COMMENT FORM - Facebook Style
   ======================================== */
.comment-form-section {
    margin-bottom: 20px;
}

.comment-form-wrapper {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.comment-avatar-wrapper {
    flex-shrink: 0;
}

.comment-avatar-img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid #e4e6eb;
}

.comment-form-container {
    flex: 1;
    min-width: 0;
}

.comment-form {
    position: relative;
}

.comment-input-wrapper {
    background: #f0f2f5;
    border-radius: 20px;
    padding: 8px 16px;
    transition: background-color 0.2s;
}

.comment-input-wrapper:focus-within {
    background: #ffffff;
    box-shadow: 0 0 0 2px #1b74e4;
}

.comment-input {
    width: 100%;
    border: none;
    background: transparent;
    padding: 8px 0;
    font-size: 14px;
    line-height: 1.4;
    color: #050505;
    resize: none;
    outline: none;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

.comment-input::placeholder {
    color: #65676b;
}

.comment-form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 8px 0 4px 0;
    border-top: 1px solid #e4e6eb;
    margin-top: 4px;
}

.action-cancel {
    background: transparent;
    border: none;
    color: #65676b;
    font-size: 14px;
    font-weight: 500;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
}

.action-cancel:hover {
    background: #f0f2f5;
}

.action-submit {
    background: #1b74e4;
    border: none;
    color: white;
    font-size: 14px;
    font-weight: 600;
    padding: 6px 16px;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.action-submit:hover {
    background: #1664c9;
}

.action-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Reply Indicator - Facebook Style */
.reply-indicator {
    background: #f0f2f5;
    padding: 6px 12px;
    border-radius: 8px;
    margin-top: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #65676b;
}

.reply-indicator i {
    color: #1b74e4;
}

.reply-indicator strong {
    color: #050505;
}

.cancel-reply-btn {
    background: none;
    border: none;
    color: #65676b;
    padding: 2px 6px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: background-color 0.2s;
}

.cancel-reply-btn:hover {
    background: #e4e6eb;
}

/* ========================================
   GUEST PROMPT - Facebook Style
   ======================================== */
.guest-prompt {
    background: #f7f8fa;
    border-radius: 12px;
    padding: 20px;
}

.guest-prompt-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: #65676b;
}

.guest-prompt-content i {
    font-size: 28px;
    color: #b0b3b8;
}

.guest-prompt-content p {
    margin: 0;
    font-size: 14px;
}

.guest-link {
    color: #1b74e4;
    text-decoration: none;
    font-weight: 600;
}

.guest-link:hover {
    text-decoration: underline;
}

/* Guest Comment Form */
.guest-comment-form {
    margin-top: 16px;
}

.guest-input-group {
    background: #ffffff;
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.guest-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 12px;
}

.guest-input {
    padding: 10px 14px;
    border: 1px solid #e4e6eb;
    border-radius: 8px;
    font-size: 14px;
    color: #050505;
    transition: border-color 0.2s;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

.guest-input:focus {
    outline: none;
    border-color: #1b74e4;
    box-shadow: 0 0 0 2px rgba(27, 116, 228, 0.1);
}

.guest-textarea-wrapper {
    position: relative;
}

.guest-textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #e4e6eb;
    border-radius: 8px;
    font-size: 14px;
    color: #050505;
    resize: vertical;
    min-height: 60px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    transition: border-color 0.2s;
}

.guest-textarea:focus {
    outline: none;
    border-color: #1b74e4;
    box-shadow: 0 0 0 2px rgba(27, 116, 228, 0.1);
}

.guest-form-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 12px;
}

.guest-submit-btn {
    background: #1b74e4;
    border: none;
    color: white;
    font-size: 14px;
    font-weight: 600;
    padding: 8px 20px;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.guest-submit-btn:hover {
    background: #1664c9;
}

/* ========================================
   COMMENTS LIST - Facebook Style
   ======================================== */
.comments-list {
    margin-top: 8px;
}

/* Comment Item */
.comment-item {
    display: flex;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid #f0f2f5;
    animation: fadeIn 0.3s ease-out;
}

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

.comment-item.comment-reply {
    padding-left: 52px;
    border-bottom: none;
}

/* Comment Avatar */
.comment-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid #e4e6eb;
    flex-shrink: 0;
}

/* Comment Content */
.comment-content-wrapper {
    flex: 1;
    min-width: 0;
}

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

.comment-author {
    font-weight: 600;
    font-size: 13px;
    color: #050505;
}

.comment-author-link {
    color: #050505;
    text-decoration: none;
}

.comment-author-link:hover {
    text-decoration: underline;
}

.comment-badge {
    display: inline-flex;
    gap: 4px;
}

.comment-badge .badge {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
}

.badge-admin {
    background: #1b74e4;
    color: white;
}

.badge-author {
    background: #e4e6eb;
    color: #050505;
}

.comment-date {
    font-size: 12px;
    color: #65676b;
}

.comment-date i {
    margin-right: 2px;
}

.comment-body {
    font-size: 14px;
    line-height: 1.5;
    color: #050505;
    word-wrap: break-word;
    margin: 2px 0 6px 0;
}

.comment-body .edit-textarea {
    width: 100%;
    padding: 8px 12px;
    border: 2px solid #1b74e4;
    border-radius: 8px;
    font-size: 14px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    resize: vertical;
}

/* Comment Actions - Facebook Style */
.comment-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.comment-actions .action-btn {
    background: none;
    border: none;
    color: #65676b;
    font-size: 13px;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-weight: 500;
}

.comment-actions .action-btn:hover {
    background: #f0f2f5;
}

.comment-actions .action-btn i {
    font-size: 13px;
}

.comment-actions .like-btn {
    color: #65676b;
}

.comment-actions .like-btn.liked {
    color: #1b74e4;
}

.comment-actions .like-btn.liked i {
    color: #1b74e4;
}

.comment-actions .like-count {
    font-size: 12px;
    color: #65676b;
    margin-left: 2px;
}

.comment-actions .reply-btn:hover {
    color: #1b74e4;
}

.comment-actions .report-btn:hover {
    color: #e41b1b;
}

.comment-actions .edit-btn:hover {
    color: #1b74e4;
}

.comment-actions .delete-btn:hover {
    color: #e41b1b;
}

/* Replies Container */
.replies-container {
    padding-left: 12px;
    margin-top: 4px;
}

/* ========================================
   LOADING SPINNER - Facebook Style
   ======================================== */
.loading-spinner {
    text-align: center;
    padding: 40px 20px;
    color: #65676b;
}

.spinner {
    display: inline-block;
    width: 32px;
    height: 32px;
    border: 3px solid #e4e6eb;
    border-top-color: #1b74e4;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-spinner p {
    margin-top: 12px;
    font-size: 14px;
}

/* ========================================
   EMPTY STATE - Facebook Style
   ======================================== */
.empty-state {
    text-align: center;
    padding: 40px 20px;
}

.empty-state i {
    font-size: 48px;
    color: #b0b3b8;
    margin-bottom: 16px;
}

.empty-state h5 {
    font-size: 17px;
    font-weight: 600;
    color: #050505;
    margin: 0 0 4px 0;
}

.empty-state p {
    font-size: 14px;
    color: #65676b;
    margin: 0;
}

/* ========================================
   ALERTS - Facebook Style
   ======================================== */
.comment-error {
    background: #fdeded;
    border: 1px solid #e41b1b;
    color: #e41b1b;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 13px;
    margin-top: 8px;
    display: none;
}

.comment-success {
    background: #dff0dd;
    border: 1px solid #31a24c;
    color: #31a24c;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 13px;
    margin-top: 8px;
    display: none;
}

/* ========================================
   ANIMATIONS
   ======================================== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========================================
   RESPONSIVE - Mobile
   ======================================== */
@media (max-width: 768px) {
    .comments-container {
        padding: 0 8px;
    }

    .comments-title {
        font-size: 16px;
    }

    .sort-toggle {
        font-size: 13px;
        padding: 6px 10px;
    }

    .comment-item.comment-reply {
        padding-left: 36px;
    }

    .comment-avatar {
        width: 32px;
        height: 32px;
    }

    .comment-author {
        font-size: 12px;
    }

    .comment-body {
        font-size: 13px;
    }

    .comment-actions .action-btn {
        font-size: 12px;
        padding: 2px 6px;
    }

    .guest-fields {
        grid-template-columns: 1fr;
    }

    .guest-prompt-content {
        flex-direction: column;
        text-align: center;
    }

    .guest-prompt-content i {
        font-size: 32px;
    }

    .comment-form-wrapper {
        gap: 8px;
    }

    .comment-avatar-img {
        width: 32px;
        height: 32px;
    }
}

@media (max-width: 480px) {
    .comments-header {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .header-right {
        display: flex;
        justify-content: flex-start;
    }

    .comment-item.comment-reply {
        padding-left: 24px;
    }
}

/* ========================================
   DARK MODE SUPPORT
   ======================================== */
@media (prefers-color-scheme: dark) {
    .comments-wrapper {
        background: #1a1a2e;
        border-top-color: #2a2a3e;
    }

    .comments-title {
        color: #e4e6eb;
    }

    .comments-header {
        border-bottom-color: #2a2a3e;
    }

    .comment-input-wrapper {
        background: #2a2a3e;
    }

    .comment-input-wrapper:focus-within {
        background: #1a1a2e;
        box-shadow: 0 0 0 2px #1b74e4;
    }

    .comment-input {
        color: #e4e6eb;
    }

    .comment-input::placeholder {
        color: #b0b3b8;
    }

    .sort-toggle {
        color: #b0b3b8;
    }

    .sort-toggle:hover {
        background: #2a2a3e;
    }

    .sort-menu {
        background: #2a2a3e;
        box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
    }

    .sort-item {
        color: #e4e6eb;
    }

    .sort-item:hover {
        background: #3a3a4e;
    }

    .comment-item {
        border-bottom-color: #2a2a3e;
    }

    .comment-author {
        color: #e4e6eb;
    }

    .comment-body {
        color: #e4e6eb;
    }

    .comment-date {
        color: #b0b3b8;
    }

    .comment-actions .action-btn {
        color: #b0b3b8;
    }

    .comment-actions .action-btn:hover {
        background: #2a2a3e;
    }

    .guest-prompt {
        background: #2a2a3e;
    }

    .guest-prompt-content {
        color: #b0b3b8;
    }

    .guest-input {
        background: #1a1a2e;
        border-color: #3a3a4e;
        color: #e4e6eb;
    }

    .guest-input:focus {
        border-color: #1b74e4;
    }

    .guest-textarea {
        background: #1a1a2e;
        border-color: #3a3a4e;
        color: #e4e6eb;
    }

    .guest-textarea:focus {
        border-color: #1b74e4;
    }

    .reply-indicator {
        background: #2a2a3e;
        color: #b0b3b8;
    }

    .reply-indicator strong {
        color: #e4e6eb;
    }

    .cancel-reply-btn:hover {
        background: #3a3a4e;
    }

    .comment-error {
        background: #2a1515;
        border-color: #e41b1b;
        color: #e41b1b;
    }

    .comment-success {
        background: #152a15;
        border-color: #31a24c;
        color: #31a24c;
    }

    .empty-state h5 {
        color: #e4e6eb;
    }

    .empty-state p {
        color: #b0b3b8;
    }

    .empty-state i {
        color: #3a3a4e;
    }
}
/* ========================================
   HIDDEN COMMENTS - Facebook Style
   ======================================== */
.comment-item.hidden-comment {
    display: none;
}

.comment-item.hidden-comment.show {
    display: flex;
}

/* ========================================
   SEE ALL COMMENTS - Facebook Style
   ======================================== */
.see-all-container {
    padding: 12px 0;
    border-top: 1px solid #e4e6eb;
    margin-top: 4px;
    text-align: center;
}

.see-all-comments-btn,
.show-less-comments-btn {
    background: transparent;
    border: none;
    color: #1b74e4;
    font-size: 14px;
    font-weight: 500;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.see-all-comments-btn:hover,
.show-less-comments-btn:hover {
    background: #f0f2f5;
}

.see-all-comments-btn i,
.show-less-comments-btn i {
    font-size: 12px;
}

/* ========================================
   HIDDEN REPLIES 
   ======================================== */
.reply-item.hidden-reply {
    display: none;
}

/* ========================================
   VIEW REPLIES BUTTON 
   ======================================== */
.view-replies-btn {
    background: transparent;
    border: none;
    color: #65676b;
    font-size: 13px;
    font-weight: 500;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 4px;
}

.view-replies-btn:hover {
    background: #f0f2f5;
    color: #1b74e4;
}

.view-replies-btn i {
    font-size: 11px;
}

.view-replies-btn.hide-replies {
    color: #1b74e4;
}

/* ========================================
   COMMENT TRANSITIONS
   ======================================== */
.comment-item,
.reply-item {
    transition: opacity 0.3s ease;
}

.comment-item.hidden-comment,
.reply-item.hidden-reply {
    opacity: 0;
}

.comment-item.hidden-comment.show,
.reply-item.hidden-reply.show {
    opacity: 1;
}

/* ========================================
   RESPONSIVE ADJUSTMENTS
   ======================================== */
@media (max-width: 768px) {
    .see-all-container {
        padding: 8px 0;
    }
    
    .see-all-comments-btn,
    .show-less-comments-btn {
        font-size: 13px;
        padding: 6px 12px;
    }
    
    .view-replies-btn {
        font-size: 12px;
    }
}
/* ========================================
   REPLIES HIDDEN - Facebook Style
   ======================================== */
.replies-container.replies-hidden .reply-item {
    display: none;
}

.replies-container.replies-hidden .view-replies-btn {
    display: inline-flex;
}

.replies-container:not(.replies-hidden) .view-replies-btn.hide-replies {
    display: inline-flex;
}

.replies-container:not(.replies-hidden) .view-replies-btn:not(.hide-replies) {
    display: none;
}

/* View Replies Button */
.view-replies-btn {
    background: transparent;
    border: none;
    color: #1b74e4;
    font-size: 13px;
    font-weight: 500;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 4px;
}

.view-replies-btn:hover {
    background: #f0f2f5;
}

.view-replies-btn i {
    font-size: 11px;
}

.view-replies-btn.hide-replies {
    color: #65676b;
}

.view-replies-btn.hide-replies:hover {
    color: #1b74e4;
}

/* Reply items - hidden by default */
.reply-item {
    transition: opacity 0.3s ease;
}

.reply-item.hidden-reply {
    display: none;
}

.reply-item:not(.hidden-reply) {
    display: flex;
}