/**
 * ContentRenderer Component Styles
 * Styles for posts, comments, replies, and inline forms rendered by content-renderer.js
 */

/* ===== Post Card ===== */
.cr-post {
    background: var(--bg-card-glass, rgba(26, 13, 46, 0.75));
    backdrop-filter: var(--glass-blur, blur(12px));
    -webkit-backdrop-filter: var(--glass-blur, blur(12px));
    border: 1px solid var(--border-color, rgba(168, 85, 247, 0.12));
    border-radius: var(--border-radius-lg, 12px);
    padding: 0;
    margin: 5px;
    position: relative;
    overflow: visible;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.cr-post:hover {
    border-color: rgba(168, 85, 247, 0.25);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

/* ===== Post Header ===== */
.cr-header {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.cr-avatar-link {
    flex-shrink: 0;
    text-decoration: none;
}

.cr-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(168, 85, 247, 0.2);
    background: var(--bg-tertiary, #1e1b4b);
}

.cr-avatar-sm {
    width: 32px;
    height: 32px;
}

.cr-user-info {
    flex: 1;
    min-width: 0;
}

.cr-name-row {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    flex-wrap: wrap;
}

.cr-username-row {
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.user-card-username-row {
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.cr-display-name {
    font-weight: 600;
    color: var(--text-primary, #e2e8f0);
    text-decoration: none;
    font-size: 0.9375rem;
    line-height: 1.3;
}

.cr-display-name:hover {
    color: var(--color-primary, #a855f7);
    text-decoration: underline;
}

.cr-username {
    color: var(--text-tertiary, rgba(255, 255, 255, 0.45));
    font-size: 0.8125rem;
}

.cr-verified {
    color: var(--color-primary, #a855f7);
    flex-shrink: 0;
    vertical-align: middle;
}

/* ===== Role Badges (Admin/Moderator) ===== */
.cr-role-badge {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 1px 6px;
    border-radius: 4px;
    vertical-align: middle;
    flex-shrink: 0;
    line-height: 1.4;
}
.cr-role-badge .fas {
    font-size: 0.6rem;
}
/* Fallback colors when inline styles are absent */
.cr-role-admin {
    background: rgba(234, 179, 8, 0.15);
    color: #eab308;
    border: 1px solid rgba(234, 179, 8, 0.3);
}
.cr-role-moderator {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

/* ===== Online Indicator ===== */
.cr-online-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    vertical-align: middle;
    box-shadow: 0 0 4px currentColor;
}

/* Status pill: (O 00min) pattern — pill contains dot + time-ago text */
.cr-status-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    vertical-align: middle;
    flex-shrink: 0;
    font-size: 0.65rem;
    font-weight: 600;
    line-height: 1;
    padding: 0.2rem 0.45rem;
    border-radius: 9999px;
    white-space: nowrap;
    background: var(--bg-primary, #ffffff);
    color: var(--text-primary, #111827);
    border: 1px solid var(--border-color, #e5e7eb);
}

.cr-status-pill .cr-online-dot {
    width: 6px;
    height: 6px;
    box-shadow: none;
    margin: 0;
}

.cr-status-pill.state-changed {
    animation: statePopColor 0.4s ease-out;
}

[data-theme='dark'] .cr-status-pill {
    background: var(--bg-primary, #0f172a);
    color: var(--text-primary, #f1f5f9);
    border-color: var(--border-color, #334155);
}

.cr-time-row {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin-top: 0.125rem;
}

.cr-privacy {
    color: var(--text-tertiary, rgba(255, 255, 255, 0.4));
    font-size: 0.75rem;
}

/* ===== Group Name Badge ===== */
.cr-group-name {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--color-primary, #a855f7);
    background: rgba(168, 85, 247, 0.1);
    border: 1px solid rgba(168, 85, 247, 0.25);
    padding: 1px 8px;
    border-radius: 12px;
    vertical-align: middle;
    flex-shrink: 0;
    line-height: 1.4;
    cursor: default;
    white-space: nowrap;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
}
.cr-group-name-sm {
    font-size: 0.6rem;
    padding: 0 5px;
    border-radius: 8px;
    max-width: 120px;
}
.cr-group-name:hover {
    background: rgba(168, 85, 247, 0.18);
}

/* ===== User Avatar (Message Bubble) ===== */
.cr-user-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
    flex-shrink: 0;
    width: 28px;
    height: 28px;
}
.cr-user-avatar-xs {
    width: 20px;
    height: 20px;
}
.cr-user-avatar-md {
    width: 36px;
    height: 36px;
}
.cr-user-avatar-img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}
.cr-user-avatar-dot {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: 1.5px solid var(--bg-primary, #111);
}
.cr-user-avatar-xs .cr-user-avatar-dot {
    width: 6px;
    height: 6px;
}

.cr-timestamp {
    color: var(--text-tertiary, rgba(255, 255, 255, 0.4));
    font-size: 0.75rem;
}

.cr-edited {
    color: var(--text-tertiary, rgba(255, 255, 255, 0.35));
    font-size: 0.75rem;
    font-style: italic;
}

/* ===== Menu Button ===== */
.cr-menu-btn {
    background: none;
    border: none;
    color: var(--text-tertiary, rgba(255, 255, 255, 0.4));
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 50%;
    transition: all 0.15s ease;
    flex-shrink: 0;
    margin-left: auto;
}

.cr-menu-btn:hover {
    background: var(--bg-hover, rgba(168, 85, 247, 0.1));
    color: var(--text-primary, #e2e8f0);
}

.cr-menu-sm {
    padding: 0.125rem;
}

/* ===== Content Body ===== */
.cr-body {
    color: var(--text-primary, #cbd5e1);
    font-size: 0.9375rem;
    line-height: 1.65;
    word-wrap: break-word;
    overflow-wrap: break-word;
    margin-bottom: 0.75rem;
}

.cr-body a {
    color: var(--color-primary, #a855f7);
    text-decoration: none;
}

.cr-body a:hover {
    text-decoration: underline;
}

.content-link {
    color: var(--color-info, #3b82f6) !important;
}

.content-hashtag {
    color: var(--color-primary, #a855f7) !important;
    font-weight: 500;
}

/* Inline hashtag chip — icon + tag text without the # prefix character */
.cr-hashtag-inline {
    display: inline-flex;
    align-items: center;
    gap: 0.2em;
    padding: 0.1em 0.45em;
    border-radius: 20px;
    background: rgba(168, 85, 247, 0.10);
    border: 1px solid rgba(168, 85, 247, 0.22);
    font-size: 0.9em;
    transition: background 0.18s ease, border-color 0.18s ease;
    white-space: nowrap;
    vertical-align: baseline;
    text-decoration: none !important;
}
.cr-hashtag-inline:hover {
    background: rgba(168, 85, 247, 0.18);
    border-color: rgba(168, 85, 247, 0.45);
}
.cr-hashtag-icon {
    font-size: 0.72em;
    opacity: 0.75;
}

.content-mention {
    display: inline-flex;
    align-items: center;
    gap: 0.15em;
    color: var(--color-secondary, #ec4899) !important;
    font-weight: 500;
    text-decoration: none !important;
    white-space: nowrap;
    vertical-align: baseline;
}
.content-mention:hover {
    text-decoration: underline !important;
}
.cr-mention-icon {
    font-size: 0.72em;
    opacity: 0.75;
}

/* ===== Actions Bar ===== */
.cr-actions {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border-color, rgba(168, 85, 247, 0.08));
}

.cr-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.75rem;
    background: none;
    border: none;
    color: var(--text-tertiary, rgba(255, 255, 255, 0.45));
    font-size: 0.8125rem;
    cursor: pointer;
    border-radius: var(--border-radius, 8px);
    transition: all 0.15s ease;
    font-family: inherit;
}

.cr-action-btn:hover {
    background: var(--bg-hover, rgba(168, 85, 247, 0.08));
    color: var(--text-primary, #e2e8f0);
}

.cr-action-btn:active {
    animation: stateBounceClick 0.25s ease-out;
}

.cr-action-btn.active {
    color: var(--color-danger, #ef4444);
    animation: statePopColor 0.35s ease-out;
}

.cr-action-btn.active svg {
    fill: currentColor;
}

/* React/like pop spinner */
.cr-react-loading {
    pointer-events: none;
    position: relative;
}

.cr-react-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    margin-left: 4px;
    border: 2px solid rgba(168, 85, 247, 0.25);
    border-top-color: var(--color-primary, #a855f7);
    border-radius: 50%;
    animation: crReactSpin 0.5s linear infinite;
    vertical-align: middle;
}

.cr-action-sm .cr-react-spinner {
    width: 12px;
    height: 12px;
    border-width: 1.5px;
}

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

.cr-action-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
}

.cr-count {
    font-size: inherit;
    font-weight: 500;
}

[data-action="react"] .cr-count {
    cursor: pointer;
}

.cr-views {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    color: var(--text-tertiary, rgba(255, 255, 255, 0.35));
    font-size: 0.8125rem;
    margin-left: auto;
    padding: 0.375rem 0;
}

.cr-bookmark {
    margin-left: auto;
}

.cr-views + .cr-bookmark {
    margin-left: 0.5rem;
}

.cr-danger {
    color: var(--color-danger, #ef4444) !important;
}

/* ===== 3-Dot Dropdown Menu ===== */
.cr-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    z-index: 9999;
    min-width: 180px;
    background: var(--bg-card, #1a1a2e);
    border: 1px solid var(--border-color, rgba(168, 85, 247, 0.15));
    border-radius: var(--border-radius, 8px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
    overflow: hidden;
    animation: crDropdownIn 0.12s ease-out;
}

@keyframes crDropdownIn {
    from { opacity: 0; transform: translateY(-6px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0)   scale(1);    }
}

.cr-dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    width: 100%;
    padding: 0.625rem 1rem;
    background: none;
    border: none;
    color: var(--text-secondary, #94a3b8);
    font-size: 0.875rem;
    font-family: inherit;
    text-align: left;
    cursor: pointer;
    transition: background 0.12s ease, color 0.12s ease;
}

.cr-dropdown-item:hover {
    background: var(--bg-hover, rgba(168, 85, 247, 0.1));
    color: var(--text-primary, #e2e8f0);
}

.cr-dropdown-item.cr-danger {
    color: var(--color-danger, #ef4444);
}

.cr-dropdown-item.cr-danger:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #f87171;
}

.cr-dropdown-item .fas {
    width: 1rem;
    text-align: center;
    opacity: 0.8;
}

/* ===== Comment Section (toggled below post) ===== */
.cr-comment-section {
    display: none;
    padding: 0.75rem 0 0.25rem;
    border-top: 1px solid var(--border-color, rgba(168, 85, 247, 0.08));
    margin-top: 0.25rem;
    overflow-y: visible;
}

.cr-comment-section.open {
    display: block;
    animation: crFadeIn 0.18s ease-out;
}

/* Smooth height transition when comments are added / removed */
.cr-comment-section.cr-thread-resizing,
.cr-replies.cr-thread-resizing {
    transition: max-height 0.3s ease-out;
    overflow: hidden;
}

@keyframes crFadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0);    }
}

/* Slide-in animation for newly added comments / replies */
@keyframes commentSlideIn {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0);    }
}

.comment-slide-in {
    animation: commentSlideIn 0.25s ease-out;
}

.cr-comments-loading,
.cr-comments-empty,
.cr-comments-error {
    padding: 1rem 0;
    color: var(--text-tertiary, rgba(255, 255, 255, 0.45));
    font-size: 0.875rem;
    text-align: center;
}

.cr-retry-btn {
    background: none;
    border: none;
    color: var(--color-primary, #a855f7);
    cursor: pointer;
    font-size: inherit;
    text-decoration: underline;
    padding: 0;
    margin-left: 0.25rem;
}

/* ===== Media Gallery ===== */
/* ===== Media Carousel ===== */
.cr-media-carousel {
    position: relative;
    margin-bottom: 0.75rem;
    border-radius: var(--border-radius, 8px);
    overflow: hidden;
}

.cr-carousel-track {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 0 2px;
}

.cr-carousel-track::-webkit-scrollbar {
    display: none;
}

.cr-carousel-slide {
    flex: 0 0 100%;
    scroll-snap-align: start;
    position: relative;
    border-radius: 4px;
    overflow: hidden;
    background: var(--bg-tertiary, #1a0d2e);
    min-height: 120px;
}

/* When there are 2 items side by side */
.cr-carousel-track:has(.cr-carousel-slide:nth-child(2):last-child) .cr-carousel-slide {
    flex: 0 0 calc(50% - 4px);
}

/* When 3+ items, show partial next slide as peek */
.cr-carousel-track:has(.cr-carousel-slide:nth-child(3)) .cr-carousel-slide {
    flex: 0 0 85%;
}

.cr-carousel-slide .cr-media-img {
    width: 100%;
    height: 280px;
    object-fit: cover;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.cr-carousel-slide:hover .cr-media-img {
    transform: scale(1.02);
}

.cr-carousel-slide .cr-media-video {
    width: 100%;
    height: 280px;
    object-fit: cover;
    background: #000;
}

.cr-media-play-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.3);
    cursor: pointer;
    transition: background 0.2s;
}

.cr-media-play-overlay:hover {
    background: rgba(0,0,0,0.5);
}

/* Detach button */
.cr-detach-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    background: rgba(0,0,0,0.6);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    z-index: 2;
    opacity: 0;
    transition: opacity 0.2s;
}

.cr-carousel-slide:hover .cr-detach-btn,
.cr-embed:hover .cr-detach-btn {
    opacity: 1;
}

/* Carousel arrows */
.cr-carousel-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: rgba(0,0,0,0.6);
    color: white;
    cursor: pointer;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    opacity: 0;
    transition: opacity 0.2s;
}

.cr-media-carousel:hover .cr-carousel-arrow {
    opacity: 1;
}

/* Always show arrows on touch-only devices (no hover support) */
@media (hover: none) {
    .cr-carousel-arrow {
        opacity: 0.7;
    }
}

.cr-carousel-prev {
    left: 8px;
}

.cr-carousel-next {
    right: 8px;
}

.cr-carousel-arrow:hover {
    background: rgba(0,0,0,0.8);
}

/* Dot indicators */
.cr-carousel-dots {
    display: flex;
    justify-content: center;
    gap: 6px;
    padding: 8px 0 4px;
}

.cr-carousel-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--text-muted, #6b7280);
    opacity: 0.4;
    transition: opacity 0.2s;
}

.cr-carousel-dot.active {
    opacity: 1;
    background: var(--color-primary, #a855f7);
}

.cr-carousel-counter {
    text-align: center;
    font-size: 12px;
    color: var(--text-muted, #6b7280);
    padding: 4px 0;
}

/* Audio card in carousel */
.cr-audio-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    gap: 12px;
    min-height: 120px;
    background: var(--bg-tertiary, #1a0d2e);
}

.cr-audio-icon {
    font-size: 32px;
    color: var(--color-primary, #a855f7);
}

.cr-inline-audio {
    width: 100%;
    max-width: 320px;
    height: 36px;
}

/* ===== Content Embeds (YouTube, SoundCloud) ===== */
.cr-embed {
    position: relative;
    width: 100%;
    margin: 0.5rem 0;
    border-radius: 8px;
    overflow: hidden;
}

.cr-embed-youtube {
    padding-top: 56.25%;
    background: #000;
}

.cr-embed-youtube iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

.cr-embed-soundcloud {
    height: 166px;
    background: var(--bg-tertiary, #1a0d2e);
}

.cr-embed-soundcloud iframe {
    width: 100%;
    height: 100%;
    border: none;
}

/* ===== Floating Player ===== */
.cr-floating-player {
    position: fixed;
    bottom: 80px;
    right: 20px;
    width: 360px;
    max-width: calc(100vw - 40px);
    background: var(--bg-primary, #0f0a1a);
    border: 1px solid var(--border-color, rgba(168,85,247,0.2));
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
    z-index: 9990;
    overflow: hidden;
    transition: width 0.3s, height 0.3s;
}

.cr-floating-player.cr-float-minimized {
    width: 260px;
}

.cr-floating-player.cr-float-minimized .cr-float-body {
    display: none;
}

.cr-float-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 10px;
    background: var(--bg-secondary, #1a0d2e);
    cursor: grab;
    user-select: none;
}

.cr-float-header:active {
    cursor: grabbing;
}

.cr-float-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary, #e2e8f0);
}

.cr-float-controls {
    display: flex;
    gap: 4px;
}

.cr-float-btn {
    width: 24px;
    height: 24px;
    border: none;
    border-radius: 4px;
    background: transparent;
    color: var(--text-muted, #6b7280);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    transition: color 0.15s;
}

.cr-float-btn:hover {
    color: var(--text-primary, #e2e8f0);
}

.cr-float-body {
    position: relative;
}

.cr-float-body video {
    width: 100%;
    display: block;
}

.cr-float-body audio {
    width: 100%;
    display: block;
    padding: 8px;
}

.cr-float-body iframe {
    width: 100%;
    border: none;
}

.cr-float-body .cr-embed-youtube iframe {
    position: static;
    height: 202px;
}

.cr-float-body .cr-embed-soundcloud iframe {
    height: 166px;
}

.cr-float-audio-art {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 80px;
    background: linear-gradient(135deg, var(--color-primary, #a855f7), #6d28d9);
    color: white;
    font-size: 28px;
}

.cr-media-lock-placeholder {
    width: 100%;
    height: 100%;
    min-height: 120px;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    background: rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
}

.cr-media-lock-placeholder i {
    font-size: 24px;
    color: white;
}

/* Mobile adjustments */
@media (max-width: 480px) {
    .cr-carousel-slide .cr-media-img,
    .cr-carousel-slide .cr-media-video {
        height: 200px;
    }

    .cr-carousel-track:has(.cr-carousel-slide:nth-child(3)) .cr-carousel-slide {
        flex: 0 0 92%;
    }

    .cr-floating-player {
        width: 280px;
        bottom: 70px;
        right: 10px;
    }
}

/* ===== Comment Styles ===== */
.cr-comment {
    padding: 0.75rem 5px;
    position: relative;
}

.cr-comment + .cr-comment {
    border-top: 1px solid var(--border-color, rgba(168, 85, 247, 0.06));
}

.cr-reply {
    margin-left: 1rem;
    padding-left: 0.5rem;
    border-left: 2px solid rgba(168, 85, 247, 0.15);
}

.cr-comment-main {
    position: relative;
}

.cr-comment-header {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    margin-bottom: 0.375rem;
}

.cr-comment-body {
    color: var(--text-primary, #cbd5e1);
    font-size: 0.875rem;
    line-height: 1.5;
    word-wrap: break-word;
    margin-bottom: 0.375rem;
    padding-left: 2.5rem;
}

.cr-comment-actions {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding-left: 2.5rem;
}

/* ===== Replies & Thread ===== */
.cr-replies {
    margin-top: 0.25rem;
}

.cr-load-replies {
    background: none;
    border: none;
    color: var(--color-primary, #a855f7);
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    padding: 0.375rem 0.75rem;
    margin-left: 2.5rem;
    margin-top: 0.25rem;
    border-radius: var(--border-radius, 8px);
    transition: background 0.15s ease;
}

.cr-load-replies:hover {
    background: rgba(168, 85, 247, 0.08);
}

/* ===== Empty / Feed States ===== */
.cr-empty {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-secondary, #94a3b8);
}

.cr-feed {
    display: flex;
    flex-direction: column;
}

.cr-thread {
    padding: 0.5rem 0;
}

/* ===== Poll ===== */
.cr-poll {
    border: 1px solid var(--border-color, rgba(168, 85, 247, 0.12));
    border-radius: var(--border-radius, 8px);
    overflow: hidden;
    margin-bottom: 0.75rem;
}

.cr-poll-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.625rem 0.75rem;
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--border-color, rgba(168, 85, 247, 0.06));
    width: 100%;
    text-align: left;
    cursor: pointer;
    position: relative;
    color: var(--text-primary, #e2e8f0);
    font-family: inherit;
    font-size: 0.875rem;
    transition: background 0.15s ease;
}

.cr-poll-option:hover:not(:disabled) {
    background: rgba(168, 85, 247, 0.06);
}

.cr-poll-bar {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    background: rgba(168, 85, 247, 0.12);
    transition: width 0.3s ease;
}

.cr-poll-text {
    position: relative;
    z-index: 1;
}

.cr-poll-pct {
    position: relative;
    z-index: 1;
    font-weight: 600;
    color: var(--color-primary, #a855f7);
}

.cr-poll-selected {
    border-left: 3px solid var(--color-primary, #a855f7);
}

/* ===== Quoted / Shared Post Card ===== */
.cr-quoted {
    border: 1px solid var(--border-color, rgba(168, 85, 247, 0.12));
    border-radius: var(--border-radius, 8px);
    padding: 0.75rem;
    margin-bottom: 0.75rem;
    background: var(--bg-secondary, rgba(13, 13, 26, 0.5));
}

.cr-shared-card {
    border-left: 3px solid var(--color-primary, #a855f7);
    border-radius: var(--border-radius, 8px);
    background: var(--bg-secondary, rgba(13, 13, 26, 0.4));
    position: relative;
    overflow: hidden;
    transition: border-color 0.2s ease;
}

.cr-shared-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.03) 0%, transparent 50%);
    pointer-events: none;
}

.cr-shared-card:hover {
    border-color: var(--color-primary, #a855f7);
}

.cr-shared-label {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--text-tertiary, rgba(255, 255, 255, 0.4));
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.5rem;
    padding-bottom: 0.375rem;
    border-bottom: 1px solid var(--border-color, rgba(168, 85, 247, 0.06));
    position: relative;
    z-index: 1;
}

.cr-shared-label svg {
    opacity: 0.6;
}

.cr-quoted-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.375rem;
    position: relative;
    z-index: 1;
}

.cr-quoted-avatar-link {
    flex-shrink: 0;
    text-decoration: none;
}

.cr-quoted-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 1.5px solid var(--border-color, rgba(168, 85, 247, 0.15));
    object-fit: cover;
}

.cr-quoted-user-info {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    flex: 1;
    min-width: 0;
}

.cr-quoted-user-info--stacked {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.125rem;
}

.cr-quoted-user-row1 {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    min-width: 0;
}

.cr-quoted-user-row2 {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    min-width: 0;
}

.cr-quoted-name {
    font-weight: 600;
    font-size: 0.8125rem;
    color: var(--text-primary, #e2e8f0);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cr-quoted-username {
    font-size: 0.75rem;
    color: var(--text-tertiary, rgba(255, 255, 255, 0.4));
    white-space: nowrap;
}

.cr-quoted-time {
    font-size: 0.6875rem;
    color: var(--text-tertiary, rgba(255, 255, 255, 0.35));
    margin-left: auto;
    white-space: nowrap;
    flex-shrink: 0;
}

.cr-quoted-body {
    font-size: 0.8125rem;
    color: var(--text-secondary, #94a3b8);
    line-height: 1.5;
    position: relative;
    z-index: 1;
    padding-left: 0.75rem;
    border-left: 2px solid var(--border-color, rgba(168, 85, 247, 0.2));
    margin-left: 0.125rem;
}

.cr-quoted-media {
    margin-top: 0.5rem;
    border-radius: calc(var(--border-radius, 8px) - 4px);
    overflow: hidden;
    position: relative;
    z-index: 1;
}

.cr-quoted-media-img {
    width: 100%;
    max-height: 200px;
    object-fit: cover;
    border-radius: calc(var(--border-radius, 8px) - 4px);
}

/* ===== View count counter bump animation ===== */
@keyframes crCountBump {
    0% { transform: scale(1); }
    40% { transform: scale(1.3); }
    100% { transform: scale(1); }
}

.cr-count-bump {
    animation: crCountBump 0.3s ease-out;
}

/* ===== Light theme overrides for shared cards ===== */
[data-theme="light"] .cr-shared-card {
    background: rgba(100, 140, 220, 0.08);
    border-color: rgba(100, 140, 200, 0.20);
    border-left-color: var(--color-primary, #a855f7);
}

[data-theme="light"] .cr-shared-card::before {
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.06) 0%, transparent 50%);
}

[data-theme="light"] .cr-quoted-name {
    color: var(--text-primary, #0f172a);
}

[data-theme="light"] .cr-shared-label {
    color: var(--text-muted, #4b6e9e);
    border-bottom-color: rgba(100, 140, 200, 0.12);
}

/* ===== File Attachments ===== */
.cr-files {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    margin-bottom: 0.75rem;
}

.cr-file {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: var(--bg-tertiary, rgba(26, 13, 46, 0.5));
    border-radius: var(--border-radius, 8px);
    border: 1px solid var(--border-color, rgba(168, 85, 247, 0.08));
    text-decoration: none;
    color: var(--text-primary, #e2e8f0);
    font-size: 0.8125rem;
    transition: background 0.15s ease;
}

.cr-file:hover {
    background: rgba(168, 85, 247, 0.08);
}

.cr-file-icon {
    color: var(--color-primary, #a855f7);
}

.cr-file-info {
    flex: 1;
    min-width: 0;
}

.cr-file-name {
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cr-file-size {
    font-size: 0.75rem;
    color: var(--text-tertiary, rgba(255, 255, 255, 0.4));
}

/* ===== Link Preview Card ===== */
.cr-link-preview {
    display: flex;
    overflow: hidden;
    margin-top: 0.5rem;
    margin-bottom: 0.75rem;
    border-radius: var(--border-radius, 8px);
    border: 1px solid var(--border-color, rgba(168, 85, 247, 0.12));
    background: var(--bg-tertiary, rgba(26, 13, 46, 0.5));
    text-decoration: none;
    color: var(--text-primary, #e2e8f0);
    transition: background 0.15s ease, border-color 0.15s ease;
    max-height: 140px;
}
.cr-link-preview:hover {
    background: rgba(168, 85, 247, 0.08);
    border-color: var(--color-primary, #a855f7);
}
.cr-link-preview-image {
    flex-shrink: 0;
    width: 140px;
    overflow: hidden;
}
.cr-link-preview-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.cr-link-preview-info {
    flex: 1;
    min-width: 0;
    padding: 0.625rem 0.75rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.2rem;
}
.cr-link-preview-site {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-tertiary, rgba(255, 255, 255, 0.4));
}
.cr-link-preview-title {
    font-weight: 600;
    font-size: 0.875rem;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.cr-link-preview-desc {
    font-size: 0.8rem;
    color: var(--text-secondary, rgba(255, 255, 255, 0.6));
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.cr-file-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: var(--bg-tertiary, rgba(26, 13, 46, 0.5));
    border-radius: var(--border-radius, 8px);
    border: 1px solid var(--border-color, rgba(168, 85, 247, 0.08));
    text-decoration: none;
    color: var(--text-primary, #e2e8f0);
    font-size: 0.8125rem;
    transition: background 0.15s ease;
}
.cr-file-item:hover {
    background: rgba(168, 85, 247, 0.08);
}

/* ===== Inline Comment / Reply Form ===== */
.cr-inline-form {
    margin-top: 0.75rem;
    padding: 0.75rem;
    background: var(--bg-secondary, rgba(13, 13, 26, 0.6));
    border: 1px solid var(--border-color, rgba(168, 85, 247, 0.15));
    border-radius: var(--border-radius, 8px);
    animation: cr-form-appear 0.2s ease;
}

@keyframes cr-form-appear {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.cr-inline-input {
    width: 100%;
    min-height: 60px;
    padding: 0.625rem;
    background: var(--bg-primary, #0d0d1a);
    border: 1px solid var(--border-color, rgba(168, 85, 247, 0.2));
    border-radius: var(--border-radius-sm, 6px);
    color: var(--text-primary, #e2e8f0);
    font-family: inherit;
    font-size: 0.875rem;
    line-height: 1.5;
    resize: vertical;
    transition: border-color 0.15s ease;
    box-sizing: border-box;
}

.cr-inline-input:focus {
    outline: none;
    border-color: var(--color-primary, #a855f7);
    box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.1);
}

.cr-inline-input::placeholder {
    color: var(--text-tertiary, rgba(255, 255, 255, 0.3));
}

.cr-inline-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.cr-inline-cancel {
    padding: 0.375rem 0.75rem;
    background: transparent;
    border: 1px solid var(--border-color, rgba(168, 85, 247, 0.2));
    border-radius: var(--border-radius-sm, 6px);
    color: var(--text-secondary, #94a3b8);
    font-size: 0.8125rem;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s ease;
}

.cr-inline-cancel:hover {
    background: var(--bg-hover, rgba(168, 85, 247, 0.06));
    color: var(--text-primary, #e2e8f0);
}

.cr-inline-submit {
    padding: 0.375rem 1rem;
    background: var(--gradient-brand, linear-gradient(135deg, #a855f7 0%, #ec4899 100%));
    border: none;
    border-radius: var(--border-radius-sm, 6px);
    color: white;
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
}

.cr-inline-submit:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(168, 85, 247, 0.3);
}

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

/* ===== Responsive ===== */
@media (max-width: 640px) {
    .cr-post {
        padding: 0.75rem 5px;
        border-radius: 8px;
    }

    .cr-avatar {
        width: 36px;
        height: 36px;
    }

    .cr-avatar-sm {
        width: 28px;
        height: 28px;
    }

    .cr-actions {
        gap: 0;
    }

    .cr-action-btn {
        padding: 0.375rem 0.5rem;
    }

    .cr-reply {
        margin-left: 0.5rem;
    }

    .cr-comment-body,
    .cr-comment-actions {
        padding-left: 2rem;
    }
}

/* ===== Typing Indicator ===== */
.cr-typing-indicator {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
    color: var(--text-tertiary, rgba(255, 255, 255, 0.45));
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: max-height 0.25s ease, opacity 0.25s ease, padding 0.25s ease;
}

.cr-typing-indicator.cr-typing-visible {
    max-height: 2rem;
    opacity: 1;
    padding: 0.375rem 0.75rem;
}

.cr-typing-indicator strong {
    color: var(--text-secondary, #94a3b8);
    font-weight: 600;
}

/* Animated bounce dots */
.cr-typing-dots {
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

.cr-typing-dots > span {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--color-primary, #a855f7);
    animation: crTypingBounce 1.2s ease-in-out infinite;
}

.cr-typing-dots > span:nth-child(2) { animation-delay: 0.15s; }
.cr-typing-dots > span:nth-child(3) { animation-delay: 0.3s; }

@keyframes crTypingBounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40% { transform: scale(1); opacity: 1; }
}

/* ===== 3-dot Dropdown Menu ===== */
.cr-dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    z-index: 1000;
    min-width: 160px;
    background: var(--bg-card, #1a0d2e);
    border: 1px solid var(--border-color, rgba(168, 85, 247, 0.18));
    border-radius: var(--border-radius, 8px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
    overflow: hidden;
    padding: 0.25rem 0;
    animation: crDropdownIn 0.12s ease;
}

@keyframes crDropdownIn {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

.cr-dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.5rem 0.875rem;
    background: none;
    border: none;
    color: var(--text-primary, #e2e8f0);
    font-family: inherit;
    font-size: 0.875rem;
    cursor: pointer;
    text-align: left;
    transition: background 0.12s ease;
}

.cr-dropdown-item:hover {
    background: rgba(168, 85, 247, 0.1);
}

.cr-dropdown-item i {
    width: 1rem;
    text-align: center;
    color: var(--text-secondary, #9ca3af);
}

.cr-dropdown-danger {
    color: var(--color-danger, #ef4444);
}

.cr-dropdown-danger i {
    color: var(--color-danger, #ef4444);
}

/* ===== Post Comment Thread ===== */
.cr-post-thread {
    display: none;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color, rgba(168, 85, 247, 0.08));
}

.cr-post-thread.cr-thread-visible {
    display: block;
}

.cr-thread-loading {
    color: var(--text-secondary, #9ca3af);
    font-size: 0.875rem;
    padding: 0.5rem 0;
    text-align: center;
}

/* ===== Clock icon next to timestamps ===== */
.cr-icon-clock {
    display: inline-block;
    vertical-align: middle;
    opacity: 0.6;
    margin-right: 2px;
    flex-shrink: 0;
}

/* ===== Follow / Unfollow toggle button ===== */
.cr-follow-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid #3b82f6;
    background: transparent;
    color: #3b82f6;
    cursor: pointer;
    margin-left: auto;
    margin-right: 0.25rem;
    flex-shrink: 0;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
    font-size: 0.75rem;
}

.cr-follow-btn:hover {
    background: #3b82f6;
    color: #fff;
}

.cr-follow-btn.cr-following {
    background: #ef4444;
    border-color: #ef4444;
    color: #fff;
}

.cr-follow-btn.cr-following:hover {
    background: #dc2626;
    border-color: #dc2626;
}

.cr-message-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid var(--accent, #8b5cf6);
    background: transparent;
    color: var(--accent, #8b5cf6);
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
    font-size: 0.75rem;
}

.cr-message-btn:hover {
    background: var(--accent, #8b5cf6);
    color: #fff;
}

/* Profile-page variant — wider, shows label text */
.profile-actions .cr-message-btn {
    width: auto;
    height: auto;
    border-radius: 0.5rem;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 600;
    gap: 0.4rem;
    margin-left: 0.5rem;
}

/* Email button — matches message-button style */
.cr-email-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid var(--accent, #8b5cf6);
    background: transparent;
    color: var(--accent, #8b5cf6);
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
    font-size: 0.75rem;
}
.cr-email-btn:hover {
    background: var(--accent, #8b5cf6);
    color: #fff;
}
.profile-actions .cr-email-btn {
    width: auto;
    height: auto;
    border-radius: 0.5rem;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 600;
    gap: 0.4rem;
    margin-left: 0.5rem;
}

/* ===== Inline Edit Composer ===== */
.cr-inline-edit-composer {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    animation: cr-form-appear 0.2s ease;
}

.cr-edit-editor {
    width: 100%;
    min-height: 60px;
    padding: 0.625rem;
    background: var(--bg-primary, #0d0d1a);
    border: 1px solid var(--color-primary, #a855f7);
    border-radius: var(--border-radius, 8px);
    color: var(--text-primary, #e2e8f0);
    font-family: inherit;
    font-size: 0.9375rem;
    line-height: 1.5;
    box-sizing: border-box;
    outline: none;
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: pre-wrap;
}

.cr-edit-editor:focus {
    border-color: var(--color-primary-light, #c084fc);
    box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.15);
}

.cr-edit-editor:empty::before {
    content: attr(data-placeholder);
    color: var(--text-tertiary, rgba(255, 255, 255, 0.3));
    pointer-events: none;
}

.cr-edit-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.cr-edit-char-count {
    font-size: 0.75rem;
    color: var(--text-tertiary, #9ca3af);
}

.cr-edit-inline-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

.cr-edit-inline {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.cr-edit-inline-textarea {
    width: 100%;
    padding: 0.5rem 0.625rem;
    background: var(--bg-input, rgba(255,255,255,0.07));
    border: 1px solid var(--color-primary, #a855f7);
    border-radius: var(--border-radius, 8px);
    color: var(--text-primary, #e2e8f0);
    font-family: inherit;
    font-size: 0.9375rem;
    line-height: 1.5;
    resize: vertical;
    box-sizing: border-box;
    outline: none;
}

.cr-edit-inline-textarea:focus {
    border-color: var(--color-primary-light, #c084fc);
    box-shadow: 0 0 0 2px rgba(168, 85, 247, 0.2);
}

.cr-edit-inline-char {
    font-size: 0.75rem;
    color: var(--text-tertiary, #9ca3af);
    text-align: right;
}

/* ===== Reported content indicator ===== */
article.cr-post.cr-reported,
div.cr-comment.cr-reported {
    border-color: rgba(239, 68, 68, 0.3);
    position: relative;
}

article.cr-post.cr-reported::after,
div.cr-comment.cr-reported::after {
    content: 'Reported';
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    font-size: 0.625rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    pointer-events: none;
}

/* ===== Inline reply area (replies loaded on demand) ===== */
.cr-inline-replies {
    margin-left: 1.5rem;
    margin-top: 0.25rem;
    border-left: 2px solid var(--border-color, rgba(168, 85, 247, 0.2));
    padding-left: 0.75rem;
}

/* ===== New Post Toast Notification ===== */
.cr-new-post-toast {
    position: fixed;
    top: 1rem;
    left: 50%;
    transform: translateX(-50%) translateY(-100%);
    z-index: 99999;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    border-radius: 12px;
    background: rgba(168, 85, 247, 0.95);
    color: #fff;
    font-size: 0.9rem;
    font-weight: 500;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(12px);
    cursor: pointer;
    opacity: 0;
    transition: opacity 250ms ease, transform 250ms ease;
    max-width: 360px;
    white-space: nowrap;
}

.cr-new-post-toast.cr-toast-visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.cr-new-post-toast .cr-toast-arrow {
    font-size: 1rem;
    line-height: 1;
}

/* =====================================================================
   CODE BLOCKS & SYNTAX HIGHLIGHTING
   ===================================================================== */

/* Inline code */
.cr-inline-code {
    background: rgba(168, 85, 247, 0.1);
    border: 1px solid rgba(168, 85, 247, 0.2);
    border-radius: 4px;
    padding: 0.125rem 0.375rem;
    font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', 'Consolas', monospace;
    font-size: 0.8125em;
    color: var(--color-secondary-light, #a78bfa);
    word-break: break-word;
}

/* Fenced code block container */
.cr-code-block {
    position: relative;
    margin: 0.75rem 0;
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.85);
    border: 1px solid rgba(148, 163, 184, 0.15);
    overflow: hidden;
}

.cr-code-block pre {
    margin: 0;
    padding: 1rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.cr-code-block code {
    font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', 'Consolas', monospace;
    font-size: 0.8125rem;
    line-height: 1.6;
    color: #e2e8f0;
    white-space: pre;
    tab-size: 4;
}

/* Language label pill */
.cr-code-lang {
    display: inline-block;
    position: absolute;
    top: 0;
    left: 0;
    padding: 0.125rem 0.625rem;
    font-size: 0.6875rem;
    font-family: inherit;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: rgba(148, 163, 184, 0.7);
    background: rgba(30, 41, 59, 0.8);
    border-bottom-right-radius: 6px;
    border-right: 1px solid rgba(148, 163, 184, 0.1);
    border-bottom: 1px solid rgba(148, 163, 184, 0.1);
}

/* Copy button */
.cr-code-copy {
    position: absolute;
    top: 0.375rem;
    right: 0.375rem;
    background: rgba(51, 65, 85, 0.6);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 4px;
    padding: 0.25rem 0.5rem;
    color: rgba(148, 163, 184, 0.7);
    cursor: pointer;
    font-size: 0.75rem;
    opacity: 0;
    transition: opacity 0.2s ease, background 0.2s ease;
}

.cr-code-block:hover .cr-code-copy {
    opacity: 1;
}

.cr-code-copy:hover {
    background: rgba(71, 85, 105, 0.8);
    color: #e2e8f0;
}

/* Syntax highlighting tokens */
.cr-tok-keyword {
    color: #c084fc;
    font-weight: 600;
}

.cr-tok-string {
    color: #86efac;
}

.cr-tok-comment {
    color: #64748b;
    font-style: italic;
}

.cr-tok-number {
    color: #fbbf24;
}

.cr-tok-punct {
    color: #94a3b8;
}

/* Light mode overrides */
[data-theme="light"] .cr-code-block {
    background: rgba(200, 220, 245, 0.65);
    border-color: rgba(100, 140, 200, 0.25);
}

[data-theme="light"] .cr-code-block code {
    color: #0f172a;
}

[data-theme="light"] .cr-inline-code {
    background: rgba(168, 85, 247, 0.10);
    color: #7c3aed;
}

[data-theme="light"] .cr-tok-keyword {
    color: #7c3aed;
}

[data-theme="light"] .cr-tok-string {
    color: #059669;
}

[data-theme="light"] .cr-tok-comment {
    color: #6b8ab5;
}

[data-theme="light"] .cr-tok-number {
    color: #d97706;
}

[data-theme="light"] .cr-tok-punct {
    color: #4b6e9e;
}

[data-theme="light"] .cr-code-lang {
    background: rgba(180, 210, 245, 0.65);
    color: rgba(30, 58, 95, 0.7);
}

[data-theme="light"] .cr-code-copy {
    background: rgba(180, 210, 245, 0.55);
    color: #4b6e9e;
}

/* =========================================================================
   ATOM: email-item  (UIComponents 'email-item')
   Replaces all inline styles in the email-item render function.
   ========================================================================= */

.email-item {
    display: flex;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    cursor: pointer;
    border-radius: 8px;
    transition: background 0.25s ease, transform 0.25s ease;
    align-items: flex-start;
}

.email-item:hover {
    background: var(--bg-hover, rgba(168, 85, 247, 0.08));
}

.email-item.unread {
    background: rgba(168, 85, 247, 0.06);
    font-weight: 600;
}

.email-item-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--color-primary, #a855f7), var(--color-secondary, #ec4899));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 0.875rem;
    flex-shrink: 0;
}

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

.email-item-sender {
    font-size: 0.875rem;
    color: var(--text-primary, #f9fafb);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 0.125rem;
}

.email-item.unread .email-item-sender {
    font-weight: 700;
}

.email-item-subject {
    font-size: 0.8125rem;
    color: var(--text-secondary, #e2d9f3);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.email-item-time {
    font-size: 0.75rem;
    color: var(--text-muted, #a78bca);
    white-space: nowrap;
    flex-shrink: 0;
}

/* =========================================================================
   ATOM: file-item  (UIComponents 'file-item')
   Replaces all inline styles in the file-item render function.
   ========================================================================= */

.file-item {
    display: flex;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    cursor: pointer;
    border-radius: 8px;
    transition: background 0.25s ease, transform 0.25s ease;
    align-items: center;
}

.file-item:hover {
    background: var(--bg-hover, rgba(168, 85, 247, 0.08));
}

.file-item-icon {
    font-size: 1.25rem;
    color: var(--color-primary, #a855f7);
    width: 32px;
    text-align: center;
    flex-shrink: 0;
}

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

.file-item-name {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary, #f9fafb);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 0.125rem;
}

.file-item-size {
    font-size: 0.75rem;
    color: var(--text-muted, #a78bca);
}

.file-item-date {
    font-size: 0.75rem;
    color: var(--text-muted, #a78bca);
    white-space: nowrap;
    flex-shrink: 0;
}
