/* Site-wide "Latest comments": sidebar widget (video page) and /comments page. */

.lc-widget {
    margin-top: 28px;
}

.lc-widget-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}

.lc-widget-sub,
.lc-widget-more { display: none; }

/* Mobile: moved below the video's own comments (Details.cshtml) and set apart as a card. */
@media (max-width: 576px) {
    .video-layout > .lc-widget {
        margin-top: 24px;
        padding: 14px 14px 4px;
        background: var(--card-bg);
        border: 1px solid var(--border-color);
        border-radius: 12px;
    }

    .video-layout > .lc-widget .lc-widget-sub {
        display: block;
        color: var(--muted-text);
        font-size: 0.8rem;
        margin: 0 0 4px;
    }

    .video-layout > .lc-widget .lc-item { padding: 12px 8px; }
    .video-layout > .lc-widget .lc-reply { padding: 6px 12px; } /* bigger tap target */

    /* 3 comments, then a faded peek at the 4th that the "See all" button sits on. */
    .video-layout > .lc-widget { padding-bottom: 14px; }
    .video-layout > .lc-widget .lc-item:nth-of-type(n+5) { display: none; }

    .video-layout > .lc-widget .lc-item:nth-of-type(4) {
        max-height: 64px;
        overflow: hidden;
        border-bottom: none;
        pointer-events: none;
        -webkit-mask-image: linear-gradient(to bottom, #000 0%, transparent 90%);
        mask-image: linear-gradient(to bottom, #000 0%, transparent 90%);
    }

    .video-layout > .lc-widget .lc-widget-more {
        display: block;
        position: relative;
        margin-top: -28px;
        padding: 11px;
        text-align: center;
        font-size: 0.9rem;
        font-weight: 700;
        color: #000;
        background: var(--primary-color);
        border-radius: 999px;
        text-decoration: none;
        box-shadow: 0 -14px 24px 8px var(--card-bg);
    }

    .video-layout > .lc-widget .lc-widget-more:active { background: var(--primary-hover); }
}

.lc-see-all {
    color: var(--primary-color);
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
}

.lc-see-all:hover { text-decoration: underline; }

.lc-page { max-width: 860px; margin: 0 auto; padding-top: 10px; }

.lc-intro { color: var(--muted-text); margin: -6px 0 18px; }

.lc-item {
    position: relative; /* anchor for the stretched video link below */
    display: flex;
    gap: 12px;
    padding: 14px 8px;
    margin: 0 -8px;
    border-bottom: 1px solid var(--border-color);
    border-radius: 8px;
    transition: background-color 0.15s;
}

/* The whole entry (avatar, name, text) opens the video: the video link's ::after
   covers the card. Reply sits above it so it keeps its own target. */
.lc-video::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
    border-radius: 8px;
}

.lc-item:hover { background-color: rgba(255, 255, 255, 0.04); }
.lc-item:active { background-color: rgba(255, 255, 255, 0.07); }
.lc-item:hover .lc-video,
.lc-item:hover .lc-author { color: var(--primary-color); }

.lc-item:has(.lc-video:focus-visible) {
    outline: 2px solid var(--primary-color);
    outline-offset: -2px;
}

.lc-video:focus-visible { outline: none; }
.lc-item:has(.lc-reply:hover) { background-color: transparent; }

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

.lc-thumb {
    flex-shrink: 0;
    width: 160px;
    aspect-ratio: 16 / 9;
    border-radius: 8px;
    overflow: hidden;
    background: var(--card-bg);
}

.lc-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

.lc-avatar {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    text-transform: uppercase;
    background-color: var(--primary-color);
    color: #000;
}

.lc-compact .lc-avatar { width: 30px; height: 30px; font-size: 0.8rem; }

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

.lc-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px 8px;
    font-size: 0.9rem;
}

.lc-author { font-weight: 700; color: var(--text-color); transition: color 0.15s; }
.lc-replying { color: var(--muted-text); font-size: 0.8rem; }
.lc-date { color: var(--muted-text); font-size: 0.78rem; }

.lc-text {
    color: #ccc;
    margin: 4px 0 6px;
    line-height: 1.45;
    white-space: pre-wrap;
    word-break: break-word;
}

.lc-compact .lc-text { font-size: 0.85rem; }

.lc-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    font-size: 0.8rem;
}

.lc-video {
    color: var(--muted-text);
    text-decoration: none;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.lc-video:hover { color: var(--text-color); }
.lc-video i { font-size: 0.65rem; margin-right: 3px; }

.lc-reply {
    position: relative;
    z-index: 2;
    flex-shrink: 0;
    color: var(--primary-color);
    font-weight: 700;
    text-decoration: none;
    padding: 4px 10px;
    border: 1px solid var(--primary-color);
    border-radius: 999px;
}

.lc-reply:hover,
.lc-reply:focus-visible { background: var(--primary-color); color: #000; }

.lc-empty { color: var(--muted-text); padding: 30px 0; text-align: center; }

@media (max-width: 576px) {
    .lc-thumb { width: 100px; }
    .lc-page .lc-avatar { display: none; }
}

/* Avatar palette: must match HtmlHelperExtensions.AvatarColorIndex / comments.js */
.lc-avatar.avatar-color-0 { background-color: #e03131; color: #fff; }
.lc-avatar.avatar-color-1 { background-color: #e8590c; color: #fff; }
.lc-avatar.avatar-color-2 { background-color: #d6336c; color: #fff; }
.lc-avatar.avatar-color-3 { background-color: #ae3ec9; color: #fff; }
.lc-avatar.avatar-color-4 { background-color: #7048e8; color: #fff; }
.lc-avatar.avatar-color-5 { background-color: #1c7ed6; color: #fff; }
.lc-avatar.avatar-color-6 { background-color: #1098ad; color: #fff; }
.lc-avatar.avatar-color-7 { background-color: #37b24d; color: #fff; }

/* Video page: comment opened from a "Reply" link in the feed. */
.comment-item.lc-target {
    animation: lc-flash 2.4s ease-out;
}

@keyframes lc-flash {
    0%, 30% { background-color: rgba(255, 144, 0, 0.18); }
    100% { background-color: transparent; }
}

@media (prefers-reduced-motion: reduce) {
    .comment-item.lc-target { animation: none; outline: 2px solid var(--primary-color); }
}
