/**
 * ═══════════════════════════════════════════════════════════════════════════════
 * UNIVERSUM Comment System v3 - Styles
 * DTF-style threading with vertical lines
 * ═══════════════════════════════════════════════════════════════════════════════
 */

/* Container */
.cs-container {
    background: var(--glass-bg, rgba(20, 20, 35, 0.8));
    border-radius: 16px;
    padding: 24px;
    margin-top: 30px;
}

.cs-container.cs-loading,
.cs-container.cs-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    min-height: 150px;
    color: var(--text-muted, #9ca3af);
}

.cs-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid rgba(139, 92, 246, 0.2);
    border-top-color: var(--star-purple, #8b5cf6);
    border-radius: 50%;
    animation: cs-spin 0.8s linear infinite;
}

@keyframes cs-spin {
    to { transform: rotate(360deg); }
}

/* Header */
.cs-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
}

.cs-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary, #fff);
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
}

.cs-title i {
    color: var(--star-purple, #8b5cf6);
}

.cs-count {
    font-weight: 400;
    color: var(--text-muted, #9ca3af);
}

.cs-sort-options {
    display: flex;
    gap: 6px;
}

.cs-sort-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted, #9ca3af);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid transparent;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.cs-sort-btn:hover {
    color: var(--text-primary, #fff);
    background: rgba(255, 255, 255, 0.1);
}

.cs-sort-btn.active {
    color: var(--star-purple, #8b5cf6);
    background: rgba(139, 92, 246, 0.15);
    border-color: rgba(139, 92, 246, 0.3);
}

.cs-sort-btn i {
    font-size: 11px;
}

/* Form */
.cs-form-wrapper {
    margin-bottom: 24px;
}

.cs-form {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    max-width: 100%;
    overflow: hidden;
}

.cs-form-avatar-wrap { flex-shrink: 0; }
.cs-form-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}
.cs-impersonate-btn {
    position: absolute; bottom: -2px; right: -4px;
    width: 18px; height: 18px; border-radius: 50%;
    border: 1px solid rgba(139,92,246,0.5);
    background: rgba(139,92,246,0.25); color: #a78bfa;
    font-size: 8px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background .2s;
}
.cs-impersonate-btn:hover { background: rgba(139,92,246,0.5); }
}

.cs-form-input-wrap {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0;
    background: rgba(8, 8, 12, 0.8);
    border: 1px solid rgba(168, 85, 247, 0.15);
    border-radius: 12px;
    padding: 0;
    transition: all 0.2s;
    position: relative;
    overflow: hidden;
}

.cs-form-input-wrap:focus-within {
    border-color: rgba(168, 85, 247, 0.35);
    box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.08);
}

.cs-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary, #fff);
    font-size: 14px;
    min-height: 20px;
    max-height: 200px;
    line-height: 1.5;
    padding: 10px 50px 10px 14px;
    box-sizing: border-box;
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
    white-space: pre-wrap;
    overflow-x: hidden;
    overflow-y: auto;
}

/* Placeholder for contenteditable */
.cs-input[contenteditable]:empty::before {
    content: attr(data-placeholder);
    color: rgba(255, 255, 255, 0.3);
    pointer-events: none;
}

/* Blockquote inside editor */
.cs-input blockquote {
    border-left: 3px solid rgba(139, 92, 246, 0.4);
    padding-left: 10px;
    margin: 4px 0;
    color: rgba(255, 255, 255, 0.6);
    font-style: italic;
}

/* Image thumbnail inside editor — horizontal blur container */
.cs-editor-img-wrap {
    position: relative;
    display: inline-block;
    width: 160px;
    height: 80px;
    border-radius: 6px;
    overflow: hidden;
    margin: 4px 0;
    vertical-align: middle;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.08);
}
.cs-editor-blur {
    position: absolute;
    inset: -10px;
    background-size: cover;
    background-position: center;
    filter: blur(12px) brightness(0.45);
    z-index: 0;
}
.cs-editor-img {
    position: relative;
    z-index: 1;
    display: block;
    width: auto;
    height: 100%;
    max-width: 100%;
    margin: 0 auto;
    object-fit: contain;
}
.cs-editor-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 6px;
}
.cs-editor-img-wrap:hover {
    opacity: 0.85;
}

.cs-submit {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(168, 85, 247, 0.15);
    color: rgba(168, 85, 247, 0.9);
    border: 1px solid rgba(168, 85, 247, 0.25);
    width: 36px;
    height: 36px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
    z-index: 1;
}

.cs-submit:hover {
    background: rgba(168, 85, 247, 0.25);
    border-color: rgba(168, 85, 247, 0.4);
    transform: scale(1.05);
}

.cs-submit:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Rich Text Toolbar */
.cs-toolbar {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 8px 12px;
    border-bottom: 1px solid rgba(168, 85, 247, 0.1);
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px 12px 0 0;
}

.cs-tool {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: transparent;
    border: none;
    color: var(--text-muted, #9ca3af);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s;
    font-size: 12px;
}

.cs-tool:hover {
    background: rgba(168, 85, 247, 0.15);
    color: rgba(168, 85, 247, 0.9);
}

.cs-tool-divider {
    width: 1px;
    height: 16px;
    background: rgba(255, 255, 255, 0.1);
    margin: 0 4px;
}

/* Translate button (admin/mod only) */
.cs-translate-btn {
    color: rgba(139, 92, 246, 0.7) !important;
    font-size: 14px !important;
}
.cs-translate-btn:hover {
    background: rgba(139, 92, 246, 0.15) !important;
    color: rgba(139, 92, 246, 1) !important;
}
.cs-translate-btn:disabled {
    opacity: 0.5;
    pointer-events: none;
}

/* Upload indicator */
.cs-toolbar.cs-uploading {
    position: relative;
    pointer-events: none;
    opacity: 0.6;
}

.cs-toolbar.cs-uploading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 16px;
    margin: -8px 0 0 -8px;
    border: 2px solid rgba(139, 92, 246, 0.3);
    border-top-color: var(--star-purple, #8b5cf6);
    border-radius: 50%;
    animation: cs-spin 0.6s linear infinite;
}

/* Full upload overlay on input area */
.cs-form-input-wrap.cs-media-uploading .cs-input {
    opacity: 0.35;
    pointer-events: none;
}

.cs-form-input-wrap.cs-media-uploading::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.25);
    border-radius: inherit;
    z-index: 10;
}

.cs-form-input-wrap.cs-media-uploading::after {
    content: '';
    position: absolute;
    top: calc(50% - 20px);
    left: 50%;
    width: 28px;
    height: 28px;
    margin-left: -14px;
    border: 3px solid rgba(139, 92, 246, 0.2);
    border-top-color: var(--star-purple, #8b5cf6);
    border-radius: 50%;
    animation: cs-spin 0.6s linear infinite;
    z-index: 11;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   Images in comments — horizontal blur container (vertical images get blur sides)
   ═══════════════════════════════════════════════════════════════════════════════ */
.cs-img-wrap {
    position: relative;
    display: block;
    width: 100%;
    max-width: 320px;
    height: 140px;
    border-radius: 8px;
    overflow: hidden;
    margin: 8px 0;
    cursor: pointer;
    background: rgba(0, 0, 0, 0.3);
}
.cs-img-blur {
    position: absolute;
    inset: -20px;
    background-size: cover;
    background-position: center;
    filter: blur(18px) brightness(0.5);
    z-index: 0;
}
.cs-img-wrap .cs-img {
    position: relative;
    z-index: 1;
    display: block;
    width: auto;
    height: 100%;
    max-width: 100%;
    margin: 0 auto;
    object-fit: contain;
    border-radius: 0;
}
.cs-img-wrap:hover {
    opacity: 0.9;
}

/* Video in displayed comments */
.cs-video-wrap {
    cursor: default;
}
.cs-video-wrap .cs-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 0;
}

/* Error state for broken images */
.cs-img-wrap.cs-img-error {
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.03);
    border: 1px dashed rgba(255, 255, 255, 0.1);
    height: 60px;
    max-width: 200px;
}
.cs-img-wrap.cs-img-error .cs-img-blur {
    display: none;
}
.cs-img-wrap.cs-img-error .cs-img {
    display: none;
}
.cs-img-wrap.cs-img-error::after {
    content: '\f03e';
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    font-size: 18px;
    color: rgba(255, 255, 255, 0.15);
}

/* Fallback for plain img in content */
.cs-content img:not(.cs-img) {
    max-width: 100%;
    max-height: 300px;
    border-radius: 8px;
    margin: 8px 0;
    cursor: pointer;
    display: block;
}

.cs-content blockquote {
    margin: 8px 0;
    padding: 8px 12px;
    border-left: 3px solid var(--star-purple, #8b5cf6);
    background: rgba(139, 92, 246, 0.1);
    border-radius: 0 8px 8px 0;
    font-style: italic;
    color: rgba(255, 255, 255, 0.8);
}

.cs-content strong {
    color: var(--text-primary, #fff);
    font-weight: 600;
}

.cs-content em {
    font-style: italic;
    color: rgba(255, 255, 255, 0.9);
}

/* Emoji Picker — animation for inline-styled overlay */
@keyframes cs-epop {
    from { opacity: 0; transform: scale(0.9); }
    to   { opacity: 1; transform: scale(1); }
}

.cs-toolbar {
    position: relative;
}

/* Form Actions */
.cs-form-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 8px;
    padding: 0 8px 8px 8px;
}

.cs-cancel {
    padding: 8px 18px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.6);
    border-radius: 10px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.cs-cancel:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.2);
}

/* Save button — same box style as Cancel, override all .cs-submit inherited positioning */
.cs-form-actions .cs-save,
.cs-save.cs-submit {
    position: static !important;
    bottom: auto !important;
    right: auto !important;
    width: auto !important;
    height: auto !important;
    padding: 8px 18px !important;
    border-radius: 10px !important;
    background: rgba(255, 255, 255, 0.06) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    color: rgba(255, 255, 255, 0.6) !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    box-shadow: none !important;
    transform: none !important;
    z-index: auto !important;
    flex-shrink: 0 !important;
    min-width: unset !important;
    gap: 0 !important;
}
.cs-form-actions .cs-save:hover,
.cs-save.cs-submit:hover {
    background: rgba(255, 255, 255, 0.1) !important;
    border-color: rgba(255, 255, 255, 0.2) !important;
    color: #fff !important;
    transform: none !important;
    box-shadow: none !important;
}
.cs-form-actions .cs-save:disabled,
.cs-save.cs-submit:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Edit Mode */
.cs-edit-mode {
    background: rgba(168, 85, 247, 0.05);
    border: 1px solid rgba(168, 85, 247, 0.2);
    border-radius: 12px;
    padding: 12px;
}

.cs-edit-mode .cs-form-input-wrap {
    background: rgba(255, 255, 255, 0.03);
}

.cs-edit-form {
    margin-top: 8px;
}

/* Edited label */
.cs-edited {
    font-size: 11px;
    color: var(--text-muted, #6b7280);
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.cs-edited i {
    font-size: 9px;
}

/* Edit button */
.cs-edit-btn {
    color: var(--star-purple, #8b5cf6);
}

.cs-edit-btn:hover {
    background: rgba(168, 85, 247, 0.15);
}

/* Updated form input wrap for toolbar */
.cs-form-input-wrap {
    flex-direction: column;
    position: relative;
    padding-bottom: 52px;
    transition: padding-bottom 0.2s ease;
}

/* Login prompt */
.cs-login-prompt {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px dashed rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    color: var(--text-muted, #9ca3af);
}

.cs-login-prompt i {
    font-size: 20px;
}

.cs-login-btn {
    margin-left: auto;
    background: linear-gradient(135deg, #4285f4, #34a853);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: transform 0.2s;
}

.cs-login-btn:hover {
    transform: scale(1.02);
}

/* Empty state */
.cs-empty {
    text-align: center;
    padding: 40px;
    color: var(--text-muted, #6b7280);
}

/* Comment List */
.cs-list {
    display: flex;
    flex-direction: column;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   COMMENT ITEM with Thread Lines
   ═══════════════════════════════════════════════════════════════════════════════ */

.cs-comment {
    display: flex;
    position: relative;
    padding-left: 0;
    margin-bottom: 4px;
    padding: 10px 10px;
    border-radius: 12px;
    transition: background 0.15s ease;
}

.cs-comment:hover {
    background: rgba(255, 255, 255, 0.02);
}

/* Thread line (vertical connector) — subtle, left of replies */
.cs-thread-line {
    display: none;
}

/* Все ответы с одним отступом (не уходим вправо, как на YouTube) */
.cs-replies > .cs-comment {
    margin-left: 20px;
}

.cs-replies .cs-replies > .cs-comment,
.cs-replies .cs-replies .cs-replies > .cs-comment {
    margin-left: 0;
}

.cs-replies .cs-thread-line {
    display: block;
    position: absolute;
    left: 14px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(180deg, rgba(168, 85, 247, 0.4), rgba(168, 85, 247, 0.1));
    border-radius: 1px;
}

.cs-replies .cs-comment.cs-last .cs-thread-line {
    height: 24px;
}

/* Контент комментария не толкает блок вправо */
.cs-comment {
    min-width: 0;
}

.cs-body {
    min-width: 0;
}

.cs-content {
    overflow-wrap: break-word;
    word-break: break-word;
}

/* "Показать N ответов" — как на YouTube: ссылка + треугольник вниз */
.cs-thread-toggle {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 0;
    margin-left: 0;
    margin-top: 4px;
    background: none;
    border: none;
    border-radius: 0;
    color: rgba(168, 85, 247, 0.95);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: color 0.2s ease;
}

.cs-thread-toggle:hover {
    color: rgba(168, 85, 247, 1);
    text-decoration: underline;
}

.cs-thread-toggle:active {
    opacity: 0.85;
}

.cs-thread-toggle i {
    font-size: 10px;
    transition: transform 0.25s cubic-bezier(0.34, 1.2, 0.64, 1);
}

.cs-thread-collapsed .cs-thread-toggle i {
    transform: rotate(-90deg);
}

/* Плашка «Показать все комментарии (N)» при более чем 2 ответах */
.cs-thread-toggle-many {
    margin-top: 8px;
    padding: 8px 14px !important;
    background: rgba(168, 85, 247, 0.1) !important;
    border: 1px solid rgba(168, 85, 247, 0.2);
    border-radius: 10px;
    font-size: 13px !important;
}

.cs-thread-toggle-many:hover {
    background: rgba(168, 85, 247, 0.18) !important;
    border-color: rgba(168, 85, 247, 0.35);
}

.cs-thread-collapsed .cs-replies {
    display: none;
}

/* Connector from thread line to avatar */
.cs-connector {
    position: absolute;
    left: 20px;
    top: 56px;
    width: 1.5px;
    height: calc(100% - 56px);
    background: rgba(255, 255, 255, 0.05);
}

/* Avatar column */
.cs-avatar-col {
    position: relative;
    flex-shrink: 0;
    z-index: 1;
}

.cs-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    object-fit: cover;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    transition: all 0.2s ease;
}

.cs-avatar:hover {
    transform: scale(1.04);
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.4);
}

/* Top 1 - Gold border for comments */
.cs-avatar.top-1 {
    border: 2px solid transparent;
    background: 
        linear-gradient(#1a1625, #1a1625) padding-box,
        linear-gradient(135deg, #ffd700, #ffed4e, #ffd700) border-box;
    box-shadow: 0 0 12px rgba(255, 215, 0, 0.3), inset 0 0 8px rgba(255, 215, 0, 0.08);
    animation: rotate-gold-comment 4s linear infinite;
}

@keyframes rotate-gold-comment {
    0%, 100% { 
        background: linear-gradient(#1a1625, #1a1625) padding-box, linear-gradient(135deg, #ffd700, #ffed4e, #ffd700) border-box;
    }
    50% { 
        background: linear-gradient(#1a1625, #1a1625) padding-box, linear-gradient(315deg, #ffd700, #ffed4e, #ffd700) border-box;
    }
}

/* Top 2 - Silver border for comments */
.cs-avatar.top-2 {
    border: 2px solid transparent;
    background: 
        linear-gradient(#1a1625, #1a1625) padding-box,
        linear-gradient(135deg, #c0c0c0, #e8e8e8, #c0c0c0) border-box;
    box-shadow: 0 0 10px rgba(192, 192, 192, 0.25), inset 0 0 6px rgba(255, 255, 255, 0.06);
    animation: shimmer-silver-comment 3s ease-in-out infinite;
}

@keyframes shimmer-silver-comment {
    0%, 100% { box-shadow: 0 0 10px rgba(192, 192, 192, 0.25), inset 0 0 6px rgba(255, 255, 255, 0.06); }
    50% { box-shadow: 0 0 14px rgba(192, 192, 192, 0.35), inset 0 0 10px rgba(255, 255, 255, 0.1); }
}

/* Top 3 - Bronze border for comments */
.cs-avatar.top-3 {
    border: 2px solid transparent;
    background: 
        linear-gradient(#1a1625, #1a1625) padding-box,
        linear-gradient(135deg, #cd7f32, #e9a76a, #cd7f32) border-box;
    box-shadow: 0 0 10px rgba(205, 127, 50, 0.25), inset 0 0 6px rgba(233, 167, 106, 0.06);
    animation: pulse-bronze-comment 3s ease-in-out infinite;
}

@keyframes pulse-bronze-comment {
    0%, 100% { box-shadow: 0 0 10px rgba(205, 127, 50, 0.25), inset 0 0 6px rgba(233, 167, 106, 0.06); }
    50% { box-shadow: 0 0 14px rgba(205, 127, 50, 0.35), inset 0 0 10px rgba(233, 167, 106, 0.1); }
}

/* Level borders for comments */
.cs-avatar.level-epic {
    border-color: rgba(139, 92, 246, 0.4);
    box-shadow: 0 0 8px rgba(139, 92, 246, 0.2);
}

.cs-avatar.level-rare {
    border-color: rgba(59, 130, 246, 0.35);
    box-shadow: 0 0 6px rgba(59, 130, 246, 0.18);
}

.cs-avatar.level-uncommon {
    border-color: rgba(34, 197, 94, 0.3);
    box-shadow: 0 0 5px rgba(34, 197, 94, 0.15);
}

/* Top badge styles removed - only avatar borders show rank */

/* Body */
.cs-body {
    flex: 1;
    min-width: 0;
    padding-left: 10px;
}

/* Meta row — clean, tight */
.cs-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
    flex-wrap: wrap;
}

.cs-author {
    font-weight: 700;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.88);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: color 0.15s ease;
    letter-spacing: -0.01em;
}

.cs-author:hover {
    color: rgba(168, 85, 247, 0.9);
}

.cs-author i {
    font-size: 9px;
}

.cs-role-admin {
    color: #ef4444;
}

.cs-role-admin i {
    color: #ef4444;
}

.cs-role-moderator {
    color: #3b82f6;
}

.cs-role-moderator i {
    color: #3b82f6;
}

.cs-score {
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.03);
}

.cs-score.positive {
    color: #22c55e;
    background: rgba(34, 197, 94, 0.06);
}

.cs-score.negative {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.06);
}

.cs-user-level {
    font-size: 7px;
    font-weight: 700;
    padding: 2px 5px;
    border-radius: 5px;
    border: 1px solid;
    opacity: 0.75;
}

.cs-date {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.25);
}

.cs-user-rank {
    font-size: 10px;
    font-weight: 500;
    opacity: 0.7;
}

.cs-sub-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* Content */
.cs-content {
    color: rgba(255, 255, 255, 0.75);
    line-height: 1.65;
    font-size: 14px;
    margin-bottom: 8px;
    word-wrap: break-word;
    position: relative;
    letter-spacing: 0.005em;
}

.cs-content p {
    margin-bottom: 8px;
}

.cs-content p:last-child {
    margin-bottom: 0;
}

/* Long comment collapse */
.cs-content.cs-long {
    max-height: 200px;
    overflow: hidden;
    position: relative;
}

.cs-content.cs-long::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 80px;
    background: linear-gradient(transparent, rgba(8, 8, 12, 0.98));
    pointer-events: none;
}

.cs-expand-content-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 6px 18px;
    margin: 6px auto 6px auto;
    background: rgba(168, 85, 247, 0.06);
    border: none;
    border-radius: 20px;
    color: rgba(168, 85, 247, 0.8);
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    width: fit-content;
}

.cs-expand-content-btn:hover {
    background: rgba(168, 85, 247, 0.12);
    color: rgba(168, 85, 247, 1);
}

.cs-expand-content-btn i {
    font-size: 10px;
    transition: transform 0.2s;
}

.cs-content.expanded {
    max-height: none;
}

.cs-content.expanded::after {
    display: none;
}

.cs-content.expanded + .cs-expand-content-btn i {
    transform: rotate(180deg);
}

/* Actions — tight row */
.cs-actions {
    display: flex;
    align-items: center;
    gap: 3px;
    margin-bottom: 6px;
}

/* Vote buttons — pill-shaped, borderless, Apple-minimal */
.cs-vote {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    padding: 5px 10px;
    border: none;
    background: rgba(255, 255, 255, 0.03);
    color: rgba(255, 255, 255, 0.35);
    border-radius: 20px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.15s ease;
    min-width: 34px;
}

.cs-vote.has-count {
    gap: 4px;
    padding: 5px 12px;
    min-width: 44px;
}

.cs-vote i {
    font-size: 12px;
    transition: transform 0.15s ease;
}

.cs-vote:hover {
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.6);
}

.cs-vote:active {
    transform: scale(0.94);
}

/* Like */
.cs-like:hover {
    background: rgba(34, 197, 94, 0.08);
    color: #22c55e;
}

.cs-like:hover i {
    transform: translateY(-1px);
}

.cs-like.active {
    background: rgba(34, 197, 94, 0.1);
    color: #22c55e;
}

/* Dislike */
.cs-dislike:hover {
    background: rgba(239, 68, 68, 0.08);
    color: #ef4444;
}

.cs-dislike:hover i {
    transform: translateY(1px);
}

.cs-dislike.active {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.cs-vote span {
    min-width: 10px;
    text-align: center;
    font-weight: 600;
    font-size: 11px;
}

.cs-vote span:empty {
    display: none;
}

.cs-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border: none;
    background: rgba(255, 255, 255, 0.02);
    color: rgba(255, 255, 255, 0.3);
    border-radius: 20px;
    cursor: pointer;
    font-size: 11px;
    transition: all 0.15s ease;
}

.cs-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.6);
}

.cs-delete-btn:hover {
    color: #ef4444;
}

/* Reply form container */
.cs-reply-form-container {
    margin: 12px 0;
}

.cs-reply-form-container .cs-form {
    padding: 0;
    background: transparent;
    border-radius: 0;
}

/* Replies container */
.cs-replies {
    margin-top: 8px;
    position: relative;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   SPECIAL STATES
   ═══════════════════════════════════════════════════════════════════════════════ */

/* Golden comment (score > 10) */
.cs-comment.cs-golden > .cs-body {
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.08), rgba(245, 158, 11, 0.05));
    border-radius: 12px;
    padding: 12px;
    margin-left: 0;
    border-left: 3px solid #f59e0b;
}

.cs-comment.cs-golden .cs-author {
    color: #f59e0b;
}

/* Collapsed comment (score < -5) */
.cs-comment.cs-collapsed > .cs-body > .cs-content,
.cs-comment.cs-collapsed > .cs-body > .cs-actions,
.cs-comment.cs-collapsed > .cs-body > .cs-replies {
    display: none;
}

.cs-hidden-notice {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(239, 68, 68, 0.08);
    border-radius: 8px;
    color: var(--text-muted, #6b7280);
    font-size: 13px;
    cursor: pointer;
    margin-bottom: 8px;
}

.cs-hidden-notice:hover {
    background: rgba(239, 68, 68, 0.12);
}

.cs-expand-link {
    color: var(--star-purple, #8b5cf6);
    margin-left: auto;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════════════════════════ */

@media (max-width: 640px) {
    .cs-container {
        padding: 12px;
        border-radius: 10px;
    }
    
    .cs-form-avatar,
    .cs-avatar {
        width: 30px;
        height: 30px;
    }
    
    .cs-comment {
        padding: 8px;
        border-radius: 10px;
    }
    
    .cs-body {
        padding-left: 8px;
    }
    
    .cs-author {
        font-size: 12px;
    }
    
    .cs-content {
        font-size: 13px;
        line-height: 1.55;
    }
    
    .cs-replies > .cs-comment {
        margin-left: 16px;
    }
    
    .cs-replies .cs-replies > .cs-comment {
        margin-left: 0;
    }
    
    .cs-replies .cs-thread-line {
        left: 12px;
    }
    
    .cs-meta {
        gap: 5px;
        margin-bottom: 4px;
    }
    
    .cs-actions {
        flex-wrap: wrap;
        gap: 3px;
    }
    
    .cs-vote {
        padding: 5px 8px;
        font-size: 11px;
        min-width: 32px;
    }
    
    .cs-btn {
        padding: 4px 6px;
        font-size: 10px;
    }
    
    .cs-header {
        gap: 8px;
        margin-bottom: 12px;
    }
    
    .cs-title {
        font-size: 15px;
    }
    
    .cs-sort-btn {
        padding: 5px 10px;
        font-size: 11px;
    }
    
    .cs-form-input-wrap {
        padding-bottom: 44px;
    }
    
    .cs-input {
        font-size: 13px;
        padding: 8px 40px 8px 12px;
    }
    
    .cs-submit {
        width: 32px;
        height: 32px;
    }
}

/* Very small screens */
@media (max-width: 400px) {
    .cs-container {
        padding: 8px;
    }
    
    .cs-form-avatar {
        display: none;
    }
    
    .cs-user-level {
        display: none;
    }
}

/* ═══════════════════════════════════════════════════════════════════════════════
   ANIMATIONS
   ═══════════════════════════════════════════════════════════════════════════════ */

.cs-comment {
    animation: cs-fadeIn 0.3s ease;
}

@keyframes cs-fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.cs-vote.active {
    animation: cs-pulse 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes cs-pulse {
    0% { transform: scale(1); }
    40% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* Highlight comment when scrolled to from top comment link - Smooth & Juicy */
.cs-comment.highlight {
    z-index: 10;
}

.cs-comment.highlight .cs-bubble {
    animation: cs-highlight-glow 2.5s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 16px;
}

@keyframes cs-highlight-glow {
    0% { 
        background: rgba(168, 85, 247, 0.25);
        box-shadow: 
            0 0 0 3px rgba(168, 85, 247, 0.8),
            0 0 40px rgba(168, 85, 247, 0.5),
            0 4px 20px rgba(168, 85, 247, 0.3);
        transform: scale(1.01);
    }
    20% {
        background: rgba(168, 85, 247, 0.2);
        box-shadow: 
            0 0 0 2px rgba(168, 85, 247, 0.6),
            0 0 30px rgba(168, 85, 247, 0.4),
            0 4px 15px rgba(168, 85, 247, 0.2);
        transform: scale(1);
    }
    100% { 
        background: var(--glass-bg, rgba(255,255,255,0.03));
        box-shadow: none;
        transform: scale(1);
    }
}

/* Self-vote prevention — disabled vote buttons on own comments */
.cs-vote-disabled,
.cs-vote[disabled] {
    opacity: 0.25 !important;
    cursor: not-allowed !important;
    pointer-events: none;
}
.cs-vote-disabled:hover {
    background: transparent !important;
    transform: none !important;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   @Mention highlighting
   ═══════════════════════════════════════════════════════════════════════════════ */
.cs-mention {
    color: rgba(139, 92, 246, 0.9);
    font-weight: 500;
    cursor: pointer;
}
.cs-mention:hover {
    color: #a855f7;
    text-decoration: underline;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   Spoiler tag
   ═══════════════════════════════════════════════════════════════════════════════ */
.cs-spoiler {
    background: rgba(255,255,255,.1);
    color: transparent;
    border-radius: 4px;
    padding: 2px 6px;
    cursor: pointer;
    transition: background .2s, color .2s;
    user-select: none;
    display: inline;
}
.cs-spoiler.revealed {
    background: rgba(139,92,246,.08);
    color: inherit;
    user-select: auto;
    cursor: text;
}
.cs-spoiler:hover:not(.revealed) {
    background: rgba(255,255,255,.15);
}

/* Spoiler in editor */
.cs-spoiler-edit {
    background: rgba(139,92,246,.12);
    border: 1px dashed rgba(139,92,246,.35);
    border-radius: 4px;
    padding: 2px 6px;
    color: inherit;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   Author badge (post/topic author)
   ═══════════════════════════════════════════════════════════════════════════════ */
.cs-author-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 9px;
    font-weight: 600;
    color: rgba(139, 92, 246, 0.9);
    background: rgba(139, 92, 246, 0.1);
    border: 1px solid rgba(139, 92, 246, 0.2);
    padding: 1px 5px;
    border-radius: 8px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    white-space: nowrap;
    line-height: 1.4;
}
.cs-author-badge i {
    font-size: 7px;
}

/* Bot badge (visible only to admin/moderator) */
.cs-bot-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 10px;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 6px;
    background: rgba(139, 92, 246, 0.15);
    border: 1px solid rgba(139, 92, 246, 0.3);
    color: #a78bfa;
    white-space: nowrap;
    cursor: default;
}
.cs-bot-badge i {
    font-size: 9px;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   Replies collapse/expand toggle
   ═══════════════════════════════════════════════════════════════════════════════ */
.cs-replies-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px 8px 52px;
    font-size: 13px;
    font-weight: 500;
    color: rgba(139, 92, 246, 0.85);
    cursor: pointer;
    user-select: none;
    transition: color 0.2s, background 0.2s;
    border-radius: 8px;
    margin: 2px 0;
}
.cs-replies-toggle:hover {
    color: #a855f7;
    background: rgba(139, 92, 246, 0.06);
}
.cs-replies-toggle i {
    font-size: 11px;
    transition: transform 0.2s;
}
.cs-replies-collapse {
    color: rgba(156, 163, 175, 0.7);
}
.cs-replies-collapse:hover {
    color: rgba(156, 163, 175, 0.9);
    background: rgba(156, 163, 175, 0.06);
}

/* "Show more comments" pagination button */
.cs-show-more {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 24px;
    margin: 16px 0 8px;
    font-size: 14px;
    font-weight: 600;
    color: rgba(139, 92, 246, 0.9);
    cursor: pointer;
    user-select: none;
    border: 1px solid rgba(139, 92, 246, 0.2);
    border-radius: 12px;
    background: rgba(139, 92, 246, 0.06);
    transition: all 0.2s;
}
.cs-show-more:hover {
    color: #c084fc;
    background: rgba(139, 92, 246, 0.12);
    border-color: rgba(139, 92, 246, 0.35);
}
.cs-show-more i {
    font-size: 11px;
}
