﻿/* ============================================================
   DISCORD CLONE — chat.css
   Modern, production-ready dark theme
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&family=JetBrains+Mono:wght@400;500&display=swap');

/* ── CSS Variables ─────────────────────────────────────────── */
:root {
    --bg-primary: #0c0e11;
    --bg-secondary: #141618;
    --bg-tertiary: #1a1d21;
    --bg-hover: #1f2226;
    --bg-active: #252930;
    --bg-input: #0f1114;
    --border: rgba(255,255,255,0.06);
    --border-strong: rgba(255,255,255,0.10);
    --text-primary: #e8eaf0;
    --text-secondary: #a8adb8;
    --text-muted: #5c6370;
    --accent: #5c6af5;
    --accent-hover: #4a58e8;
    --accent-glow: rgba(92,106,245,0.25);
    --accent-subtle: rgba(92,106,245,0.12);
    --green: #2db87d;
    --green-subtle: rgba(45,184,125,0.15);
    --red: #e8445a;
    --red-subtle: rgba(232,68,90,0.15);
    --yellow: #f0a429;
    --yellow-subtle: rgba(240,164,41,0.15);
    --gradient-accent: linear-gradient(135deg, #5c6af5 0%, #8b5cf6 100%);
    --gradient-server: linear-gradient(145deg, #1a1d21 0%, #0f1114 100%);
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.4);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.5);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.6);
    --shadow-xl: 0 20px 60px rgba(0,0,0,0.7);
    --shadow-focus: 0 0 0 3px var(--accent-glow);
    --radius-xs: 4px;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;
    --radius-full: 9999px;
    --transition: 0.15s cubic-bezier(0.4,0,0.2,1);
    --transition-slow: 0.3s cubic-bezier(0.4,0,0.2,1);
    --font-sans: 'DM Sans', system-ui, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
    --sidebar-width: 240px;
    --server-width: 68px;
    --members-width: 220px;
    --header-height: 52px;
}

/* ── Reset & Base ───────────────────────────────────────────── */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 15px;
    height: 100%;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    height: 100%;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ── Scrollbar ──────────────────────────────────────────────── */
::-webkit-scrollbar {
    width: 4px;
    height: 4px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.08);
    border-radius: 4px;
}

    ::-webkit-scrollbar-thumb:hover {
        background: rgba(255,255,255,0.14);
    }

* {
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.08) transparent;
}

/* ── App Container ──────────────────────────────────────────── */
.app-container {
    display: flex;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    background: var(--bg-primary);
}

/* ── Server List ────────────────────────────────────────────── */
.server-list {
    width: var(--server-width);
    min-width: var(--server-width);
    background: var(--bg-secondary);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 0;
    gap: 6px;
    overflow-y: auto;
    overflow-x: hidden;
    border-right: 1px solid var(--border);
    z-index: 10;
}

.server-icon {
    width: 46px;
    height: 46px;
    min-width: 46px;
    min-height: 46px;
    border-radius: 14px;
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 18px;
    font-weight: 700;
    color: var(--text-secondary);
    border: 1.5px solid var(--border);
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
    user-select: none;
}

    .server-icon::before {
        content: '';
        position: absolute;
        inset: 0;
        background: var(--gradient-accent);
        opacity: 0;
        transition: opacity var(--transition);
        border-radius: inherit;
    }

    .server-icon:hover {
        border-radius: 12px;
        border-color: var(--accent);
        color: var(--text-primary);
        transform: translateY(-1px);
        box-shadow: 0 4px 20px var(--accent-glow);
    }

        .server-icon:hover::before {
            opacity: 0.08;
        }

    .server-icon.active {
        border-radius: 12px;
        border-color: var(--accent);
        box-shadow: 0 0 0 2px var(--accent-glow);
    }

    .server-icon.friends {
        background: var(--accent-subtle);
        color: var(--accent);
        border-color: rgba(92,106,245,0.2);
    }

    .server-icon.add-server {
        font-size: 22px;
        font-weight: 300;
        background: none;
        border-style: dashed;
        border-color: rgba(255,255,255,0.1);
        color: var(--text-muted);
    }

        .server-icon.add-server:hover {
            border-color: var(--accent);
            color: var(--accent);
            background: var(--accent-subtle);
        }

/* ── Channel Sidebar ────────────────────────────────────────── */
.channel-sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    background: var(--bg-secondary);
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border);
    overflow: hidden;
}

.server-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    height: var(--header-height);
    min-height: var(--header-height);
    font-weight: 700;
    font-size: 14px;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background var(--transition);
    flex-shrink: 0;
    gap: 8px;
    letter-spacing: 0.01em;
}

    .server-header:hover {
        background: var(--bg-hover);
    }

.channel-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px 6px;
}

/* ── Category Header ────────────────────────────────────────── */
.category-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 6px 4px 6px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
    cursor: pointer;
    transition: color var(--transition);
    user-select: none;
}

    .category-header:hover {
        color: var(--text-secondary);
    }

/* ── Channel Item ────────────────────────────────────────────── */
.channel-item {
    display: flex;
    align-items: center;
    padding: 1px 2px;
    border-radius: var(--radius-sm);
    margin-bottom: 1px;
    transition: background var(--transition);
    position: relative;
}

    .channel-item:hover {
        background: rgba(255,255,255,0.04);
    }

    .channel-item.active-channel {
        background: var(--accent-subtle) !important;
    }

        .channel-item.active-channel .icon {
            color: var(--accent) !important;
        }

        .channel-item.active-channel span {
            color: var(--text-primary) !important;
        }

.channel-row {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 5px 8px;
    gap: 6px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    min-width: 0;
}

    .channel-row .icon {
        font-size: 16px;
        color: var(--text-muted);
        flex-shrink: 0;
        width: 18px;
        text-align: center;
        font-family: var(--font-sans);
        font-weight: 600;
    }

    .channel-row span {
        font-size: 14px;
        color: var(--text-secondary);
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        flex: 1;
        transition: color var(--transition);
    }

    .channel-row:hover span {
        color: var(--text-primary);
    }

/* ── User Panel ─────────────────────────────────────────────── */
.user-panel {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--bg-primary);
    border-top: 1px solid var(--border);
    flex-shrink: 0;
    min-height: 54px;
}

.user-avatar {
    width: 34px;
    height: 34px;
    min-width: 34px;
    border-radius: 50%;
    background: var(--gradient-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    color: white;
    cursor: pointer;
    flex-shrink: 0;
    overflow: hidden;
    border: 2px solid var(--border);
    transition: transform var(--transition);
}

    .user-avatar:hover {
        transform: scale(1.05);
    }

.user-info {
    flex: 1;
    min-width: 0;
}

.user-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.2;
}

.user-status {
    font-size: 11px;
    color: var(--green);
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 1px;
}

/* ── Chat Main ──────────────────────────────────────────────── */
.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: var(--bg-primary);
    position: relative;
}

/* ── Chat Header ────────────────────────────────────────────── */
.chat-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 20px;
    height: var(--header-height);
    min-height: var(--header-height);
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    font-size: 15px;
    color: var(--text-primary);
    flex-shrink: 0;
    background: var(--bg-primary);
    backdrop-filter: blur(12px);
    z-index: 5;
}

    .chat-header .channel-hash {
        color: var(--text-muted);
        font-size: 20px;
        font-weight: 400;
        line-height: 1;
    }

/* ── Messages Container ─────────────────────────────────────── */
.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px 16px 8px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    scroll-behavior: smooth;
}

/* ── Message ────────────────────────────────────────────────── */
.message {
    display: flex;
    gap: 12px;
    padding: 4px 8px;
    border-radius: var(--radius-md);
    transition: background var(--transition);
    position: relative;
    group: true;
}

    .message:hover {
        background: rgba(255,255,255,0.025);
    }

        .message:hover .message-actions {
            opacity: 1;
            pointer-events: all;
        }

.message-avatar {
    width: 38px;
    height: 38px;
    min-width: 38px;
    border-radius: 50%;
    background: var(--gradient-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 15px;
    color: white;
    flex-shrink: 0;
    overflow: hidden;
    margin-top: 2px;
    border: 1.5px solid var(--border);
}

    .message-avatar img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        border-radius: 50%;
    }

.message-content-area {
    flex: 1;
    min-width: 0;
}

.message-header {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 2px;
}

.message-author {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
    cursor: pointer;
    transition: color var(--transition);
}

    .message-author:hover {
        color: var(--accent);
    }

.message-time {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 400;
}

.message-text {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.55;
    word-break: break-word;
    white-space: pre-wrap;
}

.message-edited {
    font-size: 10px;
    color: var(--text-muted);
    margin-left: 4px;
    font-style: italic;
}

.message-image {
    max-width: min(400px, 100%);
    max-height: 300px;
    border-radius: var(--radius-md);
    cursor: zoom-in;
    object-fit: cover;
    display: block;
    margin-top: 8px;
    border: 1px solid var(--border);
    transition: opacity var(--transition), transform var(--transition);
}

    .message-image:hover {
        opacity: 0.9;
        transform: scale(1.005);
    }

/* ── Message Actions ────────────────────────────────────────── */
.message-actions {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    gap: 2px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 3px;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition);
    box-shadow: var(--shadow-md);
}

.message-action-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px 6px;
    border-radius: var(--radius-xs);
    font-size: 14px;
    transition: all var(--transition);
    line-height: 1;
}

    .message-action-btn:hover {
        background: var(--bg-hover);
        color: var(--text-primary);
    }

    .message-action-btn.danger:hover {
        background: var(--red-subtle);
        color: var(--red);
    }

/* ── Message Edit Input ─────────────────────────────────────── */
.message-edit-input {
    width: 100%;
    background: var(--bg-input);
    border: 1.5px solid var(--accent);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    font-family: var(--font-sans);
    padding: 8px 12px;
    outline: none;
    resize: none;
    margin-top: 4px;
    box-shadow: var(--shadow-focus);
}

/* ── Typing Indicator ───────────────────────────────────────── */
.typing-indicator {
    height: 22px;
    padding: 0 20px;
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    font-style: italic;
}

.typing-dots {
    display: flex;
    gap: 3px;
    align-items: center;
}

    .typing-dots span {
        width: 5px;
        height: 5px;
        border-radius: 50%;
        background: var(--text-muted);
        animation: typingBounce 1.2s infinite;
    }

        .typing-dots span:nth-child(2) {
            animation-delay: 0.2s;
        }

        .typing-dots span:nth-child(3) {
            animation-delay: 0.4s;
        }

@keyframes typingBounce {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.4;
    }

    30% {
        transform: translateY(-4px);
        opacity: 1;
    }
}

/* ── Message Input Area ─────────────────────────────────────── */
.message-input-area {
    padding: 0 16px 16px;
    flex-shrink: 0;
}

.message-input-wrapper {
    display: flex;
    align-items: center;
    gap: 4px;
    background: var(--bg-tertiary);
    border: 1.5px solid var(--border-strong);
    border-radius: var(--radius-lg);
    padding: 6px 8px;
    transition: border-color var(--transition), box-shadow var(--transition);
}

    .message-input-wrapper:focus-within {
        border-color: rgba(92,106,245,0.4);
        box-shadow: 0 0 0 3px rgba(92,106,245,0.08);
    }

    .message-input-wrapper input[type="text"] {
        flex: 1;
        background: none;
        border: none;
        outline: none;
        color: var(--text-primary);
        font-size: 14px;
        font-family: var(--font-sans);
        padding: 4px 6px;
        min-width: 0;
    }

    .message-input-wrapper input::placeholder {
        color: var(--text-muted);
    }

.send-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 6px 8px;
    border-radius: var(--radius-sm);
    font-size: 18px;
    line-height: 1;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

    .send-btn:hover {
        color: var(--text-primary);
        background: rgba(255,255,255,0.06);
    }

    .send-btn.send-primary {
        color: var(--accent);
        font-size: 20px;
    }

        .send-btn.send-primary:hover {
            color: white;
            background: var(--accent);
        }

/* ── Members Sidebar ────────────────────────────────────────── */
.members-sidebar {
    width: var(--members-width);
    min-width: var(--members-width);
    background: var(--bg-secondary);
    border-left: 1px solid var(--border);
    overflow-y: auto;
    padding: 16px 8px;
}

.members-header {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
    padding: 4px 8px 10px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 8px;
}

.member-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 8px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background var(--transition);
    position: relative;
}

    .member-item:hover {
        background: rgba(255,255,255,0.04);
    }

.member-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--gradient-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
    color: white;
    flex-shrink: 0;
    overflow: hidden;
    position: relative;
    border: 1.5px solid var(--border);
}

    .member-avatar img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        border-radius: 50%;
    }

.online-dot {
    position: absolute;
    bottom: -1px;
    right: -1px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 2px solid var(--bg-secondary);
    background: var(--text-muted);
}

    .online-dot.online {
        background: var(--green);
    }

/* ── Voice Panel ────────────────────────────────────────────── */
.voice-panel {
    margin: 8px;
    background: linear-gradient(135deg, rgba(45,184,125,0.08), rgba(45,184,125,0.04));
    border: 1px solid rgba(45,184,125,0.15);
    border-radius: var(--radius-md);
    padding: 12px;
    display: none;
    flex-direction: column;
    gap: 8px;
    flex-shrink: 0;
}

.voice-status-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--green);
    display: flex;
    align-items: center;
    gap: 6px;
}

.voice-status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--green);
    box-shadow: 0 0 6px var(--green);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.6;
        transform: scale(1.2);
    }
}

.voice-controls {
    display: flex;
    gap: 6px;
}

.voice-btn {
    flex: 1;
    background: rgba(255,255,255,0.06);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    padding: 6px;
    font-size: 15px;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

    .voice-btn:hover {
        background: rgba(255,255,255,0.1);
        color: var(--text-primary);
    }

    .voice-btn.danger {
        background: var(--red-subtle);
        border-color: rgba(232,68,90,0.2);
        color: var(--red);
    }

        .voice-btn.danger:hover {
            background: var(--red);
            color: white;
        }

/* ── Form Elements ──────────────────────────────────────────── */
.form-group {
    margin-bottom: 16px;
}

    .form-group label {
        display: block;
        font-size: 12px;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        color: var(--text-muted);
        margin-bottom: 6px;
    }

    .form-group input,
    .form-group textarea,
    .form-group select {
        width: 100%;
        padding: 10px 14px;
        background: var(--bg-input);
        border: 1.5px solid var(--border-strong);
        border-radius: var(--radius-sm);
        color: var(--text-primary);
        font-size: 14px;
        font-family: var(--font-sans);
        outline: none;
        transition: border-color var(--transition), box-shadow var(--transition);
        box-sizing: border-box;
    }

        .form-group input:focus,
        .form-group textarea:focus,
        .form-group select:focus {
            border-color: var(--accent);
            box-shadow: var(--shadow-focus);
        }

        .form-group input::placeholder,
        .form-group textarea::placeholder {
            color: var(--text-muted);
        }

/* ── Buttons ────────────────────────────────────────────────── */
.btn-primary {
    width: 100%;
    padding: 11px 20px;
    background: var(--gradient-accent);
    border: none;
    border-radius: var(--radius-sm);
    color: white;
    font-size: 14px;
    font-weight: 600;
    font-family: var(--font-sans);
    cursor: pointer;
    transition: all var(--transition);
    letter-spacing: 0.01em;
    box-shadow: 0 2px 12px rgba(92,106,245,0.3);
}

    .btn-primary:hover {
        opacity: 0.9;
        transform: translateY(-1px);
        box-shadow: 0 4px 20px rgba(92,106,245,0.4);
    }

    .btn-primary:active {
        transform: translateY(0);
    }

.btn-ghost {
    padding: 10px 20px;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    font-family: var(--font-sans);
    cursor: pointer;
    transition: all var(--transition);
}

    .btn-ghost:hover {
        background: rgba(255,255,255,0.08);
        color: var(--text-primary);
    }

/* ── Auth Box / Modal Box ───────────────────────────────────── */
.auth-box {
    background: var(--bg-secondary);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-xl);
    padding: 28px;
    width: 100%;
    max-width: 440px;
    box-shadow: var(--shadow-xl);
    animation: modalIn 0.25s cubic-bezier(0.34,1.56,0.64,1);
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: translateY(16px) scale(0.96);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.auth-box h2 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 20px;
    letter-spacing: -0.01em;
}

/* ── Modal Overlay ──────────────────────────────────────────── */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.75);
    backdrop-filter: blur(6px);
    z-index: 200;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.modal-content {
    background: var(--bg-secondary);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-xl);
    padding: 28px;
    width: 100%;
    max-width: 480px;
    box-shadow: var(--shadow-xl);
    animation: modalIn 0.25s cubic-bezier(0.34,1.56,0.64,1);
    overflow-y: auto;
    max-height: 90vh;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

    .modal-header h3 {
        font-size: 18px;
        font-weight: 700;
        color: var(--text-primary);
        letter-spacing: -0.01em;
    }

.modal-close {
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border);
    color: var(--text-muted);
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

    .modal-close:hover {
        background: var(--red-subtle);
        border-color: rgba(232,68,90,0.3);
        color: var(--red);
    }

/* ── Nav Bar (non-chat pages) ───────────────────────────────── */
.nav-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 50;
    backdrop-filter: blur(12px);
}

    .nav-bar a {
        color: var(--text-muted);
        text-decoration: none;
        font-size: 13px;
        font-weight: 500;
        padding: 5px 10px;
        border-radius: var(--radius-sm);
        transition: all var(--transition);
        display: flex;
        align-items: center;
        gap: 5px;
    }

        .nav-bar a:hover {
            background: rgba(255,255,255,0.06);
            color: var(--text-primary);
        }

        .nav-bar a.active {
            background: var(--accent-subtle);
            color: var(--accent);
        }

.nav-back {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 20px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    transition: all var(--transition);
    line-height: 1;
}

    .nav-back:hover {
        color: var(--text-primary);
        background: rgba(255,255,255,0.06);
    }

/* ── Page Wrapper ───────────────────────────────────────────── */
.page-wrapper {
    max-width: 820px;
    margin: 0 auto;
    padding: 24px 16px;
}

/* ── Card ───────────────────────────────────────────────────── */
.card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 12px;
    transition: border-color var(--transition);
}

    .card:hover {
        border-color: var(--border-strong);
    }

/* ── Section Label ──────────────────────────────────────────── */
.section-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
    margin-bottom: 16px;
}

/* ── Animations ─────────────────────────────────────────────── */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(12px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(12px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.fade-in {
    animation: fadeIn 0.2s ease;
}

.slide-up {
    animation: slideUp 0.2s ease;
}

/* ── Toast Notification ─────────────────────────────────────── */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    z-index: 9999;
    max-width: 320px;
    animation: slideIn 0.25s ease;
    display: flex;
    align-items: center;
    gap: 10px;
}

    .toast.success {
        border-left: 3px solid var(--green);
    }

    .toast.error {
        border-left: 3px solid var(--red);
    }

    .toast.info {
        border-left: 3px solid var(--accent);
    }

/* ── Emoji Picker ───────────────────────────────────────────── */
#emoji-picker {
    background: var(--bg-tertiary) !important;
    border: 1px solid var(--border-strong) !important;
    border-radius: var(--radius-lg) !important;
    box-shadow: var(--shadow-xl) !important;
}

#emoji-category-tabs::-webkit-scrollbar {
    display: none;
}

#emoji-grid::-webkit-scrollbar {
    width: 3px;
}

#emoji-grid::-webkit-scrollbar-thumb {
    background: var(--border-strong);
    border-radius: 4px;
}

/* ── Context Menu ───────────────────────────────────────────── */
#member-context-menu {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xl);
    animation: fadeIn 0.12s ease;
}

/* ── Message Highlight (from search) ───────────────────────── */
@keyframes highlightPulse {
    0% {
        background: rgba(92,106,245,0.2);
    }

    100% {
        background: transparent;
    }
}

.message-highlight {
    animation: highlightPulse 2.5s ease-out forwards;
    border-radius: var(--radius-md);
}

/* ── Danger Zone ────────────────────────────────────────────── */
.danger-zone {
    background: var(--red-subtle);
    border: 1px solid rgba(232,68,90,0.2);
    border-radius: var(--radius-md);
    padding: 16px;
}

.danger-zone-title {
    font-weight: 700;
    color: var(--red);
    font-size: 13px;
    margin-bottom: 8px;
}

.danger-zone p {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 14px;
    line-height: 1.5;
}

/* ── Mobile Bottom Bar ──────────────────────────────────────── */
.mobile-bottom-bar {
    display: none;
}

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 768px) {
    :root {
        --sidebar-width: 100vw;
        --server-width: 100vw;
    }

    body {
        overflow: hidden;
        height: 100dvh;
    }

    .app-container {
        flex-direction: row;
        width: 300vw;
        height: 100dvh;
        transform: translateX(0);
        transition: transform 0.32s cubic-bezier(0.4,0,0.2,1);
        overflow: hidden;
    }

        .app-container.show-servers {
            transform: translateX(0);
        }

        .app-container.show-channels {
            transform: translateX(-33.333vw);
        }

        .app-container.show-chat {
            transform: translateX(-66.666vw);
        }

    .server-list {
        flex-direction: column !important;
        align-items: center;
        min-width: 100vw !important;
        width: 100vw !important;
        height: 100dvh;
        overflow-y: auto;
        padding: 20px 16px;
        border-right: none;
    }

    .channel-sidebar {
        min-width: 100vw !important;
        width: 100vw !important;
        height: 100dvh;
        border-right: none;
    }

    .chat-main {
        min-width: 100vw !important;
        width: 100vw !important;
        height: 100dvh;
        padding-bottom: 60px;
    }

    .members-sidebar {
        display: none !important;
    }

    .messages-container {
        padding: 12px 12px 8px;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior-y: contain;
    }

    .message-input-area {
        padding: 0 10px 10px;
    }

    .message-input-wrapper input {
        font-size: 16px;
    }

    .server-icon {
        width: 52px !important;
        height: 52px !important;
        min-width: 52px !important;
        min-height: 52px !important;
    }

    .auth-box {
        border-radius: var(--radius-lg) !important;
    }

    .modal-content {
        max-width: calc(100vw - 24px);
    }

    .mobile-bottom-bar {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: var(--bg-secondary);
        border-top: 1px solid var(--border);
        z-index: 150;
        padding: 6px 0 max(6px, env(safe-area-inset-bottom));
        justify-content: space-around;
    }

        .mobile-bottom-bar button {
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 3px;
            background: none;
            border: none;
            color: var(--text-muted);
            cursor: pointer;
            padding: 6px 12px;
            border-radius: var(--radius-sm);
            transition: all var(--transition);
            flex: 1;
            font-family: var(--font-sans);
        }

            .mobile-bottom-bar button .icon {
                font-size: 20px;
                line-height: 1;
            }

            .mobile-bottom-bar button .label {
                font-size: 10px;
                font-weight: 500;
            }

            .mobile-bottom-bar button.active {
                color: var(--accent);
            }

    .page-wrapper {
        padding: 12px;
    }

    .card {
        padding: 16px;
        border-radius: var(--radius-md);
    }

    .nav-bar {
        padding: 8px 10px;
        gap: 4px;
    }

        .nav-bar a {
            font-size: 12px;
            padding: 5px 8px;
        }
}

@media (max-width: 480px) {
    #emoji-picker {
        width: calc(100vw - 16px) !important;
        left: 8px !important;
        right: 8px !important;
        transform: none !important;
        bottom: 72px !important;
    }
}

@supports (padding-bottom: env(safe-area-inset-bottom)) {
    @media (max-width: 768px) {
        .message-input-area {
            padding-bottom: max(10px, env(safe-area-inset-bottom));
        }
    }
}
