/**
 * YanHH3D Comments System - CSS
 * Style giống hình mẫu
 */

/* ======================================
   COMMENT SECTION WRAPPER
====================================== */
.yanhh3d-comments-section {
    background: transparent;
    padding: 20px 0;
    margin-top: 20px;
}

/* Ẩn scrollbar */
.yanhh3d-comments-section::-webkit-scrollbar,
#comments-list::-webkit-scrollbar,
.comment-replies::-webkit-scrollbar {
    display: none;
}

.yanhh3d-comments-section,
#comments-list,
.comment-replies {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* ======================================
   COMMENTS HEADER ROW (Title + Sort ngang hàng)
====================================== */
.comments-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    flex-wrap: wrap;
    gap: 10px;
}

.comments-title {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    padding: 8px 0;
    gap: 8px;
    font-size: 14px;
    color: #fff;
    margin-bottom: 0;
}

.comments-title i {
    font-size: 16px;
    color: #ffffff;
}

/* ======================================
   SORT SELECT
====================================== */
.comments-sort-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 15px;
    margin-bottom: 15px;
}

.sort-label {
    font-size: 14px;
    color: #888;
}

.comment-sort-select {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    padding: 5px 30px 5px 10px;
    border-radius: 5px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23fff' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
}

.comment-sort-select:hover {
    background-color: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
}

.comment-sort-select:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.3);
}

.comment-sort-select option {
    background: #2d303a;
    color: #fff;
}

/* ======================================
   COMMENT FORM
====================================== */
.comment-form-wrapper {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    align-items: flex-start;
}

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

.comment-form-avatar img,
.comment-form-avatar .avatar-initial {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    object-fit: cover;
    font-size: 14px;
}

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

.comment-form-input textarea {
    width: 100%;
    background: #49505794;
    border: none;
    color: #fff;
    padding: 12px 15px;
    border-radius: 8px;
    font-size: 14px;
    resize: none;
    min-height: 90px;
    font-family: inherit;
}

.comments-textarea,
.reply-form textarea {
    width: 100%;
    background: #49505794;
    border: none;
    color: #fff;
    padding: 12px 15px;
    border-radius: 0 0 4px 4px;
    font-size: 14px;
    resize: none;
    min-height: 100px;
    font-family: inherit;
}

.comment-form-input textarea:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.3);
}

.comment-form-input textarea:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.comment-form-input textarea::placeholder {
    color: #888;
}

.comment-form-actions {
    margin-top: 10px;
    text-align: right;
}

.btn-comment-submit {
    background: #3498db;
    color: #fff;
    border: none;
    padding: 10px 25px;
    border-radius: 5px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-comment-submit:hover:not(:disabled) {
    background: #2980b9;
}

.btn-comment-submit:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Nút đăng nhập để bình luận */
.comment-login-wrapper {
    text-align: center;
    padding: 15px 0;
    margin-bottom: 20px;
}

.btn-login-comment {
    display: inline-block;
    background: #1fc3f9;
    border: none;
    color: #fff !important;
    padding: 10px;
    border-radius: 15px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none !important;
}

.btn-login-comment:hover {
    background: #17a8d8;
    color: #fff !important;
    text-decoration: none !important;
}

/* ======================================
   AVATAR INITIAL (Chữ cái đầu)
====================================== */
.avatar-initial {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    color: #fff;
    font-weight: 600;
    font-size: 16px;
    text-transform: uppercase;
}

/* ======================================
   COMMENTS LIST
====================================== */
#comments-list {
    margin-bottom: 20px;
}

.comments-group {
    margin-bottom: 25px;
    padding-bottom: 0;
    background: #2a2c31;
    border-radius: 15px;
    padding: 15px;
}

.comments-loading,
.comments-error,
.no-comments {
    text-align: center;
    padding: 30px;
    color: #888;
    font-size: 14px;
}

.comments-loading i {
    margin-right: 8px;
}

/* ======================================
   SINGLE COMMENT ITEM
====================================== */
.comment-item {
    display: flex;
    gap: 12px;
    padding: 0;
}

.comments-group > .comment-item {
    padding: 0;
    border-bottom: none;
}

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

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

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

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

.comment-author {
    font-weight: 600;
    color: #1fc3f9 !important;
    font-size: 14px;
}

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

.comment-content {
    color: #ddd;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
    margin-bottom: 10px;
}

/* ======================================
   COMMENT ACTIONS (Vote, Reply, Delete)
====================================== */
.comments-actions-row {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    margin-top: 8px;
    margin-bottom: 8px;
    gap: 15px;
}

.comments-reactions {
    display: flex;
    align-items: center;
    gap: 5px;
}

.comments-reaction-picker {
    position: relative;
    display: inline-block;
}

.comments-reaction-picker-trigger {
    background: none;
    border: none;
    color: #fff;
    padding: 4px 8px;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
}

.comments-reaction-picker-trigger:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.comments-icon {
    width: 20px;
    height: 20px;
}

.comments-modal {
    position: absolute;
    bottom: 100%;
    background: #2d303a;
    border: 1px solid #3d404a;
    border-radius: 8px;
    padding: 8px;
    z-index: 100;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.comments-modal.is-left {
    left: 0;
}

.comments-modal.is-compact {
    padding: 6px;
}

.comments-modal-contents {
    display: flex;
}

.comments-reaction-picker-reactions {
    display: flex;
    gap: 5px;
}

.comments-reaction-picker-reaction {
    background: none;
    border: none;
    font-size: 20px;
    padding: 5px 8px;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
}

.comments-reaction-picker-reaction:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.2);
}

.comments-reply-button-container {
    display: inline-flex;
}

.comments-reply-inline-button {
    background: none;
    border: none;
    color: #888;
    font-size: 13px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 5px;
}

.comments-reply-inline-button:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.comment-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.comment-actions button {
    background: none;
    border: none;
    color: #888;
    font-size: 13px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 5px;
}

.comment-actions button:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

/* Reaction buttons */
.comment-reactions {
    display: flex;
    align-items: center;
    gap: 5px;
}

.reaction-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    background: rgba(255, 255, 255, 0.1);
    padding: 4px 8px;
    border-radius: 15px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.reaction-badge:hover {
    background: rgba(255, 255, 255, 0.2);
}

.reaction-badge.active {
    background: rgba(52, 152, 219, 0.3);
}

.reaction-badge .reaction-emoji {
    font-size: 14px;
}

.reaction-badge .reaction-count {
    font-size: 12px;
    color: #fff;
}

/* Emoji Picker */
.emoji-picker-wrapper {
    position: relative;
    display: inline-block;
}

.btn-emoji-picker {
    background: none !important;
    border: none;
    color: #888;
    padding: 4px 8px;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
}

.btn-emoji-picker:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.btn-emoji-picker svg {
    width: 20px;
    height: 20px;
}

.emoji-picker-dropdown {
    position: absolute;
    bottom: 100%;
    left: 0;
    background: #2d303a;
    border: 1px solid #3d404a;
    border-radius: 8px;
    padding: 8px;
    display: none;
    z-index: 100;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.emoji-picker-dropdown.show {
    display: flex;
    gap: 5px;
}

.emoji-picker-dropdown button {
    background: none;
    border: none;
    font-size: 20px;
    padding: 5px 8px;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
}

.emoji-picker-dropdown button:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.2);
}

.btn-reply i,
.btn-delete i,
.btn-pin i {
    font-size: 12px;
}

.btn-delete:hover {
    color: #e74c3c !important;
}

/* ======================================
   PINNED COMMENT
====================================== */
.btn-pin {
    background: none !important;
    border: none;
    color: #888 !important;
    font-size: 14px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s;
}

.btn-pin:hover {
    color: #f39c12 !important;
    background: rgba(243, 156, 18, 0.1) !important;
}

.btn-pin.is-pinned {
    color: #f39c12 !important;
}

.btn-pin.is-pinned:hover {
    color: #e74c3c !important;
    background: rgba(231, 76, 60, 0.1) !important;
}

.comment-pinned-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: linear-gradient(135deg, #f39c12, #e67e22);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    margin-right: 8px;
}

.comment-pinned-badge i {
    font-size: 10px;
}

.comments-group.pinned-comment {
    background: linear-gradient(135deg, rgba(243, 156, 18, 0.1), rgba(230, 126, 34, 0.05));
    border: 1px solid rgba(243, 156, 18, 0.3);
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 15px;
}

.comment-item.is-pinned {
    position: relative;
}

/* ======================================
   REPLIES TOGGLE
====================================== */
.comment-replies-toggle {
    margin-top: 10px;
}

.btn-show-replies {
    background: none !important;
    border: none;
    color: #3498db !important;
    font-size: 13px;
    cursor: pointer;
    padding: 5px 0;
    display: flex;
    align-items: center;
    gap: 5px;
}

.btn-show-replies:hover {
    text-decoration: underline;
}

.btn-show-replies i {
    transition: transform 0.2s;
}

/* ======================================
   REPLIES CONTAINER
====================================== */
.comment-replies {
    margin-top: 15px;
    margin-left: 20px;
    padding-left: 15px;
}

.comment-replies .comment-item {
    padding: 10px 0;
}

.comment-replies .comment-avatar img,
.comment-replies .comment-avatar .avatar-initial {
    width: 32px;
    height: 32px;
    font-size: 13px;
}

.comment-replies .comment-author {
    font-size: 13px;
}

.comment-replies .comment-content {
    font-size: 13px;
}

/* ======================================
   REPLY FORM
====================================== */
.reply-form-container {
    margin-top: 10px;
}

.reply-form {
    background: transparent;
    padding: 0;
    border-radius: 8px;
}

.reply-form textarea {
    width: 100%;
    background: #49505794;
    border: none;
    color: #fff;
    padding: 12px 15px;
    border-radius: 8px;
    font-size: 14px;
    resize: none;
    min-height: 90px;
    font-family: inherit;
}

.reply-form textarea:focus {
    outline: none;
    border-color: #3498db;
}

.reply-form-actions {
    margin-top: 10px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.reply-form .btn {
    padding: 6px 15px;
    font-size: 13px;
    border-radius: 4px;
    cursor: pointer;
}

.reply-form .btn-secondary {
    background: #3d404a;
    border: none;
    color: #fff;
}

.reply-form .btn-secondary:hover {
    background: #4d505a;
}

.reply-form .btn-primary {
    background: #3498db;
    border: none;
    color: #fff;
}

.reply-form .btn-primary:hover {
    background: #2980b9;
}

/* ======================================
   LOAD MORE BUTTON
====================================== */
#load-more-comments,
#load-more-comments.custom-paginate-comment {
    text-align: center;
    padding: 20px 0;
    margin-top: 15px;
    position: relative;
    z-index: 10;
}

#load-more-comments .btn-load-more,
#load-more-comments.custom-paginate-comment button,
.custom-paginate-comment .btn-load-more,
.yanhh3d-comments-section .btn-load-more,
button.btn-load-more,
.btn.btn-load-more {
    display: inline-block !important;
    background: #404246 !important;
    border: none !important;
    color: #fff !important;
    padding: 10px !important;
    border-radius: 15px !important;
    font-size: 14px !important;
    cursor: pointer !important;
    transition: all 0.2s;
    width: 100%;
    text-align: center;
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
}

#load-more-comments .btn-load-more:hover,
#load-more-comments.custom-paginate-comment button:hover,
.custom-paginate-comment .btn-load-more:hover,
.yanhh3d-comments-section .btn-load-more:hover,
button.btn-load-more:hover,
.btn.btn-load-more:hover {
    background: #505359 !important;
    color: #fff !important;
}

/* ======================================
   RESPONSIVE
====================================== */
@media (max-width: 768px) {
    .yanhh3d-comments-section {
        padding: 15px 0;
        border-radius: 0;
        margin-top: 15px;
    }

    .comments-title,
    .comment-form-wrapper,
    .comments-sort-wrapper {
        padding-left: 2px;
        padding-right: 2px;
    }

    .comments-group {
        margin-left: 2px;
        margin-right: 2px;
    }

    .comments-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .comments-sort {
        width: 100%;
    }

    .comments-sort select {
        flex: 1;
    }

    .comment-form-wrapper {
        padding: 12px;
    }

    .comment-form-avatar {
        display: none;
    }

    .comment-item {
        gap: 10px;
        padding: 12px 0;
    }

    .comment-avatar img,
    .comment-avatar .avatar-initial {
        width: 35px;
        height: 35px;
        font-size: 14px;
    }

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

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

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

    .comment-actions button {
        font-size: 12px;
        padding: 3px 6px;
    }

    .comment-replies {
        margin-left: 10px;
        padding-left: 10px;
    }

    .comment-replies .comment-avatar img,
    .comment-replies .comment-avatar .avatar-initial {
        width: 28px;
        height: 28px;
        font-size: 11px;
    }
}

@media (max-width: 480px) {
    .comment-form-input textarea {
        min-height: 50px;
        padding: 10px 12px;
        font-size: 13px;
    }

    .btn-comment-submit {
        padding: 8px 16px;
        font-size: 13px;
    }

    .comment-time {
        font-size: 11px;
    }
}
