/* ==========================================================================
   KARLALYN COMMENTS PREVIEW & THREADED REPLIES STYLES (DREAME STANDARD)
   ========================================================================== */

.stat-item-comments {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    border-radius: 6px;
    padding: 1px 5px;
    transition: all 0.2s ease;
}

.stat-item-comments.is-clickable {
    cursor: pointer;
    color: #2563eb !important;
    font-weight: 600;
}

.stat-item-comments.is-clickable:hover {
    background: rgba(37, 99, 235, 0.08);
    color: #1d4ed8 !important;
    text-decoration: underline;
}

.comment-pulse-active {
    animation: karlalynCommPulse 1.4s cubic-bezier(0.25, 1, 0.5, 1);
}

@keyframes karlalynCommPulse {
    0% { transform: scale(1); }
    30% { transform: scale(1.35); background: #fef3c7; color: #d97706; }
    100% { transform: scale(1); }
}

/* Modal Overlay & Card */
#karlalyn-comments-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    z-index: 1000000;
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.25s ease;
    padding: 16px;
}

#karlalyn-comments-modal-overlay.is-visible {
    display: flex;
    opacity: 1;
}

#karlalyn-comments-modal-card {
    background: #ffffff;
    border-radius: 20px;
    width: 100%;
    max-width: 530px;
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35);
    overflow: hidden;
    transform: scale(0.95);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

#karlalyn-comments-modal-overlay.is-visible #karlalyn-comments-modal-card {
    transform: scale(1);
}

/* Header */
.kcm-header {
    padding: 14px 18px;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #f8fafc;
}

.kcm-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.kcm-icon-badge {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
    flex-shrink: 0;
}

.kcm-title-wrap h3 {
    margin: 0;
    font-size: 1.02rem;
    font-weight: 800;
    color: #0f172a;
    line-height: 1.25;
}

.kcm-title-wrap p {
    margin: 2px 0 0 0;
    font-size: 0.8rem;
    font-weight: 600;
    color: #475569;
    max-width: 360px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.kcm-close-btn {
    background: transparent;
    border: none;
    font-size: 1.35rem;
    color: #94a3b8;
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.kcm-close-btn:hover {
    background: #e2e8f0;
    color: #1e293b;
}

/* Body & Comment Items */
.kcm-body {
    padding: 14px 18px;
    overflow-y: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 140px;
}

.kcm-thread-block {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.kcm-comment-item {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 10px 12px;
    transition: all 0.3s ease;
    position: relative;
}

.kcm-comment-item.kcm-reply-item {
    background: #ffffff;
    border: 1px solid #f1f5f9;
    box-shadow: 0 1px 3px rgba(0,0,0,0.03);
}

.kcm-comment-item.kcm-new-arrival {
    border-color: #3b82f6;
    background: #eff6ff;
    box-shadow: 0 4px 14px rgba(59, 130, 246, 0.15);
    animation: kcmGlow 2s ease-out;
}

@keyframes kcmGlow {
    0% { transform: translateY(-8px); opacity: 0; }
    100% { transform: translateY(0); opacity: 1; }
}

.kcm-item-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 5px;
}

.kcm-author-box {
    display: flex;
    align-items: center;
    gap: 8px;
}

.kcm-avatar {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #ffffff;
    font-size: 0.74rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

.kcm-reply-item .kcm-avatar {
    width: 22px;
    height: 22px;
    font-size: 0.68rem;
}

.kcm-author-name {
    font-size: 0.82rem;
    font-weight: 700;
    color: #1e293b;
}

.kcm-meta-right {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.7rem;
    color: #94a3b8;
}

.kcm-chapter-pill {
    background: #e2e8f0;
    color: #475569;
    padding: 2px 7px;
    border-radius: 6px;
    font-size: 0.66rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
}

.kcm-chapter-pill:hover {
    background: #2563eb;
    color: #ffffff;
}

.kcm-comment-text {
    font-size: 0.82rem;
    line-height: 1.45;
    color: #334155;
    word-break: break-word;
    margin: 0;
}

.kcm-item-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    margin-top: 6px;
    padding-top: 4px;
    border-top: 1px dashed #f1f5f9;
}

.kcm-btn-reply {
    background: transparent;
    border: none;
    color: #2563eb;
    font-size: 0.72rem;
    font-weight: 700;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: all 0.15s ease;
}

.kcm-btn-reply:hover {
    background: rgba(37, 99, 235, 0.1);
    color: #1d4ed8;
}

/* Nested Replies Container */
.kcm-replies-wrap {
    margin-left: 20px;
    padding-left: 12px;
    border-left: 2px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.kcm-trans-badge {
    display: inline-block;
    margin-top: 4px;
    font-size: 0.65rem;
    color: #2563eb;
    background: #dbeafe;
    padding: 1px 6px;
    border-radius: 4px;
    font-weight: 600;
}

.kcm-empty-state {
    text-align: center;
    padding: 28px 16px;
    color: #94a3b8;
    font-size: 0.84rem;
}

/* Interactive Composer */
.kcm-composer {
    padding: 12px 18px;
    border-top: 1px solid #f1f5f9;
    background: #ffffff;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.kcm-replying-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 8px;
    padding: 4px 10px;
    font-size: 0.76rem;
    color: #1e40af;
}

.kcm-replying-text {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.kcm-cancel-reply-btn {
    background: transparent;
    border: none;
    font-size: 0.9rem;
    color: #64748b;
    cursor: pointer;
    padding: 0 4px;
    border-radius: 4px;
}

.kcm-cancel-reply-btn:hover {
    color: #ef4444;
}

.kcm-composer-meta {
    display: flex;
    gap: 8px;
    align-items: center;
}

.kcm-select-chapter,
.kcm-input-name {
    padding: 6px 10px;
    border-radius: 8px;
    border: 1px solid #cbd5e1;
    font-size: 0.78rem;
    background: #f8fafc;
    color: #334155;
    flex: 1;
    outline: none;
    box-sizing: border-box;
}

.kcm-select-chapter:focus,
.kcm-input-name:focus {
    border-color: #3b82f6;
    background: #ffffff;
}

.kcm-textarea {
    width: 100%;
    min-height: 52px;
    max-height: 100px;
    padding: 8px 12px;
    border-radius: 10px;
    border: 1px solid #cbd5e1;
    font-size: 0.82rem;
    font-family: inherit;
    resize: vertical;
    outline: none;
    transition: all 0.2s;
    box-sizing: border-box;
    display: block;
}

.kcm-textarea:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

.kcm-composer-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.kcm-feedback-msg {
    font-size: 0.74rem;
    font-weight: 600;
    transition: opacity 0.2s;
}

.kcm-feedback-msg.success { color: #10b981; }
.kcm-feedback-msg.error { color: #ef4444; }

.kcm-btn-submit {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    color: #ffffff;
    border: none;
    padding: 7px 16px;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}

.kcm-btn-submit:hover {
    background: #1e40af;
    transform: translateY(-1px);
}

.kcm-btn-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Quick View Discussion Trigger */
#qv-stat-block-discussions {
    cursor: pointer;
    border-radius: 8px;
    padding: 3px 6px;
    margin: -3px -6px;
    transition: all 0.2s ease;
}
#qv-stat-block-discussions:hover {
    background: rgba(37, 99, 235, 0.08);
}
#qv-stat-block-discussions:hover #qv-comments,
#qv-stat-block-discussions:hover #qv-lbl-discussions {
    color: #2563eb !important;
}
#qv-stat-block-discussions:hover #qv-comments {
    text-decoration: underline;
}


/* Sleek Modern Scrollbar */
.kcm-body {
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}
.kcm-body::-webkit-scrollbar {
    width: 6px;
}
.kcm-body::-webkit-scrollbar-track {
    background: transparent;
}
.kcm-body::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 9999px;
}
.kcm-body::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

.kcm-shortcut-hint {
    font-size: 0.68rem;
    color: #94a3b8;
    margin-right: 8px;
    display: none;
}
@media (min-width: 640px) {
    .kcm-shortcut-hint {
        display: inline-block;
    }
}

/* Smart Gating: Paid / Locked Chapter Pill */
.kcm-chapter-pill.is-locked {
    color: #d97706;
    background: #fffbeb !important;
    border-color: #fde68a !important;
    cursor: pointer;
}
.kcm-chapter-pill.is-locked:hover {
    color: #b45309 !important;
    background: #fef3c7 !important;
    border-color: #fcd34d !important;
    box-shadow: 0 1px 4px rgba(217, 119, 6, 0.18);
}