/* ── Markdown Styles ──────────────────────────── */
.msg-content p { margin-bottom: 4px; }
.msg-content p:last-child { margin-bottom: 0; }
.msg-content a {
    color: var(--accent);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color var(--transition);
}
.msg-content a:hover { border-bottom-color: var(--accent); }
.msg-content strong { font-weight: 600; }
.msg-content em { font-style: italic; }
.msg-content ul, .msg-content ol {
    margin: 4px 0;
    padding-left: 20px;
}
.msg-content blockquote {
    border-left: 3px solid var(--accent);
    padding: 4px 12px;
    margin: 6px 0;
    color: var(--text-secondary);
    background: var(--accent-dim);
    border-radius: 0 var(--radius) var(--radius) 0;
}
.msg-content code {
    font-family: var(--font-mono);
    font-size: 13px;
    background: var(--bg-tertiary);
    padding: 2px 6px;
    border-radius: 4px;
    color: var(--accent);
}
.msg-content pre {
    margin: 8px 0;
    padding: 0;
    background: transparent;
}
.msg-content pre code {
    display: block;
    padding: 12px 16px;
    background: var(--bg-primary);
    border-radius: var(--radius);
    overflow-x: auto;
    font-size: 13px;
    line-height: 1.5;
    color: var(--text-primary);
}
.msg-content table {
    border-collapse: collapse;
    margin: 8px 0;
    width: 100%;
}
.msg-content th, .msg-content td {
    border: 1px solid var(--border-color);
    padding: 6px 10px;
    text-align: left;
    font-size: 13px;
}
.msg-content th { background: var(--bg-tertiary); font-weight: 600; }
.msg-content img { max-width: 100%; border-radius: var(--radius); }
.msg-content hr {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 8px 0;
}

/* ── Code Block Wrapper ──────────────────────── */
.code-block-wrapper {
    position: relative;
    margin: 8px 0;
}
.code-block-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 12px;
    background: var(--bg-tertiary);
    border-radius: var(--radius) var(--radius) 0 0;
    border: 1px solid var(--border-color);
    border-bottom: none;
}
.code-lang-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    font-family: var(--font-mono);
}
.code-copy-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 11px;
    font-family: var(--font-main);
    padding: 3px 10px;
    border-radius: 4px;
    cursor: pointer;
    opacity: 0;
    transition: opacity var(--transition), background var(--transition);
    z-index: 5;
}
.code-block-wrapper:hover .code-copy-btn { opacity: 1; }
.code-copy-btn:hover { background: var(--accent-dim); color: var(--accent); }

/* ── Code Lines ──────────────────────────────── */
.code-line-numbered {
    display: flex;
    line-height: 1.5;
    cursor: pointer;
    transition: background 0.1s;
}
.code-line-numbered:hover { background: rgba(255,255,255,0.04); }
.code-line-number {
    display: inline-block;
    min-width: 36px;
    padding-right: 12px;
    text-align: right;
    color: var(--text-muted);
    user-select: none;
    flex-shrink: 0;
    font-size: 12px;
    opacity: 0.5;
}
.code-line-content {
    flex: 1;
    min-width: 0;
}

/* ── Twemoji ─────────────────────────────────── */
img.emoji, .twemoji {
    height: 1.2em;
    width: 1.2em;
    vertical-align: -0.2em;
    display: inline-block;
}

/* ── File Attachments ────────────────────────── */
.file-attachment {
    display: flex;
    border-radius: var(--radius);
    overflow: hidden;
    max-width: 400px;
    margin-top: 4px;
}
.image-att {
    display: inline-block;
    cursor: pointer;
    position: relative;
}
.image-att img {
    max-width: 360px;
    max-height: 300px;
    border-radius: var(--radius);
    display: block;
    object-fit: contain;
}
.video-att {
    position: relative;
    display: inline-block;
}
.video-att video {
    max-width: 400px;
    max-height: 300px;
    border-radius: var(--radius);
    display: block;
}
.generic-att {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: background var(--transition);
    text-decoration: none;
    color: var(--text-primary);
}
.generic-att:hover { background: var(--accent-dim); }
.file-icon {
    font-size: 24px;
    flex-shrink: 0;
    color: var(--accent);
}
.file-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.file-name {
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.file-size {
    font-size: 11px;
    color: var(--text-muted);
}

/* ── Emoji Picker ────────────────────────────── */
.emoji-picker {
    position: absolute;
    bottom: 56px;
    left: 12px;
    width: 320px;
    max-height: 360px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    z-index: 60;
    animation: emojiSlideUp 0.2s ease;
    overflow: hidden;
}
.emoji-search {
    padding: 10px;
    border-bottom: 1px solid var(--border-color);
}
.emoji-search input {
    width: 100%;
    padding: 8px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 13px;
    font-family: var(--font-main);
    outline: none;
}
.emoji-search input:focus { border-color: var(--accent); }
.emoji-grid {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}
.emoji-category-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    padding: 8px 4px 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.emoji-item {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    font-size: 20px;
    cursor: pointer;
    border-radius: var(--radius);
    transition: background var(--transition), transform 0.1s;
}
.emoji-item:hover {
    background: var(--bg-tertiary);
    transform: scale(1.2);
}

/* ── Archive Tree ────────────────────────────── */
.archive-tree {
    max-height: 400px;
    overflow-y: auto;
}
.archive-entry {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background var(--transition);
    font-size: 13px;
}
.archive-entry:hover { background: var(--bg-tertiary); }
.archive-entry.is-dir { color: var(--accent); font-weight: 500; }
.entry-icon { font-size: 16px; flex-shrink: 0; }
.entry-name { flex: 1; min-width: 0; word-break: break-all; }
.entry-size { font-size: 11px; color: var(--text-muted); flex-shrink: 0; }

/* ── Text File Viewer ────────────────────────── */
.textview-content {
    max-height: 500px;
    overflow: auto;
    background: var(--bg-primary);
    border-radius: var(--radius);
    padding: 0;
    margin: 0;
}
.textview-content code {
    font-family: var(--font-mono);
    font-size: 13px;
    line-height: 1.5;
    display: block;
    padding: 16px;
}

/* ── Default avatar placeholder ───────────────── */
.avatar-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-dim);
    color: var(--accent);
    font-weight: 700;
    font-size: 16px;
    font-family: var(--font-main);
}

/* ── File Download Button ────────────────────── */
.file-download-btn {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.6);
    border-radius: 50%;
    color: #fff;
    font-size: 14px;
    text-decoration: none;
    opacity: 0;
    transition: opacity 0.2s;
    z-index: 5;
    cursor: pointer;
    border: none;
}
.file-attachment:hover .file-download-btn { opacity: 1; }
.file-download-btn:hover { background: rgba(0,0,0,0.85); }

/* ── Message Actions ─────────────────────────── */
.msg-actions {
    position: absolute;
    top: -8px;
    right: 4px;
    display: flex;
    gap: 2px;
    opacity: 0;
    transition: opacity 0.15s;
    z-index: 10;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 2px;
    box-shadow: var(--shadow);
}
.message-group:hover .msg-actions,
.msg-continuation:hover .msg-actions { opacity: 1; }
.msg-action-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 4px;
    font-size: 14px;
    line-height: 1;
    transition: background 0.1s, color 0.1s;
}
.msg-action-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

/* ── Edit Indicator Bar ──────────────────────── */
.edit-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: var(--bg-tertiary);
    border-left: 3px solid var(--accent);
    border-radius: var(--radius) var(--radius) 0 0;
    font-size: 12px;
    color: var(--text-secondary);
    animation: filePreviewIn 0.2s ease;
}
.edit-indicator-cancel {
    margin-left: auto;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 16px;
    padding: 0 4px;
    transition: color 0.15s;
}
.edit-indicator-cancel:hover { color: var(--text-primary); }

/* ── Edited Tag ──────────────────────────────── */
.msg-edited {
    font-size: 10px;
    color: var(--text-muted);
    margin-left: 6px;
    font-style: italic;
}

/* ── Mermaid Diagram ───────────────────────────── */
.mermaid-diagram {
    background: var(--bg-tertiary);
    padding: 16px;
    border-radius: var(--radius);
    text-align: center;
    overflow-x: auto;
    margin: 8px 0;
}
.mermaid-diagram svg {
    max-width: 100%;
    height: auto;
}

/* ── Role Badge ────────────────────────────────── */
.role-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 1px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    margin-left: 6px;
    line-height: 1.4;
    vertical-align: middle;
}
.role-badge i { font-size: 10px; }

/* ── Role Icon Picker ──────────────────────────── */
.role-icon-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px 0;
}
.role-icon-option {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 16px;
    border: 2px solid transparent;
    transition: border-color 0.15s, color 0.15s;
}
.role-icon-option:hover { color: var(--text-primary); }
.role-icon-option.active { border-color: var(--accent); color: var(--accent); }

/* ── Role List in Manage Modal ─────────────────── */
.roles-list {
    padding: 12px 16px;
    max-height: 300px;
    overflow-y: auto;
}
.role-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: var(--radius);
    background: var(--bg-tertiary);
    margin-bottom: 8px;
}
.role-item-icon { font-size: 18px; }
.role-item-name { flex: 1; font-weight: 600; }
.role-item-actions { display: flex; gap: 6px; }
.role-item-actions button {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 4px;
    font-size: 13px;
}
.role-item-actions button:hover { color: var(--text-primary); background: var(--bg-secondary); }

/* ── Assign Role List ──────────────────────────── */
.assign-role-list { display: flex; flex-direction: column; gap: 6px; }
.assign-role-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius);
    background: var(--bg-tertiary);
    cursor: pointer;
    border: 2px solid transparent;
    transition: border-color 0.15s;
}
.assign-role-option:hover { border-color: var(--accent); }
.assign-role-option.active { border-color: var(--accent); }
.assign-role-none {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius);
    background: var(--bg-tertiary);
    cursor: pointer;
    border: 2px solid transparent;
    color: var(--text-muted);
}
.assign-role-none:hover { border-color: var(--text-muted); }

/* ── Archive Entry Download Button ─────────────── */
.archive-entry-download {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px 8px;
    margin-left: auto;
    font-size: 14px;
    border-radius: 4px;
    flex-shrink: 0;
    transition: color 0.15s, background 0.15s;
}
.archive-entry-download:hover {
    color: var(--accent);
    background: var(--bg-tertiary);
}

/* ── Clear All Pending Files Button ────────────── */
.clear-all-files {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border: 1px solid var(--text-muted);
    border-radius: var(--radius);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 11px;
    white-space: nowrap;
    flex-shrink: 0;
    transition: color 0.15s, border-color 0.15s;
}
.clear-all-files:hover {
    color: var(--text-primary);
    border-color: var(--text-primary);
}

/* ── Link Preview Card ──────────────────────────── */
.link-preview-card {
    display: flex;
    gap: 12px;
    padding: 10px 14px;
    margin-top: 6px;
    background: var(--bg-tertiary);
    border-left: 3px solid var(--accent);
    border-radius: 0 var(--radius) var(--radius) 0;
    cursor: pointer;
    text-decoration: none;
    color: var(--text-primary);
    max-width: 480px;
    transition: background var(--transition);
    overflow: hidden;
}
.link-preview-card:hover { background: var(--accent-dim); }
.link-preview-thumb {
    width: 80px;
    height: 60px;
    object-fit: cover;
    border-radius: 4px;
    flex-shrink: 0;
}
.link-preview-info { flex: 1; min-width: 0; overflow: hidden; }
.link-preview-site { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.3px; }
.link-preview-title {
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin: 2px 0;
}
.link-preview-desc {
    font-size: 12px;
    color: var(--text-secondary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ── Reply Indicator ────────────────────────────── */
.reply-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: var(--bg-tertiary);
    border-left: 3px solid var(--accent);
    border-radius: var(--radius) var(--radius) 0 0;
    font-size: 12px;
    color: var(--text-secondary);
    animation: filePreviewIn 0.2s ease;
}
.reply-indicator-cancel {
    margin-left: auto;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 16px;
    padding: 0 4px;
    transition: color 0.15s;
}
.reply-indicator-cancel:hover { color: var(--text-primary); }

/* ── Reply Block in Message (styles in components.css) ── */

/* ── Reaction Bar ───────────────────────────────── */
.reaction-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 4px;
}
.reaction-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    user-select: none;
}
.reaction-pill:hover { background: var(--accent-dim); border-color: var(--accent); }
.reaction-pill.mine { border-color: var(--accent); background: var(--accent-dim); }
.reaction-pill .emoji { font-size: 14px; }
.reaction-pill .count { font-size: 11px; font-weight: 600; color: var(--text-secondary); }
.reaction-add-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    cursor: pointer;
    font-size: 12px;
    color: var(--text-muted);
    transition: background 0.15s, color 0.15s;
}
.reaction-add-btn:hover { background: var(--accent-dim); color: var(--accent); }

/* ── Pin Badge ──────────────────────────────────── */
.pin-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    color: var(--accent);
    margin-left: 6px;
}
.pin-badge i { font-size: 10px; }

/* ── Document Viewer ────────────────────────────── */
.modal-fullscreen {
    width: 90vw;
    max-width: 1000px;
    height: 80vh;
    display: flex;
    flex-direction: column;
}
.docview-body {
    flex: 1;
    overflow: auto;
    padding: 16px;
    background: var(--bg-primary);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}
.docview-body iframe {
    width: 100%;
    height: 100%;
    border: none;
    border-radius: var(--radius);
}
.doc-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.doc-table th, .doc-table td {
    border: 1px solid var(--border-color);
    padding: 6px 10px;
    text-align: left;
}
.doc-table th { background: var(--bg-tertiary); font-weight: 600; color: var(--text-primary); }
.doc-table td { color: var(--text-secondary); }
.slide-preview {
    padding: 16px;
    margin-bottom: 12px;
    background: var(--bg-tertiary);
    border-radius: var(--radius);
}
.slide-preview h3 { color: var(--accent); margin-bottom: 8px; font-size: 14px; }
.slide-preview p { color: var(--text-secondary); font-size: 13px; margin-bottom: 4px; }

/* ── Forward Room List ──────────────────────────── */
.forward-room-list { display: flex; flex-direction: column; gap: 6px; }
.forward-room-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius);
    background: var(--bg-tertiary);
    cursor: pointer;
    border: 2px solid transparent;
    transition: border-color 0.15s;
    color: var(--text-primary);
    font-weight: 500;
}
.forward-room-option:hover { border-color: var(--accent); }

/* ── Pinned List ────────────────────────────────── */
.pinned-list .pinned-msg-item {
    padding: 10px 12px;
    background: var(--bg-tertiary);
    border-radius: var(--radius);
    margin-bottom: 8px;
    transition: background 0.15s;
}
.pinned-list .pinned-msg-item:hover {
    background: var(--bg-secondary);
}
.pinned-msg-item .pinned-msg-author { font-weight: 600; color: var(--accent); font-size: 13px; }
.pinned-msg-item .pinned-msg-text { font-size: 13px; color: var(--text-secondary); margin-top: 4px; }
.pinned-msg-item .pinned-msg-time { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.pinned-msg-item .pinned-msg-files { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 4px; }
.pinned-file-chip {
    display: inline-flex; align-items: center; gap: 4px;
    background: var(--bg-secondary); padding: 2px 8px; border-radius: 4px;
    font-size: 11px; color: var(--text-secondary);
}
.pinned-file-chip i { color: var(--accent); font-size: 10px; }

/* ── Message highlight animation ──────────────── */
@keyframes msg-flash {
    0%,100% { background: transparent; }
    30% { background: rgba(139,92,246,0.18); }
}
.message-group.msg-highlight {
    animation: msg-flash 2s ease;
    border-radius: var(--radius);
}

/* ── Load More Spinner ──────────────────────────── */
.load-more-spinner {
    text-align: center;
    padding: 12px;
    color: var(--text-muted);
    font-size: 13px;
}

/* ── Doc Preview Button in Attachment ────────────── */
.doc-preview-btn {
    background: none;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 11px;
    margin-left: 8px;
    transition: color 0.15s, border-color 0.15s;
}
.doc-preview-btn:hover { color: var(--accent); border-color: var(--accent); }

/* ── Collapsible Reply Block ────────────────────── */
.reply-block {
    border-left: 3px solid var(--accent);
    background: var(--bg-tertiary);
    border-radius: 0 var(--radius) var(--radius) 0;
    padding: 6px 10px;
    margin: 4px 0 6px 0;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: flex-start;
    gap: 4px;
    transition: background 0.15s;
    max-width: 500px;
}
.reply-block:hover { background: var(--bg-secondary); }
.reply-block-toggle {
    font-size: 10px;
    margin-top: 2px;
    flex-shrink: 0;
    transition: transform 0.2s;
    color: var(--text-muted);
}
.reply-block.expanded .reply-block-toggle { transform: rotate(90deg); }
.reply-preview {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    color: var(--text-secondary);
}
.reply-preview .reply-block-author { font-weight: 600; margin-right: 4px; }
.reply-expand { display: none; color: var(--text-primary); }
.reply-expand .reply-block-author { font-weight: 600; margin-right: 4px; }
.reply-block.expanded .reply-preview { display: none; }
.reply-block.expanded .reply-expand { display: block; }

/* ── Collapsible Forward Block ──────────────────── */
.forward-block {
    border-left: 3px solid var(--accent);
    background: var(--bg-tertiary);
    border-radius: 0 var(--radius) var(--radius) 0;
    padding: 6px 10px;
    margin: 4px 0 6px 0;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.15s;
    max-width: 500px;
}
.forward-block:hover { background: var(--bg-secondary); }
.fwd-header {
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}
.fwd-icon { font-size: 11px; }
.fwd-toggle {
    font-size: 10px;
    transition: transform 0.2s;
    margin-left: auto;
}
.forward-block.expanded .fwd-toggle { transform: rotate(90deg); }
.fwd-preview {
    color: var(--text-secondary);
    margin-top: 4px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}
.fwd-expand {
    display: none;
    margin-top: 6px;
    color: var(--text-primary);
}
.fwd-expand p { margin-bottom: 4px; }
.forward-block.expanded .fwd-preview { display: none; }
.forward-block.expanded .fwd-expand { display: block; }
.fwd-orig-files { margin-top: 6px; }
.fwd-orig-file {
    display: inline-block;
    background: var(--bg-secondary);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    margin: 2px 4px 2px 0;
    color: var(--text-secondary);
}
.fwd-orig-file i { margin-right: 4px; color: var(--text-muted); }

/* ── Custom Video Player ───────────────────────── */
.custom-video-player {
    position: relative;
    background: #000;
    border-radius: var(--radius);
    overflow: hidden;
    max-width: 100%;
    line-height: 0;
}
.custom-video-player video {
    width: 100%;
    display: block;
    border-radius: var(--radius);
    max-height: 400px;
    cursor: pointer;
}
.custom-video-player:fullscreen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #000;
    width: 100vw;
    height: 100vh;
}
.custom-video-player:fullscreen video {
    max-height: calc(100vh - 50px);
    max-width: 100vw;
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 0;
}
.custom-video-player:fullscreen .vp-controls {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 12px 20px;
    z-index: 10;
    background: linear-gradient(transparent, rgba(0,0,0,0.9));
}
.custom-video-player:fullscreen .vp-overlay {
    z-index: 5;
}
/* Webkit fullscreen (Safari, older Chrome) */
.custom-video-player:-webkit-full-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #000;
    width: 100vw;
    height: 100vh;
}
.custom-video-player:-webkit-full-screen video {
    max-height: calc(100vh - 50px);
    max-width: 100vw;
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 0;
}
.custom-video-player:-webkit-full-screen .vp-controls {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 12px 20px;
    z-index: 10;
    background: linear-gradient(transparent, rgba(0,0,0,0.9));
    opacity: 1;
}
.custom-video-player:-webkit-full-screen .vp-overlay {
    z-index: 5;
}
/* PiP button */
.vp-pip-btn {
    font-size: 13px;
}
.vp-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.25s;
    pointer-events: auto;
    cursor: pointer;
}
.vp-play-overlay {
    background: rgba(0,0,0,0.3);
}
.vp-play-overlay i {
    font-size: 48px;
    color: #fff;
    text-shadow: 0 2px 8px rgba(0,0,0,0.5);
    transition: transform 0.15s;
}
.vp-play-overlay:hover i { transform: scale(1.1); }
.vp-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: linear-gradient(transparent, rgba(0,0,0,0.85));
    transition: opacity 0.3s;
    line-height: 1;
}
.custom-video-player:hover .vp-controls {
    opacity: 1;
}
.vp-btn {
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    font-size: 14px;
    padding: 4px;
    transition: color 0.15s;
    line-height: 1;
}
.vp-btn:hover { color: var(--accent, #8B5CF6); }
.vp-time {
    color: rgba(255,255,255,0.8);
    font-size: 11px;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
    min-width: 80px;
}
.vp-progress {
    flex: 1;
    height: 4px;
    background: rgba(255,255,255,0.2);
    border-radius: 2px;
    cursor: pointer;
    position: relative;
    transition: height 0.15s;
}
.vp-progress:hover { height: 6px; }
.vp-progress-filled {
    height: 100%;
    background: var(--accent, #8B5CF6);
    border-radius: 2px;
    width: 0%;
    transition: width 0.1s linear;
}
.vp-volume-wrap {
    display: flex;
    align-items: center;
    gap: 4px;
}
.vp-volume {
    width: 60px;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: linear-gradient(to right, var(--accent, #8B5CF6) 100%, rgba(255,255,255,0.2) 100%);
    border-radius: 2px;
    outline: none;
    cursor: pointer;
    transition: background 0.1s;
}
.vp-volume::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--accent, #8B5CF6);
    cursor: pointer;
}
.vp-volume::-moz-range-thumb {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--accent, #8B5CF6);
    border: none;
    cursor: pointer;
}
.vp-speed-btn {
    font-size: 11px;
    font-weight: 600;
    min-width: 28px;
    text-align: center;
}
.vp-quality-wrap {
    position: relative;
}
.vp-quality-btn {
    font-size: 11px;
    font-weight: 600;
    min-width: 28px;
    text-align: center;
}
.vp-quality-menu {
    position: absolute;
    bottom: 100%;
    right: 0;
    background: rgba(0,0,0,0.92);
    border-radius: 8px;
    padding: 4px 0;
    min-width: 90px;
    margin-bottom: 8px;
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255,255,255,0.1);
}
.vp-quality-item {
    padding: 6px 14px;
    color: #fff;
    font-size: 12px;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s;
}
.vp-quality-item:hover { background: rgba(255,255,255,0.1); }
.vp-quality-item.active { color: var(--accent, #8B5CF6); font-weight: 600; }

/* ── Mobile responsive ─────────────────────────────── */
@media (max-width: 768px) {
    /* Code blocks */
    .msg-content pre code {
        padding: 8px 10px;
        font-size: 12px;
    }
    .code-line-number { min-width: 24px; padding-right: 8px; font-size: 11px; }

    /* File attachments */
    .image-att img {
        max-width: 260px;
        max-height: 220px;
    }
    .video-att video {
        max-width: 100%;
        max-height: 250px;
    }
    .custom-video-player video {
        max-height: 260px;
    }
    .vp-play-overlay i { font-size: 36px; }
    .vp-controls { padding: 6px 8px; gap: 6px; }
    .vp-btn { font-size: 12px; padding: 3px; }
    .vp-time { font-size: 10px; min-width: 60px; }
    .vp-volume-wrap { display: none; }
    .vp-speed-btn { font-size: 10px; }
    .vp-quality-btn { font-size: 10px; }

    /* Link previews compact */
    .link-preview-card {
        flex-direction: column;
        gap: 8px;
    }
    .link-preview-thumb {
        width: 100%;
        height: 120px;
    }

    /* Emoji picker */
    .emoji-item {
        width: 38px;
        height: 38px;
        font-size: 22px;
    }

    /* Reply/forward blocks */
    .reply-block,
    .forward-block {
        max-width: 100%;
    }

    /* Generic file attachment */
    .generic-att {
        padding: 8px 10px;
    }
    .file-icon { font-size: 20px; }
    .file-name { font-size: 12px; }

    /* Reaction pills */
    .reaction-pill { padding: 2px 6px; font-size: 12px; }
    .reaction-pill .emoji { font-size: 13px; }

    /* Msg actions on hover — touch friendly */
    .msg-actions {
        top: -6px;
        right: 2px;
    }
    .msg-action-btn {
        padding: 6px 8px;
        font-size: 15px;
    }

    /* Document viewer */
    .docview-body { padding: 8px; }
}
