:root {
    --brand: #5865f2;
    --brand-hover: #4752c4;
    --success: #23a559;
    --danger: #da373c;
    --bg-primary: #313338;
    --bg-secondary: #2b2d31;
    --bg-tertiary: #1e1f22;
    --bg-accent: #3f4147;
    --bg-modifier-hover: rgba(78, 80, 88, 0.3);
    --bg-modifier-selected: rgba(78, 80, 88, 0.6);
    --text-normal: #dbdee1;
    --text-muted: #949ba4;
    --text-header: #ffffff;
    --input-bg: #1e1f22;
    --modal-bg: #313338;
    --sidebar-width: 240px;
    --server-nav-width: 72px;
}

[data-theme="light"] {
    --bg-primary: #ffffff;
    --bg-secondary: #f2f3f5;
    --bg-tertiary: #e3e5e8;
    --bg-accent: #ebedef;
    --text-normal: #313338;
    --text-muted: #5c5e66;
    --text-header: #060607;
    --input-bg: #e3e5e8;
    --modal-bg: #ffffff;
}

* { margin: 0; padding: 0; box-sizing: border-box; outline: none; }
body { font-family: 'Inter', sans-serif; background: var(--bg-tertiary); color: var(--text-normal); height: 100vh; overflow: hidden; }

/* Scrollbars */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg-tertiary); border-radius: 4px; border: 2px solid transparent; }
::-webkit-scrollbar-thumb:hover { background: var(--bg-accent); }

.screen { height: 100vh; display: flex; }
.hidden { display: none !important; }

/* Auth Screen */
#auth-screen {
    background-image: url('https://raw.githubusercontent.com/foscord/foscord-frontend/main/public/assets/auth-bg.svg');
    background-size: cover;
    align-items: center;
    justify-content: center;
}

.auth-card {
    background: var(--modal-bg);
    padding: 32px;
    border-radius: 8px;
    width: 480px;
    box-shadow: 0 8px 16px rgba(0,0,0,0.2);
}

/* Navigators */
.server-sidebar {
    width: var(--server-nav-width);
    background: var(--bg-tertiary);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 12px;
    gap: 8px;
}

.content-sidebar {
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    display: flex;
    flex-direction: column;
}

/* Main Content */
.main-content {
    flex: 1;
    background: var(--bg-primary);
    display: flex;
    flex-direction: column;
    position: relative;
}

.chat-header {
    height: 48px;
    padding: 0 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 1px 0 rgba(0,0,0,0.2);
    z-index: 10;
}

/* UI Elements */
.nav-item {
    width: 48px;
    height: 48px;
    background: var(--bg-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.nav-item:hover, .nav-item.active { border-radius: 16px; background: var(--brand); color: white; }
.nav-item.active .pill { height: 40px; }
.nav-item:hover .pill { height: 20px; }

.pill {
    position: absolute;
    left: -4px;
    width: 8px;
    height: 0;
    background: white;
    border-radius: 0 4px 4px 0;
    transition: height 0.2s;
}

.sidebar-header {
    height: 48px;
    padding: 0 16px;
    display: flex;
    align-items: center;
    font-weight: 700;
    font-size: 16px;
    color: var(--text-header);
    box-shadow: 0 1px 0 rgba(0,0,0,0.2);
}

.sidebar-scroll { flex: 1; overflow-y: auto; padding: 8px; }

.sidebar-item {
    padding: 6px 8px;
    border-radius: 4px;
    margin-bottom: 2px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-muted);
    transition: all 0.1s;
}

.sidebar-item:hover { background: var(--bg-modifier-hover); color: var(--text-normal); }
.sidebar-item.active { background: var(--bg-modifier-selected); color: var(--text-header); }

.avatar-sm { background: var(--bg-accent); border-radius: 50%; background-size: cover; position: relative; flex-shrink: 0; }
.status-indicator {
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 3px solid var(--bg-secondary);
}
.status-indicator.online { background: var(--success); }
.status-indicator.idle { background: #f0b232; }
.status-indicator.dnd { background: var(--danger); }
.status-indicator.offline { background: #747f8d; }

/* Buttons */
.btn-primary { background: var(--brand); color: white; border: none; padding: 10px 24px; border-radius: 3px; font-weight: 500; cursor: pointer; transition: background 0.2s; }
.btn-primary:hover { background: var(--brand-hover); }
.btn-success { background: var(--success); color: white; border: none; padding: 10px 24px; border-radius: 3px; font-weight: 500; cursor: pointer; }
.btn-danger { background: var(--danger); color: white; border: none; padding: 10px 24px; border-radius: 3px; font-weight: 500; cursor: pointer; }
.btn-text { background: none; border: none; color: var(--text-normal); cursor: pointer; font-size: 14px; }
.btn-icon { background: none; border: none; color: var(--text-muted); cursor: pointer; padding: 4px; border-radius: 4px; }
.btn-icon:hover { background: var(--bg-modifier-hover); color: var(--text-normal); }

/* Chat */
.message-list { flex: 1; overflow-y: auto; padding: 16px 0; }
.message-item { display: flex; gap: 16px; padding: 8px 16px; }
.message-item:hover { background: rgba(0,0,0,0.05); }
.msg-user { font-weight: 600; color: var(--text-header); cursor: pointer; }
.msg-user:hover { text-decoration: underline; }
.msg-time { font-size: 12px; color: var(--text-muted); margin-left: 8px; }
.msg-text { color: var(--text-normal); line-height: 1.4; }

/* Settings View */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.85);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.settings-view {
    width: 100vw; height: 100vh;
    background: var(--bg-primary);
    display: flex;
}

.settings-sidebar {
    width: 320px;
    background: var(--bg-secondary);
    padding: 60px 20px 60px 40px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.settings-content {
    flex: 1;
    padding: 60px 40px;
    overflow-y: auto;
}

.setting-section { max-width: 740px; }
.setting-header { font-size: 12px; font-weight: 700; color: var(--text-muted); margin: 24px 0 8px; text-transform: uppercase; }
.setting-card { background: var(--bg-secondary); padding: 16px; border-radius: 8px; margin-bottom: 24px; }
.settings-input { width: 100%; background: var(--input-bg); border: none; padding: 10px; color: white; border-radius: 3px; margin-bottom: 16px; font-size: 16px; }

/* Toast */
#notification-host { position: fixed; top: 20px; right: 20px; z-index: 2000; display: flex; flex-direction: column; gap: 10px; }
.toast {
    background: var(--bg-tertiary);
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    box-shadow: 0 8px 16px rgba(0,0,0,0.4);
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideIn 0.3s ease;
    border-left: 4px solid var(--brand);
}

@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* Voice & Grid */
.voice-member-box {
    background: var(--bg-secondary);
    border-radius: 12px;
    aspect-ratio: 16/9;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    border: 2px solid transparent;
    overflow: hidden;
}

.voice-member-box.talking { border-color: var(--success); }
.voice-member-box video { width: 100%; height: 100%; object-fit: cover; }
