/* Chat System Styles */

:root {
    --bg: #050505;
    --muted: #a0a0a0;
    --text: #f5f5f5;
    --accent: #f5f5f5;
    --accent-2: #cfcfcf;
    --card: rgba(255,255,255,0.04);
    --border: rgba(255,255,255,0.08);
}

body {
    background: radial-gradient(circle at 25% 15%, rgba(255,255,255,0.06), transparent 38%),
                radial-gradient(circle at 80% 0%, rgba(200,200,200,0.05), transparent 42%),
                var(--bg);
    color: var(--text);
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* Hide floating chat buttons everywhere */
.chat-button,
[data-chat-button],
.chat-button.animate-in,
.chat-button.chat-hidden {
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
    width: 0 !important;
    height: 0 !important;
}

/* Chat Button - Top Right - Same animation and style as Discord embed */
.chat-button:not(.animate-in):not(.force-visible) {
    opacity: 0 !important;
    visibility: hidden !important;
    transform: translateY(10px) !important;
}

.chat-button {
    position: fixed !important;
    top: 20px !important;
    right: 20px !important;
    width: 0 !important;
    height: 0 !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
}

/* Monochrome overrides */
a, button, .btn, .send-message-btn, .auth-submit, .start-private-chat,
.create-server-btn, .dm-button, .logout-button, .image-upload-btn,
.chat-close, .panel-close, .dm-filter-btn, .dm-search-btn, .chill-close,
.chill-audio-play, .entry-button {
    background: #0f0f0f !important;
    color: #f5f5f5 !important;
    border-color: rgba(255,255,255,0.15) !important;
    box-shadow: none !important;
}

.send-message-btn:hover,
.auth-submit:hover,
.start-private-chat:hover,
.create-server-btn:hover,
.dm-button:hover,
.logout-button:hover,
.image-upload-btn:hover,
.dm-search-btn:hover,
.dm-filter-btn:hover,
.entry-button:hover {
    background: #1a1a1a !important;
    border-color: rgba(255,255,255,0.25) !important;
}

.chat-header, .chat-sidebar, .chat-input-container, .chat-panel, .card, .panel, .cta-banner {
    background: rgba(255,255,255,0.03) !important;
    border-color: rgba(255,255,255,0.08) !important;
    color: #f5f5f5 !important;
}

.sidebar-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 36px;
    height: 36px;
    background: rgba(20, 20, 20, 0.05);
    border: 1px solid rgba(104, 107, 115, 0.12);
    border-radius: 10px;
    cursor: pointer;
    padding: 8px;
    transition: all 0.2s ease;
}

.sidebar-toggle span {
    display: block;
    height: 2px;
    width: 100%;
    background: #f5f5f5;
    border-radius: 999px;
}

.sidebar-toggle:hover {
    background: rgba(20, 20, 20, 0.08);
    border-color: rgba(104, 107, 115, 0.2);
}

/* Show button when animate-in class is added */
.chat-button.animate-in:not(.chat-hidden) {
    opacity: 1 !important;
    visibility: visible !important;
    transform: translateY(0) !important;
    display: flex !important;
}

.chat-button:hover {
    background: rgba(20, 20, 20, 0.05) !important;
    border-color: rgba(104, 107, 115, 0.12) !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.02) !important;
    color: rgba(104, 107, 115, 1) !important;
    transform: translateY(0) scale(1.05) !important;
}

.chat-button:active {
    transform: translateY(0) scale(0.98) !important;
}

.chat-button svg {
    width: 24px !important;
    height: 24px !important;
    transition: transform 0.2s ease !important;
}

.chat-button:hover svg {
    transform: scale(1.1) !important;
}

/* When entry screen is dismissed, animate in - same as Discord embed */
body.entry-dismissed .chat-button:not(.chat-hidden),
.chat-button.animate-in:not(.chat-hidden) {
    opacity: 1 !important;
    visibility: visible !important;
    transform: translateY(0) !important;
    display: flex !important;
}

/* Hide button when chat is open */
.chat-button.chat-hidden {
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
    transform: translateY(10px) !important;
    display: none !important;
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease !important;
}

/* Also hide when chat container is open - use more specific selector */
.chat-container.chat-open ~ .chat-button,
body:has(.chat-container.chat-open) .chat-button,
.chill-page ~ .chat-button,
body:has(.chill-page) .chat-button {
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
    transform: translateY(10px) !important;
    display: none !important;
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease !important;
}

.chat-button:hover {
    background: rgba(104, 107, 115, 1);
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

.chat-button svg {
    width: 24px;
    height: 24px;
}

/* Chat Container - Full Screen */
.chat-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    /* Transparent glassmorphic style - allows video to show through */
    background: rgba(20, 20, 20, 0.3) !important;
    backdrop-filter: blur(5px) saturate(150%) !important;
    -webkit-backdrop-filter: blur(5px) saturate(150%) !important;
    z-index: 100001; /* Higher than chill page */
    display: flex;
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    box-shadow: 0 0 32px rgba(0, 0, 0, 0.3), inset 0 0 0 rgba(255, 255, 255, 0.01) !important;
}

.chat-container.chat-open {
    opacity: 1;
    visibility: visible;
}

/* Notice bar for retention info */
.chat-notice {
    width: 100%;
    background: rgba(20, 20, 20, 0.35);
    border-bottom: 1px solid rgba(104, 107, 115, 0.18);
    color: rgba(255, 255, 255, 0.85);
    padding: 8px 14px;
    font-size: 13px;
    letter-spacing: 0.1px;
    text-align: center;
}

/* When on chill page, chat should be visible */
.chill-page .chat-container.chat-open {
    opacity: 1;
    visibility: visible;
    z-index: 100001;
}

/* Chat Header */
.chat-header {
    padding: 20px;
    background: rgba(20, 20, 20, 0.03) !important;
    backdrop-filter: blur(5px) saturate(150%) !important;
    -webkit-backdrop-filter: blur(5px) saturate(150%) !important;
    border-bottom: 1px solid rgba(104, 107, 115, 0.06) !important;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-header-left {
    display: flex;
    align-items: center;
    gap: 15px;
    flex: 1;
}

.chat-header-buttons {
    display: flex;
    gap: 10px;
    margin-left: auto;
}

.settings-button,
.dm-button,
.logout-button {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(20, 20, 20, 0.02) !important;
    backdrop-filter: blur(3px) saturate(150%) !important;
    -webkit-backdrop-filter: blur(3px) saturate(150%) !important;
    border: 1px solid rgba(104, 107, 115, 0.06) !important;
    border-radius: 8px;
    cursor: pointer;
    padding: 0;
    margin: 0;
    pointer-events: auto !important;
    transition: all 0.2s ease;
    color: rgba(104, 107, 115, 0.9) !important;
}

.settings-button svg,
.dm-button svg,
.logout-button svg {
    width: 20px;
    height: 20px;
    pointer-events: none;
    color: rgba(104, 107, 115, 0.9) !important;
    stroke: rgba(104, 107, 115, 0.9) !important;
}

.settings-button:hover,
.dm-button:hover,
.logout-button:hover {
    background: rgba(20, 20, 20, 0.08) !important;
    border-color: rgba(104, 107, 115, 0.12) !important;
    transform: translateY(-1px);
    color: rgba(104, 107, 115, 1) !important;
}

.settings-button:hover svg,
.dm-button:hover svg,
.logout-button:hover svg {
    color: rgba(104, 107, 115, 1) !important;
    stroke: rgba(104, 107, 115, 1) !important;
}

.dm-button:hover {
    background: rgba(20, 20, 20, 0.08) !important;
    border-color: rgba(104, 107, 115, 0.12) !important;
    transform: translateY(-1px);
}

/* Ensure chat button stays hidden when chat or chill page is open - VERY AGGRESSIVE */
.chat-container.chat-open ~ .chat-button,
body:has(.chat-container.chat-open) .chat-button,
.chill-page ~ .chat-button,
body:has(.chill-page) .chat-button,
.chat-button.chat-hidden {
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
    transform: translateY(10px) !important;
}

/* Prevent button from showing when chat or chill page is open - multiple selectors */
.chat-container.chat-open ~ .chat-button,
body:has(.chat-container.chat-open) .chat-button,
.chill-page ~ .chat-button,
body:has(.chill-page) .chat-button {
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

/* Force hide if chat container or chill page exists and is open */
body:has(.chat-container.chat-open) .chat-button,
body:has(.chill-page) .chat-button {
    display: none !important;
}

.chat-header h3 {
    margin: 0;
    color: #686b73;
    font-size: 18px;
    font-weight: 600;
}

.chat-close {
    background: none;
    border: none;
    color: #686b73;
    font-size: 28px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
}

.chat-close:hover {
    background: rgba(104, 107, 115, 0.2);
    color: #1f2732;
}

/* Chat Main */
.chat-main {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Chat Sidebar */
.chat-sidebar {
    width: 180px;
    background: rgba(20, 20, 20, 0.01) !important;
    backdrop-filter: blur(5px) saturate(150%) !important;
    -webkit-backdrop-filter: blur(5px) saturate(150%) !important;
    border-right: 1px solid rgba(104, 107, 115, 0.06) !important;
    overflow-y: auto;
    padding: 15px;
}

.chat-section {
    margin-bottom: 25px;
}

.chat-section h4 {
    margin: 0 0 10px 0;
    color: rgba(104, 107, 115, 0.7);
    font-size: 12px;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 1px;
}

.room-list,
.private-chat-list {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.public-room-item,
.private-chat-item {
    padding: 10px 12px;
    background: rgba(20, 20, 20, 0.02) !important;
    border: 1px solid rgba(104, 107, 115, 0.06) !important;
    border-radius: 12px;
    color: rgba(104, 107, 115, 0.9);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
    backdrop-filter: blur(3px) saturate(150%) !important;
    -webkit-backdrop-filter: blur(3px) saturate(150%) !important;
}

.public-room-item:hover,
.private-chat-item:hover {
    background: rgba(20, 20, 20, 0.05) !important;
    border-color: rgba(104, 107, 115, 0.12) !important;
    transform: translateX(2px);
}

.public-room-item.active,
.private-chat-item.active {
    background: rgba(20, 20, 20, 0.08) !important;
    border-color: rgba(104, 107, 115, 0.2) !important;
    color: rgba(104, 107, 115, 1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.01) !important;
}

.start-private-chat {
    width: 100%;
    padding: 10px;
    background: rgba(20, 20, 20, 0.05) !important;
    backdrop-filter: blur(3px) saturate(150%) !important;
    -webkit-backdrop-filter: blur(3px) saturate(150%) !important;
    border: 1px solid rgba(104, 107, 115, 0.12) !important;
    border-radius: 12px;
    color: rgba(104, 107, 115, 0.9);
    cursor: pointer;
    font-size: 14px;
    margin-bottom: 10px;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05), inset 0 1px 0 rgba(255, 255, 255, 0.01) !important;
}

.start-private-chat:hover {
    background: rgba(20, 20, 20, 0.08) !important;
    border-color: rgba(104, 107, 115, 0.2) !important;
    transform: translateY(-1px);
}

.logout-btn {
    width: 100%;
    padding: 10px;
    background: rgba(20, 20, 20, 0.03) !important;
    backdrop-filter: blur(3px) saturate(150%) !important;
    -webkit-backdrop-filter: blur(3px) saturate(150%) !important;
    border: 1px solid rgba(104, 107, 115, 0.1) !important;
    border-radius: 12px;
    color: rgba(104, 107, 115, 0.9);
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05), inset 0 1px 0 rgba(255, 255, 255, 0.01) !important;
}

.logout-btn:hover {
    background: rgba(20, 20, 20, 0.06) !important;
    border-color: rgba(104, 107, 115, 0.18) !important;
    transform: translateY(-1px);
}

.no-chats {
    color: rgba(104, 107, 115, 0.5);
    font-size: 12px;
    padding: 10px;
    text-align: center;
}

/* Chat Content */
.chat-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.chat-welcome {
    color: rgba(104, 107, 115, 0.6);
    text-align: center;
    padding: 40px 20px;
    font-size: 14px;
}

.message {
    padding: 12px 15px;
    background: rgba(20, 20, 20, 0.02) !important;
    backdrop-filter: blur(3px) saturate(150%) !important;
    -webkit-backdrop-filter: blur(3px) saturate(150%) !important;
    border: 1px solid rgba(104, 107, 115, 0.06) !important;
    border-radius: 12px;
    max-width: 80%;
    align-self: flex-start;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05), inset 0 1px 0 rgba(255, 255, 255, 0.01) !important;
}

.message.own-message {
    align-self: flex-end;
    background: rgba(20, 20, 20, 0.05) !important;
    border-color: rgba(104, 107, 115, 0.12) !important;
}

.message-author {
    font-size: 12px;
    color: rgba(104, 107, 115, 0.8);
    font-weight: 600;
    margin-bottom: 5px;
}

.message-text {
    color: #686b73;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
}

.message-image {
    max-width: 100%;
    max-height: 400px;
    border-radius: 8px;
    margin: 8px 0;
    display: block;
    object-fit: contain;
}

.message-video {
    max-width: 100%;
    max-height: 400px;
    border-radius: 8px;
    margin: 8px 0;
    display: block;
    object-fit: contain;
}

.message-time {
    font-size: 10px;
    color: rgba(104, 107, 115, 0.5);
    margin-top: 5px;
}

.chat-input-container {
    padding: 15px 20px;
    background: rgba(20, 20, 20, 0.03) !important;
    backdrop-filter: blur(5px) saturate(150%) !important;
    -webkit-backdrop-filter: blur(5px) saturate(150%) !important;
    border-top: 1px solid rgba(104, 107, 115, 0.06) !important;
    display: flex;
    gap: 10px;
    align-items: center;
}

.image-upload-btn {
    width: 40px;
    height: 40px;
    background: rgba(20, 20, 20, 0.05) !important;
    backdrop-filter: blur(3px) saturate(150%) !important;
    -webkit-backdrop-filter: blur(3px) saturate(150%) !important;
    border: 1px solid rgba(104, 107, 115, 0.06) !important;
    border-radius: 8px;
    color: rgba(104, 107, 115, 0.9);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    padding: 0;
    flex-shrink: 0;
}

.image-upload-btn:hover {
    background: rgba(20, 20, 20, 0.08) !important;
    border-color: rgba(104, 107, 115, 0.12) !important;
}

.message-input {
    flex: 1;
    padding: 12px 15px;
    background: rgba(20, 20, 20, 0.02) !important;
    backdrop-filter: blur(3px) saturate(150%) !important;
    -webkit-backdrop-filter: blur(3px) saturate(150%) !important;
    border: 1px solid rgba(104, 107, 115, 0.06) !important;
    border-radius: 12px;
    color: rgba(104, 107, 115, 0.9);
    font-size: 14px;
    outline: none;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05), inset 0 1px 0 rgba(255, 255, 255, 0.01) !important;
}

.message-input:focus {
    border-color: rgba(104, 107, 115, 0.15) !important;
    background: rgba(20, 20, 20, 0.05) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.02) !important;
}

.message-input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.send-message-btn {
    padding: 12px 20px;
    background: rgba(20, 20, 20, 0.05) !important;
    backdrop-filter: blur(3px) saturate(150%) !important;
    -webkit-backdrop-filter: blur(3px) saturate(150%) !important;
    border: 1px solid rgba(104, 107, 115, 0.12) !important;
    border-radius: 12px;
    color: rgba(104, 107, 115, 0.9);
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05), inset 0 1px 0 rgba(255, 255, 255, 0.01) !important;
}

.send-message-btn:hover:not(:disabled) {
    background: rgba(20, 20, 20, 0.08) !important;
    border-color: rgba(104, 107, 115, 0.2) !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.02) !important;
}

.send-message-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Auth Styles */
.chat-auth {
    flex: 1;
    padding: 30px 20px;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.auth-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 25px;
    flex-shrink: 0;
}

.auth-tab {
    flex: 1;
    padding: 12px;
    background: rgba(20, 20, 20, 0.02) !important;
    backdrop-filter: blur(3px) saturate(150%) !important;
    -webkit-backdrop-filter: blur(3px) saturate(150%) !important;
    border: 1px solid rgba(104, 107, 115, 0.06) !important;
    border-radius: 12px;
    color: rgba(104, 107, 115, 0.9);
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05), inset 0 1px 0 rgba(255, 255, 255, 0.01) !important;
}

.auth-tab.active {
    background: rgba(20, 20, 20, 0.08) !important;
    border-color: rgba(104, 107, 115, 0.2) !important;
    color: rgba(104, 107, 115, 1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.02) !important;
}

.auth-tab:hover {
    background: rgba(20, 20, 20, 0.05) !important;
    border-color: rgba(104, 107, 115, 0.12) !important;
}

.auth-content {
    flex: 1;
    position: relative;
    min-height: 0;
    width: 100%;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 100%;
    position: relative;
    box-sizing: border-box;
}

#login-form {
    width: 100%;
    box-sizing: border-box;
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

#register-form {
    width: 100%;
    box-sizing: border-box;
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.auth-input {
    padding: 12px 15px;
    background: rgba(20, 20, 20, 0.02) !important;
    backdrop-filter: blur(3px) saturate(150%) !important;
    -webkit-backdrop-filter: blur(3px) saturate(150%) !important;
    border: 1px solid rgba(104, 107, 115, 0.06) !important;
    border-radius: 12px;
    color: rgba(104, 107, 115, 0.9);
    font-size: 14px;
    outline: none;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05), inset 0 1px 0 rgba(255, 255, 255, 0.01) !important;
    width: 100%;
    box-sizing: border-box;
    margin: 0 !important;
    position: relative;
    z-index: 1;
    flex-shrink: 0;
}

.auth-input:focus {
    border-color: rgba(104, 107, 115, 0.15) !important;
    background: rgba(20, 20, 20, 0.05) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.02) !important;
}

.auth-input::placeholder {
    color: rgba(104, 107, 115, 0.5);
}

.auth-submit {
    padding: 12px;
    background: rgba(20, 20, 20, 0.05) !important;
    backdrop-filter: blur(3px) saturate(150%) !important;
    -webkit-backdrop-filter: blur(3px) saturate(150%) !important;
    border: 1px solid rgba(104, 107, 115, 0.12) !important;
    border-radius: 12px;
    color: rgba(104, 107, 115, 0.9);
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s ease;
    margin-top: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05), inset 0 1px 0 rgba(255, 255, 255, 0.01) !important;
}

.auth-submit:hover {
    background: rgba(20, 20, 20, 0.08) !important;
    border-color: rgba(104, 107, 115, 0.2) !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.02) !important;
}

.auth-error {
    color: rgba(255, 100, 100, 0.8);
    font-size: 12px;
    padding: 8px;
    background: rgba(255, 100, 100, 0.1);
    border-radius: 6px;
    display: none;
}

/* Backend Turning On Overlay */
.backend-turning-on-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: rgba(5, 5, 5, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 100003;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.backend-turning-on-content {
    text-align: center;
    padding: 40px;
    background: rgba(20, 20, 20, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    max-width: 400px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.backend-turning-on-content h3 {
    margin: 20px 0 10px;
    color: rgba(255, 255, 255, 0.9);
    font-size: 22px;
    font-weight: 600;
}

.backend-turning-on-content p {
    margin: 10px 0;
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
    line-height: 1.6;
}

.backend-status {
    margin-top: 20px !important;
    color: rgba(255, 255, 255, 0.8) !important;
    font-weight: 500;
}

.backend-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top-color: rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    margin: 0 auto;
    animation: spin 1s linear infinite;
}

.backend-retry-btn {
    margin-top: 20px;
    padding: 12px 24px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.9);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.backend-retry-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

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

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Scrollbar Styles */
.chat-sidebar::-webkit-scrollbar,
.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-sidebar::-webkit-scrollbar-track,
.chat-messages::-webkit-scrollbar-track {
    background: rgba(104, 107, 115, 0.05);
}

.chat-sidebar::-webkit-scrollbar-thumb,
.chat-messages::-webkit-scrollbar-thumb {
    background: rgba(104, 107, 115, 0.3);
    border-radius: 3px;
}

.chat-sidebar::-webkit-scrollbar-thumb:hover,
.chat-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(104, 107, 115, 0.5);
}

/* Chat Panels (DM and Servers) */
.chat-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 400px;
    max-height: 600px;
    background: rgba(20, 20, 20, 0.05) !important;
    backdrop-filter: blur(10px) saturate(150%) !important;
    -webkit-backdrop-filter: blur(10px) saturate(150%) !important;
    border: 1px solid rgba(104, 107, 115, 0.1) !important;
    border-radius: 16px;
    z-index: 100002 !important; /* Higher than chat container */
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.01) !important;
}

.panel-header {
    padding: 20px;
    border-bottom: 1px solid rgba(104, 107, 115, 0.06) !important;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel-header h4 {
    margin: 0;
    color: rgba(104, 107, 115, 0.9);
    font-size: 18px;
    font-weight: 600;
}

.panel-close {
    background: none;
    border: none;
    color: rgba(104, 107, 115, 0.9);
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s;
}

.panel-close:hover {
    background: rgba(104, 107, 115, 0.1);
}

.panel-content {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.dm-search {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}


.dm-filters {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
}

.dm-filter-btn {
    flex: 1;
    padding: 8px 10px;
    background: rgba(20, 20, 20, 0.08);
    border: 1px solid rgba(104, 107, 115, 0.2);
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    font-size: 13px;
}

.dm-filter-btn.active {
    background: rgba(104, 107, 115, 0.2);
    border-color: rgba(104, 107, 115, 0.4);
    color: #fff;
}

.dm-search-input {
    flex: 1;
    padding: 10px 15px;
    background: rgba(20, 20, 20, 0.02) !important;
    backdrop-filter: blur(3px) saturate(150%) !important;
    -webkit-backdrop-filter: blur(3px) saturate(150%) !important;
    border: 1px solid rgba(104, 107, 115, 0.06) !important;
    border-radius: 8px;
    color: rgba(104, 107, 115, 0.9);
    font-size: 14px;
    outline: none;
}

.dm-search-btn {
    padding: 10px 20px;
    background: rgba(20, 20, 20, 0.05) !important;
    backdrop-filter: blur(3px) saturate(150%) !important;
    -webkit-backdrop-filter: blur(3px) saturate(150%) !important;
    border: 1px solid rgba(104, 107, 115, 0.12) !important;
    border-radius: 8px;
    color: rgba(104, 107, 115, 0.9);
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s ease;
}

.dm-search-btn:hover {
    background: rgba(20, 20, 20, 0.08) !important;
    border-color: rgba(104, 107, 115, 0.2) !important;
}

.dm-list,
.server-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.dm-item,
.server-item {
    padding: 12px 15px;
    background: rgba(20, 20, 20, 0.02) !important;
    backdrop-filter: blur(3px) saturate(150%) !important;
    -webkit-backdrop-filter: blur(3px) saturate(150%) !important;
    border: 1px solid rgba(104, 107, 115, 0.06) !important;
    border-radius: 8px;
    color: rgba(104, 107, 115, 0.9);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
}

.dm-item:hover,
.server-item:hover {
    background: rgba(20, 20, 20, 0.05) !important;
    border-color: rgba(104, 107, 115, 0.12) !important;
}

.dm-item.active,
.server-item.active {
    background: rgba(20, 20, 20, 0.08) !important;
    border-color: rgba(104, 107, 115, 0.2) !important;
}

.dm-item-main {
    font-weight: 600;
    color: #fff;
}

.dm-item-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
    font-size: 12px;
    color: rgba(255,255,255,0.7);
}

.dm-pill {
    padding: 2px 6px;
    border-radius: 999px;
    background: rgba(104, 107, 115, 0.3);
    border: 1px solid rgba(104, 107, 115, 0.35);
    font-size: 11px;
    color: #fff;
}

.dm-preview {
    flex: 1;
    min-width: 0;
    color: rgba(255,255,255,0.65);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.create-server-btn {
    width: 100%;
    padding: 12px;
    background: rgba(20, 20, 20, 0.05) !important;
    backdrop-filter: blur(3px) saturate(150%) !important;
    -webkit-backdrop-filter: blur(3px) saturate(150%) !important;
    border: 1px solid rgba(104, 107, 115, 0.12) !important;
    border-radius: 8px;
    color: rgba(104, 107, 115, 0.9);
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 20px;
    transition: all 0.2s ease;
}

.create-server-btn:hover {
    background: rgba(20, 20, 20, 0.08) !important;
    border-color: rgba(104, 107, 115, 0.2) !important;
}

.no-items {
    text-align: center;
    color: rgba(104, 107, 115, 0.5);
    padding: 40px 20px;
    font-size: 14px;
}

/* Chill Page - Full Screen with Background Video and Music */
.chill-page {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 100000;
    overflow: hidden;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.chill-page.active {
    opacity: 1;
}

.chill-background-video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 1;
}

.chill-content {
    position: relative;
    z-index: 2;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chill-close {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    background: rgba(20, 20, 20, 0.3) !important;
    backdrop-filter: blur(10px) saturate(150%) !important;
    -webkit-backdrop-filter: blur(10px) saturate(150%) !important;
    border: 1px solid rgba(104, 107, 115, 0.2) !important;
    border-radius: 50%;
    color: rgba(255, 255, 255, 0.9);
    font-size: 32px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: all 0.3s ease;
    padding: 0;
    margin: 0;
    line-height: 1;
}

.chill-close:hover {
    background: rgba(20, 20, 20, 0.5) !important;
    border-color: rgba(104, 107, 115, 0.4) !important;
    transform: scale(1.1);
}

.chill-audio-play {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    padding: 15px 30px;
    background: rgba(20, 20, 20, 0.4) !important;
    backdrop-filter: blur(10px) saturate(150%) !important;
    -webkit-backdrop-filter: blur(10px) saturate(150%) !important;
    border: 1px solid rgba(104, 107, 115, 0.3) !important;
    border-radius: 25px;
    color: rgba(255, 255, 255, 0.9);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    z-index: 10;
    transition: all 0.3s ease;
}

.chill-audio-play:hover {
    background: rgba(20, 20, 20, 0.6) !important;
    border-color: rgba(104, 107, 115, 0.5) !important;
    transform: translateX(-50%) translateY(-2px);
}

.chill-music {
    display: none; /* Hide audio element */
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .chat-container {
        width: 100%;
        right: -100%;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
    }

    .chat-container.chat-open {
        right: 0;
        width: 100%;
    }

    .chat-header {
        padding: 15px;
        flex-wrap: wrap;
        gap: 10px;
    }

    .chat-header-left {
        flex: 1;
        min-width: 0;
    }

    .chat-header h3 {
        font-size: 16px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 150px;
    }

    .chat-header-buttons {
        gap: 8px;
        flex-shrink: 0;
    }

    .settings-button,
    .dm-button,
    .logout-button {
        width: 36px;
        height: 36px;
    }

    .settings-button svg,
    .dm-button svg,
    .logout-button svg {
        width: 18px;
        height: 18px;
    }

    .chat-close {
        width: 36px;
        height: 36px;
        font-size: 24px;
    }

    .chat-main {
        flex-direction: column;
    }

    .chat-content {
        flex: 1;
        min-height: 0;
    }

    .chat-messages {
        padding: 15px;
        font-size: 14px;
    }

    .message {
        padding: 10px;
        margin-bottom: 12px;
    }

    .message-author {
        font-size: 13px;
        margin-bottom: 6px;
    }

    .message-text {
        font-size: 14px;
        line-height: 1.5;
    }

    .message-time {
        font-size: 11px;
    }

    .chat-input-container {
        padding: 12px;
        gap: 8px;
        flex-wrap: nowrap;
    }

    .message-input {
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 10px 12px;
        flex: 1;
        min-width: 0;
    }

    .send-message-btn {
        padding: 10px 16px;
        font-size: 14px;
        white-space: nowrap;
    }

    .image-upload-btn {
        width: 40px;
        height: 40px;
        flex-shrink: 0;
    }

    .chat-panel {
        width: 100%;
        max-width: 100%;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
        top: 0;
        right: -100%;
    }

    .chat-panel.panel-open {
        right: 0;
    }

    .chat-sidebar {
        width: 100%;
        max-width: 100%;
    }

    .settings-modal-content {
        width: 95%;
        max-width: 95%;
        max-height: 90vh;
        margin: 20px auto;
    }

    .settings-modal-header {
        padding: 20px;
    }

    .settings-modal-header h2 {
        font-size: 20px;
    }

    .settings-modal-body {
        padding: 20px;
    }

    .settings-section {
        margin-bottom: 24px;
    }

    .settings-section h3 {
        font-size: 16px;
    }

    .settings-input-group {
        flex-direction: column;
        gap: 10px;
    }

    .settings-input {
        width: 100%;
        font-size: 16px; /* Prevents zoom on iOS */
    }

    .settings-btn {
        width: 100%;
        padding: 12px;
        font-size: 14px;
    }

    .settings-pfp-preview {
        width: 100px;
        height: 100px;
    }
    
    .chill-close {
        top: 15px;
        right: 15px;
        width: 45px;
        height: 45px;
        font-size: 28px;
    }
    
    .chill-audio-play {
        bottom: 20px;
        padding: 12px 24px;
        font-size: 14px;
    }

    /* DM Panel Mobile */
    .dm-panel {
        width: 100%;
        max-width: 100%;
    }

    .dm-search-input {
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 12px;
    }

    .dm-list-item {
        padding: 12px;
        font-size: 14px;
    }

    .dm-search {
        flex-direction: column;
        gap: 10px;
    }

    .dm-search-btn {
        width: 100%;
    }

    .dm-filters {
        flex-wrap: wrap;
    }

    .dm-filter-btn {
        font-size: 12px;
        padding: 8px;
    }

    .message {
        max-width: 90%;
        padding: 10px 12px;
    }

    .message-image,
    .message-video {
        max-height: 250px;
    }

    .chat-notice {
        padding: 6px 12px;
        font-size: 12px;
    }

    /* Auth forms mobile */
    .auth-input {
        font-size: 16px; /* Prevents zoom on iOS */
    }

    .auth-submit {
        font-size: 16px;
        padding: 14px 20px;
    }

    /* Header mobile */
    header {
        padding: 16px;
        flex-wrap: wrap;
    }

    .header-actions {
        width: 100%;
        justify-content: center;
        margin-top: 12px;
        gap: 8px;
    }

    .header-actions .btn {
        flex: 1;
        max-width: 150px;
        padding: 10px 14px;
        font-size: 14px;
    }

    /* Hero section mobile */
    .hero {
        grid-template-columns: 1fr;
        gap: 20px;
        margin-top: 20px;
    }

    .hero-card {
        padding: 20px;
    }

    h1 {
        font-size: 28px;
    }

    .lead {
        font-size: 16px;
    }
}

/* Very small screens */
@media (max-width: 480px) {
    .chat-header {
        padding: 12px;
    }

    .chat-header h3 {
        font-size: 14px;
        max-width: 120px;
    }

    .settings-button,
    .dm-button,
    .logout-button {
        width: 32px;
        height: 32px;
    }

    .settings-button svg,
    .dm-button svg,
    .logout-button svg {
        width: 16px;
        height: 16px;
    }

    .chat-messages {
        padding: 12px;
    }

    .message {
        max-width: 95%;
        padding: 8px 10px;
    }

    .message-text {
        font-size: 13px;
    }

    .chat-input-container {
        padding: 10px;
    }

    .message-input {
        font-size: 16px;
        padding: 8px 10px;
    }

    .send-message-btn {
        padding: 8px 12px;
        font-size: 13px;
    }

    .settings-modal-content {
        width: 100%;
        max-width: 100%;
        margin: 0;
        border-radius: 0;
        max-height: 100vh;
    }

    .settings-modal-header {
        padding: 16px;
    }

    .settings-modal-body {
        padding: 16px;
    }

    .settings-pfp-preview {
        width: 80px;
        height: 80px;
    }
}

/* Code Verification Popup */
.code-verification-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.code-verification-content {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 32px;
    max-width: 420px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.code-verification-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.code-verification-header h3 {
    margin: 0;
    font-size: 24px;
    font-weight: 600;
    color: var(--text);
    letter-spacing: -0.02em;
}

.code-verification-close {
    background: transparent;
    border: none;
    color: var(--muted);
    font-size: 32px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.code-verification-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text);
}

.code-verification-body {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.code-verification-body p {
    margin: 0;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.5;
}

.code-verification-body p strong {
    color: var(--text);
    font-weight: 600;
}

.code-verification-hint {
    font-size: 13px !important;
    color: var(--muted) !important;
}

.code-verification-input {
    width: 100%;
    padding: 16px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text);
    font-size: 24px;
    font-weight: 600;
    text-align: center;
    letter-spacing: 8px;
    font-family: 'Inter', monospace;
    outline: none;
    transition: all 0.2s ease;
}

.code-verification-input:focus {
    border-color: rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.04);
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.1);
}

.code-verification-input::placeholder {
    color: var(--muted);
    letter-spacing: 0;
    font-size: 14px;
}

.code-verification-error {
    display: none;
    padding: 12px;
    background: rgba(255, 100, 100, 0.1);
    border: 1px solid rgba(255, 100, 100, 0.3);
    border-radius: 8px;
    color: rgba(255, 100, 100, 0.9);
    font-size: 13px;
    text-align: center;
}

.code-verification-actions {
    display: flex;
    gap: 12px;
    margin-top: 8px;
}

.code-verification-submit,
.code-verification-cancel {
    flex: 1;
    padding: 14px 20px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    border: none;
}

.code-verification-submit {
    background: var(--accent);
    color: #050505;
}

.code-verification-submit:hover:not(:disabled) {
    opacity: 0.9;
    transform: translateY(-1px);
}

.code-verification-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.code-verification-cancel {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text);
    border: 1px solid var(--border);
}

.code-verification-cancel:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

@media (max-width: 768px) {
    .code-verification-content {
        padding: 24px;
        max-width: 100%;
        width: 95%;
    }

    .code-verification-header h3 {
        font-size: 20px;
    }

    .code-verification-input {
        font-size: 20px;
        letter-spacing: 6px;
        padding: 14px;
    }
}

/* Settings Modal */
.settings-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100002;
    padding: 20px;
}

.settings-modal-content {
    background: rgba(20, 20, 20, 0.95);
    border: 1px solid rgba(104, 107, 115, 0.2);
    border-radius: 16px;
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.settings-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px;
    border-bottom: 1px solid rgba(104, 107, 115, 0.1);
}

.settings-modal-header h2 {
    margin: 0;
    font-size: 24px;
    font-weight: 600;
    color: #f5f5f5;
}

.settings-close {
    background: none;
    border: none;
    color: rgba(104, 107, 115, 0.9);
    font-size: 32px;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.settings-close:hover {
    background: rgba(104, 107, 115, 0.1);
    color: #f5f5f5;
}

.settings-modal-body {
    padding: 24px;
}

.settings-section {
    margin-bottom: 32px;
}

.settings-section:last-child {
    margin-bottom: 0;
}

.settings-section h3 {
    margin: 0 0 16px;
    font-size: 18px;
    font-weight: 600;
    color: #f5f5f5;
}

.settings-pfp-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.settings-pfp-preview {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    overflow: hidden;
    background: rgba(104, 107, 115, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid rgba(104, 107, 115, 0.2);
}

.settings-pfp-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.settings-pfp-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(104, 107, 115, 0.5);
}

.settings-input-group {
    display: flex;
    gap: 12px;
    margin-bottom: 8px;
}

.settings-input {
    flex: 1;
    padding: 12px 16px;
    background: rgba(104, 107, 115, 0.05);
    border: 1px solid rgba(104, 107, 115, 0.2);
    border-radius: 8px;
    color: #f5f5f5;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: all 0.2s ease;
}

.settings-input:focus {
    border-color: rgba(104, 107, 115, 0.4);
    background: rgba(104, 107, 115, 0.08);
}

.settings-btn {
    padding: 12px 20px;
    background: rgba(104, 107, 115, 0.1);
    border: 1px solid rgba(104, 107, 115, 0.2);
    border-radius: 8px;
    color: #f5f5f5;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.settings-btn:hover:not(:disabled) {
    background: rgba(104, 107, 115, 0.2);
    border-color: rgba(104, 107, 115, 0.3);
    transform: translateY(-1px);
}

.settings-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.settings-error {
    color: rgba(255, 100, 100, 0.9);
    font-size: 13px;
    margin-top: 8px;
    display: none;
}

.settings-error.show {
    display: block;
}

.settings-success {
    color: #4ade80;
    font-size: 13px;
    margin-top: 8px;
    display: none;
}

.settings-success.show {
    display: block;
}

.settings-info {
    color: rgba(104, 107, 115, 0.8);
    font-size: 13px;
    margin-top: 8px;
}

/* Black and White Chat Interface Styles */
.chat-container {
    display: flex !important;
    flex-direction: row !important;
    background: #000000 !important;
}

/* Sidebar */
.chat-sidebar {
    width: 260px;
    background: #0a0a0a;
    border-right: 1px solid #1a1a1a;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid #1a1a1a;
}

.sidebar-title {
    margin: 0;
    font-size: 24px;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: -0.5px;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 16px 0;
}

.nav-section {
    margin-bottom: 24px;
}

.nav-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px 12px;
}

.nav-section-title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #666666;
}

.nav-add-btn {
    background: none;
    border: none;
    color: #666666;
    font-size: 18px;
    cursor: pointer;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.nav-add-btn:hover {
    color: #ffffff;
    background: #1a1a1a;
    border-radius: 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    color: #999999;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 15px;
    border-left: 3px solid transparent;
}

.nav-item:hover {
    background: #1a1a1a;
    color: #ffffff;
}

.nav-item.active {
    background: #1a1a1a;
    color: #ffffff;
    border-left-color: #ffffff;
}

.nav-icon {
    font-weight: 600;
    width: 20px;
    text-align: center;
}

.nav-label {
    flex: 1;
}

.dm-list-sidebar {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 0 20px;
    max-height: 300px;
    overflow-y: auto;
}

.dm-item-sidebar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    border-radius: 6px;
    color: #999999;
    cursor: pointer;
    transition: all 0.2s ease;
}

.dm-item-sidebar:hover {
    background: #1a1a1a;
    color: #ffffff;
}

.dm-item-sidebar.active {
    background: #1a1a1a;
    color: #ffffff;
}

.dm-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    flex-shrink: 0;
    overflow: hidden;
    background: #1a1a1a;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.dm-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.dm-username-wrap {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.dm-status-badge {
    font-size: 11px;
    color: #f5f5f5;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    padding: 2px 6px;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: 0.2px;
}

.avatar-fallback {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-weight: 600;
    font-size: 14px;
    background: #333333;
}

.dm-username {
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

/* Message Requests */
.request-list-sidebar {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 0 20px;
    max-height: 300px;
    overflow-y: auto;
}

.request-item-sidebar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    border-radius: 6px;
    color: #999999;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid #1a1a1a;
}

.request-item-sidebar:hover {
    background: #1a1a1a;
    color: #ffffff;
    border-color: #333333;
}

.request-info {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-width: 0;
}

.request-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.accept-btn,
.decline-btn {
    width: 24px;
    height: 24px;
    background: #1a1a1a;
    border: 1px solid #333333;
    color: #ffffff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
    font-size: 16px;
    line-height: 1;
    padding: 0;
}

.accept-btn:hover {
    background: #2a2a2a;
    border-color: #4a4a4a;
    color: #4ade80;
}

.decline-btn:hover {
    background: #2a2a2a;
    border-color: #4a4a4a;
    color: #ff6b6b;
}

.request-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    background: #ffffff;
    color: #000000;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    padding: 0 6px;
    margin-left: 4px;
}

/* User Search */
.user-search-section {
    padding: 0 20px;
}

.user-search-input {
    width: 100%;
    padding: 10px 12px;
    background: #1a1a1a;
    border: 1px solid #1a1a1a;
    border-radius: 6px;
    color: #ffffff;
    font-size: 14px;
    outline: none;
    transition: all 0.2s ease;
    margin-bottom: 8px;
}

.user-search-input:focus {
    border-color: #333333;
    background: #0f0f0f;
}

.user-search-input::placeholder {
    color: #666666;
}

.user-search-results {
    display: flex;
    flex-direction: column;
    gap: 2px;
    max-height: 300px;
    overflow-y: auto;
}

.user-search-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    border-radius: 6px;
    color: #999999;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.user-search-item:hover {
    background: #1a1a1a;
    color: #ffffff;
    border-color: #333333;
}

.message-user-btn {
    margin-left: auto;
    padding: 6px 12px;
    background: #ffffff;
    border: none;
    color: #000000;
    cursor: pointer;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.message-user-btn:hover {
    background: #cccccc;
}

.no-dms {
    padding: 16px;
    color: #666666;
    font-size: 13px;
    text-align: center;
}

.sidebar-footer {
    border-top: 1px solid #1a1a1a;
    padding: 12px;
    background: #0a0a0a;
}

.user-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px;
    border-radius: 8px;
    transition: background 0.2s ease;
}

.user-card:hover {
    background: #1a1a1a;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    flex-shrink: 0;
    overflow: hidden;
    background: #1a1a1a;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

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

.user-name {
    font-size: 14px;
    font-weight: 600;
    color: #ffffff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-status {
    font-size: 12px;
    color: #666666;
}

.user-menu {
    display: flex;
    gap: 4px;
}

.menu-btn {
    width: 32px;
    height: 32px;
    background: none;
    border: none;
    color: #666666;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.menu-btn:hover {
    background: #1a1a1a;
    color: #ffffff;
}

/* Chat Main Area */
.chat-main-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #000000;
    overflow: hidden;
}

.chat-header {
    height: 60px;
    background: #0a0a0a;
    border-bottom: 1px solid #1a1a1a;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
}

.header-left {
    flex: 1;
}

.chat-title {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: #ffffff;
    letter-spacing: -0.3px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-btn {
    width: 36px;
    height: 36px;
    background: none;
    border: none;
    color: #666666;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s ease;
    font-size: 24px;
    line-height: 1;
}

.header-btn:hover {
    background: #1a1a1a;
    color: #ffffff;
}

.chat-notice {
    background: #1a1a1a;
    color: #999999;
    padding: 12px 24px;
    font-size: 13px;
    border-bottom: 1px solid #1a1a1a;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.message-item {
    display: flex;
    gap: 16px;
    padding: 8px 0;
    transition: background-color 0.15s ease;
    border-radius: 4px;
    margin: 0 -8px;
    padding-left: 8px;
    padding-right: 8px;
}

.message-item:hover {
    background: rgba(255, 255, 255, 0.02);
}

.message-item.grouped {
    padding-top: 2px;
}

.message-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    flex-shrink: 0;
    overflow: hidden;
    background: #1a1a1a;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    margin-top: 2px;
}

.message-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.message-avatar-spacer {
    width: 44px;
    flex-shrink: 0;
}

.message-content {
    flex: 1;
    min-width: 0;
}

.message-header {
    display: flex;
    align-items: baseline;
    gap: 12px;
    margin-bottom: 4px;
}

.message-author {
    font-size: 15px;
    font-weight: 600;
    color: #ffffff;
    cursor: pointer;
}

.message-author:hover {
    text-decoration: underline;
}

.message-time {
    font-size: 12px;
    color: #666666;
}

.message-body {
    color: #cccccc;
    font-size: 15px;
    line-height: 1.5;
    word-wrap: break-word;
}

.message-text {
    margin: 0;
}

.message-image,
.message-video {
    max-width: 100%;
    max-height: 400px;
    border-radius: 8px;
    margin-top: 8px;
    display: block;
    object-fit: contain;
    border: 1px solid #1a1a1a;
}

.message-error {
    color: #ff6b6b;
    font-size: 13px;
    padding: 8px 12px;
    background: rgba(255, 107, 107, 0.1);
    border: 1px solid rgba(255, 107, 107, 0.3);
    border-radius: 6px;
    margin-top: 8px;
    display: inline-block;
}

.media-preview-container {
    padding: 12px 24px;
    background: #0a0a0a;
    border-top: 1px solid #1a1a1a;
    border-bottom: 1px solid #1a1a1a;
}

.media-preview-wrapper {
    position: relative;
    display: inline-block;
    max-width: 300px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #1a1a1a;
}

.media-preview-image,
.media-preview-video {
    max-width: 100%;
    max-height: 200px;
    display: block;
    object-fit: contain;
    background: #1a1a1a;
}

.media-preview-remove {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    background: rgba(0, 0, 0, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    color: #ffffff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    padding: 0;
}

.media-preview-remove:hover {
    background: rgba(0, 0, 0, 0.9);
    border-color: rgba(255, 255, 255, 0.4);
    transform: scale(1.1);
}

.chat-input-area {
    padding: 16px 24px;
    background: #0a0a0a;
    border-top: 1px solid #1a1a1a;
    display: flex;
    align-items: center;
    gap: 12px;
}

.attach-btn {
    width: 40px;
    height: 40px;
    background: none;
    border: 1px solid #1a1a1a;
    color: #666666;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.attach-btn:hover {
    background: #1a1a1a;
    border-color: #333333;
    color: #ffffff;
}

.message-input {
    flex: 1;
    background: #1a1a1a;
    border: 1px solid #1a1a1a;
    color: #ffffff;
    font-size: 15px;
    padding: 12px 16px;
    border-radius: 8px;
    outline: none;
    font-family: inherit;
    transition: all 0.2s ease;
}

.message-input:focus {
    border-color: #333333;
    background: #0f0f0f;
}

.message-input::placeholder {
    color: #666666;
}

.send-btn {
    width: 40px;
    height: 40px;
    background: #ffffff;
    border: none;
    color: #000000;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.send-btn:hover {
    background: #cccccc;
}

.send-btn:active {
    background: #999999;
}

/* Scrollbars */
.chat-sidebar::-webkit-scrollbar,
.chat-messages::-webkit-scrollbar,
.dm-list-sidebar::-webkit-scrollbar {
    width: 8px;
}

.chat-sidebar::-webkit-scrollbar-track,
.chat-messages::-webkit-scrollbar-track,
.dm-list-sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.chat-sidebar::-webkit-scrollbar-thumb,
.chat-messages::-webkit-scrollbar-thumb,
.dm-list-sidebar::-webkit-scrollbar-thumb {
    background: #1a1a1a;
    border-radius: 4px;
}

.chat-sidebar::-webkit-scrollbar-thumb:hover,
.chat-messages::-webkit-scrollbar-thumb:hover,
.dm-list-sidebar::-webkit-scrollbar-thumb:hover {
    background: #333333;
}

/* Mobile polish: respect safe areas and real viewport height */
@media (max-width: 768px) {
    .chat-container,
    .chat-panel {
        height: 100dvh;
        max-height: 100dvh;
    }

    .chat-input-container,
    .chat-input-area {
        padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    }

    body {
        padding-bottom: env(safe-area-inset-bottom, 0px);
    }

    .chat-header {
        gap: 10px;
    }

    .header-left {
        display: flex;
        align-items: center;
        gap: 8px;
        flex: 1;
    }

    .chat-title {
        margin-left: 0;
        text-align: left;
        font-size: 17px;
        max-width: 60vw;
        flex: 0 1 60vw;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .sidebar-toggle {
        display: inline-flex;
        margin-right: 10px;
    }

    .chat-container {
        position: relative;
    }

    .chat-sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        width: 78vw;
        max-width: 320px;
        height: 100vh;
        transform: translateX(-110%);
        transition: transform 0.25s ease;
        z-index: 100003;
        box-shadow: 8px 0 32px rgba(0,0,0,0.35);
        pointer-events: none;
        visibility: hidden;
    }

    .chat-container.sidebar-open .chat-sidebar {
        transform: translateX(0);
        pointer-events: auto;
        visibility: visible;
    }

    .sidebar-backdrop {
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.55);
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.2s ease;
        z-index: 100002;
    }

    .chat-container.sidebar-open .sidebar-backdrop {
        opacity: 1;
        pointer-events: auto;
    }

    .sidebar-header {
        display: flex;
        align-items: center;
        gap: 10px;
    }

    .sidebar-title {
        font-size: 20px;
    }

    .sidebar-close {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 32px;
        height: 32px;
        margin-left: auto;
        background: rgba(20, 20, 20, 0.1);
        border: 1px solid rgba(104, 107, 115, 0.14);
        color: #f5f5f5;
        border-radius: 10px;
        cursor: pointer;
        transition: all 0.2s ease;
        font-size: 18px;
        line-height: 1;
    }

    .sidebar-close:hover {
        background: rgba(20, 20, 20, 0.18);
        border-color: rgba(104, 107, 115, 0.24);
    }

    .chat-main-area {
        width: 100%;
    }

    .chat-header {
        gap: 10px;
    }
}

@media (min-width: 769px) {
    .sidebar-backdrop {
        display: none;
    }
    .sidebar-close {
        display: none;
    }
}
