/* =============================================================================
   PGSqlChat - Discord-inspired Theme
   =============================================================================
   Phase 1.1: Color Scheme + Phase 1.2: Typography + Phase 1.3: Component Polish
   ============================================================================= */

/* -----------------------------------------------------------------------------
   CSS Custom Properties (Design Tokens)
   ----------------------------------------------------------------------------- */
:root {
    /* Background hierarchy (darkest to lightest) */
    --bg-tertiary: #111214;      /* Deepest: sidebar */
    --bg-secondary: #151618;     /* Panels, user area */
    --bg-primary: #1c1d21;       /* Main content area */
    --bg-modifier-hover: #232528; /* Hover states */
    --bg-modifier-active: #2a2c30; /* Active/selected states */
    --bg-accent: #32343a;        /* Elevated elements */

    /* Text colors */
    --text-normal: #dbdee1;      /* Primary text */
    --text-muted: #949ba4;       /* Secondary text, timestamps */
    --text-faint: #6d6f78;       /* Tertiary, very subtle */
    --text-link: #00a8fc;        /* Links */
    --text-positive: #23a559;    /* Success text */
    --text-warning: #f0b232;     /* Warning text */
    --text-danger: #f23f43;      /* Error text */

    /* Brand/accent colors */
    --accent-primary: #5865f2;   /* Blurple - primary actions */
    --accent-primary-hover: #4752c4;
    --accent-primary-active: #3c45a5;
    --accent-success: #23a559;   /* Green - success, online */
    --accent-success-hover: #1a7d41;
    --accent-danger: #da373c;    /* Red - danger, delete */
    --accent-danger-hover: #a12828;
    --accent-warning: #f0b232;   /* Yellow - warning, idle */

    /* Status colors */
    --status-online: #23a559;
    --status-idle: #f0b232;
    --status-dnd: #f23f43;
    --status-offline: #80848e;

    /* Borders */
    --border-subtle: #3f4147;
    --border-strong: #4e5058;

    /* Shadows */
    --shadow-low: 0 1px 0 rgba(0, 0, 0, 0.2);
    --shadow-medium: 0 4px 8px rgba(0, 0, 0, 0.24);
    --shadow-high: 0 8px 16px rgba(0, 0, 0, 0.32);

    /* Spacing scale */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;

    /* Border radius */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-full: 50%;

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;

    /* Layout */
    --sidebar-width: 240px;
    --header-height: 48px;
}

/* -----------------------------------------------------------------------------
   Base Styles & Reset
   ----------------------------------------------------------------------------- */
html, body {
    font-family: 'Segoe UI', 'Noto Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif, 'Noto Color Emoji';
    font-size: 16px;
    line-height: 1.375;
    height: 100%;
    margin: 0;
    background-color: var(--bg-tertiary);
    color: var(--text-normal);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

*, *::before, *::after {
    box-sizing: border-box;
}

/* Selection */
::selection {
    background-color: var(--accent-primary);
    color: white;
}

/* -----------------------------------------------------------------------------
   Scrollbar Styling
   ----------------------------------------------------------------------------- */
::-webkit-scrollbar {
    width: 14px;
    height: 14px;
}

::-webkit-scrollbar-track {
    background: #2a2b30;
    border-radius: var(--radius-sm);
}

::-webkit-scrollbar-thumb {
    background: #5a5c62;
    border-radius: var(--radius-sm);
}

::-webkit-scrollbar-thumb:hover {
    background: #6a6c72;
}

/* Firefox */
* {
    scrollbar-width: auto;
    scrollbar-color: #5a5c62 #2a2b30;
}

/* -----------------------------------------------------------------------------
   Typography
   ----------------------------------------------------------------------------- */
h1, h2, h3, h4, h5, h6 {
    color: var(--text-normal);
    font-weight: 600;
    margin: 0;
    line-height: 1.25;
}

h1 { font-size: 1.5rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.125rem; }
h4 { font-size: 1rem; }
h5 { font-size: 0.875rem; }
h6 { font-size: 0.75rem; }

p {
    margin: 0;
}

a {
    color: var(--text-link);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    text-decoration: underline;
}

/* -----------------------------------------------------------------------------
   Bootstrap Overrides
   ----------------------------------------------------------------------------- */

/* Override Bootstrap's dark theme colors */
[data-bs-theme="dark"] {
    --bs-body-bg: var(--bg-primary);
    --bs-body-color: var(--text-normal);
    --bs-secondary-bg: var(--bg-secondary);
    --bs-tertiary-bg: var(--bg-tertiary);
    --bs-border-color: var(--border-subtle);
}

/* Card overrides */
.card {
    background-color: var(--bg-secondary);
    border: none;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-medium);
}

.card-body {
    padding: var(--space-lg);
}

.card-title {
    color: var(--text-normal);
    font-weight: 600;
}

/* Form controls */
.form-control {
    background-color: var(--bg-tertiary);
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-normal);
    padding: 10px 12px;
    font-size: 1rem;
    transition: box-shadow var(--transition-fast);
}

.form-control::placeholder {
    color: var(--text-muted);
}

.form-control:focus {
    background-color: var(--bg-tertiary);
    color: var(--text-normal);
    box-shadow: 0 0 0 2px var(--accent-primary);
    outline: none;
}

.form-control:disabled {
    background-color: var(--bg-accent);
    color: var(--text-muted);
    cursor: not-allowed;
}

.form-label {
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    margin-bottom: var(--space-xs);
}

/* Buttons */
.btn {
    font-weight: 500;
    font-size: 0.875rem;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    border: none;
    transition: background-color var(--transition-fast), opacity var(--transition-fast);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background-color: var(--accent-primary) !important;
    border-color: var(--accent-primary) !important;
    color: white !important;
}

.btn-primary:hover:not(:disabled),
.btn-primary:focus:not(:disabled) {
    background-color: var(--accent-primary-hover) !important;
    border-color: var(--accent-primary-hover) !important;
}

.btn-primary:active:not(:disabled) {
    background-color: var(--accent-primary-active) !important;
    border-color: var(--accent-primary-active) !important;
}

.btn-success {
    background-color: var(--accent-success);
    color: white;
}

.btn-success:hover:not(:disabled) {
    background-color: var(--accent-success-hover);
}

.btn-danger {
    background-color: var(--accent-danger);
    color: white;
}

.btn-danger:hover:not(:disabled) {
    background-color: var(--accent-danger-hover);
}

.btn-outline-secondary {
    background-color: transparent;
    border: 1px solid var(--border-strong);
    color: var(--text-normal);
}

.btn-outline-secondary:hover:not(:disabled) {
    background-color: var(--bg-modifier-hover);
    border-color: var(--border-strong);
    color: var(--text-normal);
}

/* Badges */
.badge {
    font-weight: 500;
    font-size: 0.65rem;
    padding: 3px 6px;
    border-radius: var(--radius-full);
}

.badge.bg-danger {
    background-color: var(--accent-danger) !important;
}

/* Alerts */
.alert {
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
}

.alert-danger {
    background-color: rgba(242, 63, 67, 0.15);
    color: var(--text-danger);
}

/* Border colors */
.border-secondary {
    border-color: var(--border-subtle) !important;
}

/* Background colors */
.bg-dark {
    background-color: var(--bg-secondary) !important;
}

.bg-secondary {
    background-color: var(--bg-secondary) !important;
}

.bg-primary {
    background-color: var(--accent-primary) !important;
}

/* Text colors */
.text-light {
    color: var(--text-normal) !important;
}

.text-muted {
    color: var(--text-muted) !important;
}

.text-primary {
    color: var(--accent-primary) !important;
}

.text-success {
    color: var(--status-online) !important;
}

.text-danger {
    color: var(--text-danger) !important;
}

/* -----------------------------------------------------------------------------
   Layout Components
   ----------------------------------------------------------------------------- */

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    background-color: var(--bg-tertiary);
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    height: var(--header-height);
    padding: 0 var(--space-md);
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--border-subtle);
    box-shadow: var(--shadow-low);
}

.sidebar-header h5 {
    font-size: 1rem;
    font-weight: 600;
}

/* Channel list */
.channel-category {
    color: var(--text-muted);
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    padding: var(--space-md) var(--space-sm) var(--space-xs);
}

.channel-item {
    display: flex;
    align-items: center;
    padding: 6px var(--space-sm);
    margin: 1px 8px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-weight: 500;
    transition: background-color var(--transition-fast), color var(--transition-fast);
    text-decoration: none;
}

.channel-item:hover {
    background-color: var(--bg-modifier-hover);
    color: var(--text-normal);
    text-decoration: none;
}

.channel-item.active {
    background-color: var(--bg-modifier-active);
    color: var(--text-normal);
}

.channel-item .channel-icon {
    margin-right: var(--space-xs);
    font-size: 1.25rem;
    opacity: 0.7;
}

.channel-item.active .channel-icon {
    opacity: 1;
}

/* DM item wrapper for close button */
.dm-item-wrapper {
    display: flex;
    align-items: center;
    position: relative;
    margin: 1px 8px;
}

.dm-item-wrapper .dm-item {
    flex: 1;
    margin: 0;
}

.dm-close-btn {
    position: absolute;
    right: 4px;
    width: 20px;
    height: 20px;
    padding: 0;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    opacity: 0.4;
    transition: opacity var(--transition-fast), color var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
}

.dm-close-btn:hover {
    opacity: 1;
    color: var(--text-normal);
    background-color: var(--bg-modifier-hover);
}

.dm-item-wrapper:hover .dm-close-btn {
    opacity: 0.7;
}

/* User area at bottom of sidebar */
.user-area {
    height: 52px;
    padding: 0 var(--space-sm);
    background-color: var(--bg-tertiary);
    border-top: none;
    display: flex;
    align-items: center;
}

.user-area-inner {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    width: 100%;
}

/* -----------------------------------------------------------------------------
   Main Content Area
   ----------------------------------------------------------------------------- */

/* Channel header */
.channel-header {
    height: var(--header-height);
    min-height: var(--header-height);
    padding: 0 var(--space-md);
    display: flex;
    align-items: center;
    background-color: var(--bg-primary);
    border-bottom: 1px solid var(--border-subtle);
    box-shadow: var(--shadow-low);
    z-index: 1;
}

.channel-header h5 {
    font-size: 1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.channel-header .channel-icon {
    color: var(--text-muted);
}

/* Search box in header */
.search-box {
    margin-left: auto;
    position: relative;
    display: flex;
    align-items: center;
}

.search-box input {
    width: 200px;
    padding: 6px 28px 6px 10px;
    background: var(--bg-tertiary);
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-normal);
    font-size: 0.875rem;
    transition: width 0.2s ease;
}

.search-box input:focus {
    width: 260px;
    outline: none;
    background: var(--bg-secondary);
}

.search-box input::placeholder {
    color: var(--text-muted);
}

.search-clear {
    position: absolute;
    right: 6px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1rem;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}

.search-clear:hover {
    color: var(--text-normal);
}

/* Search results panel */
.search-results-panel {
    position: absolute;
    top: var(--header-height);
    right: 0;
    width: 420px;
    max-height: 60vh;
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-high);
    z-index: 100;
    display: flex;
    flex-direction: column;
    margin: var(--space-sm);
}

.search-results-header {
    padding: var(--space-sm) var(--space-md);
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.search-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.search-close:hover {
    color: var(--text-normal);
}

.search-results-list {
    overflow-y: auto;
    flex: 1;
}

.search-result {
    padding: var(--space-sm) var(--space-md);
    border-bottom: 1px solid var(--border-subtle);
    cursor: pointer;
    transition: background-color 0.1s ease;
}

.search-result:hover {
    background: var(--bg-modifier-hover);
}

.search-result:last-child {
    border-bottom: none;
}

.search-result-header {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-bottom: 4px;
    font-size: 0.75rem;
}

.search-result-user {
    font-weight: 600;
    color: var(--text-normal);
}

.search-result-channel {
    color: var(--text-muted);
}

.search-result-time {
    color: var(--text-faint);
    margin-left: auto;
}

.search-result-content {
    color: var(--text-normal);
    font-size: 0.875rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-result-content mark {
    background: var(--accent-warning);
    color: #000;
    padding: 0 2px;
    border-radius: 2px;
}

/* Messages area */
.messages-container {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: var(--space-md);
    background-color: var(--bg-primary);
}

/* Individual message */
.message {
    padding: 2px 0;
    margin: 0;
    padding-left: var(--space-md);
    padding-right: var(--space-xl);
    transition: background-color var(--transition-fast);
}

.message:hover {
    background-color: var(--bg-modifier-hover);
}

.message-highlight {
    background-color: rgba(88, 101, 242, 0.3) !important;
    animation: highlight-fade 2s ease-out;
}

@keyframes highlight-fade {
    0% { background-color: rgba(88, 101, 242, 0.5); }
    100% { background-color: transparent; }
}

.message-header {
    display: flex;
    align-items: baseline;
    gap: var(--space-sm);
}

.message-username {
    font-weight: 500;
    color: var(--text-normal);
    cursor: pointer;
}

.message-username:hover {
    text-decoration: underline;
}

.message-timestamp {
    font-size: 0.6875rem;
    color: var(--text-muted);
}

/* Bot badge */
.bot-badge {
    display: inline-flex;
    align-items: center;
    padding: 0 4px;
    height: 15px;
    font-size: 0.625rem;
    font-weight: 500;
    text-transform: uppercase;
    background-color: var(--accent-primary);
    color: white;
    border-radius: 3px;
    vertical-align: top;
    margin-top: 2px;
}

.message-content {
    color: var(--text-normal);
    line-height: 1.375;
    word-wrap: break-word;
}

/* Jump to present button */
.jump-to-present {
    display: flex;
    justify-content: center;
    padding: 8px;
    background: linear-gradient(to bottom, transparent, var(--bg-secondary));
}

.jump-to-present button {
    background-color: var(--brand-color);
    color: white;
    border: none;
    border-radius: 20px;
    padding: 8px 16px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color var(--transition-fast), transform var(--transition-fast);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.jump-to-present button:hover {
    background-color: var(--brand-color-hover);
    transform: scale(1.02);
}

/* Message input area */
.message-input-container {
    min-height: 52px;
    padding: 0;
    background-color: var(--bg-tertiary);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

.message-input-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 0;
    background-color: var(--bg-accent);
    border-radius: var(--radius-sm);
    flex: 1;
    min-height: 40px;
    max-height: 200px;
}

.message-input-wrapper .form-control {
    background-color: transparent;
    border: none;
    padding: var(--space-sm) var(--space-md);
    flex: 1;
    min-height: 24px;
    max-height: 184px;
    resize: none;
    overflow-y: auto;
    line-height: 1.375;
}

.message-input-wrapper .form-control:focus {
    box-shadow: none;
}

.message-input-wrapper .btn {
    margin: 4px;
    padding: 6px 16px;
    height: 32px;
}

/* -----------------------------------------------------------------------------
   Login/Register Page
   ----------------------------------------------------------------------------- */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--bg-tertiary);
}

.auth-card {
    width: 100%;
    max-width: 480px;
    background-color: var(--bg-primary);
    border-radius: var(--radius-md);
    padding: var(--space-xl);
    box-shadow: var(--shadow-high);
}

.auth-title {
    text-align: center;
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: var(--space-sm);
}

.auth-subtitle {
    text-align: center;
    color: var(--text-muted);
    margin-bottom: var(--space-lg);
}

/* -----------------------------------------------------------------------------
   Welcome Screen (when authenticated but no channel selected)
   ----------------------------------------------------------------------------- */
.welcome-container {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    background-color: var(--bg-primary);
    color: var(--text-muted);
    text-align: center;
}

.welcome-content h4 {
    color: var(--text-normal);
    margin-bottom: var(--space-sm);
}

.welcome-content p {
    color: var(--text-muted);
}

/* -----------------------------------------------------------------------------
   Status Indicators
   ----------------------------------------------------------------------------- */
.status-indicator {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: var(--radius-full);
    margin-right: var(--space-xs);
}

.status-online { background-color: var(--status-online); }
.status-idle { background-color: var(--status-idle); }
.status-dnd { background-color: var(--status-dnd); }
.status-offline { background-color: var(--status-offline); }

/* -----------------------------------------------------------------------------
   Blazor Loading & Error States
   ----------------------------------------------------------------------------- */
#blazor-error-ui {
    background: var(--accent-danger);
    bottom: 0;
    box-shadow: var(--shadow-medium);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
    color: white;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

.loading-progress {
    position: absolute;
    display: block;
    width: 8rem;
    height: 8rem;
    inset: 20vh 0 auto 0;
    margin: 0 auto;
}

.loading-progress circle {
    fill: none;
    stroke: var(--bg-accent);
    stroke-width: 0.6rem;
    transform-origin: 50% 50%;
    transform: rotate(-90deg);
}

.loading-progress circle:last-child {
    stroke: var(--accent-primary);
    stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
    transition: stroke-dasharray 0.05s ease-in-out;
}

.loading-progress-text {
    position: absolute;
    text-align: center;
    font-weight: bold;
    inset: calc(20vh + 3.25rem) 0 auto 0.2rem;
    color: var(--text-muted);
}

.loading-progress-text:after {
    content: var(--blazor-load-percentage-text, "Loading");
}

/* -----------------------------------------------------------------------------
   Utility Classes
   ----------------------------------------------------------------------------- */
.gap-xs { gap: var(--space-xs); }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }

.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* -----------------------------------------------------------------------------
   Member List (Right Sidebar)
   ----------------------------------------------------------------------------- */
.member-list {
    width: 240px;
    min-width: 240px;
    height: 100%;
    background-color: var(--bg-secondary);
    overflow-y: auto;
    overflow-x: hidden;
}

.member-list-header {
    padding: var(--space-lg) var(--space-md) var(--space-sm);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.02em;
}

.member-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-xs) var(--space-sm);
    margin: 1px var(--space-sm);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background-color var(--transition-fast);
}

.member-item:hover {
    background-color: var(--bg-modifier-hover);
}

.member-avatar {
    position: relative;
    flex-shrink: 0;
}

.member-avatar .status-dot {
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid var(--bg-secondary);
}

.member-avatar .status-dot.online {
    background-color: var(--status-online);
}

.member-avatar .status-dot.offline {
    background-color: var(--status-offline);
}

.member-info {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    min-width: 0;
    flex: 1;
}

.member-name {
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.member-item:hover .member-name {
    color: var(--text-normal);
}

.member-empty {
    padding: var(--space-md);
    color: var(--text-muted);
    font-size: 0.875rem;
    text-align: center;
}

/* -----------------------------------------------------------------------------
   Rich Markdown Content Styling
   ----------------------------------------------------------------------------- */
.message-content-rich {
    color: var(--text-normal);
    line-height: 1.375;
    word-wrap: break-word;
}

.message-content-rich h1,
.message-content-rich h2,
.message-content-rich h3,
.message-content-rich h4,
.message-content-rich h5,
.message-content-rich h6 {
    margin-top: var(--space-sm);
    margin-bottom: var(--space-xs);
    line-height: 1.25;
}

.message-content-rich h1 { font-size: 1.5rem; }
.message-content-rich h2 { font-size: 1.25rem; }
.message-content-rich h3 { font-size: 1.125rem; }
.message-content-rich h4 { font-size: 1rem; }

.message-content-rich p {
    margin: var(--space-xs) 0;
}

.message-content-rich p:first-child {
    margin-top: 0;
}

.message-content-rich p:last-child {
    margin-bottom: 0;
}

/* Inline code */
.message-content-rich code {
    background-color: var(--bg-accent);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.875em;
}

/* Code blocks */
.message-content-rich pre {
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    overflow-x: auto;
    margin: var(--space-sm) 0;
}

.message-content-rich pre code {
    background: none;
    padding: 0;
    font-size: 0.8125rem;
    line-height: 1.5;
    border-radius: 0;
}

/* Blockquotes */
.message-content-rich blockquote {
    border-left: 4px solid var(--accent-primary);
    padding-left: var(--space-md);
    margin: var(--space-sm) 0;
    color: var(--text-muted);
}

.message-content-rich blockquote p {
    margin: 0;
}

/* Lists */
.message-content-rich ul,
.message-content-rich ol {
    padding-left: var(--space-lg);
    margin: var(--space-xs) 0;
}

.message-content-rich li {
    margin: 2px 0;
}

/* Task lists (GFM) */
.message-content-rich ul.contains-task-list {
    list-style: none;
    padding-left: var(--space-md);
}

.message-content-rich .task-list-item input[type="checkbox"] {
    margin-right: var(--space-xs);
}

/* Links */
.message-content-rich a {
    color: var(--text-link);
    text-decoration: none;
}

.message-content-rich a:hover {
    text-decoration: underline;
}

/* Images */
.message-content-rich img {
    max-width: 100%;
    max-height: 300px;
    border-radius: var(--radius-md);
    margin: var(--space-xs) 0;
}

/* Tables */
.message-content-rich table {
    border-collapse: collapse;
    margin: var(--space-sm) 0;
    font-size: 0.875rem;
}

.message-content-rich th,
.message-content-rich td {
    border: 1px solid var(--border-subtle);
    padding: var(--space-xs) var(--space-sm);
}

.message-content-rich th {
    background-color: var(--bg-secondary);
    font-weight: 600;
}

.message-content-rich tr:nth-child(even) {
    background-color: var(--bg-modifier-hover);
}

/* Horizontal rule */
.message-content-rich hr {
    border: none;
    border-top: 1px solid var(--border-subtle);
    margin: var(--space-md) 0;
}

/* Strong/Bold */
.message-content-rich strong {
    font-weight: 600;
    color: var(--text-normal);
}

/* Emphasis/Italic */
.message-content-rich em {
    font-style: italic;
}

/* Strikethrough */
.message-content-rich del {
    text-decoration: line-through;
    color: var(--text-muted);
}

/* Prism.js theme overrides for dark mode */
.message-content-rich pre[class*="language-"] {
    background-color: var(--bg-tertiary);
    margin: var(--space-sm) 0;
}

.message-content-rich code[class*="language-"] {
    text-shadow: none;
}

/* -----------------------------------------------------------------------------
   File Attachments Styling
   ----------------------------------------------------------------------------- */
.message-attachments {
    margin-top: var(--space-sm);
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
}

.attachment-image {
    max-width: 100%;
}

.attachment-image img {
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: opacity var(--transition-fast);
    display: block;
}

.attachment-image img:hover {
    opacity: 0.9;
}

.attachment-file {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: var(--space-sm) var(--space-md);
    max-width: 300px;
}

.attachment-file a {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    color: var(--text-link);
    text-decoration: none;
}

.attachment-file a:hover {
    text-decoration: underline;
}

.attachment-file .file-icon {
    font-size: 1.25rem;
}

.attachment-file .file-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}

.attachment-file .file-size {
    color: var(--text-muted);
    font-size: 0.75rem;
    white-space: nowrap;
}

/* -----------------------------------------------------------------------------
   File Upload UI
   ----------------------------------------------------------------------------- */
.file-upload-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 1.5rem;
    font-weight: 300;
    transition: color var(--transition-fast);
    flex-shrink: 0;
}

.file-upload-btn:hover {
    color: var(--text-normal);
}

.pending-files {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-xs);
    padding: var(--space-sm) var(--space-md);
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--border-subtle);
}

.pending-file {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    background-color: var(--bg-accent);
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-sm);
    font-size: 0.8125rem;
    max-width: 200px;
}

.pending-file-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-normal);
}

.pending-file-size {
    color: var(--text-muted);
    font-size: 0.6875rem;
    white-space: nowrap;
}

.pending-file-remove {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0 2px;
    font-size: 1rem;
    line-height: 1;
    transition: color var(--transition-fast);
}

.pending-file-remove:hover {
    color: var(--accent-danger);
}

/* -----------------------------------------------------------------------------
   Link Embeds (OpenGraph Previews)
   ----------------------------------------------------------------------------- */
.message-embeds {
    margin-top: var(--space-sm);
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

/* Direct image embeds */
.embed-image {
    max-width: 400px;
}

.embed-image img {
    max-width: 100%;
    max-height: 300px;
    border-radius: var(--radius-md);
    display: block;
}

.embed-image a {
    display: block;
}

/* OpenGraph link embeds */
.link-embed {
    display: flex;
    background-color: var(--bg-secondary);
    border-left: 4px solid var(--accent-primary);
    border-radius: var(--radius-md);
    overflow: hidden;
    max-width: 500px;
}

.embed-thumbnail {
    flex-shrink: 0;
    width: 80px;
    height: 80px;
    overflow: hidden;
}

.embed-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.embed-content {
    padding: var(--space-sm) var(--space-md);
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.embed-site {
    font-size: 0.6875rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.embed-title {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-link);
    text-decoration: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.embed-title:hover {
    text-decoration: underline;
}

.embed-description {
    font-size: 0.8125rem;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* -----------------------------------------------------------------------------
   Media Embeds (YouTube, GIF, Video, Image)
   ----------------------------------------------------------------------------- */
.media-embed {
    max-width: 100%;
    border-radius: var(--radius-md);
    overflow: hidden;
}

/* YouTube embeds */
.youtube-embed {
    position: relative;
    width: 100%;
    max-width: 480px;
    aspect-ratio: 16 / 9;
    background-color: var(--bg-tertiary);
}

.youtube-embed iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
    border-radius: var(--radius-md);
}

/* GIF embeds */
.gif-embed {
    max-width: 400px;
}

.gif-embed img {
    max-width: 100%;
    max-height: 300px;
    display: block;
    border-radius: var(--radius-md);
}

/* Video embeds */
.video-embed {
    max-width: 480px;
}

.video-embed video {
    max-width: 100%;
    max-height: 400px;
    display: block;
    border-radius: var(--radius-md);
    background-color: var(--bg-tertiary);
}

/* Image embeds */
.image-embed {
    max-width: 400px;
}

.image-embed img {
    max-width: 100%;
    max-height: 300px;
    display: block;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: opacity var(--transition-fast);
}

.image-embed img:hover {
    opacity: 0.9;
}

.image-embed a {
    display: block;
}

/* -----------------------------------------------------------------------------
   Twemoji (Consistent Cross-Platform Emoji)
   ----------------------------------------------------------------------------- */
img.emoji {
    height: 1.2em;
    width: 1.2em;
    margin: 0 0.05em 0 0.1em;
    vertical-align: -0.2em;
    display: inline-block;
}

/* Larger emoji in message content (when emoji is the only content) */
.message-content-rich > img.emoji:only-child,
.message-content-rich > p > img.emoji:only-child {
    height: 2.5em;
    width: 2.5em;
}

/* Emoji picker button */
.emoji-picker-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 1.25rem;
    transition: color var(--transition-fast);
    flex-shrink: 0;
    background: none;
    border: none;
    padding: 0;
}

.emoji-picker-btn:hover {
    color: var(--text-normal);
}

/* -----------------------------------------------------------------------------
   Emoji Picker Panel
   ----------------------------------------------------------------------------- */
.emoji-picker-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 99;
}

.emoji-picker-container {
    position: relative;
}

.emoji-picker-panel {
    position: absolute;
    bottom: 100%;
    right: 0;
    margin-bottom: var(--space-sm);
    width: 352px;
    max-height: 420px;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-high);
    display: flex;
    flex-direction: column;
    z-index: 100;
}

.emoji-picker-search {
    padding: var(--space-sm);
    border-bottom: 1px solid var(--border-subtle);
}

.emoji-picker-search input {
    width: 100%;
    background-color: var(--bg-tertiary);
    border: none;
    border-radius: var(--radius-sm);
    padding: var(--space-sm);
    color: var(--text-normal);
    font-size: 0.875rem;
}

.emoji-picker-search input::placeholder {
    color: var(--text-muted);
}

.emoji-picker-search input:focus {
    outline: none;
    box-shadow: 0 0 0 2px var(--accent-primary);
}

.emoji-picker-categories {
    display: flex;
    padding: var(--space-xs);
    border-bottom: 1px solid var(--border-subtle);
    gap: 2px;
}

.emoji-category-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-xs);
    background: none;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 1.125rem;
    color: var(--text-muted);
    transition: background-color var(--transition-fast), color var(--transition-fast);
}

.emoji-category-btn:hover {
    background-color: var(--bg-modifier-hover);
    color: var(--text-normal);
}

.emoji-category-btn.active {
    background-color: var(--bg-modifier-active);
    color: var(--text-normal);
}

.emoji-picker-grid {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-sm);
}

.emoji-category-header {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: var(--space-sm) var(--space-xs);
    letter-spacing: 0.02em;
}

.emoji-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 2px;
}

.emoji-item {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    font-size: 1.5rem;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: background-color var(--transition-fast);
    background: none;
    border: none;
    padding: 0;
}

.emoji-item:hover {
    background-color: var(--bg-modifier-hover);
}

.emoji-item img.emoji {
    height: 1.5rem;
    width: 1.5rem;
    margin: 0;
    vertical-align: middle;
}

/* -----------------------------------------------------------------------------
   Drag & Drop File Upload
   ----------------------------------------------------------------------------- */
.drop-zone {
    transition: background-color var(--transition-fast);
}

.drop-zone.drag-over {
    background-color: var(--bg-modifier-hover) !important;
}

.drop-overlay {
    position: absolute;
    inset: 0;
    background-color: rgba(88, 101, 242, 0.15);
    border: 3px dashed var(--accent-primary);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    pointer-events: none;
    margin: var(--space-md);
}

.drop-overlay-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-sm);
    color: var(--accent-primary);
    font-size: 1.25rem;
    font-weight: 600;
}

.drop-icon {
    font-size: 3rem;
}

/* -----------------------------------------------------------------------------
   User Context Menu (Right-Click)
   ----------------------------------------------------------------------------- */
.context-menu-backdrop {
    position: fixed;
    inset: 0;
    z-index: 999;
}

.context-menu {
    position: fixed;
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-high);
    min-width: 200px;
    z-index: 1000;
    overflow: hidden;
}

.context-menu-header {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-md);
    background-color: var(--bg-secondary);
}

.context-menu-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.125rem;
    color: #1e1f22;
    flex-shrink: 0;
}

.context-menu-user-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.context-menu-displayname {
    font-weight: 600;
    color: var(--text-normal);
    display: flex;
    align-items: center;
    gap: var(--space-xs);
}

.context-menu-username {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.context-menu-divider {
    height: 1px;
    background-color: var(--border-subtle);
}

.context-menu-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    cursor: pointer;
    color: var(--text-normal);
    font-size: 0.875rem;
    transition: background-color var(--transition-fast);
}

.context-menu-item:hover {
    background-color: var(--accent-primary);
    color: white;
}

.context-menu-icon {
    width: 20px;
    text-align: center;
}

/* -----------------------------------------------------------------------------
   User Profile Popup
   ----------------------------------------------------------------------------- */
.profile-backdrop {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 1000;
}

.profile-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 340px;
    background-color: var(--bg-tertiary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-high);
    z-index: 1001;
    overflow: hidden;
}

.profile-banner {
    height: 60px;
}

.profile-content {
    padding: 0 var(--space-md) var(--space-md);
    position: relative;
}

.profile-avatar-wrapper {
    position: relative;
    width: fit-content;
    margin-top: -40px;
    margin-bottom: var(--space-sm);
}

.profile-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 6px solid var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 2rem;
    color: #1e1f22;
}

.profile-status-dot {
    position: absolute;
    bottom: 4px;
    right: 4px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 4px solid var(--bg-tertiary);
}

.profile-status-dot.online {
    background-color: var(--status-online);
}

.profile-status-dot.offline {
    background-color: var(--status-offline);
}

.profile-header {
    margin-bottom: var(--space-md);
}

.profile-displayname {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-normal);
    margin: 0 0 2px 0;
    display: flex;
    align-items: center;
    gap: var(--space-xs);
}

.profile-username {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.profile-divider {
    height: 1px;
    background-color: var(--border-subtle);
    margin: var(--space-md) 0;
}

.profile-section {
    margin-bottom: var(--space-md);
}

.profile-section-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-normal);
    margin-bottom: var(--space-xs);
    letter-spacing: 0.02em;
}

.profile-section-content {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.profile-status {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
}

.profile-status::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.profile-status.online::before {
    background-color: var(--status-online);
}

.profile-status.offline::before {
    background-color: var(--status-offline);
}

.profile-actions {
    margin-top: var(--space-md);
}

.profile-action-btn {
    width: 100%;
    padding: var(--space-sm) var(--space-md);
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color var(--transition-fast);
}

.profile-action-btn.primary {
    background-color: var(--accent-primary);
    color: white;
}

.profile-action-btn.primary:hover {
    background-color: var(--brand-color-hover);
}

.profile-close {
    position: absolute;
    top: var(--space-sm);
    right: var(--space-sm);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.3);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 1.25rem;
    cursor: pointer;
    transition: background-color var(--transition-fast);
}

.profile-close:hover {
    background: rgba(0, 0, 0, 0.5);
}

/* Profile avatar image (when user has uploaded one) */
.profile-avatar-img {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 6px solid var(--bg-tertiary);
    object-fit: cover;
}

/* Avatar edit button overlay */
.avatar-edit-btn {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--accent-primary);
    border: 3px solid var(--bg-tertiary);
    color: white;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color var(--transition-fast);
}

.avatar-edit-btn:hover {
    background: var(--accent-primary-hover);
}

/* Profile edit form */
.profile-edit-form {
    padding: var(--space-md) 0;
}

.edit-field {
    margin-bottom: var(--space-md);
}

.edit-field label {
    display: block;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-normal);
    margin-bottom: var(--space-xs);
    letter-spacing: 0.02em;
}

.edit-input {
    width: 100%;
    padding: var(--space-sm) var(--space-md);
    background-color: var(--bg-primary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-normal);
    font-size: 0.875rem;
}

.edit-input:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.edit-file-input {
    width: 100%;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.edit-file-input::file-selector-button {
    padding: var(--space-xs) var(--space-sm);
    margin-right: var(--space-sm);
    background-color: var(--bg-modifier-hover);
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-normal);
    cursor: pointer;
}

.edit-file-input::file-selector-button:hover {
    background-color: var(--bg-modifier-active);
}

.edit-error {
    display: block;
    margin-top: var(--space-xs);
    color: var(--text-danger);
    font-size: 0.75rem;
}

.edit-actions {
    display: flex;
    gap: var(--space-sm);
    margin-top: var(--space-md);
}

.edit-actions .profile-action-btn {
    flex: 1;
}

.profile-action-btn:not(.primary) {
    background-color: var(--bg-modifier-hover);
    color: var(--text-normal);
}

.profile-action-btn:not(.primary):hover {
    background-color: var(--bg-modifier-active);
}

.profile-action-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* -----------------------------------------------------------------------------
   Typing Indicator
   ----------------------------------------------------------------------------- */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-xs) var(--space-md);
    color: var(--text-muted);
    font-size: 0.8125rem;
    min-height: 24px;
}

.typing-dots {
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

.typing-dots span {
    width: 6px;
    height: 6px;
    background-color: var(--text-muted);
    border-radius: 50%;
    animation: typing-bounce 1.4s infinite ease-in-out both;
}

.typing-dots span:nth-child(1) {
    animation-delay: -0.32s;
}

.typing-dots span:nth-child(2) {
    animation-delay: -0.16s;
}

.typing-dots span:nth-child(3) {
    animation-delay: 0s;
}

@keyframes typing-bounce {
    0%, 80%, 100% {
        transform: scale(0.7);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* -----------------------------------------------------------------------------
   Message Edit/Delete Actions
   ----------------------------------------------------------------------------- */
.message-hoverable {
    position: relative;
}

.message-actions {
    position: absolute;
    top: -8px;
    right: var(--space-md);
    display: none;
    gap: 2px;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-medium);
    padding: 2px;
}

.message-hoverable:hover .message-actions {
    display: flex;
}

.message-action-btn {
    background: none;
    border: none;
    padding: 4px 8px;
    cursor: pointer;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    transition: background-color var(--transition-fast);
    line-height: 1;
}

.message-action-btn:hover {
    background-color: var(--bg-modifier-hover);
}

.message-action-delete:hover {
    background-color: rgba(218, 55, 60, 0.2);
}

/* Edited indicator */
.message-edited {
    font-size: 0.625rem;
    color: var(--text-muted);
    margin-left: var(--space-xs);
}

/* Message edit mode */
.message-edit-container {
    margin-top: var(--space-xs);
}

.message-edit-input {
    width: 100%;
    background-color: var(--bg-accent);
    border: none;
    border-radius: var(--radius-sm);
    padding: var(--space-sm);
    color: var(--text-normal);
    font-size: 1rem;
    font-family: inherit;
    line-height: 1.375;
    resize: none;
    min-height: 44px;
    max-height: 200px;
}

.message-edit-input:focus {
    outline: none;
    box-shadow: 0 0 0 2px var(--accent-primary);
}

.message-edit-actions {
    margin-top: var(--space-xs);
}

.message-edit-hint {
    font-size: 0.6875rem;
    color: var(--text-muted);
}

.message-edit-hint a {
    color: var(--text-link);
    cursor: pointer;
}

.message-edit-hint a:hover {
    text-decoration: underline;
}

/* Delete confirmation modal */
.delete-modal-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.delete-modal {
    background-color: var(--bg-tertiary);
    border-radius: var(--radius-md);
    padding: var(--space-lg);
    max-width: 400px;
    width: 90%;
    box-shadow: var(--shadow-high);
}

.delete-modal h4 {
    margin: 0 0 var(--space-sm) 0;
    color: var(--text-normal);
    font-size: 1.25rem;
}

.delete-modal p {
    margin: 0 0 var(--space-lg) 0;
    color: var(--text-muted);
}

.delete-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-sm);
}

.delete-modal .btn-cancel {
    background-color: transparent;
    border: none;
    color: var(--text-normal);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.875rem;
}

.delete-modal .btn-cancel:hover {
    text-decoration: underline;
}

.delete-modal .btn-delete {
    background-color: #da373c;
    border: none;
    color: white;
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
}

.delete-modal .btn-delete:hover {
    background-color: #c93135;
}

/* -----------------------------------------------------------------------------
   Message Reactions
   ----------------------------------------------------------------------------- */
.message-reactions {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 4px;
    align-items: center;
}

.reaction-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 6px;
    border-radius: var(--radius-md);
    background-color: var(--bg-modifier-hover);
    border: 1px solid transparent;
    cursor: pointer;
    font-size: 0.875rem;
    transition: var(--transition-fast);
}

.reaction-pill:hover {
    background-color: var(--bg-modifier-active);
}

.reaction-pill.reacted {
    background-color: rgba(88, 101, 242, 0.15);
    border-color: var(--accent-primary);
}

.reaction-pill.reacted:hover {
    background-color: rgba(88, 101, 242, 0.25);
}

.reaction-emoji {
    font-size: 1rem;
    line-height: 1;
}

.reaction-count {
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 500;
}

.reaction-pill.reacted .reaction-count {
    color: var(--accent-primary);
}

.add-reaction-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    padding: 0;
    border-radius: var(--radius-md);
    background-color: transparent;
    border: 1px dashed var(--border-subtle);
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--text-muted);
    transition: var(--transition-fast);
    opacity: 0;
}

.message-hoverable:hover .add-reaction-btn,
.message-reactions:hover .add-reaction-btn {
    opacity: 1;
}

.add-reaction-btn:hover {
    background-color: var(--bg-modifier-hover);
    border-color: var(--border-strong);
    color: var(--text-normal);
}

/* Reaction Picker */
.reaction-picker-container {
    position: absolute;
    top: -50px;
    right: 8px;
    z-index: 100;
}

.reaction-picker-panel {
    display: none;
    background-color: var(--bg-accent);
    border-radius: var(--radius-md);
    padding: var(--space-xs);
    box-shadow: var(--shadow-high);
    gap: 2px;
}

.reaction-picker-panel.visible {
    display: flex;
}

.reaction-picker-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: none;
    border-radius: var(--radius-sm);
    background-color: transparent;
    cursor: pointer;
    font-size: 1.25rem;
    transition: var(--transition-fast);
}

.reaction-picker-btn:hover {
    background-color: var(--bg-modifier-hover);
    transform: scale(1.1);
}

/* -----------------------------------------------------------------------------
   System Messages (Presence Notifications)
   ----------------------------------------------------------------------------- */
.system-message {
    display: flex;
    justify-content: center;
    padding: 4px 16px;
    margin: 2px 0;
}

.system-message span {
    color: var(--text-muted);
    font-size: 0.8rem;
    font-style: italic;
}
