/* Mesme v2 - Premium Dark Glassmorphism Design System */

/* -- Tokens -- */
:root {
    --bg-darkest: #060610;
    --bg-dark: #0d0d1a;
    --bg-medium: #131320;
    --bg-light: #1a1a2e;
    --bg-lighter: #222238;
    --bg-hover: #2a2a42;
    --glass: rgba(18, 18, 38, 0.55);
    --glass-border: rgba(255, 255, 255, 0.12);
    --glass-strong: rgba(10, 10, 25, 0.8);
    --glass-panel: rgba(12, 12, 28, 0.75);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.35);
    --accent: #00d4aa;
    --accent-hover: #00e8bc;
    --accent-glow: rgba(0, 212, 170, 0.25);
    --accent2: #0099ff;
    --accent-gradient: linear-gradient(135deg, #00d4aa, #0099ff);
    --green: #43b581;
    --yellow: #faa61a;
    --red: #f04747;
    --text: #e0e1e5;
    --text-muted: #6b7280;
    --text-dim: #4b5058;
    --white: #ffffff;
    --font: 'Inter', -apple-system, system-ui, sans-serif;
    --radius: 16px;
    --radius-sm: 12px;
    --radius-xs: 8px;
    --radius-pill: 50px;
    --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-spring: 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    --msg-anim: messageIn 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28) forwards;
}

@keyframes messageIn {
    0% {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    60% {
        transform: translateY(-2px) scale(1.01);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html,
body {
    height: 100%;
    font-family: var(--font);
    background: var(--bg-darkest);
    color: var(--text);
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
}

/* ── Startup Loader ────────────────────────────────── */
.startup-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-darkest);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.8s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.8s;
}

.startup-loader.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.loader-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    animation: fadeIn 1s ease-out;
}

.loader-logo {
    width: 80px;
    height: 80px;
    background: var(--accent-gradient);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    font-weight: 800;
    color: white;
    box-shadow: 0 0 30px var(--accent-glow);
    margin-bottom: 10px;
}

.loader-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top: 3px solid var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* -- Launch Button (Premium Interaction) -- */
.launch-btn {
    padding: 14px 32px;
    background: var(--accent-gradient);
    border: none;
    border-radius: var(--radius-sm);
    color: white;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 0 20px var(--accent-glow);
    transition: var(--transition-spring);
    animation: pulseGlow 2s infinite;
}

.launch-btn:hover {
    transform: scale(1.05) translateY(-2px);
    box-shadow: 0 0 35px var(--accent-glow);
    filter: brightness(1.1);
}

.launch-btn.hidden {
    display: none;
}

@keyframes pulseGlow {
    0% {
        box-shadow: 0 0 15px var(--accent-glow);
    }

    50% {
        box-shadow: 0 0 30px var(--accent-glow);
    }

    100% {
        box-shadow: 0 0 15px var(--accent-glow);
    }
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.loader-text {
    font-size: 14px;
    color: var(--text-muted);
    font-weight: 500;
    letter-spacing: 1px;
    text-transform: uppercase;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Animated ambient background */
body::before {
    content: '';
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background:
        radial-gradient(circle at 20% 30%, rgba(0, 212, 170, 0.06) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(0, 153, 255, 0.05) 0%, transparent 50%),
        radial-gradient(circle at 50% 50%, rgba(100, 50, 200, 0.03) 0%, transparent 60%);
    animation: ambientDrift 25s ease-in-out infinite alternate;
    z-index: -1;
    pointer-events: none;
}

@keyframes ambientDrift {
    0% {
        transform: translate(0, 0) rotate(0deg);
    }

    50% {
        transform: translate(2%, -1%) rotate(1deg);
    }

    100% {
        transform: translate(-1%, 2%) rotate(-1deg);
    }
}

::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--bg-lighter);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
}

.hidden {
    display: none !important;
}

.media-deleted {
    display: inline-block;
    padding: 10px 15px;
    background: rgba(255, 60, 60, 0.1);
    border: 1px dashed var(--red);
    color: var(--red);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-style: italic;
    margin: 5px 0;
}

/* -- Chat Textarea -- */
#chatInput {
    background: var(--bg-light);
    color: var(--text);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 0.9rem;
    outline: none;
    transition: border-color var(--transition), box-shadow var(--transition);
}

#chatInput:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-glow);
}

#chatInput::placeholder {
    color: var(--text-muted);
}

/* -- Auth View -- */
.auth-view {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0d0d1a 0%, #1a0a2e 50%, #0a1628 100%);
    position: relative;
}

.auth-view::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background:
        radial-gradient(circle at 30% 40%, rgba(124, 92, 252, 0.12) 0%, transparent 50%),
        radial-gradient(circle at 70% 60%, rgba(0, 212, 170, 0.08) 0%, transparent 50%);
    animation: auroraAuth 15s ease-in-out infinite alternate;
}

@keyframes auroraAuth {
    to {
        transform: translateX(3%) translateY(-2%);
    }
}

.auth-glass {
    position: relative;
    width: 420px;
    padding: 40px;
    background: var(--glass-strong);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 80px rgba(124, 92, 252, 0.08);
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.auth-logo {
    text-align: center;
    margin-bottom: 28px;
}

.logo-icon {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    border-radius: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 12px;
    box-shadow: 0 4px 20px var(--accent-glow);
}

.message.highlight {
    background: rgba(124, 92, 252, 0.2);
    box-shadow: 0 0 10px var(--accent-glow);
    transition: background 0.5s, box-shadow 0.5s;
}

.auth-logo h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--white);
}

.auth-tagline {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 4px;
}

.auth-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 24px;
    background: var(--bg-dark);
    border-radius: var(--radius-sm);
    padding: 3px;
}

.auth-tab {
    flex: 1;
    padding: 10px;
    border: none;
    background: none;
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border-radius: 6px;
    transition: var(--transition);
    font-family: var(--font);
}

.auth-tab.active {
    background: var(--accent);
    color: white;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.input-group label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.input-group input,
.modal-input,
.search-input,
.setting-input {
    padding: 11px 14px;
    background: var(--bg-dark);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 14px;
    font-family: var(--font);
    transition: var(--transition);
    outline: none;
    width: 100%;
}

.input-group input:focus,
.modal-input:focus,
.search-input:focus,
.setting-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.btn-primary {
    padding: 12px 24px;
    border: none;
    background: var(--accent-gradient);
    color: white;
    font-size: 15px;
    font-weight: 600;
    border-radius: var(--radius-pill);
    cursor: pointer;
    transition: var(--transition);
    font-family: var(--font);
}

.btn-primary:hover {
    filter: brightness(1.15);
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 6px 20px var(--accent-glow);
}

.btn-primary:active {
    transform: translateY(0) scale(0.98);
}

.btn-danger {
    padding: 12px 24px;
    border: 1px solid var(--red);
    background: transparent;
    color: var(--red);
    font-size: 14px;
    font-weight: 500;
    border-radius: var(--radius-pill);
    cursor: pointer;
    transition: var(--transition);
    width: 100%;
    font-family: var(--font);
}

.btn-danger:hover {
    background: var(--red);
    color: white;
    transform: translateY(-1px);
}

.btn-danger:active {
    transform: translateY(0) scale(0.98);
}

/* -- App Layout -- */
.app-view {
    display: flex;
    height: 100vh;
    width: 100%;
}

/* ── Social Sidebar (Left) ──────────────────────────────── */
.social-sidebar {
    width: 280px;
    min-width: 280px;
    max-height: 100vh;
    height: 100vh;
    background: var(--glass-panel);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--glass-border);
    flex-shrink: 0;
    order: 0;
    overflow: hidden;
}

/* ── Server Sidebar (Far Right) ─────────────────────────── */
.server-sidebar {
    width: 72px;
    min-width: 72px;
    background: var(--bg-darkest);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 0;
    gap: 4px;
    overflow-y: auto;
    flex-shrink: 0;
    order: 3;
    border-left: 1px solid var(--glass-border);
}

.server-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--bg-medium);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-spring);
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 600;
    flex-shrink: 0;
    position: relative;
}

.server-sidebar-spacer {
    flex: 1;
}

.logout-server-icon {
    margin-bottom: 4px;
}

.logout-server-icon:hover {
    background: rgba(255, 50, 50, 0.2);
    color: #ff4d4d;
    border-radius: var(--radius);
}

.server-icon:hover {
    border-radius: var(--radius);
    background: var(--accent);
    color: white;
    transform: scale(1.08);
    box-shadow: 0 4px 15px var(--accent-glow);
}

.server-icon.active {
    border-radius: var(--radius);
    background: var(--accent);
    color: white;
}

.server-icon.active::before {
    content: '';
    position: absolute;
    right: -16px;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 32px;
    background: var(--white);
    border-radius: 4px 0 0 4px;
}

.home-icon {
    background: var(--bg-light);
    color: var(--accent);
}

.home-icon:hover {
    background: var(--accent);
    color: white;
}

.add-server {
    background: var(--bg-light);
    color: var(--green);
    font-size: 22px;
}

.add-server:hover {
    background: var(--green);
    color: white;
    border-radius: var(--radius);
    transform: scale(1.08);
}

.sidebar-divider {
    width: 32px;
    height: 2px;
    background: var(--bg-lighter);
    border-radius: 1px;
    margin: 4px 0;
    flex-shrink: 0;
}

/* ── Channel Sidebar (Right, animated) ──────────────────── */
.channel-sidebar {
    width: 260px;
    min-width: 260px;
    background: var(--glass-panel);
    backdrop-filter: blur(32px);
    -webkit-backdrop-filter: blur(32px);
    box-shadow: var(--glass-shadow);
    display: flex;
    flex-direction: column;
    border-left: 1px solid var(--glass-border);
    flex-shrink: 0;
    order: 2;
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease;
}

.channel-sidebar.slide-out {
    transform: translateX(100%);
    opacity: 0;
    width: 0;
    min-width: 0;
    overflow: hidden;
    border: none;
    padding: 0;
}

.sidebar-header {
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--glass-border);
    min-height: 50px;
}

.sidebar-header h2 {
    font-size: 15px;
    font-weight: 600;
    color: var(--white);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.icon-btn {
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: var(--text-muted);
    border-radius: var(--radius-xs);
    cursor: pointer;
    transition: var(--transition);
    font-size: 14px;
    flex-shrink: 0;
}

.icon-btn:hover {
    background: var(--bg-hover);
    color: var(--text);
}

.channel-list,
.dm-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
    min-height: 0;
}

.category-header {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 16px 8px 4px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    cursor: pointer;
}

.category-header:hover {
    color: var(--text);
}

.category-header svg {
    width: 10px;
    height: 10px;
    transition: var(--transition);
}

.category-header.collapsed svg {
    transform: rotate(-90deg);
}

.channel-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    color: var(--text-muted);
    font-size: 14px;
    transition: var(--transition);
    position: relative;
    margin: 1px 0;
}

.channel-item:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text);
    transform: translateX(4px) scale(1.02);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.channel-item.active {
    background: rgba(0, 212, 170, 0.12);
    color: var(--white);
    border-left: 3px solid var(--accent);
}

.channel-item.dragging {
    opacity: 0.4;
    border: 1px dashed var(--accent);
}

.channel-item.drag-over-top {
    border-top: 2px solid var(--accent);
}

.channel-item.drag-over-bottom {
    border-bottom: 2px solid var(--accent);
}

.channel-item.channel-nested {
    font-size: 13px;
    border-left: 2px solid rgba(255,255,255,0.06);
    margin-left: 8px;
    padding-left: 16px;
    opacity: 0.85;
}

.channel-item.channel-nested:hover {
    opacity: 1;
    border-left-color: var(--accent);
}

.channel-item.channel-nested.active {
    opacity: 1;
    border-left-color: var(--accent);
}

.channel-item .ch-icon {
    font-size: 14px;
    opacity: 0.7;
}

/* Unread Badges & Dots */
.unread-badge,
.tab-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #ff4757;
    /* Vibrant red */
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    min-width: 16px;
    height: 16px;
    border-radius: 10px;
    /* Pill/Circle */
    padding: 0 4px;
    pointer-events: none;
    box-shadow: 0 0 10px rgba(255, 71, 87, 0.3);
}

/* For sidebar items, make them small circles by default */
.dm-item .unread-badge,
.friend-item .unread-badge {
    min-width: 8px;
    height: 8px;
    padding: 0;
    font-size: 0;
    /* No text as per user request */
    border-radius: 50%;
    background: #ff4757;
    margin-left: 10px;
    box-shadow: 0 0 8px rgba(255, 71, 87, 0.4);
}

.tab-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    min-width: 10px;
    height: 10px;
    padding: 0;
    font-size: 0;
    border-radius: 50%;
}

.channel-item .ch-icon {
    font-size: 16px;
    opacity: 0.7;
    flex-shrink: 0;
    width: 20px;
    text-align: center;
}

.channel-item .ch-name {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.channel-item .voice-count {
    font-size: 11px;
    background: var(--accent);
    color: white;
    padding: 1px 6px;
    border-radius: 10px;
}

.unread-badge {
    background: #f04747;
    /* Red */
    color: white;
    font-size: 11px;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    margin-left: auto;
    box-shadow: 0 0 0 2px var(--bg-tertiary);
}

.tab-badge {
    background: #f04747;
    /* Discord red */
    color: white;
    font-size: 11px;
    font-weight: 800;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    margin-left: 6px;
    box-shadow: 0 0 4px rgba(240, 71, 71, 0.5);
}

.dm-item,
.friend-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    background: transparent;
    border: 1px solid transparent;
    margin-bottom: 4px;
}

.dm-item:hover,
.friend-item:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--glass-border);
    transform: translateY(-1px);
}

.dm-item.active {
    background: var(--glass-panel);
    border-color: rgba(0, 212, 170, 0.3);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.friend-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.friend-name {
    font-size: 14.5px;
    font-weight: 500;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.friend-status-text {
    font-size: 12px;
    color: var(--text-dim);
}

.friend-actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: var(--transition);
}

.friend-item:hover .friend-actions {
    opacity: 1;
}

.friend-msg-btn,
.btn-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.friend-msg-btn:hover {
    background: var(--accent);
    color: var(--bg-darkest);
    transform: scale(1.1);
    box-shadow: 0 0 8px var(--accent-glow);
}

.friends-section-header {
    margin: 16px 8px 8px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
}

.dm-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--bg-lighter);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    color: var(--accent);
    flex-shrink: 0;
    position: relative;
}

.dm-avatar .status-badge {
    position: absolute;
    bottom: -1px;
    right: -1px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid var(--bg-dark);
}

.dm-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
}

.dm-name-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2px;
}

.dm-time {
    font-size: 11px;
    color: var(--text-muted);
    flex-shrink: 0;
    margin-left: 8px;
}

.dm-preview {
    font-size: 13px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

/* User bar */
.user-bar {
    padding: 10px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(0, 0, 0, 0.3);
    border-top: 1px solid var(--glass-border);
    backdrop-filter: blur(10px);
    flex-direction: column;
}

.user-avatar-small {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--accent-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
    color: white;
    flex-shrink: 0;
    transition: var(--transition);
}

.user-avatar-small:hover {
    transform: scale(1.1);
    box-shadow: 0 0 15px var(--accent-glow);
}

.user-info-bar {
    flex: 1;
    min-width: 0;
}

.user-bar-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--white);
    display: block;
}

.user-bar-status {
    font-size: 11px;
    color: var(--text-muted);
    display: block;
}

/* -- Main Content -- */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    min-width: 0;
    overflow: hidden;
    order: 1;
    background: var(--glass-panel);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

/* Chat header — gradient banner */
.chat-header {
    padding: 12px 18px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    background: linear-gradient(135deg, rgba(0, 212, 170, 0.15), rgba(0, 153, 255, 0.1), rgba(100, 50, 200, 0.08));
    min-height: 54px;
    flex-shrink: 0;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.chat-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    flex-shrink: 0;
}

.chat-channel-icon {
    font-size: 20px;
    color: var(--text-muted);
    flex-shrink: 0;
}

.chat-header h3 {
    font-size: 15px;
    font-weight: 600;
    color: var(--white);
    white-space: nowrap;
}

/* Center group: settings + search + pins */
.chat-header-center {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-width: 0;
}

.chat-header-settings {
    flex-shrink: 0;
}

/* Inline search bar in chat header */
.chat-header-search {
    flex: 1;
    max-width: 420px;
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-lighter);
    border: 1px solid var(--glass-border);
    border-radius: 6px;
    padding: 6px 12px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.chat-header-search:focus-within {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px rgba(124, 92, 252, 0.15);
}

.chat-header-search .search-icon {
    color: var(--text-muted);
    flex-shrink: 0;
}

.chat-header-search input {
    flex: 1;
    background: none;
    border: none;
    color: var(--text);
    font-size: 13px;
    outline: none;
    min-width: 0;
}

.chat-header-search input::placeholder {
    color: var(--text-muted);
}

.chat-topic {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-left: 8px;
    padding-left: 8px;
    border-left: 1px solid var(--glass-border);
}

.chat-header-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

/* ── Toolbar buttons (Pockets/GIF/Emoji above input) ── */
.chat-input-toolbar {
    display: flex;
    justify-content: center;
    gap: 6px;
    padding: 0 0 8px;
}

.toolbar-btn {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--glass-border);
    color: var(--text-muted);
    padding: 6px 14px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    gap: 4px;
}

.toolbar-btn:hover {
    background: rgba(124, 92, 252, 0.15);
    color: var(--text);
    border-color: var(--accent-primary);
    transform: scale(1.05);
}

.toolbar-btn:active {
    transform: scale(0.97);
}

.gif-toolbar-btn {
    font-weight: 700;
    font-size: 12px;
    letter-spacing: 0.5px;
}


/* Chat messages */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px 16px 8px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow-anchor: auto;
    position: relative;
}


/* Option 9: Jump to Bottom Button */
.jump-bottom-btn {
    position: absolute;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--accent);
    color: white;
    padding: 8px 16px;
    border-radius: var(--radius-pill);
    border: none;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    z-index: 100;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    transition: var(--transition-spring);
    display: flex;
    align-items: center;
    gap: 6px;
}

.jump-bottom-btn:hover {
    transform: translateX(-50%) scale(1.05);
    filter: brightness(1.1);
}

.jump-bottom-btn.hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateX(-50%) translateY(20px);
}

.message {
    display: flex;
    gap: 12px;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    transition: background 0.15s;
    position: relative;
    /* Modern CSS Virtualization */
    content-visibility: auto;
    contain-intrinsic-size: auto 80px;
}

.message.animate-in {
    animation: var(--msg-anim);
}

/* Sent but not yet confirmed by server — greyish */
.message.sending {
    opacity: 0.6;
    filter: grayscale(0.3);
}

.message.sending .msg-time::after {
    content: ' \2022  sending...';
    font-style: italic;
    color: var(--text-muted);
}

/* Failed to send — reddish */
.message.msg-failed {
    border-left: 3px solid #e04040;
    opacity: 0.8;
}

.message.msg-failed .msg-time::after {
    content: ' \2022  failed';
    font-style: italic;
    color: #e04040;
}

/* Ensure the scroll-loader is visible and centered */
.scroll-loader {
    padding: 20px;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.message:hover {
    background: rgba(255, 255, 255, 0.04);
}

.message.grouped {
    padding-top: 2px;
    padding-bottom: 2px;
}

.msg-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg-lighter);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    color: var(--accent);
    flex-shrink: 0;
}

.message.grouped .msg-avatar {
    visibility: hidden;
    width: 40px;
}

.msg-body {
    flex: 1;
    min-width: 0;
}

.msg-header {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 2px;
}

.msg-header .msg-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--white);
}

.msg-header .msg-time {
    font-size: 11px;
    color: var(--text-dim);
}

.msg-header .msg-edited {
    font-size: 10px;
    color: var(--text-dim);
    font-style: italic;
}

.msg-content {
    font-size: 14.5px;
    line-height: 1.5;
    color: var(--white);
    word-break: break-word;
}

/* ── Mentions ─────────────────────────────────────── */
.mention {
    color: var(--accent);
    background: rgba(0, 212, 170, 0.1);
    padding: 0 4px;
    border-radius: 4px;
    font-weight: 500;
}

.mention-me {
    color: var(--bg-darkest);
    background: var(--accent);
    box-shadow: 0 0 4px var(--accent-glow);
}

.message.is-mentioned {
    background: rgba(0, 212, 170, 0.08);
    border-left: 3px solid var(--accent);
    padding-left: 17px;
    /* compensate for border */
}

.message.is-mentioned:hover {
    background: rgba(0, 212, 170, 0.12);
}

.msg-content img.gif-embed {
    max-width: 300px;
    max-height: 200px;
    border-radius: var(--radius-sm);
    margin-top: 4px;
    display: block;
}

.msg-reactions {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    margin-top: 4px;
}

.reaction-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 8px;
    border-radius: 12px;
    background: var(--bg-lighter);
    border: 1px solid var(--glass-border);
    font-size: 13px;
    cursor: pointer;
    transition: var(--transition);
}

.reaction-badge:hover {
    border-color: var(--accent);
}

.reaction-badge.me {
    border-color: var(--accent);
    background: rgba(124, 92, 252, 0.15);
}

.reaction-badge .r-count {
    font-size: 11px;
    color: var(--text-muted);
}

/* Message hover actions */
.msg-actions {
    position: absolute;
    top: -8px;
    right: 8px;
    display: none;
    gap: 2px;
    background: var(--bg-medium);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xs);
    padding: 2px;
}

.message:hover .msg-actions {
    display: flex;
}

.msg-action-btn {
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    border-radius: var(--radius-xs);
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.msg-action-btn:hover {
    background: var(--bg-hover);
    color: var(--text);
}

/* Unread Badge */
.unread-badge {
    background: #f04747;
    color: #ffffff;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    z-index: 5;
}

.typing-indicator {
    padding: 4px 16px 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-muted);
    flex-shrink: 0;
}

.typing-dots span {
    display: inline-block;
    width: 6px;
    height: 6px;
    background: var(--text-muted);
    border-radius: 50%;
    animation: bounce 1.4s infinite;
}

.typing-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes bounce {

    0%,
    80%,
    100% {
        transform: translateY(0);
    }

    40% {
        transform: translateY(-6px);
    }
}

/* Chat input */
.chat-input-area {
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-dark);
    border-top: 1px solid var(--glass-border);
    flex-shrink: 0;
}

.input-wrapper {
    flex: 1;
}

.input-wrapper input {
    width: 100%;
    padding: 11px 14px;
    background: var(--bg-lighter);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 14px;
    font-family: var(--font);
    outline: none;
    transition: var(--transition);
}

.input-wrapper input:focus {
    border-color: var(--accent);
}

.gif-btn {
    font-weight: 700;
    font-size: 11px;
}

.send-btn:hover {
    color: var(--accent);
}

/* GIF Picker */
.gif-picker {
    position: absolute;
    bottom: 70px;
    left: 16px;
    right: 16px;
    height: 400px;
    background: var(--bg-medium);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    z-index: 100;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
}

.gif-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 10px 0 10px;
    border-bottom: 1px solid var(--glass-border);
}

.gif-tabs {
    display: flex;
    gap: 10px;
}

.gif-tab {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 13px;
    padding: 6px 4px;
    cursor: pointer;
    border-bottom: 2px solid transparent;
}

.gif-tab:hover {
    color: var(--text);
}

.gif-tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.gif-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.gif-controls input[type=range] {
    width: 120px;
    cursor: pointer;
}

.gif-search-bar {
    padding: 10px;
    border-bottom: 1px solid var(--glass-border);
}

.gif-category-row {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    white-space: nowrap;
    scrollbar-width: none;
    /* Firefox */
}

.gif-category-row::-webkit-scrollbar {
    display: none;
    /* Chrome/Safari */
}

.category-chip {
    background: var(--bg-dark);
    border: 1px solid var(--glass-border);
    color: var(--text);
    padding: 6px 12px;
    border-radius: 16px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
    user-select: none;
}

.category-chip:hover {
    background: var(--bg-medium);
    border-color: var(--accent);
}

.category-chip.active {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

.gif-search-bar input {
    width: 100%;
    padding: 8px 12px;
    background: var(--bg-dark);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: var(--font);
    font-size: 13px;
    outline: none;
}

.gif-search-bar input:focus {
    border-color: var(--accent);
}

.gif-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(var(--gif-size, 120px), 1fr));
    gap: 6px;
    padding: 10px;
    overflow-y: scroll;
    min-height: 0;
    flex: 1;
}

.gif-grid::-webkit-scrollbar {
    width: 8px;
}

.gif-grid::-webkit-scrollbar-track {
    background: var(--bg-dark);
    border-radius: 4px;
}

.gif-grid::-webkit-scrollbar-thumb {
    background: var(--glass-border);
    border-radius: 4px;
}

.gif-grid::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

.gif-item {
    position: relative;
    width: 100%;
    height: var(--gif-size, 120px);
    overflow: hidden;
    border-radius: var(--radius-sm);
    cursor: pointer;
}

.gif-item img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #000;
}

.gif-item-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    opacity: 0;
    transition: opacity 0.2s;
}

.gif-item:hover .gif-item-overlay {
    opacity: 1;
}

.gif-action-btn {
    background: rgba(30, 30, 30, 0.8);
    border: none;
    color: white;
    padding: 6px;
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.2s, background 0.2s;
}

.gif-action-btn:hover {
    transform: scale(1.1);
    background: var(--accent);
}

.gif-action-btn.saved {
    color: #f91880;
}

.gif-powered {
    text-align: center;
    padding: 6px;
    font-size: 10px;
    color: var(--text-dim);
}

/* Emoji Picker */
.emoji-picker {
    position: absolute;
    bottom: 70px;
    right: 16px;
    width: 320px;
    max-height: 300px;
    background: var(--bg-medium);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    z-index: 100;
    overflow-y: auto;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
}

.emoji-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 2px;
    padding: 10px;
}

.emoji-grid button {
    border: none;
    background: transparent;
    font-size: 22px;
    padding: 6px;
    cursor: pointer;
    border-radius: var(--radius-xs);
    transition: var(--transition);
}

.emoji-grid button:hover {
    background: var(--bg-hover);
    transform: scale(1.2);
}

/* -- Icon State Utilities -- */
.control-btn .icon-off {
    display: none;
}

.control-btn.active .icon-on {
    display: none !important;
}

.control-btn.active .icon-off {
    display: block !important;
}

.control-btn.active {
    background: var(--red);
    color: white;
    box-shadow: 0 0 10px rgba(240, 71, 71, 0.4);
}

/* -- Side Panels (Search & Pins) -- */
.search-panel,
.pins-panel {
    position: absolute;
    top: 50px;
    right: 0;
    bottom: 0;
    width: 320px;
    background: var(--bg-dark);
    border-left: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    z-index: 40;
    box-shadow: -5px 0 30px rgba(0, 0, 0, 0.3);
    border-top-left-radius: 12px;
}

.search-header,
.pins-header {
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    background: var(--bg-medium);
    border-bottom: 1px solid var(--glass-border);
    font-size: 14px;
    font-weight: 600;
    color: var(--white);
    border-top-left-radius: 12px;
}

.icon-btn-small {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: none;
    background: var(--bg-light);
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: var(--transition);
}

.icon-btn-small:hover {
    background: var(--bg-hover);
    color: var(--text);
}

.search-results,
.pins-list {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}

.search-result-item,
.pin-item {
    padding: 12px 16px;
    border-bottom: 1px solid var(--glass-border);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.search-result-item:hover,
.pin-item:hover {
    background: var(--bg-hover);
}

.search-result-item .sr-content,
.pin-item .pin-content {
    font-size: 13px;
    color: var(--text);
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    line-clamp: 3;
}

.search-result-item .sr-meta,
.pin-item .pin-meta {
    font-size: 11px;
    color: var(--text-muted);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.pin-jump {
    align-self: flex-start;
    margin-top: 6px;
    font-size: 10px;
    padding: 2px 8px;
    background: var(--bg-light);
    border: none;
    border-radius: 10px;
    color: var(--accent);
    cursor: pointer;
}

.pin-jump:hover {
    background: var(--accent);
    color: white;
}

.search-input {
    width: 100%;
    background: var(--bg-dark);
    border: 1px solid var(--glass-border);
}

.no-results {
    padding: 20px;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
}

/* Call Panel */
.call-panel {
    position: absolute;
    top: 50px;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-darkest);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 50;
}

.call-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.call-header span {
    font-size: 16px;
    font-weight: 600;
    color: var(--white);
}

.call-timer {
    font-size: 14px;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

.call-participants {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
    justify-content: center;
}

.call-participant {
    padding: 6px 12px;
    background: var(--bg-light);
    border-radius: 20px;
    font-size: 13px;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 6px;
}

.call-participant .status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--green);
}

.call-videos {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    padding: 12px;
}

#localVideo {
    width: 240px;
    height: 180px;
    border-radius: var(--radius);
    background: var(--bg-medium);
    object-fit: cover;
}

/* Video Tile Container */
.video-tile {
    position: relative;
    width: 400px;
    /* Default larger size */
    height: 300px;
    background: var(--bg-medium);
    border-radius: var(--radius);
    overflow: hidden;
    resize: both;
    /* Allow user resizing */
    min-width: 200px;
    min-height: 150px;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--glass-border);
}

.video-tile video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: #000;
}

.video-tile-label {
    position: absolute;
    bottom: 8px;
    left: 8px;
    background: rgba(0, 0, 0, 0.6);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    color: white;
    z-index: 2;
}


.call-controls {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

.call-btn {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    background: var(--bg-lighter);
    font-size: 22px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.call-btn:hover {
    background: var(--bg-hover);
    transform: scale(1.1);
}

.call-btn.hangup {
    background: var(--red);
}

.call-btn.hangup:hover {
    filter: brightness(1.2);
}

.call-btn.active {
    background: var(--accent);
}

/* Members Panel */
.members-panel {
    position: absolute;
    top: 50px;
    right: 0;
    bottom: 0;
    width: 240px;
    background: var(--bg-dark);
    border-left: 1px solid var(--glass-border);
    overflow-y: auto;
    padding: 16px;
    z-index: 40;
}

.members-panel h4 {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

.member-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 8px;
    border-radius: var(--radius-xs);
    cursor: pointer;
    transition: var(--transition);
    margin-bottom: 2px;
}

.member-item:hover {
    background: var(--bg-hover);
}

.member-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg-lighter);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    color: var(--accent);
    position: relative;
    flex-shrink: 0;
}

.member-info {
    flex: 1;
    min-width: 0;
}

.member-name {
    font-size: 13px;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

.member-role {
    font-size: 10px;
    color: var(--text-dim);
}

/* Status dots */
.status-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.status-dot.online,
.status-badge.online {
    background: var(--green);
}

.status-dot.idle,
.status-badge.idle {
    background: var(--yellow);
}

.status-dot.dnd,
.status-badge.dnd {
    background: var(--red);
}

.status-dot.invisible,
.status-dot.offline,
.status-badge.invisible,
.status-badge.offline {
    background: var(--text-dim);
}

/* Settings Panel */
.settings-panel {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-dark);
    overflow-y: auto;
    padding: 24px 32px;
    z-index: 60;
}

.settings-panel h3 {
    font-size: 20px;
    font-weight: 700;
    color: var(--white);
    margin-bottom: 24px;
}

/* Card Grid */
.settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 540px;
    margin-bottom: 24px;
}

.settings-card-view {
    animation: settingsFadeIn 0.2s ease;
}

.settings-cards-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    max-width: 540px;
}

.settings-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 24px 16px;
    background: var(--bg-medium);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: var(--font);
    text-align: center;
    position: relative;
    overflow: hidden;
}

.settings-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--accent-gradient);
    opacity: 0;
    transition: opacity 0.3s ease;
    border-radius: inherit;
}

.settings-card:hover {
    transform: translateY(-3px);
    border-color: rgba(0, 212, 170, 0.3);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(0, 212, 170, 0.15);
}

.settings-card:hover::before {
    opacity: 0.06;
}

.settings-card:active {
    transform: translateY(-1px);
}

.settings-card-icon {
    font-size: 28px;
    position: relative;
    z-index: 1;
}

.settings-card-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--white);
    position: relative;
    z-index: 1;
}

.settings-card-desc {
    font-size: 11px;
    color: var(--text-muted);
    position: relative;
    z-index: 1;
}

/* Settings Pages (slide-in panels) */
.settings-page {
    animation: settingsSlideIn 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    max-width: 600px;
}

.settings-page.hiding {
    animation: settingsSlideOut 0.2s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.settings-page-content {
    background: var(--bg-medium);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 20px;
}

.settings-back-btn {
    background: none;
    border: 1px solid var(--glass-border);
    color: var(--text-muted);
    font-size: 13px;
    font-family: var(--font);
    cursor: pointer;
    padding: 6px 14px;
    border-radius: 20px;
    margin-bottom: 16px;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.settings-back-btn:hover {
    color: var(--white);
    border-color: var(--accent);
    background: rgba(0, 212, 170, 0.08);
}

@keyframes settingsFadeIn {
    from { opacity: 0; transform: scale(0.98); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes settingsSlideIn {
    from { opacity: 0; transform: translateX(30px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes settingsSlideOut {
    from { opacity: 1; transform: translateX(0); }
    to { opacity: 0; transform: translateX(-20px); }
}

/* Keep old section styles for compatibility */
.settings-sections {
    display: flex;
    flex-direction: column;
    gap: 20px;
    max-width: 600px;
}

.settings-section {
    background: var(--bg-medium);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 20px;
}

.settings-section h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--white);
    margin-bottom: 16px;
}


.setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.setting-row:last-child {
    margin-bottom: 0;
}

.setting-row label {
    font-size: 13px;
    color: var(--text);
    white-space: nowrap;
}

/* Stacked layout for audio tuning — label on top, slider full-width below */
.setting-row-stack {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 14px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 8px;
    transition: border-color 0.2s;
}

.setting-row-stack:hover {
    border-color: rgba(255, 255, 255, 0.08);
}

.setting-row-stack:last-child {
    margin-bottom: 0;
}

.setting-row-stack label {
    font-size: 13px;
    color: var(--text);
    white-space: normal;
    line-height: 1.4;
}

.setting-row-stack .setting-range {
    width: 100%;
}

.setting-input {
    max-width: 250px;
}

.setting-select {
    padding: 8px 12px;
    background: var(--bg-dark);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 13px;
    font-family: var(--font);
    outline: none;
    max-width: 250px;
    width: 100%;
}

.setting-select:focus {
    border-color: var(--accent);
}

.setting-range {
    width: 200px;
    accent-color: var(--accent);
}

/* Toggle switch */
.toggle {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 22px;
}

.toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: var(--bg-lighter);
    border-radius: 22px;
    transition: var(--transition);
}

.toggle-slider::before {
    content: '';
    position: absolute;
    left: 3px;
    top: 3px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--text);
    transition: var(--transition);
}

.toggle input:checked+.toggle-slider {
    background: var(--accent);
}

.toggle input:checked+.toggle-slider::before {
    transform: translateX(18px);
}

/* -- Modals -- */
.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 250;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.modal-backdrop .modal {
    position: relative;
    inset: auto;
    z-index: auto;
    background: var(--glass-strong);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 32px;
    animation: fadeIn 0.2s ease;
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}

.modal-backdrop .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.modal-backdrop .modal-header h2 {
    color: var(--white);
    font-size: 1.2rem;
    font-weight: 600;
}

.modal-backdrop .modal-body {
    color: var(--text);
}

.modal-backdrop .primary-btn {
    padding: 10px 20px;
    background: var(--accent-gradient);
    border: none;
    color: white;
    font-weight: 600;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    font-family: var(--font);
}

.modal-backdrop .primary-btn:hover {
    filter: brightness(1.15);
    transform: translateY(-1px);
}

.modal-backdrop .primary-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}

.modal-backdrop .secondary-btn {
    padding: 10px 20px;
    background: var(--bg-lighter);
    border: 1px solid var(--glass-border);
    color: var(--text);
    font-weight: 500;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    font-family: var(--font);
}

.modal-backdrop .secondary-btn:hover {
    background: var(--bg-hover);
}

.modal {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.modal-content {
    background: var(--glass-strong);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 32px;
    width: 420px;
    position: relative;
    animation: fadeIn 0.2s ease;
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}

.small-modal .modal-content {
    width: 320px;
}

.modal-content h3,
.modal-content h4 {
    color: var(--white);
    margin-bottom: 16px;
}

.modal-close {
    position: absolute;
    top: 12px;
    right: 16px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 18px;
    cursor: pointer;
    transition: var(--transition);
}

.modal-close:hover {
    color: var(--white);
}

.modal-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 16px;
    background: var(--bg-dark);
    border-radius: var(--radius-sm);
    padding: 3px;
}

.modal-tab {
    flex: 1;
    padding: 8px;
    border: none;
    background: none;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border-radius: 6px;
    transition: var(--transition);
    font-family: var(--font);
}

.modal-tab.active {
    background: var(--accent);
    color: white;
}

.modal-input {
    margin-bottom: 12px;
}

/* Status options */
.status-options {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 12px;
}

.status-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: none;
    background: transparent;
    color: var(--text);
    font-size: 14px;
    font-family: var(--font);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.status-option:hover {
    background: var(--bg-hover);
}

.status-option.active {
    background: var(--bg-lighter);
}

/* Context Menu */
.context-menu {
    position: fixed;
    z-index: 300;
    background: var(--bg-medium);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    padding: 4px;
    min-width: 180px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5);
}

.ctx-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 12px;
    border: none;
    background: transparent;
    color: var(--text);
    font-size: 13px;
    font-family: var(--font);
    cursor: pointer;
    border-radius: var(--radius-xs);
    transition: var(--transition);
}

.ctx-item:hover {
    background: var(--bg-hover);
}

.ctx-item[data-action="delete"]:hover {
    background: rgba(240, 71, 71, 0.15);
    color: var(--red);
}

/* Toast */
.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 500;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 12px 20px;
    background: var(--glass-strong);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 13px;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
    animation: slideIn 0.3s ease;
    max-width: 360px;
}

.toast.success {
    border-left: 3px solid var(--green);
}

.toast.error {
    border-left: 3px solid var(--red);
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(30px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* -- Themes -- */
body.theme-midnight {
    --bg-darkest: #0a0e1a;
    --bg-dark: #0e1426;
    --bg-medium: #131a30;
    --bg-light: #182040;
    --bg-lighter: #1e2850;
    --bg-hover: #243060;
    --accent: #4a80ff;
    --accent-hover: #6090ff;
    --accent-glow: rgba(74, 128, 255, 0.3);
}

body.theme-amoled {
    --bg-darkest: #000000;
    --bg-dark: #050505;
    --bg-medium: #0a0a0a;
    --bg-light: #111111;
    --bg-lighter: #1a1a1a;
    --bg-hover: #222222;
}

/* -- Server list scrollable -- */
.server-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: center;
}

/* -- Responsive -- */
@media (max-width: 768px) {
    .channel-sidebar {
        display: none;
    }

    .server-sidebar {
        width: 56px;
        min-width: 56px;
    }

    .server-icon {
        width: 40px;
        height: 40px;
    }

    .members-panel {
        width: 100%;
    }
}

/* -- Verification Gate (full-screen block) -- */
.verify-gate {
    position: fixed;
    inset: 0;
    z-index: 999;
    background: var(--bg-darkest);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.verify-gate-card {
    background: var(--bg-medium);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 48px 40px;
    max-width: 440px;
    width: 90%;
    text-align: center;
}

.verify-gate-icon {
    font-size: 56px;
    margin-bottom: 16px;
}

.verify-gate-card h2 {
    color: var(--white);
    font-size: 24px;
    margin-bottom: 8px;
}

.verify-gate-email {
    color: var(--accent);
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 12px;
}

.verify-gate-desc {
    color: var(--text-muted);
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 28px;
}

.verify-gate-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 16px;
}

.btn-secondary {
    padding: 12px 20px;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    background: var(--bg-light);
    color: var(--text);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
}

.btn-secondary:hover {
    background: var(--bg-hover);
    border-color: var(--accent);
}

.verify-gate-status {
    color: var(--text-muted);
    font-size: 13px;
    min-height: 20px;
    margin-bottom: 8px;
}

.verify-gate-status.success {
    color: var(--green);
}

.verify-gate-status.error {
    color: var(--red);
}

/* -- Forgot Password Link -- */
.btn-link {
    background: none;
    border: none;
    color: var(--accent);
    font-size: 13px;
    cursor: pointer;
    padding: 8px 0;
    text-align: center;
    display: block;
    width: 100%;
}

.btn-link:hover {
    color: var(--accent-hover);
    text-decoration: underline;
}

/* -- Email verification status in settings -- */
.verify-status {
    font-size: 13px;
    font-weight: 500;
    padding: 4px 10px;
    border-radius: var(--radius-xs);
}

.verify-status.verified {
    color: var(--green);
    background: rgba(67, 181, 129, 0.1);
}

.verify-status.unverified {
    color: var(--yellow);
    background: rgba(250, 166, 26, 0.1);
}

/* -- Enhanced Call Panel -- */
.call-panel {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-dark);
    display: flex;
    flex-direction: column;
    z-index: 30;
    animation: fadeIn 0.2s ease;
}

.call-panel.fullscreen {
    position: fixed;
    z-index: 9999;
}

.call-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    background: var(--bg-medium);
    border-bottom: 1px solid var(--glass-border);
    flex-shrink: 0;
}

.call-header span {
    font-weight: 600;
    font-size: 15px;
    color: var(--white);
}

.call-header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.call-timer {
    font-family: 'Courier New', monospace;
    font-size: 14px !important;
    color: var(--text-muted) !important;
    font-weight: 400 !important;
}

/* -- Call Participants List -- */
.call-participants {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 20px;
    background: var(--bg-medium);
    border-bottom: 1px solid var(--glass-border);
    flex-shrink: 0;
    min-height: 0;
}

.call-participant {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: var(--bg-light);
    border-radius: var(--radius-sm);
    font-size: 12px;
    color: var(--text);
    animation: fadeIn 0.3s ease;
}

.call-participant .status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--green);
    flex-shrink: 0;
}

.call-participant .status-dot.speaking {
    background: var(--green);
    animation: pulse-speak 0.6s ease-in-out infinite;
}

@keyframes pulse-speak {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(67, 181, 129, 0.5);
    }

    50% {
        box-shadow: 0 0 0 4px rgba(67, 181, 129, 0);
    }
}

.call-participant .participant-indicators {
    display: flex;
    gap: 3px;
    font-size: 10px;
    opacity: 0.7;
}

/* -- Video Grid -- */
.call-video-grid {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 8px;
    padding: 12px;
    overflow-y: auto;
    align-content: center;
}

.video-tile {
    position: relative;
    background: var(--bg-medium);
    border-radius: var(--radius);
    overflow: hidden;
    border: 2px solid var(--glass-border);
    aspect-ratio: 16 / 9;
    min-height: 160px;
    resize: both;
    transition: border-color 0.2s ease;
}

.video-tile:hover {
    border-color: var(--accent);
}

.video-tile.speaking {
    border-color: var(--green);
    box-shadow: 0 0 12px rgba(67, 181, 129, 0.25);
}

.video-tile video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.scroll-loader {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px;
    color: var(--text-muted);
    font-size: 13px;
}

.spinner-sm {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* -- Tooltips -- */
.server-tooltip {
    position: fixed;
    background: var(--glass-strong);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    padding: 12px;
    border-radius: var(--radius-sm);
    color: var(--white);
    font-size: 13px;
    z-index: 10000;
    pointer-events: none;
    /* Critical: prevent cursor overlap from triggering leave/enter loops */
    opacity: 0;
    transform: translateX(10px);
    transition: opacity 0.2s, transform 0.2s;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    white-space: nowrap;
}

.server-tooltip.visible {
    opacity: 1;
    transform: translateX(0);
}

.tooltip-title {
    font-weight: 700;
    margin-bottom: 8px;
    font-size: 14px;
}

.tooltip-voice {
    display: flex;
    flex-direction: column;
    gap: 8px;
    border-top: 1px solid var(--glass-border);
    padding-top: 8px;
}

.voice-count-badge {
    color: var(--accent);
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
}

.tooltip-avatars {
    display: flex;
    gap: -8px;
    /* overlapped avatars */
}

.tooltip-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--bg-lighter);
    border: 2px solid var(--bg-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
    margin-left: -8px;
}

.tooltip-avatar:first-child {
    margin-left: 0;
}

.video-tile-label {
    position: absolute;
    bottom: 8px;
    left: 8px;
    padding: 3px 10px;
    background: rgba(0, 0, 0, 0.65);
    color: white;
    font-size: 12px;
    font-weight: 500;
    border-radius: var(--radius-xs);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.video-tile-indicators {
    position: absolute;
    bottom: 8px;
    right: 8px;
    display: flex;
    gap: 4px;
}

.mic-indicator,
.cam-indicator,
.screen-indicator {
    font-size: 14px;
    padding: 2px 5px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: var(--radius-xs);
}

.mic-indicator.muted {
    opacity: 0.4;
}

.self-tile {
    border-color: var(--accent);
    border-style: solid;
}

.remote-video-tiles {
    display: contents;
}

/* -- Call Controls -- */
.call-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 14px 20px;
    background: var(--bg-medium);
    border-top: 1px solid var(--glass-border);
    flex-shrink: 0;
}

.call-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: none;
    font-size: 20px;
    cursor: pointer;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-lighter);
    color: var(--text);
}

.call-btn:hover {
    background: var(--bg-hover);
    transform: scale(1.05);
}

.call-btn.active {
    background: var(--accent);
    color: white;
}

.call-btn.hangup {
    background: var(--red);
    color: white;
}

.call-btn.hangup:hover {
    background: #d43b3b;
    transform: scale(1.08);
}

/* -- Voice Channel Participants (inline in sidebar) -- */
.voice-participants {
    padding-left: 36px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.voice-user {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 3px 8px;
    font-size: 12px;
    color: var(--text-muted);
    border-radius: var(--radius-xs);
}

.voice-user-avatar {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--bg-lighter);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    font-weight: 600;
    color: var(--text);
    flex-shrink: 0;
}

.voice-user-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.voice-user-indicators {
    display: flex;
    gap: 2px;
    font-size: 10px;
    opacity: 0.6;
}

/* -- Fade animation -- */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* ── Home Tabs ─────────────────────────────────────────────────── */
.home-tabs {
    display: flex;
    padding: 0 8px;
    gap: 4px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 4px;
}

.home-tab {
    flex: 1;
    padding: 10px 0;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.home-tab:hover {
    color: var(--text);
    background: var(--bg-hover);
}

.home-tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

/* ── Friends List ──────────────────────────────────────────────── */
.friends-list {
    flex: 1;
    overflow-y: auto;
    padding: 4px 0;
    min-height: 0;
}

.friend-item {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    gap: 10px;
    cursor: pointer;
    border-radius: 6px;
    margin: 1px 8px;
    transition: background 0.15s;
}

.friend-item:hover {
    background: var(--bg-hover);
}

.friend-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.friend-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.friend-status-text {
    font-size: 12px;
    color: var(--text-muted);
}

.friend-msg-btn {
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 6px 10px;
    cursor: pointer;
    font-size: 14px;
    opacity: 0;
    transition: all 0.15s;
}

.friend-item:hover .friend-msg-btn {
    opacity: 1;
}

.friend-msg-btn:hover {
    background: var(--accent);
    border-color: var(--accent);
}

/* ── Enhanced DM List ──────────────────────────────────────────── */
.dm-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.dm-name-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.dm-time {
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
    flex-shrink: 0;
}

.dm-preview {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.dm-preview.dm-empty {
    font-style: italic;
    opacity: 0.5;
}

/* ── YouTube Embeds ────────────────────────────────────────────── */
.yt-embed {
    margin: 8px 0 4px;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    width: 100%;
    min-width: 300px;
    max-width: 480px;
    /* Natural embed size */
    aspect-ratio: 16 / 9;
    background: #000;
}

.yt-embed iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 8px;
}

/* ── Message Links ─────────────────────────────────────────────── */
.msg-link {
    color: var(--accent);
    text-decoration: none;
    word-break: break-all;
}

.msg-link:hover {
    text-decoration: underline;
}

/* ── Server & Channel Hovers ───────────────────────────────────── */
.server-icon {
    transition: all 0.2s ease;
}

.server-icon:hover {
    border-radius: 16px;
    background: var(--accent);
    color: white;
}

.server-icon.active {
    border-radius: 16px;
    background: var(--accent);
    color: white;
}

.channel-item {
    transition: background 0.15s;
}

.channel-item:hover {
    background: var(--bg-hover);
    color: var(--text);
}

/* ── User Bar Dock (Global Controls) ───────────────────────────── */
.sidebar-header {
    height: 60px;
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    /* Space between title and buttons */
    padding: 0 16px;
    flex-shrink: 0;
}

/* Voice Controls Bar — separate row above profile */
.voice-controls-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 10px;
    background: rgba(67, 181, 129, 0.08);
    border-top: 1px solid rgba(67, 181, 129, 0.2);
    flex-shrink: 0;
}

.voice-controls-info {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.voice-controls-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #43b581;
    flex-shrink: 0;
    animation: pulse-speak 1.5s ease-out infinite;
}

.voice-controls-label {
    font-size: 12px;
    font-weight: 600;
    color: #43b581;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.voice-controls-btns {
    display: flex;
    gap: 4px;
}

.vc-btn {
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
}

.vc-btn:hover {
    background: rgba(124, 92, 252, 0.2);
    color: var(--text);
    transform: scale(1.05);
}

.vc-btn.streaming {
    color: #43b581;
    background: rgba(67, 181, 129, 0.2);
    border-color: rgba(67, 181, 129, 0.3);
}

.vc-btn-danger {
    color: #ff4d4d;
}

.vc-btn-danger:hover {
    background: rgba(255, 50, 50, 0.2);
    color: #ff6b6b;
}

.user-bar {
    background: var(--bg-darker);
    display: flex;
    flex-direction: column;
    padding: 6px 8px 8px;
    flex-shrink: 0;
    border-top: 1px solid var(--bg-darkest);
    gap: 4px;
}

.user-bar-info {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    flex: 1;
    padding: 4px;
    border-radius: 4px;
    overflow: hidden;
}

.user-bar-info:hover {
    background: var(--bg-hover);
    cursor: pointer;
}

.user-avatar-small {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-size: cover;
    background-position: center;
    background-color: var(--bg-light);
    flex-shrink: 0;
}

.user-info-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.user-bar-name {
    font-weight: 600;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-bar-status {
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-bar-controls {
    display: flex;
    align-items: center;
}

.control-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--text-muted);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s;
    position: relative;
    z-index: 101;
}

.control-btn-lg {
    width: 40px;
    height: 40px;
}

.control-btn:hover {
    background: var(--bg-hover);
    color: var(--text);
    transform: scale(1.05);
}

.control-btn.active,
.call-btn.active {
    background: var(--white);
    color: var(--bg-darkest);
}

/* Logout button at top of user bar */
.logout-bar-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 8px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 12px;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.15s;
    width: 100%;
}

.logout-bar-btn:hover {
    background: rgba(255, 50, 50, 0.1);
    color: #ff4d4d;
}

.logout-bar-btn span {
    font-weight: 500;
}

.control-btn.red-strike {
    background: var(--bg-light);
    color: var(--red);
    position: relative;
}

.control-btn.red-strike svg {
    opacity: 0.8;
}

.control-btn.red-strike::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 120%;
    height: 2px;
    background: var(--red);
    transform: translate(-50%, -50%) rotate(-45deg);
    border-radius: 2px;
    pointer-events: none;
}

.control-btn.active {
    color: var(--status-dnd);
}

/* For muted/deafened state */

/* ── Drag & Drop ───────────────────────────────────────────────── */
.channel-item.dragging {
    opacity: 0.5;
    background: var(--bg-active);
}

.channel-item.drag-over-top {
    border-top: 2px solid var(--accent);
}

.channel-item.drag-over-bottom {
    border-bottom: 2px solid var(--accent);
}

/* ── Fixes ─────────────────────────────────────────────────────── */
.sidebar,
.user-bar {
    width: 280px !important;
}

.friends-list,
.dm-list {
    width: 280px !important;
}

/* --- GUI Refinements --- */

/* 1. Own Messages */
.message.own {
    flex-direction: row;
    text-align: left;
    background: transparent !important;
    margin-right: auto;
    margin-left: 0;
    max-width: 80%;
}

.message.own:hover {
    background: transparent !important;
}

.message.own .msg-header {
    flex-direction: row;
    justify-content: flex-start;
}

.message.own .msg-actions {
    right: 8px;
    left: auto;
    flex-direction: row;
}

.message.own .msg-content {
    background: linear-gradient(135deg, var(--accent), #6a4ce0);
    color: white;
    padding: 8px 12px;
    border-radius: 14px 14px 14px 4px;
    display: inline-block;
    box-shadow: 0 2px 8px rgba(124, 92, 252, 0.2);
    text-align: left;
}

.message:not(.own) .msg-content {
    background: var(--bg-light);
    color: var(--text);
    padding: 10px 14px;
    border-radius: 18px 18px 18px 4px;
    display: inline-block;
    text-align: left;
}

.message.own .msg-avatar {
    margin-left: 0;
    margin-right: 8px;
}

/* 2. Pinned Messages */
.message.pinned {
    border-right: 3px solid var(--yellow);
    background: rgba(250, 166, 26, 0.05);
}

/* 3. Audio Icons & Volume */
.btn-control.active {
    background: var(--red) !important;
    color: white !important;
    animation: none;
    /* No pulse, just static red */
}

.volume-slider {
    width: 80px;
}

/* Expose native video volume slider */
video::-webkit-media-controls-volume-panel,
audio::-webkit-media-controls-volume-panel,
video::-webkit-media-controls-volume-slider,
audio::-webkit-media-controls-volume-slider {
    display: flex !important;
    opacity: 1 !important;
    visibility: visible !important;
}

.resizable-media {
    display: inline-flex;
    overflow: hidden;
    max-width: 100%;
    border-radius: 8px;
    position: relative;
    box-sizing: border-box;
    resize: both; /* Native browser resizing (3 directional lines) */
}

/* Optional aesthetic handle layered over native CSS resizer, hidden on touch devices */
@media (pointer: fine) {
    .resizable-media::after {
        content: '';
        position: absolute;
        bottom: 0;
        right: 0;
        width: 30px;
        height: 30px;
        pointer-events: none; /* Crucial: lets the native OS grab the resize handle below it */
        z-index: 50;
        background: radial-gradient(circle at 100% 100%, rgba(255, 43, 94, 0.45) 0%, transparent 70%);
        border-bottom-right-radius: 8px;
        opacity: 0;
        transition: opacity 0.2s ease;
    }

    .resizable-media:hover::after {
        opacity: 1;
    }
}

.resizable-media.yt-embed {
    width: 640px;
    height: 360px;
    min-width: 200px;
    min-height: 112px;
}

.resizable-media.media-default {
    width: 400px;
    height: 300px;
    min-width: 150px;
    min-height: 100px;
}

/* Children fill width, height is driven by parent's aspect-ratio */
.resizable-media video,
.resizable-media iframe {
    width: 100%;
    height: 100%;
    border-radius: 8px;
    display: block;
    object-fit: contain;
    pointer-events: auto;
}

/* Images are special: they have intrinsic aspect ratios, so we let them dictate height */
.resizable-media img {
    width: 100%;
    height: auto;
    border-radius: 8px;
    display: block;
    object-fit: contain;
    pointer-events: auto;
}

/* When an image is inside resizable-media, the container should use the image's natural aspect ratio */
.lp-image-wrap.resizable-media {
    aspect-ratio: unset;
}

/* pure-media-wrap: no graph layer, just the raw media */
.pure-media-wrap {
    margin-top: 6px;
    max-width: 100%;
}

/* ── Link Preview Cards (OpenGraph) ────────────────────────────── */
.link-preview-card {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 8px;
    padding: 12px;
    background: rgba(0, 0, 0, 0.2);
    border-left: 4px solid #5865f2;
    border-radius: 4px;
    width: max-content;
    min-width: 300px;
    max-width: 100%;
    transition: background 0.15s;
    cursor: pointer;
}

.link-preview-card:hover {
    background: rgba(0, 0, 0, 0.35);
}

.lp-site {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
}

.lp-favicon {
    width: 16px;
    height: 16px;
    border-radius: 2px;
    flex-shrink: 0;
}

.lp-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--accent);
    line-height: 1.3;
}

.lp-title:hover {
    text-decoration: underline;
}

.lp-desc {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.lp-image-wrap {
    margin-top: 4px;
    width: 100% !important;
    height: auto !important;
    min-height: unset !important;
}

.lp-image-wrap .lp-image {
    width: 100%;
    height: auto !important;
    max-height: 400px;
    object-fit: cover;
    border-radius: 4px;
    cursor: pointer;
}

/* Override resizable-media defaults for preview images */
.link-preview-card .lp-image-wrap.resizable-media.media-default {
    width: 100%;
    aspect-ratio: unset;
}

/* Give preview videos a standard 16:9 aspect ratio */
.link-preview-card .lp-video-wrap.resizable-media.media-default {
    width: 640px;
    aspect-ratio: 16 / 9;
    margin-top: 4px;
}

/* Pure media site videos: same defaults */
.pure-media-wrap .lp-video-wrap.resizable-media.media-default {
    width: 640px;
    aspect-ratio: 16 / 9;
}

.resizable-media.is-dragging iframe {
    pointer-events: none !important;
}
.resizable-drag-overlay {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 30px;
    height: 30px;
    cursor: nwse-resize;
    z-index: 50;
    /* Invisible but intercepts clicks! */
}

/* ───────────────────────────────────────────────────────── */
/* Phase 5 Features: Context Menu, Replies, Read States      */
/* ───────────────────────────────────────────────────────── */

/* Custom Webkit native scrollbars for Chat */
.custom-webkit-scrollbar::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
.custom-webkit-scrollbar::-webkit-scrollbar-track {
    background: transparent;
}
.custom-webkit-scrollbar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}
.custom-webkit-scrollbar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Context Menu */
.context-menu {
    position: absolute;
    background: var(--bg-dark);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    padding: 8px 0;
    min-width: 180px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    z-index: 10000;
}

.context-menu .menu-item {
    padding: 8px 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    color: var(--text);
    font-size: 14px;
    transition: background 0.2s;
}

.context-menu .menu-item:hover {
    background: rgba(124, 92, 252, 0.2);
}

/* Reply Banner (Above Input) */
.reply-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(124, 92, 252, 0.1);
    border-left: 4px solid var(--accent);
    padding: 8px 12px;
    margin-bottom: 8px;
    border-radius: 4px;
    font-size: 13px;
    color: var(--text-muted);
}

.reply-banner-content {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* In-message Reply Snippet */
.msg-reply {
    font-size: 12px;
    color: var(--text-muted);
    background: rgba(0, 0, 0, 0.2);
    padding: 4px 8px;
    border-radius: 4px;
    border-left: 2px solid var(--glass-border);
    margin-bottom: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: background 0.2s;
}

.msg-reply:hover {
    background: rgba(255, 255, 255, 0.05);
}

/* Unread Message Divider */
.unread-divider {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 16px 0;
    position: relative;
    color: #ff4757;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.unread-divider::before,
.unread-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: #ff4757;
    margin: 0 12px;
    opacity: 0.5;
}

.volume-slider {
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--bg-lighter);
    border-radius: 2px;
    outline: none;
    cursor: pointer;
    margin-left: auto;
}

.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--text-muted);
    cursor: pointer;
    transition: background 0.2s;
}

.volume-slider::-webkit-slider-thumb:hover {
    background: var(--white);
}

.call-participant {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-radius: 6px;
    margin-bottom: 4px;
    background: rgba(255, 255, 255, 0.03);
}

.call-participant:hover {
    background: var(--bg-hover);
}

.participant-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
}

/* --- Context Menu --- */
.context-menu {
    position: fixed;
    z-index: 10000;
    min-width: 180px;
    background: rgba(22, 22, 30, 0.95);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(12px);
    padding: 6px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.ctx-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text);
    transition: background 0.1s;
}

.ctx-item:hover {
    background: var(--accent);
    color: white;
}

.ctx-item.danger:hover {
    background: var(--red);
}

.ctx-separator {
    height: 1px;
    background: var(--glass-border);
    margin: 4px 0;
}

.ctx-icon {
    width: 16px;
    text-align: center;
    font-size: 14px;
}

/* --- Pins Panel --- */
.pins-panel {
    position: absolute;
    top: 50px;
    /* Header height */
    right: 0;
    bottom: 0;
    width: 300px;
    background: var(--bg-dark);
    border-left: 1px solid var(--glass-border);
    z-index: 100;
    display: flex;
    flex-direction: column;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.3);
}

.pins-header {
    padding: 16px;
    font-weight: 700;
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-medium);
}

.pins-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

.pin-item {
    background: var(--bg-light);
    border-radius: 6px;
    padding: 10px;
    margin-bottom: 8px;
    border: 1px solid var(--glass-border);
}

.pin-meta {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.pin-content {
    font-size: 13px;
    color: var(--text);
    margin-bottom: 8px;
}

.pin-jump {
    font-size: 11px;
    background: var(--bg-dark);
    border: 1px solid var(--glass-border);
    color: var(--text-muted);
    padding: 2px 8px;
    border-radius: 4px;
    cursor: pointer;
}

.pin-jump:hover {
    background: var(--accent);
    color: white;
}

/* --- Search Results --- */
.search-result-item {
    padding: 10px;
    border-bottom: 1px solid var(--glass-border);
    cursor: pointer;
}

.search-result-item:hover {
    background: var(--bg-hover);
}

.sr-meta {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 2px;
}

.sr-user {
    font-weight: 700;
    color: var(--accent);
    margin-right: 6px;
}

.sr-content {
    font-size: 13px;
    color: var(--text);
}

.message.highlight {
    animation: highlightMsg 2s;
}

@keyframes highlightMsg {
    0% {
        background: var(--accent);
    }

    100% {
        background: transparent;
    }
}

.btn-small {
    background: var(--accent);
    color: white;
    border: none;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    font-weight: 600;
    margin-left: auto;
}

.btn-small:hover {
    background: var(--accent-hover);
}

/* Control button active state (muted/deafened) */
.control-btn.active {
    color: var(--red);
}

/* Server Tooltip */
.server-tooltip {
    pointer-events: none;
    position: fixed;
    background: var(--bg-dark);
    border: 1px solid var(--glass-border);
    padding: 12px;
    border-radius: var(--radius-sm);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s;
    z-index: 10000;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    min-width: 150px;
}

.server-tooltip.visible {
    opacity: 1;
}

.server-tooltip::before {
    content: '';
    position: absolute;
    left: -6px;
    top: 50%;
    transform: translateY(-50%);
    border-top: 6px solid transparent;
    border-bottom: 6px solid transparent;
    border-right: 6px solid var(--bg-dark);
}

.tooltip-title {
    font-weight: 700;
    margin-bottom: 6px;
    color: var(--white);
    font-size: 14px;
}

.tooltip-voice {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.voice-count-badge {
    font-size: 12px;
    color: var(--green);
    font-weight: 600;
}

.tooltip-avatars {
    display: flex;
}

.tooltip-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--bg-lighter);
    border: 2px solid var(--bg-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    color: var(--text);
    margin-right: -6px;
    font-weight: 600;
}

/* Own messages: left-aligned with slight indent, subtle highlight */
.message.own {
    margin-left: 40px;
    background: rgba(88, 101, 242, 0.06);
    border-left: 2px solid var(--accent);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

/* Voice user hover */
.voice-user:hover {
    background: var(--bg-hover);
    border-radius: var(--radius-sm);
}

/* ── User Profile Popup (Glassmorphism) ── */
.user-profile-popup {
    position: fixed;
    z-index: 10000;
    background: rgba(30, 30, 40, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
    min-width: 250px;
    max-width: 280px;
    overflow: hidden;
    opacity: 0;
    transform: scale(0.95) translateY(-4px);
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.user-profile-popup.visible {
    opacity: 1;
    transform: scale(1) translateY(0);
    pointer-events: auto;
}

/* Banner area */
.profile-popup-banner {
    position: relative;
    height: 60px;
    background: linear-gradient(135deg, rgba(124, 92, 252, 0.4), rgba(99, 60, 200, 0.3));
    background-size: cover;
    background-position: center;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    margin: 0;
    border-radius: 0;
}

/* Avatar overlapping banner */
.profile-popup-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, #5865f2, #7c5cfc);
    border: 3px solid rgba(30, 30, 40, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
    color: #fff;
    position: relative;
    bottom: -22px;
    overflow: hidden;
}

.profile-popup-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Status dot on avatar */
.profile-popup-status-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 3px solid rgba(30, 30, 40, 0.85);
    position: absolute;
    bottom: -20px;
    left: calc(50% + 12px);
}

/* Info section */
.profile-popup-info {
    padding: 28px 16px 8px;
    text-align: center;
}

.profile-popup-section {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    padding: 12px;
    margin: 0 16px;
}

.profile-popup-section-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 6px;
    letter-spacing: 0.5px;
}

.profile-popup-name {
    font-size: 18px;
    font-weight: 700;
    color: var(--white);
}

.profile-popup-username {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.profile-popup-bio {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.5;
    margin-top: 4px;
}

.profile-popup-status-text {
    font-size: 12px;
    color: var(--text-muted);
    font-style: italic;
    margin-bottom: 6px;
}

/* Quick Actions grid — shown first */
.profile-popup-actions {
    display: flex;
    gap: 8px;
    padding: 8px 16px;
    order: -1;
}

.profile-action-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 10px 6px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 10px;
    color: var(--text);
    cursor: pointer;
    transition: all 0.15s;
    font-size: 10px;
    font-weight: 500;
}

.profile-action-btn:hover {
    background: rgba(124, 92, 252, 0.2);
    border-color: rgba(124, 92, 252, 0.3);
    transform: scale(1.05);
}

.profile-action-btn:active {
    transform: scale(0.97);
}

.profile-action-icon {
    font-size: 20px;
}

/* Search within popup */
.profile-popup-search {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0 16px 12px;
    padding: 8px 10px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 8px;
}

.profile-popup-search input {
    flex: 1;
    background: none;
    border: none;
    color: var(--text);
    font-size: 12px;
    outline: none;
}

.profile-popup-search input::placeholder {
    color: var(--text-muted);
}

.profile-popup-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    padding-top: 10px;
    justify-content: center;
}

.profile-popup-badge {
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 10px;
    color: #fff;
    font-weight: 600;
    text-transform: uppercase;
}

.profile-popup-joined {
    font-size: 11px;
    color: var(--text-muted);
}

/* ── Speaking Indicator ────────────────────────────── */
@keyframes pulse-speak {
    0% {
        box-shadow: 0 0 0 0 rgba(67, 181, 129, 0.6);
    }

    70% {
        box-shadow: 0 0 0 5px rgba(67, 181, 129, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(67, 181, 129, 0);
    }
}

/* Voice user avatar ring when speaking */
.voice-user-avatar.speaking {
    outline: 2px solid #43b581;
    outline-offset: 1px;
    animation: pulse-speak 1.2s ease-out infinite;
    border-radius: 50%;
}

/* Voice user row glow when speaking */
.voice-user.speaking {
    background: rgba(67, 181, 129, 0.1);
    border-radius: var(--radius-sm);
}

.voice-user.speaking .voice-user-name {
    color: #43b581;
}

/* User bar avatar speaking */
.user-avatar-small.speaking {
    outline: 2px solid #43b581;
    outline-offset: 1px;
    animation: pulse-speak 1.2s ease-out infinite;
}

/* Video tile speaking border */
.video-tile.speaking,
#localVideo.speaking {
    outline: 2px solid #43b581;
    outline-offset: -2px;
}

/* ── Call User Strip (top, horizontal scroll) ───── */
.call-user-strip {
    display: flex;
    gap: 12px;
    padding: 10px 14px;
    overflow-x: auto;
    overflow-y: hidden;
    flex-shrink: 0;
    border-bottom: 1px solid var(--glass-border);
    scrollbar-width: thin;
}

.call-user-strip::-webkit-scrollbar {
    height: 3px;
}

.call-user-strip::-webkit-scrollbar-thumb {
    background: rgba(124, 92, 252, 0.3);
    border-radius: 3px;
}

.call-user-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
    cursor: pointer;
    position: relative;
}

.call-user-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #5865f2, #7c5cfc);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 700;
    color: #fff;
    border: 2px solid transparent;
    transition: border-color 0.3s, box-shadow 0.3s;
    user-select: none;
    overflow: hidden;
}

.call-user-avatar.speaking {
    border-color: #43b581;
    box-shadow: 0 0 12px rgba(67, 181, 129, 0.4);
}

.call-user-avatar.streaming {
    border-color: #7c5cfc;
    box-shadow: 0 0 12px rgba(124, 92, 252, 0.5);
    border-radius: 8px;
}

/* When streaming: show thumbnail preview */
.call-user-card.is-streaming .call-user-avatar {
    width: 72px;
    height: 48px;
    border-radius: 6px;
    font-size: 0;
    border-color: #7c5cfc;
}

.call-user-card.is-streaming .call-user-avatar video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 4px;
}

.call-user-mini-pic {
    display: none;
    position: absolute;
    bottom: 14px;
    right: -2px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: linear-gradient(135deg, #5865f2, #7c5cfc);
    border: 2px solid var(--bg-dark);
    font-size: 8px;
    font-weight: 700;
    color: #fff;
    align-items: center;
    justify-content: center;
}

.call-user-card.is-streaming .call-user-mini-pic {
    display: flex;
}

.call-user-name {
    font-size: 10px;
    color: var(--text-muted);
    font-weight: 500;
    text-align: center;
    max-width: 72px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.call-user-card.self .call-user-name {
    color: var(--text);
}

/* ── Stream Viewer (shown when video active) ───── */
.stream-viewer {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 8px;
    min-height: 0;
}

.stream-main {
    flex: 1;
    position: relative;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    min-height: 200px;
}

.stream-main video,
.stream-main canvas {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.stream-label {
    position: absolute;
    bottom: 8px;
    left: 8px;
    padding: 4px 10px;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(6px);
    border-radius: 4px;
    font-size: 12px;
    color: #fff;
    font-weight: 500;
    z-index: 2;
}

/* Stream Controls Overlay — appears on hover */
.stream-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.85));
    opacity: 0;
    transform: translateY(6px);
    transition: opacity 0.25s ease, transform 0.25s ease;
    pointer-events: none;
}

.stream-main:hover .stream-controls,
.stream-controls:hover {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

/* Also hide the stream-label when controls are visible to avoid overlap */
.stream-main:hover .stream-label {
    opacity: 0;
}

/* Stream Bar — auto-hide, show on hover */
.stream-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 10px;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(8px);
    border-radius: 0 0 8px 8px;
    gap: 8px;
    min-height: 36px;
    opacity: 0;
    transform: translateY(4px);
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
}

/* Show bar when hovering anywhere on the stream viewer */
.stream-viewer:hover .stream-bar,
.stream-bar:hover {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.stream-bar-left,
.stream-bar-right {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Stream Picker Tabs — shown when multiple streams active */
.stream-picker {
    display: flex;
    gap: 4px;
    padding: 4px 8px;
    background: rgba(0, 0, 0, 0.35);
    border-radius: 8px 8px 0 0;
    overflow-x: auto;
}

.stream-picker-tab {
    padding: 5px 14px;
    border-radius: 5px;
    border: none;
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.7);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s, color 0.2s;
}

.stream-picker-tab:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
}

.stream-picker-tab.active {
    background: var(--accent, #4a7cf7);
    color: #fff;
}

/* Quality dropdown */
.stream-quality-wrap {
    position: relative;
}

.stream-quality-menu {
    position: absolute;
    bottom: calc(100% + 8px);
    right: 0;
    min-width: 140px;
    padding: 4px;
    background: #1a1a1a;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.5);
    z-index: 200;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sqm-item {
    padding: 7px 12px;
    border: none;
    background: transparent;
    color: rgba(255,255,255,0.75);
    font-size: 12px;
    text-align: left;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.sqm-item:hover {
    background: rgba(255,255,255,0.1);
    color: #fff;
}

.sqm-item.active {
    background: var(--accent, #4a7cf7);
    color: #fff;
}

.sqm-divider {
    height: 1px;
    background: rgba(255,255,255,0.12);
    margin: 4px 0;
}

.sqm-section-label {
    padding: 4px 12px 2px;
    font-size: 10px;
    font-weight: 600;
    color: rgba(255,255,255,0.4);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sqm-codec {
    padding: 7px 12px;
    border: none;
    background: transparent;
    color: rgba(255,255,255,0.75);
    font-size: 12px;
    text-align: left;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.sqm-codec:hover {
    background: rgba(255,255,255,0.1);
    color: #fff;
}

.sqm-codec.active {
    background: #2d8a4e;
    color: #fff;
}

/* Toast notifications */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 13px;
    color: #fff;
    z-index: 99999;
    animation: toastIn 0.3s ease, toastOut 0.3s ease 3.5s forwards;
    pointer-events: none;
}

.toast-error {
    background: rgba(220, 50, 50, 0.92);
}

@keyframes toastIn {
    from { opacity: 0; transform: translateX(-50%) translateY(20px); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

@keyframes toastOut {
    from { opacity: 1; }
    to   { opacity: 0; }
}

/* Bitrate slider */
.stream-bitrate-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 8px;
    background: rgba(0,0,0,0.4);
    border-radius: 6px;
}

.bitrate-label {
    font-size: 11px;
    color: rgba(255,255,255,0.7);
    white-space: nowrap;
    min-width: 90px;
}

.bitrate-label span {
    color: #fff;
    font-weight: 600;
}

.bitrate-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 120px;
    height: 4px;
    background: rgba(255,255,255,0.15);
    border-radius: 2px;
    outline: none;
    cursor: pointer;
}

.bitrate-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--accent, #4a7cf7);
    border: 2px solid rgba(255,255,255,0.3);
    cursor: pointer;
    transition: transform 0.1s;
}

.bitrate-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.bitrate-slider::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--accent, #4a7cf7);
    border: 2px solid rgba(255,255,255,0.3);
    cursor: pointer;
}

.stream-controls-left,
.stream-controls-center,
.stream-controls-right {
    display: flex;
    align-items: center;
    gap: 6px;
}

.stream-controls-label {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
    white-space: nowrap;
}

.stream-ctrl-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    border: none;
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.75);
    cursor: pointer;
    transition: background 0.2s, color 0.2s, transform 0.15s;
}

.stream-ctrl-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    transform: scale(1.06);
}

.stream-ctrl-btn:active {
    transform: scale(0.94);
}

.stream-ctrl-btn.active {
    background: var(--accent, #4a7cf7);
    color: #fff;
}

.stream-ctrl-btn svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

/* Volume slider group */
.stream-vol-group {
    display: flex;
    align-items: center;
    gap: 6px;
}

.stream-vol-icon {
    color: rgba(255, 255, 255, 0.65);
    flex-shrink: 0;
}

.stream-vol-slider {
    width: 90px;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: rgba(255, 255, 255, 0.18);
    border-radius: 2px;
    outline: none;
    cursor: pointer;
}

.stream-vol-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 13px;
    height: 13px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid var(--accent, #4a7cf7);
    cursor: pointer;
    transition: transform 0.15s;
}

.stream-vol-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.stream-vol-slider::-moz-range-thumb {
    width: 13px;
    height: 13px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid var(--accent, #4a7cf7);
    cursor: pointer;
}

/* ═══════════════════════════════════════
   Call Controls — polished SVG icon buttons
   ═══════════════════════════════════════ */
.call-ctrl-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    transition: background 0.2s, color 0.2s, transform 0.15s, box-shadow 0.2s;
    position: relative;
}

.call-ctrl-btn:hover {
    background: rgba(255, 255, 255, 0.16);
    color: #fff;
    transform: scale(1.08);
}

.call-ctrl-btn:active {
    transform: scale(0.93);
}

.call-ctrl-btn.active {
    background: var(--accent, #4a7cf7);
    color: #fff;
    box-shadow: 0 0 12px rgba(74, 124, 247, 0.4);
}

.call-ctrl-btn.muted {
    background: rgba(255, 60, 60, 0.2);
    color: #ff5555;
}

.call-ctrl-btn.muted:hover {
    background: rgba(255, 60, 60, 0.35);
}

.call-ctrl-btn svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

/* Hangup button — red */
.call-ctrl-hangup {
    background: #e74c3c !important;
    color: #fff !important;
}

.call-ctrl-hangup:hover {
    background: #ff3b2e !important;
    box-shadow: 0 0 14px rgba(231, 76, 60, 0.5);
}

/* ═══════════════════════════════════════
   Instant Custom Tooltips via data-tip
   ═══════════════════════════════════════ */
[data-tip] {
    position: relative;
}

[data-tip]::after {
    content: attr(data-tip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%) scale(0.85);
    padding: 5px 10px;
    background: #111;
    color: #eee;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    border-radius: 5px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.12s ease, transform 0.12s ease;
    z-index: 9999;
    box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}

[data-tip]:hover::after {
    opacity: 1;
    transform: translateX(-50%) scale(1);
}

/* ═══════════════════════════════════════
   Hover Volume Slider Wrappers
   ═══════════════════════════════════════ */
.call-slider-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.call-hover-slider {
    position: absolute;
    bottom: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%);
    writing-mode: vertical-lr;
    direction: rtl;
    width: 6px;
    height: 90px;
    -webkit-appearance: slider-vertical;
    appearance: slider-vertical;
    background: rgba(30, 30, 30, 0.95);
    border-radius: 6px;
    outline: none;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    cursor: pointer;
    padding: 8px 0;
    z-index: 100;
}

.call-slider-wrap:hover .call-hover-slider {
    opacity: 1;
    pointer-events: auto;
}

/* Slider track/thumb for vertical slider (Chromium) */
.call-hover-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid var(--accent, #4a7cf7);
    cursor: pointer;
}

.call-hover-slider::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid var(--accent, #4a7cf7);
    cursor: pointer;
}

/* Tooltip needs to be above slider when both visible */
.call-slider-wrap [data-tip]::after {
    bottom: calc(100% + 108px);
}

/* Hide tooltip when slider is shown */
.call-slider-wrap:hover [data-tip]::after {
    opacity: 0 !important;
}

.call-controls-right {
    display: flex;
    gap: 6px;
    align-items: center;
}

/* CSS-based fullscreen for call panel */
.call-panel.css-fullscreen,
.stream-viewer.css-fullscreen {
    position: fixed !important;
    top: 0;
    left: 0;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 9999;
    background: #000;
    border-radius: 0;
    margin: 0;
    padding: 0 !important;
    max-width: none;
    max-height: none;
}

/* Hide ALL other UI when desktop fullscreen is active */
.stream-fullscreen-active .social-sidebar,
.stream-fullscreen-active .channel-sidebar,
.stream-fullscreen-active .server-sidebar,
.stream-fullscreen-active .chat-header,
.stream-fullscreen-active .chat-messages,
.stream-fullscreen-active .chat-input-area,
.stream-fullscreen-active .members-panel,
.stream-fullscreen-active .typing-indicator,
.stream-fullscreen-active .reply-banner,
.stream-fullscreen-active #msgLimitBanner {
    display: none !important;
}

/* Hide normal controls in CSS fullscreen */
.stream-viewer.css-fullscreen~.call-controls {
    display: none !important;
}

/* Fullscreen hover controls overlay */
.fullscreen-overlay-controls {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 10001;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    padding: 14px 24px;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.85));
    transform: translateY(100%);
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
    pointer-events: none;
}

.fullscreen-overlay-controls.visible {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
}

.fullscreen-overlay-controls .call-btn {
    font-size: 1.3rem;
    padding: 10px 16px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #fff;
    cursor: pointer;
    transition: background 0.2s;
}

.fullscreen-overlay-controls .call-btn:hover {
    background: rgba(255, 255, 255, 0.25);
}

.fullscreen-overlay-controls .stream-volume-slider {
    width: 120px;
    accent-color: #4a7cf7;
}

/* Native Fullscreen scaling for canvas and video */
.stream-viewer:fullscreen {
    width: 100vw;
    height: 100vh;
    padding: 0 !important;
    background: #000;
}

canvas:-webkit-full-screen,
video:-webkit-full-screen,
canvas:fullscreen,
video:fullscreen {
    width: 100vw !important;
    height: 100vh !important;
    object-fit: contain !important;
    background: #000;
}

/* SHOW badge for streaming users */
.show-badge {
    display: inline-block;
    background: #4a7cf7;
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 8px;
    letter-spacing: 0.5px;
    cursor: pointer;
    margin-left: 4px;
    vertical-align: middle;
    animation: showPulse 2s ease-in-out infinite;
    transition: background 0.15s ease, transform 0.1s ease;
}

.show-badge:hover {
    background: #6b93ff;
    transform: scale(1.15);
}

@keyframes showPulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
    }
}

.video-tile:hover {
    border-color: rgba(124, 92, 252, 0.4);
    transform: scale(1.03);
}

.video-tile video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 10px;
}

.video-tile-label {
    position: absolute;
    bottom: 4px;
    left: 4px;
    padding: 2px 6px;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 4px;
    font-size: 10px;
    color: var(--text);
}

.video-tile-indicators {
    position: absolute;
    top: 4px;
    right: 4px;
    display: flex;
    gap: 2px;
}

.mic-indicator {
    font-size: 12px;
    filter: drop-shadow(0 0 2px rgba(0, 0, 0, 0.5));
}

/* Call panel upgrade */
.call-panel {
    display: flex;
    flex-direction: column;
    background: var(--bg-dark);
    border-left: 1px solid var(--glass-border);
    height: 100%;
    min-width: 320px;
}

.call-panel.fullscreen {
    position: fixed;
    inset: 0;
    z-index: 9999;
    border: none;
    border-radius: 0;
    min-width: 100%;
}

.call-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-bottom: 1px solid var(--glass-border);
    font-weight: 600;
    font-size: 14px;
}

.call-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.call-timer {
    font-size: 12px;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

.call-participants {
    padding: 6px 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    font-size: 12px;
    max-height: 60px;
    overflow-y: auto;
}

.call-participant {
    padding: 3px 8px;
    background: rgba(124, 92, 252, 0.1);
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
}

.call-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-top: 1px solid var(--glass-border);
    flex-shrink: 0;
}

.call-controls-left {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 90px;
}

.call-controls-center {
    display: flex;
    align-items: center;
    gap: 10px;
}

.vol-icon {
    font-size: 14px;
    opacity: 0.6;
}

.stream-volume-slider {
    width: 70px;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 2px;
    outline: none;
    cursor: pointer;
}

.stream-volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #7c5cfc;
    cursor: pointer;
}

.stream-volume-slider::-moz-range-thumb {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #7c5cfc;
    border: none;
    cursor: pointer;
}

.call-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: var(--white);
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    z-index: 101;
}

.call-btn:hover {
    background: rgba(124, 92, 252, 0.2);
    transform: scale(1.08);
}

.call-btn.active {
    background: rgba(124, 92, 252, 0.35);
    box-shadow: 0 0 12px rgba(124, 92, 252, 0.3);
    border-color: rgba(124, 92, 252, 0.5);
}

.call-btn.hangup {
    background: rgba(255, 50, 50, 0.2);
    border-color: rgba(255, 50, 50, 0.3);
    color: #ff4d4d;
}

.call-btn.hangup:hover {
    background: rgba(255, 50, 50, 0.4);
    transform: scale(1.1);
}

/* Call Button Popover Sliders */
.popover-slider-container {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.popover-slider {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%) rotate(-90deg);
    transform-origin: center bottom;
    width: 100px;
    height: 8px;
    -webkit-appearance: none;
    appearance: none;
    background: linear-gradient(to right,
            rgba(67, 181, 129, 1) 0%,
            rgba(250, 166, 26, 1) 50%,
            rgba(240, 71, 71, 1) 100%);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 6px;
    outline: none;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    padding: 0;
    margin: 0;
}

.popover-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
    box-shadow: 0 0 6px rgba(0, 0, 0, 0.8);
    border: 2px solid var(--bg-dark);
}

.popover-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid var(--bg-dark);
    cursor: pointer;
    box-shadow: 0 0 6px rgba(0, 0, 0, 0.8);
}

.popover-slider.stream-vol::-webkit-slider-thumb {
    background: #fff;
}

.popover-slider.stream-vol::-moz-range-thumb {
    background: #fff;
}

/* Hover bridge — large invisible area connecting button to slider */
.popover-slider-container::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: -20px;
    right: -20px;
    height: 140px;
    opacity: 0;
    pointer-events: none;
    z-index: 99;
}

.popover-slider-container:hover::before {
    pointer-events: auto;
}

.popover-slider-container:hover .popover-slider,
.popover-slider-container:focus-within .popover-slider,
.popover-slider:active {
    opacity: 1;
    pointer-events: auto;
}

/* User-bar streaming button states */
.control-btn.streaming {
    color: #43b581;
    background: rgba(67, 181, 129, 0.15);
}

.control-btn.streaming:hover {
    background: rgba(67, 181, 129, 0.25);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #43b581;
    display: inline-block;
}

.volume-slider {
    width: 60px;
    height: 4px;
    accent-color: var(--accent-primary);
    cursor: pointer;
}

/* ══════════════════════════════════════════════════════════════════
   REPORT MODAL & SERVER ADMIN PANEL
   ══════════════════════════════════════════════════════════════════ */

/* ── Report Modal ─────────────────────────────────── */
.report-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.15s ease;
}

.report-modal {
    background: var(--bg-dark);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: 24px;
    width: 420px;
    max-width: 90vw;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
}

.report-modal h3 {
    margin: 0 0 12px;
    font-size: 18px;
    color: var(--text);
}

.report-preview {
    background: rgba(255, 255, 255, 0.04);
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 16px;
    border-left: 3px solid var(--accent-primary);
    font-style: italic;
}

.report-reasons {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.report-reason {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 14px;
    color: var(--text);
    transition: background 0.15s;
}

.report-reason:hover {
    background: rgba(255, 255, 255, 0.06);
}

.report-reason input {
    accent-color: var(--accent-primary);
}

.report-description {
    width: 100%;
    box-sizing: border-box;
    padding: 10px 12px;
    background: var(--bg-lighter);
    color: var(--text);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-family: inherit;
    resize: vertical;
}

.report-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 16px;
}

/* ── Admin Panel Overlay ───────────────────────────── */
.admin-panel-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    pointer-events: none; /* Let clicks pass through to app underneath */
    display: flex;
    align-items: center;
    justify-content: center;
}

.admin-panel {
    pointer-events: auto; /* Re-enable clicks for the window itself */
    position: relative;
    background: rgba(22, 22, 28, 0.85);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    width: 800px;
    min-width: 400px;
    min-height: 300px;
    max-width: 95vw;
    height: 600px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.8), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    resize: both; /* Allow CSS resizing */
    /* Add subtle scale animation */
    animation: popIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes popIn {
    0% { opacity: 0; transform: scale(0.96); }
    100% { opacity: 1; transform: scale(1); }
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: linear-gradient(90deg, rgba(88, 101, 242, 0.1), transparent);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    cursor: grab; /* Show grab icon for dragging */
    user-select: none; /* Prevent selection while dragging */
}

.admin-header:active {
    cursor: grabbing;
}

.admin-header h2 {
    margin: 0;
    font-size: 18px;
    color: var(--text);
}

.admin-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 20px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    transition: 0.15s;
}

.admin-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text);
}

/* Window Content Body */
.admin-body {
    display: flex;
    flex-direction: row;
    flex: 1;
    overflow: hidden;
}

/* Sidebar Navigation */
.admin-sidebar {
    display: flex;
    flex-direction: column;
    width: 230px;
    background: rgba(18, 18, 23, 0.5);
    border-right: 1px solid var(--glass-border);
    padding: 12px 8px;
    gap: 4px;
    overflow-y: auto;
}

.admin-tab {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 10px 14px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    text-align: left;
    border-radius: 6px;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    align-items: center;
    gap: 10px;
}

.admin-tab:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.05);
}

.admin-tab.active {
    color: #fff;
    background: var(--accent-primary);
    box-shadow: 0 4px 12px rgba(88, 101, 242, 0.2);
}

.admin-tab-group {
    margin-bottom: 8px;
}

.admin-tab-group-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--text-dim);
    font-weight: 700;
    padding: 8px 14px 4px;
    user-select: none;
}

/* Content area */
.admin-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px;
}

.admin-loading {
    padding: 40px;
    text-align: center;
    color: var(--text-muted);
}

.admin-empty {
    padding: 40px;
    text-align: center;
    color: var(--text-muted);
    font-size: 14px;
}

.admin-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Filters */
.admin-filter {
    display: flex;
    gap: 6px;
    margin-bottom: 14px;
}

.admin-filter-btn {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--glass-border);
    color: var(--text-muted);
    padding: 6px 14px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: 0.15s;
}

.admin-filter-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text);
}

.admin-filter-btn.active {
    background: rgba(124, 92, 252, 0.2);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

/* ── Report Cards ──────────────────────────────────── */
.report-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    transition: 0.15s;
}

.report-card:hover {
    border-color: rgba(255, 255, 255, 0.15);
}

.report-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.report-reason-badge {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    padding: 3px 10px;
    border-radius: 12px;
    background: rgba(255, 166, 0, 0.15);
    color: #ffa600;
}

.report-time {
    font-size: 11px;
    color: var(--text-muted);
}

.report-card-body {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.5;
}

.report-card-body p {
    margin: 3px 0;
}

.report-card-body strong {
    color: var(--text);
}

.report-snapshot {
    font-style: italic;
    opacity: 0.8;
}

.report-card-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--glass-border);
}

.report-action-input {
    flex: 1;
    padding: 6px 10px;
    background: var(--bg-lighter);
    color: var(--text);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    font-size: 12px;
}

.report-card-resolved {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--glass-border);
    font-size: 12px;
    color: var(--text-muted);
}

/* ── Member Cards ──────────────────────────────────── */
.member-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    transition: 0.15s;
}

.member-card:hover {
    border-color: rgba(255, 255, 255, 0.15);
}

.member-card-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.member-card-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
}

.member-card-role {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    padding: 2px 8px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-muted);
}

.member-card-role.owner {
    background: rgba(255, 166, 0, 0.15);
    color: #ffa600;
}

.member-card-role.admin {
    background: rgba(124, 92, 252, 0.15);
    color: #7c5cfc;
}

.member-card-role.banned {
    background: rgba(255, 50, 50, 0.15);
    color: #ff4d4d;
}

.member-card-actions {
    display: flex;
    gap: 6px;
}

.ban-reason {
    font-size: 11px;
    color: var(--text-muted);
    font-style: italic;
}

/* ── Audit Log ─────────────────────────────────────── */
.audit-entry {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    font-size: 13px;
}

.audit-entry:last-child {
    border-bottom: none;
}

.audit-icon {
    font-size: 18px;
    flex-shrink: 0;
    margin-top: 1px;
}

.audit-info {
    flex: 1;
}

.audit-text {
    color: var(--text-muted);
    line-height: 1.4;
}

.audit-text strong {
    color: var(--text);
}

.audit-details {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    opacity: 0.7;
    margin-top: 2px;
}

.audit-time {
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
    flex-shrink: 0;
}

/* ── RBAC: Role Cards ─────────────────────────────────── */
.roles-header {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 14px;
}

.roles-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.role-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    transition: 0.15s;
    cursor: default;
}

.role-card:hover { border-color: rgba(255, 255, 255, 0.15); }

.role-card.role-default { opacity: 0.7; }

.role-card-color {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    flex-shrink: 0;
}

.role-card-info { flex: 1; }

.role-card-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}

.role-card-meta {
    font-size: 11px;
    color: var(--text-muted);
    margin-left: 8px;
}

.role-card-actions {
    display: flex;
    gap: 6px;
}

.role-card-actions .btn-secondary,
.role-card-actions .btn-danger {
    padding: 4px 10px;
    font-size: 12px;
    border-radius: 8px;
    width: auto;
}

/* ── RBAC: Role Editor ────────────────────────────────── */
.role-editor {
    animation: fadeIn 0.2s ease;
}

.role-editor-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
}

.role-editor-header h3 {
    margin: 0;
    font-size: 16px;
}

.role-editor-body {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.role-editor-basic {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.role-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.role-field label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.role-field input[type="text"] {
    padding: 8px 12px;
    background: var(--bg-lighter);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    color: var(--text);
    font-size: 14px;
    outline: none;
    transition: 0.15s;
    width: 220px;
}

.role-field input[type="text"]:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-glow);
}

.role-field input[type="color"] {
    width: 48px;
    height: 36px;
    border: 2px solid var(--glass-border);
    border-radius: 8px;
    cursor: pointer;
    background: none;
    padding: 2px;
}

.role-field-row {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    width: 100%;
}

.role-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-muted);
    cursor: pointer;
}

.role-checkbox input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--accent);
}

/* ── RBAC: Permission Toggles ─────────────────────────── */
.perm-section-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    padding-bottom: 4px;
    border-bottom: 1px solid var(--glass-border);
}

.perm-toggles {
    max-height: 400px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.perm-category-title {
    font-size: 12px;
    font-weight: 700;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.perm-category-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
}

.perm-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: 6px;
    cursor: pointer;
    transition: 0.1s;
}

.perm-toggle:hover {
    background: rgba(255, 255, 255, 0.04);
}

.perm-toggle input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--accent);
    flex-shrink: 0;
}

.perm-toggle-label {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.2;
}

.role-editor-actions {
    display: flex;
    justify-content: flex-end;
    padding-top: 12px;
    border-top: 1px solid var(--glass-border);
}

.role-editor-actions .btn-primary {
    padding: 8px 24px;
    font-size: 13px;
    border-radius: 8px;
}

/* ── RBAC: Role Badges (Member List / Cards) ──────────── */
.role-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border: 1px solid;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 600;
    line-height: 1.4;
}

.role-badge-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.member-card-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.member-card-roles {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

/* ── RBAC: Role Assignment Modal ──────────────────────── */
.role-assign-modal {
    position: fixed;
    inset: 0;
    z-index: 10001;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.15s ease;
}

.role-assign-content {
    background: var(--bg-dark);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    padding: 20px;
    width: 360px;
    max-width: 90vw;
    max-height: 70vh;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}

.role-assign-content h3 {
    margin: 0 0 16px;
    font-size: 16px;
    color: var(--text);
}

.role-assign-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 300px;
    overflow-y: auto;
}

.role-assign-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: 0.1s;
}

.role-assign-item:hover {
    background: rgba(255, 255, 255, 0.04);
}

.role-assign-item input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--accent);
}

.role-assign-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid var(--glass-border);
}

.role-assign-actions .btn-secondary {
    padding: 6px 16px;
    font-size: 12px;
    border-radius: 8px;
    width: auto;
}

/* ── Home View ──────────────────────────────────────── */
.home-view {
    position: absolute;
    inset: 0;
    z-index: 10;
    background: var(--bg-darkest);
    overflow: hidden;
}

.home-scroll {
    height: 100%;
    overflow-y: auto;
    padding: 80px 48px 60px;
    scroll-behavior: smooth;
}

.home-welcome {
    margin-bottom: 36px;
    animation: homeSlideUp 0.6s ease forwards;
}

.home-greeting {
    font-size: 32px;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 6px;
    letter-spacing: -0.5px;
}

.home-subtitle {
    font-size: 15px;
    color: var(--text-muted);
    font-weight: 400;
}

.home-section {
    margin-bottom: 40px;
    animation: homeSlideUp 0.6s ease forwards;
    animation-delay: 0.1s;
    opacity: 0;
}

.home-section:nth-child(3) {
    animation-delay: 0.2s;
}

.home-section:nth-child(4) {
    animation-delay: 0.3s;
}

.home-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    gap: 16px;
}

.home-section-header h2 {
    font-size: 18px;
    font-weight: 600;
    color: var(--white);
    white-space: nowrap;
}

/* ── Recent Messages Row ─────────────────────────── */
.recent-messages-scroll {
    display: flex;
    gap: 14px;
    overflow-x: auto;
    padding-bottom: 8px;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    /* Hide scrollbar Firefox */
    -ms-overflow-style: none;
    /* Hide scrollbar IE/Edge */
    scroll-behavior: smooth;
}

.recent-messages-scroll::-webkit-scrollbar {
    display: none;
    /* Hide scrollbar Chrome/Safari */
}

.carousel-nav {
    display: flex;
    gap: 8px;
}

.carousel-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    color: var(--text);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    font-size: 12px;
}

.carousel-btn:hover {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
    transform: scale(1.1);
}

.carousel-btn:active {
    transform: scale(0.9);
}

.numeric-unread-badge {
    font-size: 11px !important;
    font-weight: 700 !important;
    background: #ff4757 !important;
    color: white !important;
    padding: 0 4px !important;
    border-radius: 50% !important;
    margin-left: 8px !important;
    box-shadow: 0 2px 5px rgba(255, 71, 87, 0.4) !important;
    min-width: 18px !important;
    height: 18px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
    line-height: 1 !important;
    box-sizing: border-box !important;
    z-index: 10 !important;
    visibility: visible !important;
}

.recent-messages-scroll {
    display: flex;
    overflow-x: auto;
    overflow-y: hidden;
    gap: 0; /* JS handles spacing via 3D transform */
    padding: 20px calc(50% - 110px); /* Center the first/last items */
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory;
    perspective: 1000px;
}

/* Visible thin scrollbar */
.recent-messages-scroll::-webkit-scrollbar {
    height: 4px;
}

.recent-messages-scroll::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 4px;
}

.recent-messages-scroll::-webkit-scrollbar-thumb {
    background: rgba(0, 212, 170, 0.25);
    border-radius: 4px;
}

.recent-messages-scroll::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 212, 170, 0.45);
}

.recent-messages-scroll {
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 212, 170, 0.25) rgba(255, 255, 255, 0.03);
}

.recent-msg-card {
    flex-shrink: 0;
    width: 220px;
    background: linear-gradient(145deg, rgba(30, 34, 45, 0.8) 0%, rgba(20, 22, 30, 0.9) 100%);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 12px 14px;
    cursor: pointer;
    scroll-snap-align: center;
    display: flex;
    flex-direction: column;
    gap: 8px;
    position: relative;
    transform-style: preserve-3d;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3), inset 0 1px 1px rgba(255, 255, 255, 0.08);
    /* NO TRANSITION ON JS PROPERTIES to prevent fighting rAF */
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

/* Add a subtle top glare for the glass effect */
.recent-msg-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 40%;
    background: linear-gradient(180deg, rgba(255,255,255,0.06) 0%, rgba(255,255,255,0) 100%);
    border-radius: 12px 12px 0 0;
    pointer-events: none;
}

.recent-msg-card:hover {
    border-color: rgba(0, 212, 170, 0.4);
    box-shadow: 0 0 25px rgba(0, 212, 170, 0.15), inset 0 1px 1px rgba(255, 255, 255, 0.15);
}

.recent-card-dismiss {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 18px;
    height: 18px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-muted);
    font-size: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.2s ease;
    z-index: 2;
    padding: 0;
    line-height: 1;
}

.recent-msg-card:hover .recent-card-dismiss {
    opacity: 1;
}

.recent-card-dismiss:hover {
    background: rgba(255, 70, 70, 0.35);
    color: #ff6b6b;
    transform: scale(1.15);
}

.recent-msg-header {
    display: flex;
    align-items: center;
    gap: 8px;
}

.recent-msg-avatar {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--accent-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
}

.recent-msg-meta {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.recent-msg-name {
    font-size: 11px;
    font-weight: 600;
    color: var(--white);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
}

.recent-msg-source {
    font-size: 9px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
}

.recent-msg-time {
    font-size: 9px;
    color: var(--text-dim);
    white-space: nowrap;
    flex-shrink: 0;
}

.recent-msg-content {
    font-size: 11px;
    color: var(--text);
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin: 0;
    word-break: break-word;
}

.recent-placeholder {
    padding: 16px;
    color: var(--text-muted);
    font-size: 12px;
    text-align: center;
    width: 100%;
}

/* ── Explore Search ──────────────────────────────── */
.explore-search {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-pill);
    padding: 8px 16px;
    flex: 1;
    max-width: 320px;
    transition: var(--transition);
}

.explore-search:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.explore-search-icon {
    flex-shrink: 0;
    opacity: 0.5;
}

.explore-search input {
    background: none;
    border: none;
    color: var(--text);
    font-size: 14px;
    outline: none;
    width: 100%;
    font-family: var(--font);
}

.explore-search input::placeholder {
    color: var(--text-dim);
}

/* ── Tag Pills ───────────────────────────────────── */
.explore-tags {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.explore-tag {
    padding: 8px 18px;
    border: 1px solid var(--glass-border);
    background: var(--glass);
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 500;
    border-radius: var(--radius-pill);
    cursor: pointer;
    transition: var(--transition);
    font-family: var(--font);
    white-space: nowrap;
}

.explore-tag:hover {
    background: rgba(0, 212, 170, 0.08);
    color: var(--text);
    border-color: rgba(0, 212, 170, 0.2);
    transform: translateY(-1px);
}

.explore-tag.active {
    background: var(--accent-gradient);
    color: white;
    border-color: transparent;
    box-shadow: 0 4px 15px var(--accent-glow);
}

/* ── Explore Grid ────────────────────────────────── */
.explore-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.explore-card {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: var(--transition);
    cursor: default;
    position: relative;
    overflow: hidden;
}

.explore-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--accent-gradient);
    opacity: 0;
    transition: var(--transition);
}

.explore-card:hover {
    transform: translateY(-4px);
    border-color: rgba(0, 212, 170, 0.2);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
}

.explore-card:hover::before {
    opacity: 1;
}

.explore-card-top {
    display: flex;
    align-items: center;
    gap: 14px;
}

.explore-card-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    background: var(--accent-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
}

.explore-card-info {
    flex: 1;
    min-width: 0;
}

.explore-card-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--white);
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.explore-card-members {
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
}

.explore-card-members::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--green);
}

.explore-card-desc {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.explore-card-tags {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.explore-card-tag {
    font-size: 11px;
    padding: 3px 10px;
    border-radius: var(--radius-pill);
    background: rgba(0, 212, 170, 0.1);
    color: var(--accent);
    font-weight: 500;
}

.explore-card-bottom {
    display: flex;
    justify-content: flex-end;
    margin-top: auto;
}

.explore-join-btn {
    padding: 8px 24px;
    border: none;
    background: var(--accent-gradient);
    color: white;
    font-size: 13px;
    font-weight: 600;
    border-radius: var(--radius-pill);
    cursor: pointer;
    transition: var(--transition);
    font-family: var(--font);
}

.explore-join-btn:hover {
    filter: brightness(1.15);
    transform: scale(1.05);
    box-shadow: 0 4px 15px var(--accent-glow);
}

.explore-join-btn.joined {
    background: var(--bg-lighter);
    color: var(--text-muted);
    cursor: default;
}

.explore-empty,
.events-placeholder {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
    font-size: 14px;
    background: var(--glass);
    border: 1px dashed var(--glass-border);
    border-radius: var(--radius);
}

.explore-empty-icon,
.events-icon {
    font-size: 40px;
    display: block;
    margin-bottom: 12px;
}

.explore-empty-sub,
.events-sub {
    font-size: 12px;
    color: var(--text-dim);
    margin-top: 6px;
}

/* ── Events Placeholder ──────────────────────────── */
.coming-soon-badge {
    padding: 4px 14px;
    border-radius: var(--radius-pill);
    background: rgba(0, 153, 255, 0.15);
    color: var(--accent2);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

/* ── Social Sidebar Navigation ───────────────────── */
.social-sidebar .home-tabs {
    display: flex;
    gap: 4px;
    padding: 4px 12px;
    margin-bottom: 4px;
}

.home-tab {
    flex: 1;
    padding: 10px 0;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 600;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    font-family: var(--font);
    text-align: center;
}

.home-tab:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text);
}

.home-tab.active {
    background: rgba(0, 212, 170, 0.12);
    color: var(--accent);
}

/* ── Home View Animations ────────────────────────── */
@keyframes homeSlideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ── Unread Badges ──────────────────────────────── */
.unread-badge {
    background: #ff4757 !important;
    color: white !important;
    font-size: 11px !important;
    font-weight: 700 !important;
    min-width: 18px !important;
    height: 18px !important;
    border-radius: 50% !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 4px !important;
    box-shadow: 0 2px 5px rgba(255, 71, 87, 0.4) !important;
    pointer-events: none !important;
    line-height: 1 !important;
    box-sizing: border-box !important;
    text-align: center !important;
    z-index: 10 !important;
    visibility: visible !important;
}

/* Removed empty unread-badge overrides */

.tab-badge {
    background: #ff4757;
    color: white;
    font-size: 10px;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    position: absolute;
    top: 2px;
    right: 2px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    pointer-events: none;
    transform: scale(0.9);
}

.home-tab {
    position: relative;
    /* Ensure badges position correctly */
}

/* -- Desktop focus fallback -- */
.app-unfocused {
    filter: saturate(0.8);
}

/* ── Shared animation ──────────────────────────────── */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* ------------------------------------------------------------------
   PHASE 14: PREMIUM RECENT FEED STYLES
   ------------------------------------------------------------------ */

.recent-messages-scroll {
    display: flex;
    gap: 20px;
    padding: 10px 5px 25px 5px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.recent-messages-scroll::-webkit-scrollbar {
    display: none;
}

.premium-glass {
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}

.recent-msg-card {
    min-width: 320px;
    max-width: 320px;
    border-radius: 16px;
    padding: 20px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    scroll-snap-align: start;
    display: flex;
    flex-direction: column;
    gap: 15px;
    animation: slideInUp 0.6s ease-out both;
}

.recent-msg-card:hover {
    transform: translateY(-8px) scale(1.02);
    border-color: rgba(0, 212, 170, 0.3);
    background: rgba(255, 255, 255, 0.05);
    box-shadow: 0 12px 40px 0 rgba(0, 0, 0, 0.4);
}

.recent-card-bg-glow {
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at center, rgba(0, 212, 170, 0.05) 0%, transparent 70%);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.5s ease;
    z-index: 0;
}

.recent-msg-card:hover .recent-card-bg-glow {
    opacity: 1;
}

.recent-msg-header {
    display: flex;
    gap: 12px;
    align-items: center;
    z-index: 1;
}

.recent-msg-avatar-container {
    position: relative;
    flex-shrink: 0;
}

.recent-msg-avatar {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: linear-gradient(135deg, #00d4aa, #00a383);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: white;
    font-size: 16px;
    border: 2px solid rgba(255, 255, 255, 0.1);
}

.recent-unread-dot {
    position: absolute;
    top: -6px;
    right: -6px;
    background: #ff4757;
    color: white;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    font-size: 10px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    border: 2px solid #0c0c0c;
    box-shadow: 0 2px 8px rgba(255, 71, 87, 0.4);
    animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.recent-msg-meta {
    flex: 1;
    min-width: 0;
}

.recent-msg-name-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2px;
}

.recent-msg-name {
    font-weight: 700;
    font-size: 15px;
    color: #ffffff;
}

.recent-msg-time {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.4);
    font-weight: 500;
}

.recent-msg-source {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
    display: flex;
    align-items: center;
    gap: 4px;
}

.source-server {
    font-weight: 600;
}

.source-separator {
    opacity: 0.3;
}

.recent-msg-body {
    flex: 1;
    z-index: 1;
}

.recent-msg-content {
    font-size: 14px;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.7);
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.recent-card-footer {
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    z-index: 1;
}

.view-thread-btn {
    font-size: 12px;
    color: #00d4aa;
    font-weight: 600;
    opacity: 0;
    transform: translateX(-10px);
    transition: all 0.3s ease;
}

.recent-msg-card:hover .view-thread-btn {
    opacity: 1;
    transform: translateX(0);
}

.truncate {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes popIn {
    from {
        opacity: 0;
        transform: scale(0.5);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.new-ping {
    animation: pulseGlow 2s infinite;
}

@keyframes pulseGlow {
    0% {
        box-shadow: 0 0 0 0 rgba(0, 212, 170, 0.4);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(0, 212, 170, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(0, 212, 170, 0);
    }
}

.recent-server-icon {
    width: 16px;
    height: 16px;
    border-radius: 4px;
    object-fit: cover;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* ═══════════════════════════════════════════════════════════
   LINK PREVIEWS (OpenGraph Cards)
   ═══════════════════════════════════════════════════════════ */
.link-preview-card {
    background: var(--bg-hover);
    border-radius: var(--radius-sm);
    border-left: 4px solid var(--accent);
    padding: 12px;
    margin-top: 6px;
    max-width: 450px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: background 0.2s;
    user-select: none;
}
.link-preview-card:hover {
    background: rgba(255, 255, 255, 0.05);
}
.lp-site {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
}
.lp-favicon {
    width: 14px;
    height: 14px;
    border-radius: 2px;
}
.lp-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--accent);
    margin-bottom: 2px;
    line-height: 1.3;
}
.lp-desc {
    font-size: 13px;
    color: var(--text-dim);
    line-height: 1.4;
    overflow: hidden;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    line-clamp: 3;
}
.lp-image-wrap {
    margin-top: 4px;
    border-radius: 6px;
    overflow: hidden;
    max-height: 250px;
    background: var(--bg-dark);
}
.lp-image {
    max-width: 100%;
    max-height: 250px;
    object-fit: contain;
    display: block;
    cursor: zoom-in;
}

.recent-msg-media {
    margin-top: 8px;
    border-radius: 8px;
    overflow: hidden;
    max-height: 120px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.recent-msg-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* ═══════════════════════════════════════════════════════════════
   LIGHTBOX GALLERY (Desktop & Global)
   ═══════════════════════════════════════════════════════════════ */
.lightbox {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    transition: opacity 0.25s ease-in-out;
}
.lightbox.hidden {
    opacity: 0;
    pointer-events: none;
}
.lightbox-content-container {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    align-items: center;
    justify-content: center;
}
.lightbox-content-container img {
    max-width: 90vw;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.6);
    animation: fadeIn 0.2s ease-out;
}
.lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    font-size: 24px;
    color: var(--text);
    background: rgba(0,0,0,0.5);
    border: none;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    cursor: pointer;
    z-index: 10000;
    transition: background 0.2s, transform 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.lightbox-close:hover {
    background: rgba(255,43,94,0.8);
    transform: scale(1.1);
}
.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: 24px;
    color: var(--text);
    background: rgba(0,0,0,0.5);
    border: none;
    border-radius: 50%;
    width: 56px;
    height: 56px;
    cursor: pointer;
    z-index: 10000;
    transition: background 0.2s, transform 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.lightbox-nav:hover {
    background: var(--accent);
    transform: translateY(-50%) scale(1.1);
}
.lightbox-nav.hidden {
    display: none !important;
}
.lightbox-prev {
    left: 20px;
}
.lightbox-next {
    right: 20px;
}

/* ═══════════════════════════════════════════════════════════════
   MOBILE RESPONSIVE — max-width: 768px
   ═══════════════════════════════════════════════════════════════ */

/* Mobile overlay backdrop */
.mobile-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 89;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.mobile-overlay.visible {
    opacity: 1;
    pointer-events: auto;
}

/* Mobile hamburger / sidebar toggle buttons — hidden on desktop */
.mobile-menu-btn,
.mobile-channel-btn,
.mobile-only {
    display: none !important;
}

@media (max-width: 768px) {

    /* Show mobile-only elements */
    .mobile-only {
        display: inline-flex !important;
    }

    /* ── Show mobile UI elements ───────────────── */
    .mobile-overlay {
        display: block;
    }

    .mobile-menu-btn,
    .mobile-channel-btn {
        display: inline-flex !important;
        width: 36px;
        height: 36px;
        align-items: center;
        justify-content: center;
        border: none;
        background: rgba(255, 255, 255, 0.08);
        color: var(--text);
        border-radius: var(--radius-xs);
        cursor: pointer;
        transition: var(--transition);
        font-size: 18px;
        flex-shrink: 0;
        -webkit-tap-highlight-color: transparent;
    }

    .mobile-menu-btn:active,
    .mobile-channel-btn:active {
        background: rgba(255, 255, 255, 0.16);
        transform: scale(0.92);
    }

    /* ── App Layout — single column ───────────── */
    .app-view {
        flex-direction: column;
        position: relative;
        overflow: hidden;
    }

    /* ── Social Sidebar — slide-in overlay from left ── */
    .social-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: 85vw;
        max-width: 320px;
        z-index: 90;
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        border-right: 1px solid var(--glass-border);
        order: 0;
    }

    .social-sidebar.mobile-open {
        transform: translateX(0);
    }

    /* ── Channel Sidebar — slide-in overlay from right ── */
    .channel-sidebar {
        position: fixed !important;
        top: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        left: auto !important;
        width: 80vw !important;
        max-width: 300px !important;
        min-width: 0 !important;
        height: 100% !important;
        z-index: 90 !important;
        transform: translateX(100%) !important;
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
        border-left: 1px solid var(--glass-border) !important;
        border-right: none !important;
        order: 2;
        display: flex !important;
        flex-direction: column !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        opacity: 1 !important;
        padding: 0 !important;
        background: var(--glass-panel) !important;
        backdrop-filter: blur(24px) !important;
        -webkit-backdrop-filter: blur(24px) !important;
    }

    /* When mobile-open, slide in — overrides EVERYTHING including slide-out */
    .channel-sidebar.mobile-open,
    .channel-sidebar.slide-out.mobile-open {
        transform: translateX(0) !important;
        opacity: 1 !important;
        width: 80vw !important;
        max-width: 300px !important;
        overflow-y: auto !important;
        border-left: 1px solid var(--glass-border) !important;
        padding: 0 !important;
    }

    /* ── Server Sidebar — bottom navigation bar ── */
    .server-sidebar {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        height: 56px;
        min-width: unset;
        flex-direction: row;
        justify-content: space-around;
        align-items: center;
        padding: 0 8px;
        gap: 0;
        z-index: 80;
        border-left: none;
        border-top: 1px solid var(--glass-border);
        overflow: hidden;
        order: 3;
    }

    .server-sidebar .sidebar-divider {
        display: none;
    }

    .server-sidebar .server-sidebar-spacer {
        display: none;
    }

    /* Hide logout in bottom nav — accessible via Settings */
    .server-sidebar .logout-server-icon {
        display: none;
    }

    .server-icon {
        width: 40px;
        height: 40px;
        font-size: 12px;
    }

    .server-icon.active::before {
        /* Move indicator to top instead of right on mobile */
        right: auto;
        left: 50%;
        top: -8px;
        transform: translateX(-50%);
        width: 24px;
        height: 3px;
        border-radius: 0 0 3px 3px;
    }

    .server-list {
        display: flex;
        flex-direction: row;
        gap: 4px;
        overflow-x: auto;
        overflow-y: hidden;
        max-width: 45vw;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }

    .server-list::-webkit-scrollbar {
        display: none;
    }

    .logout-server-icon {
        margin-bottom: 0;
    }

    /* ── Main Content — full width, account for bottom nav ── */
    .main-content {
        flex: 1;
        order: 0;
        width: 100%;
        padding-bottom: 56px; /* space for bottom nav */
        min-height: 0;
    }

    /* ── Chat Header — mobile layout ────────── */
    .chat-header {
        padding: 8px 12px;
        gap: 8px;
        min-height: 48px;
    }

    .chat-header h3 {
        font-size: 14px;
    }

    .chat-header-center {
        gap: 4px;
    }

    .chat-header-search {
        display: none; /* hide inline search on mobile, still accessible via button */
    }

    .chat-header-settings {
        display: none; /* settings accessible via bottom nav */
    }

    .chat-header-actions {
        gap: 4px;
    }

    .chat-header-actions .icon-btn {
        width: 36px;
        height: 36px;
    }

    /* ── Chat Messages — mobile padding ──────── */
    .chat-messages {
        padding: 8px 8px 8px 8px;
    }

    /* ── Chat Input — mobile friendly ────────── */
    .chat-input-area {
        padding: 8px 10px !important;
    }

    .chat-input-toolbar {
        gap: 4px;
    }

    .toolbar-btn {
        min-width: 36px;
        min-height: 36px;
        font-size: 16px;
    }

    #chatInput {
        font-size: 16px !important; /* prevent iOS zoom on focus */
        padding: 10px 40px 10px 12px !important;
    }

    .send-btn {
        width: 40px !important;
        height: 40px !important;
    }

    /* ── Call Panel — mobile ─────────────────── */
    .call-panel {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 56px !important;
        z-index: 85 !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch;
        padding: 0 !important;
        flex-direction: column !important;
        background: var(--bg-dark) !important;
    }

    .call-panel:not(.hidden) {
        display: flex !important;
    }

    .call-user-strip {
        padding: 6px 8px;
        flex-shrink: 0;
    }

    .call-controls {
        padding: 10px 12px;
        gap: 8px;
        flex-shrink: 0;
    }

    .call-ctrl-btn {
        width: 44px;
        height: 44px;
    }

    .call-controls-center {
        gap: 8px;
    }

    /* ── Voice Controls Bar — float above bottom nav on mobile ── */
    .voice-controls-bar {
        position: fixed !important;
        bottom: 56px !important;
        left: 0 !important;
        right: 0 !important;
        z-index: 82 !important;
        border-radius: 0 !important;
        border-top: 1px solid var(--glass-border) !important;
        background: var(--bg-medium) !important;
        padding: 6px 12px !important;
    }

    /* Hide the "Voice Connected" label + green dot on mobile — saves space */
    .voice-controls-bar .voice-controls-info {
        display: none !important;
    }

    /* ── Stream Viewer — mobile ──────────────── */
    .stream-viewer {
        padding: 4px;
        flex: 1;
    }

    .stream-main {
        min-height: 180px;
        border-radius: 6px;
    }

    .stream-bar {
        padding: 6px 8px;
        flex-wrap: wrap;
        gap: 6px;
    }

    .stream-bar-left,
    .stream-bar-right {
        flex-wrap: wrap;
        gap: 4px;
    }

    .stream-ctrl-btn {
        width: 36px;
        height: 36px;
    }

    .stream-quality-menu {
        bottom: 100%;
        right: 0;
        left: auto;
    }

    /* ── Members Panel — full-width overlay ──── */
    .members-panel {
        position: fixed !important;
        top: 0;
        right: 0;
        bottom: 56px;
        width: 85vw !important;
        max-width: 300px;
        z-index: 90;
        border-left: 1px solid var(--glass-border);
    }

    /* ── Settings Panel — mobile padding ─────── */
    .settings-panel {
        padding: 16px;
    }

    .settings-panel h3 {
        font-size: 18px;
        margin-bottom: 16px;
    }

    .settings-cards-grid {
        grid-template-columns: repeat(2, 1fr);
        max-width: 100%;
    }

    .settings-page {
        max-width: 100%;
    }

    .settings-sections {
        max-width: 100%;
    }

    .settings-section {
        padding: 14px;
    }

    .setting-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }

    .setting-input {
        max-width: 100%;
        width: 100%;
    }

    .setting-select {
        width: 100%;
    }

    .setting-range {
        width: 100%;
    }

    /* ── Modal — mobile responsive ─────────── */
    .modal-content {
        width: 92vw !important;
        max-width: 420px;
        padding: 20px;
        border-radius: 16px;
        max-height: 85vh;
        overflow-y: auto;
    }

    .small-modal .modal-content {
        width: 92vw !important;
        max-width: 320px;
    }

    .modal-backdrop .modal {
        width: 92vw !important;
        max-width: 400px;
    }

    /* ── Auth View — mobile ─────────────────── */
    .auth-glass {
        width: 92vw;
        max-width: 420px;
        padding: 24px;
    }

    .auth-logo h1 {
        font-size: 24px;
    }

    /* ── Home View — mobile ─────────────────── */
    .home-scroll {
        padding: 24px 16px 80px;
    }

    .home-greeting {
        font-size: 24px;
    }

    .home-subtitle {
        font-size: 13px;
    }

    .home-section-header {
        flex-wrap: wrap;
        gap: 8px;
    }

    .home-section-header h2 {
        font-size: 16px;
    }

    .explore-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)) !important;
    }

    .explore-search {
        width: 100%;
    }

    .explore-tags {
        flex-wrap: wrap;
    }

    /* ── GIF Picker — mobile ───────────────── */
    .gif-picker {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: 55vh;
        border-radius: 16px 16px 0 0;
        z-index: 110;
    }

    .gif-controls input[type=range] {
        width: 80px;
    }

    /* ── Emoji Picker — mobile ──────────────── */
    .emoji-picker {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        max-height: 50vh;
        border-radius: 16px 16px 0 0;
        z-index: 110;
    }

    /* ── Search Panel — mobile ──────────────── */
    .search-panel {
        width: 100% !important;
        right: 0 !important;
    }

    /* ── Pins Panel — mobile ────────────────── */
    .pins-panel {
        width: 100% !important;
        right: 0 !important;
    }

    /* ── Pockets Modal — mobile ──────────────── */
    #pocketsModal .modal-content,
    #userProfileModal .modal-content {
        max-width: 95vw !important;
    }

    /* ── Reply Banner — mobile ──────────────── */
    .reply-banner {
        padding: 6px 10px;
    }

    /* ── Jump to Bottom — above bottom nav ──── */
    .jump-bottom-btn {
        bottom: 80px;
    }

    /* ── Toast — above bottom nav ─────────── */
    .toast-container {
        bottom: 72px !important;
    }

    /* ── Context Menu — mobile touch sizes ──── */
    .ctx-item {
        padding: 12px 16px;
        font-size: 15px;
    }

    /* ── Voice Controls Bar — mobile ────────── */
    .voice-controls-bar {
        padding: 8px 12px;
    }

    .voice-controls-btns {
        gap: 6px;
    }

    .vc-btn {
        width: 36px;
        height: 36px;
    }

    /* ── User Bar — simplified for mobile ──── */
    .user-bar {
        padding: 8px 12px;
    }

    .user-bar-controls {
        gap: 6px;
    }

    .control-btn-lg {
        width: 36px;
        height: 36px;
    }

    .popover-slider {
        width: 60px;
    }

    /* ── Fullscreen overlay controls ────────── */
    .fullscreen-overlay-controls {
        bottom: 0;
        padding: 12px 16px;
    }

    /* ── Message bubbles — mobile sizes ─────── */
    .message {
        padding: 8px 10px;
    }

    .msg-avatar {
        width: 32px;
        height: 32px;
        font-size: 12px;
    }

    .msg-content {
        font-size: 14px;
    }

    /* ── Typing Indicator ───────────────────── */
    .typing-indicator {
        padding: 4px 10px;
        font-size: 12px;
    }

    /* ── Lightbox — mobile ──────────────────── */
    #lightbox img,
    #lightbox video {
        max-width: 95vw !important;
        max-height: 80vh !important;
    }

    #lightboxClose {
        top: 10px !important;
        right: 10px !important;
        font-size: 30px !important;
    }

    /* ── Recent Messages carousel — mobile ──── */
    .recent-messages-scroll {
        gap: 10px;
    }

    .recent-msg-card {
        min-width: 250px;
    }

    /* ── DM List items — mobile touch targets ── */
    .dm-item,
    .friend-item {
        padding: 12px 14px;
        min-height: 48px;
    }

    /* ── Prevent iOS zoom on input focus ──────── */
    input[type="text"],
    input[type="email"],
    input[type="password"],
    textarea,
    select {
        font-size: 16px !important;
    }

    /* ── Screen picker grid — mobile ─────────── */
    .screen-picker-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)) !important;
    }

    /* ── Msg Limit Banner ────────────────────── */
    #msgLimitBanner {
        margin: 0 8px 4px 8px !important;
    }

    /* ── Chat input attachments ───────────────── */
    #attachmentsPreview {
        gap: 6px !important;
    }

    /* ═══════════════════════════════════════════════════════════
       MOBILE PERFORMANCE OPTIMIZATIONS
       ═══════════════════════════════════════════════════════════ */

    /* ── 1. Kill backdrop-filter blur (biggest GPU drain) ──── */
    .social-sidebar,
    .channel-sidebar,
    .main-content,
    .chat-header,
    .user-bar,
    .modal-content,
    .auth-glass,
    .settings-section,
    .voice-controls-bar,
    .gif-picker,
    .emoji-picker,
    .server-sidebar,
    .call-panel,
    .ctx-menu,
    .search-panel,
    .pins-panel,
    .members-panel,
    .connection-banner {
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
    }

    /* Give panels solid backgrounds so they still look good without blur */
    .social-sidebar {
        background: var(--bg-dark) !important;
    }

    .channel-sidebar {
        background: var(--bg-dark) !important;
    }

    .server-sidebar {
        background: var(--bg-dark) !important;
    }

    .chat-header {
        background: var(--bg-medium) !important;
    }

    .user-bar {
        background: var(--bg-medium) !important;
    }

    .modal-content {
        background: var(--bg-medium) !important;
    }

    .auth-glass {
        background: var(--bg-medium) !important;
    }

    .voice-controls-bar {
        background: var(--bg-medium) !important;
    }

    .ctx-menu {
        background: var(--bg-medium) !important;
    }

    .gif-picker,
    .emoji-picker {
        background: var(--bg-dark) !important;
    }

    .search-panel,
    .pins-panel {
        background: var(--bg-dark) !important;
    }

    .members-panel {
        background: var(--bg-dark) !important;
    }

    /* ── 2. Disable ambient background animation ───────────── */
    body::before {
        animation: none !important;
        background: var(--bg-dark) !important;
        opacity: 0.3 !important;
        width: 100% !important;
        height: 100% !important;
    }

    /* ── 3. GPU compositing for slide-in sidebars ──────────── */
    .social-sidebar,
    .channel-sidebar {
        will-change: transform;
    }

    .mobile-overlay {
        will-change: opacity;
    }

    /* ── 4. Simplify transitions on list items ─────────────── */
    .dm-item,
    .friend-item,
    .channel-item,
    .message,
    .server-icon,
    .status-option,
    .home-tab {
        transition: background 0.15s ease !important;
    }

    /* ── 5. Disable OverlayScrollbars custom styles (use native) ── */
    [data-overlayscrollbars],
    [data-overlayscrollbars-viewport],
    .os-scrollbar {
        -webkit-overflow-scrolling: touch;
    }

    .os-scrollbar-vertical,
    .os-scrollbar-horizontal {
        display: none !important;
    }

    /* ── 6. Use native scrolling momentum ──────────────────── */
    .chat-messages,
    .home-scroll,
    .social-sidebar,
    .channel-list,
    .friends-list,
    .dm-list,
    .settings-panel,
    .members-panel,
    .modal-content {
        -webkit-overflow-scrolling: touch;
    }

    /* ── 7. Reduce box-shadow complexity ───────────────────── */
    .modal-content {
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4) !important;
    }

    .server-icon {
        box-shadow: none !important;
    }

    /* ── 8. Simplify call panel on mobile ──────────────────── */
    .call-panel {
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
    }
}

/* ═══════════════════════════════════════════════════════════
   Skeleton Loading States — Shimmer placeholders
   ═══════════════════════════════════════════════════════════ */
@keyframes skeleton-shimmer {
    0%   { opacity: 0.15; }
    50%  { opacity: 0.3; }
    100% { opacity: 0.15; }
}

/* Skeleton card — used in recent messages/mentions carousel rows */
.skeleton-card {
    display: inline-block;
    width: 220px;
    height: 90px;
    margin-right: 12px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.06);
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
    flex-shrink: 0;
}

/* Skeleton row — used in friends/DM lists */
.skeleton-row {
    height: 52px;
    margin: 4px 8px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.04);
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
}

.skeleton-row:nth-child(2) { animation-delay: 0.15s; }
.skeleton-row:nth-child(3) { animation-delay: 0.3s; }
.skeleton-row:nth-child(4) { animation-delay: 0.45s; }
.skeleton-row:nth-child(5) { animation-delay: 0.6s; }

/* ═══════════════════════════════════════════════════════════
   Chat Loading Spinner — overlay positioned OUTSIDE scaleY(-1)
   ═══════════════════════════════════════════════════════════ */
.chat-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    inset: 0;
    z-index: 5;
    background: var(--bg-dark, #1a1a2e);
}

.chat-loading.hidden {
    display: none;
}

.chat-loading-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid rgba(255, 255, 255, 0.08);
    border-top-color: var(--accent-primary, #7c5cfc);
    border-radius: 50%;
    animation: chat-spin 0.8s linear infinite;
}

@keyframes chat-spin {
    to { transform: rotate(360deg); }
}

/* ── Theme / Boost Tab ─────────────────────────────────── */
.theme-boost-info {
    background: linear-gradient(135deg, rgba(0, 212, 170, 0.08) 0%, rgba(0, 153, 255, 0.08) 100%);
    border: 1px solid rgba(0, 212, 170, 0.2);
    border-radius: var(--radius-sm);
    padding: 16px;
    margin-bottom: 20px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
}

.boost-badge {
    display: flex;
    align-items: center;
    gap: 8px;
}

.boost-icon {
    font-size: 20px;
}

.boost-level {
    font-size: 16px;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.boost-count {
    font-size: 12px;
    color: var(--text-muted);
}

.boost-next {
    font-size: 12px;
    color: var(--text-muted);
    font-style: italic;
}

.boost-actions {
    margin-left: auto;
}

.boost-actions .btn-primary,
.boost-actions .btn-danger {
    padding: 6px 16px;
    font-size: 12px;
    border-radius: 8px;
    width: auto;
}

.boost-boosters {
    width: 100%;
    font-size: 12px;
    color: var(--text-muted);
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.boost-boosters-label {
    font-weight: 600;
    margin-right: 6px;
}

.boost-booster {
    color: var(--accent);
}

.theme-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 16px;
}

.theme-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.theme-field.wide {
    grid-column: 1 / -1;
}

.theme-field.locked {
    opacity: 0.45;
    pointer-events: none;
}

.theme-field label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.theme-lock {
    font-size: 10px;
    color: var(--yellow);
    text-transform: none;
    font-weight: 500;
}

.theme-field input[type="text"],
.theme-field input[type="url"],
.theme-field textarea {
    padding: 8px 12px;
    background: var(--bg-lighter);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    color: var(--text);
    font-size: 13px;
    font-family: var(--font);
    outline: none;
    transition: 0.15s;
    width: 100%;
}

.theme-field input:focus,
.theme-field textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-glow);
}

.theme-field input[type="color"] {
    width: 48px;
    height: 36px;
    border: 2px solid var(--glass-border);
    border-radius: 8px;
    cursor: pointer;
    background: none;
    padding: 2px;
}

.theme-field textarea {
    resize: vertical;
    min-height: 80px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
}

.theme-actions {
    display: flex;
    justify-content: flex-end;
    padding-top: 12px;
    border-top: 1px solid var(--glass-border);
}

.theme-actions .btn-primary {
    padding: 8px 24px;
    font-size: 13px;
    border-radius: 8px;
}

/* ═══════════════════════════════════════════════════════════════════
   EDIT SERVER MODAL (Premium)
   ═══════════════════════════════════════════════════════════════════ */

#editServerModal {
    display: flex;
    align-items: center;
    justify-content: center;
}

.esm-panel {
    width: 820px;
    max-width: 95vw;
    max-height: 90vh;
    background: linear-gradient(160deg, rgba(22, 24, 32, 0.98), rgba(14, 15, 20, 0.99));
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 16px;
    box-shadow: 0 40px 100px rgba(0,0,0,0.6), inset 0 1px 0 rgba(255,255,255,0.05);
    overflow-y: auto;
    position: relative;
    animation: esmSlideIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes esmSlideIn {
    from { opacity: 0; transform: translateY(20px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.esm-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 8px;
    background: rgba(255,255,255,0.05);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 2;
}

.esm-close:hover {
    background: rgba(255, 70, 70, 0.2);
    color: #ff6b6b;
}

.esm-layout {
    display: flex;
    gap: 0;
}

.esm-preview {
    width: 280px;
    flex-shrink: 0;
    padding: 32px 24px;
    background: rgba(0,0,0,0.2);
    border-right: 1px solid rgba(255,255,255,0.05);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.esm-preview-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-dim);
    margin-bottom: 16px;
    font-weight: 600;
}

.esm-card-preview {
    width: 100%;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.esm-card-banner {
    height: 80px;
    background: var(--accent-gradient);
    position: relative;
}

.esm-card-body {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.esm-card-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    background: var(--accent-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    font-weight: 700;
    color: white;
    margin-top: -40px;
    border: 3px solid rgba(22, 24, 32, 0.98);
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}

.esm-card-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--white);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.esm-card-desc {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.esm-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.esm-card-tags span {
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 20px;
    background: rgba(0,212,170,0.12);
    color: var(--accent);
    font-weight: 500;
}

.esm-card-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 8px;
    border-top: 1px solid rgba(255,255,255,0.05);
    margin-top: 4px;
}

.esm-stat {
    font-size: 11px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 5px;
}

.esm-stat-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
}

.esm-stat-dot.online { background: var(--green); }

/* Right Form */
.esm-form {
    flex: 1;
    padding: 32px 28px;
    overflow-y: auto;
}

.esm-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--white);
    margin-bottom: 24px;
}

.esm-section {
    margin-bottom: 24px;
}

.esm-section-header {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--text-dim);
    font-weight: 700;
    margin-bottom: 14px;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.esm-field {
    margin-bottom: 16px;
}

.esm-label {
    display: block;
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: 6px;
}

.esm-input, .esm-textarea {
    width: 100%;
    padding: 10px 14px;
    background: rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 8px;
    color: var(--text);
    font-size: 14px;
    font-family: var(--font);
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    box-sizing: border-box;
}

.esm-input:focus, .esm-textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(0,212,170,0.1);
}

.esm-textarea {
    resize: vertical;
    min-height: 70px;
    line-height: 1.5;
}

.esm-hint {
    display: block;
    font-size: 11px;
    color: var(--text-dim);
    margin-top: 4px;
}

/* Toggle row */
.esm-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: rgba(0,0,0,0.2);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 10px;
    margin-top: 12px;
}

.esm-toggle-info { flex: 1; }

.esm-toggle-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--white);
}

.esm-toggle-sub {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* Toggle Switch */
.esm-switch {
    position: relative;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
    cursor: pointer;
}

.esm-switch input { display: none; }

.esm-switch-track {
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,0.1);
    border-radius: 12px;
    transition: background 0.25s ease;
}

.esm-switch-track::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: white;
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.esm-switch input:checked + .esm-switch-track {
    background: var(--accent);
}

.esm-switch input:checked + .esm-switch-track::after {
    transform: translateX(20px);
}

/* Actions */
.esm-actions {
    padding-top: 20px;
    border-top: 1px solid rgba(255,255,255,0.06);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.esm-btn-save {
    padding: 10px 28px;
    border: none;
    background: var(--accent-gradient);
    color: white;
    font-size: 14px;
    font-weight: 600;
    border-radius: 10px;
    cursor: pointer;
    font-family: var(--font);
    transition: all 0.2s ease;
}

.esm-btn-save:hover {
    filter: brightness(1.15);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(0,212,170,0.3);
}

.esm-btn-save:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Responsive */
@media (max-width: 700px) {
    .esm-layout { flex-direction: column; }
    .esm-preview {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid rgba(255,255,255,0.05);
        padding: 20px;
    }
    .esm-card-preview { max-width: 280px; margin: 0 auto; }
}. s t a t u s - b a d g e . o n l i n e   {   b a c k g r o u n d :   v a r ( - - g r e e n )   ! i m p o r t a n t ;   }  
 . s t a t u s - b a d g e . i d l e   {   b a c k g r o u n d :   # f 1 c 4 0 f   ! i m p o r t a n t ;   }  
 . s t a t u s - b a d g e . d n d   {   b a c k g r o u n d :   # 3 4 9 8 d b   ! i m p o r t a n t ;   }  
 . s t a t u s - b a d g e . i n v i s i b l e ,   . s t a t u s - b a d g e . o f f l i n e   {   b a c k g r o u n d :   # 9 5 a 5 a 6   ! i m p o r t a n t ;   }  
 