:root {
    --bg-dark: #03030c;
    --glass-bg: rgba(255, 255, 255, 0.02);
    --glass-border: rgba(255, 255, 255, 0.05);
    --neon-cyan: #00f3ff;
    --neon-purple: #bc13fe;
    --neon-pink: #ff007f;
    --neon-green: #39ff14;
    --text-main: #e0e0f0;
    --text-muted: #7f818b;
    --chat-bubble-bg: rgba(255, 255, 255, 0.015);
    --panel-gap: 15px; /* Added for spacing */
}

/* --- PREMIUM LIGHT MODE OVERRIDES --- */
body.light-mode {
    --bg-dark: #f8fafc; /* Very light slate */
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(0, 0, 0, 0.05);
    --neon-cyan: #0284c7; /* Sky blue */
    --neon-purple: #7c3aed; /* Violet */
    --neon-pink: #e11d48; /* Rose */
    --neon-green: #059669; /* Emerald */
    --text-main: #0f172a; /* Slate 900 */
    --text-muted: #64748b; /* Slate 500 */
    --chat-bubble-bg: rgba(255, 255, 255, 0.8);
    
    background-color: var(--bg-dark);
    background-image: 
        radial-gradient(circle at 0% 0%, rgba(124, 58, 237, 0.05) 0%, transparent 50%),
        radial-gradient(circle at 100% 100%, rgba(2, 132, 199, 0.05) 0%, transparent 50%);
}

body.light-mode .modal { background: rgba(248, 250, 252, 0.7); backdrop-filter: blur(20px); }
body.light-mode .glass-box { background: rgba(255, 255, 255, 0.9); border: 1px solid rgba(0,0,0,0.08); box-shadow: 0 20px 40px rgba(0,0,0,0.05); }
body.light-mode .admin-dashboard-box { background: rgba(255, 255, 255, 0.95) !important; border: 1px solid rgba(0,0,0,0.1) !important; box-shadow: 0 15px 35px rgba(0,0,0,0.1) !important; }
body.light-mode input[type="text"], body.light-mode input[type="password"], body.light-mode textarea, body.light-mode select { background: #ffffff; color: #0f172a; border: 1px solid #e2e8f0; box-shadow: inset 0 2px 4px rgba(0,0,0,0.02); }
body.light-mode input[type="text"]:focus, body.light-mode input[type="password"]:focus, body.light-mode textarea:focus, body.light-mode select:focus { border-color: var(--neon-cyan); box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.1); }
body.light-mode .neon-text { text-shadow: none; font-weight: 700; }
body.light-mode .neon-btn { background: var(--neon-cyan); color: #ffffff; border: none; box-shadow: 0 4px 10px rgba(2, 132, 199, 0.2); text-shadow: none; font-weight: 600; }
body.light-mode .neon-btn:hover { background: #0369a1; box-shadow: 0 6px 15px rgba(2, 132, 199, 0.3); color: #ffffff; }
body.light-mode .neon-btn-purple { background: var(--neon-purple); box-shadow: 0 4px 10px rgba(124, 58, 237, 0.2); }
body.light-mode .neon-btn-purple:hover { background: #6d28d9; }
body.light-mode .neon-btn-pink { background: var(--neon-pink); box-shadow: 0 4px 10px rgba(225, 29, 72, 0.2); }
body.light-mode .neon-btn-pink:hover { background: #be123c; }
body.light-mode .neon-btn-green { background: var(--neon-green); box-shadow: 0 4px 10px rgba(5, 150, 105, 0.2); }
body.light-mode .neon-btn-green:hover { background: #047857; }
body.light-mode .server-icon { background: #ffffff; color: #64748b; box-shadow: 0 4px 6px rgba(0,0,0,0.05); border: 1px solid #e2e8f0; }
body.light-mode .server-icon.active { background: var(--neon-cyan); color: #ffffff; border-color: var(--neon-cyan); }
body.light-mode .server-icon i { color: inherit; }
body.light-mode .icon-btn { color: #64748b !important; }
body.light-mode .icon-btn:hover { color: var(--neon-cyan) !important; background: rgba(2, 132, 199, 0.05); }
body.light-mode .chat-input-area { background: #ffffff; border: 1px solid #e2e8f0; box-shadow: 0 -4px 15px rgba(0,0,0,0.02); }
body.light-mode .chat-input-area input[type="text"] { color: #0f172a; background: transparent; box-shadow: none; border: none; }
body.light-mode .chat-message { color: #0f172a; }
body.light-mode .toast { background: #ffffff; color: #0f172a; border-left: 4px solid var(--neon-cyan); box-shadow: 0 10px 25px rgba(0,0,0,0.08); }
body.light-mode .custom-scrollbar::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.15); }
body.light-mode .custom-scrollbar::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,0.25); }
body.light-mode .glass-panel { box-shadow: 0 4px 20px rgba(0,0,0,0.03); }
body.light-mode .friend-item:hover, body.light-mode .channel-item:hover { background: rgba(0,0,0,0.03); }

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Outfit', 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: var(--bg-dark);
    background-image: 
        radial-gradient(circle at 10% 20%, rgba(188, 19, 254, 0.15) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(0, 243, 255, 0.15) 0%, transparent 40%);
    color: var(--text-main);
    overflow: hidden;
    height: 100vh;
    height: 100dvh;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Custom Scrollbars */
.custom-scrollbar::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
.custom-scrollbar::-webkit-scrollbar-track {
    background: transparent;
}
.custom-scrollbar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 10px;
}
.custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background: var(--neon-cyan);
    box-shadow: 0 0 10px var(--neon-cyan);
}

/* Typography & Neon Glows */
.neon-text {
    text-shadow: 0 0 5px currentColor, 0 0 12px currentColor;
    font-weight: bold;
}
.neon-cyan { color: var(--neon-cyan); }
.neon-purple { color: var(--neon-purple); }
.neon-pink { color: var(--neon-pink); }
.neon-green { color: var(--neon-green); }

/* Glassmorphism */
.glass-box, .glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.45);
}

.hidden { display: none !important; }

/* Interactive Elements & Buttons */
.neon-btn {
    background: transparent;
    border: 1px solid var(--neon-cyan);
    color: var(--neon-cyan);
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    text-shadow: 0 0 5px var(--neon-cyan);
    box-shadow: inset 0 0 5px var(--neon-cyan), 0 0 5px var(--neon-cyan);
    width: 100%;
    margin-top: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
}
.neon-btn:hover {
    background: var(--neon-cyan);
    color: var(--bg-dark);
    box-shadow: inset 0 0 10px var(--neon-cyan), 0 0 20px var(--neon-cyan);
    transform: translateY(-1px);
}
.neon-btn-pink {
    border-color: var(--neon-pink);
    color: var(--neon-pink);
    text-shadow: 0 0 5px var(--neon-pink);
    box-shadow: inset 0 0 5px var(--neon-pink), 0 0 5px var(--neon-pink);
}
.neon-btn-pink:hover {
    background: var(--neon-pink);
    color: var(--bg-dark);
    box-shadow: inset 0 0 10px var(--neon-pink), 0 0 20px var(--neon-pink);
}
.neon-btn-green {
    border-color: var(--neon-green);
    color: var(--neon-green);
    text-shadow: 0 0 5px var(--neon-green);
    box-shadow: inset 0 0 5px var(--neon-green), 0 0 5px var(--neon-green);
}
.neon-btn-green:hover {
    background: var(--neon-green);
    color: var(--bg-dark);
    box-shadow: inset 0 0 10px var(--neon-green), 0 0 20px var(--neon-green);
}
.icon-btn {
    background: transparent;
    border: none;
    color: var(--text-main);
    cursor: pointer;
    font-size: 1.2rem;
    padding: 6px;
    transition: all 0.2s ease-in-out;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.icon-btn:hover {
    color: var(--neon-cyan);
    transform: scale(1.15);
}

/* Inputs & Form Styling */
input[type="text"], input[type="password"], textarea {
    width: 100%;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--glass-border);
    color: #ffffff;
    padding: 11px 14px;
    border-radius: 8px;
    margin-bottom: 10px;
    outline: none;
    transition: all 0.3s;
}
input[type="text"]:focus, input[type="password"]:focus, textarea:focus {
    border-color: var(--neon-cyan);
    box-shadow: 0 0 10px rgba(0, 243, 255, 0.2);
}

/* Custom Checkbox */
input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--glass-border);
    border-radius: 4px;
    cursor: pointer;
    vertical-align: middle;
    position: relative;
    transition: 0.2s;
}
input[type="checkbox"]:checked {
    background: var(--neon-cyan);
    border-color: var(--neon-cyan);
    box-shadow: 0 0 8px var(--neon-cyan);
}
input[type="checkbox"]:checked::after {
    content: '✓';
    color: var(--bg-dark);
    font-size: 13px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-weight: bold;
}

/* Modals */
.modal {
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh; height: 100dvh;
    background: rgba(3, 3, 12, 0.75);
    backdrop-filter: blur(10px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}
.modal .glass-box {
    padding: 30px;
    width: 420px;
    max-width: 90%;
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.08);
}
.close-btn {
    position: absolute;
    top: 15px; right: 18px;
    background: transparent; border: none; color: var(--text-muted);
    font-size: 1.5rem; cursor: pointer;
    transition: color 0.2s;
}
.close-btn:hover {
    color: var(--neon-pink);
}

/* PWA Overlay */
#pwa-overlay {
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    background: var(--bg-dark);
    z-index: 9999;
    display: flex; justify-content: center; align-items: center;
}
#pwa-overlay .glass-box {
    padding: 40px; text-align: center;
}

/* Login Background & Blobs */
#login-screen {
    position: relative;
    width: 100vw; height: 100vh;
    display: flex; justify-content: center; align-items: center;
    overflow: hidden;
    background: #020207;
}
.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(90px);
    opacity: 0.55;
    animation: floatBlob 15s infinite alternate ease-in-out;
}
.blob-1 {
    width: 350px; height: 350px;
    background: var(--neon-cyan);
    top: 10%; left: 15%;
}
.blob-2 {
    width: 450px; height: 450px;
    background: var(--neon-purple);
    bottom: 8%; right: 15%;
    animation-delay: -6s;
}
.blob-3 {
    width: 250px; height: 250px;
    background: var(--neon-pink);
    top: 40%; right: 35%;
    animation-delay: -3s;
    opacity: 0.3;
}
@keyframes floatBlob {
    0% { transform: translate(0, 0) scale(1) rotate(0deg); }
    50% { transform: translate(80px, 40px) scale(1.15) rotate(180deg); }
    100% { transform: translate(-40px, 80px) scale(0.9) rotate(360deg); }
}

.auth-box {
    padding: 40px;
    width: 380px;
    max-width: 90%;
    text-align: center;
    z-index: 10;
    border-color: rgba(255,255,255,0.07);
    box-shadow: 0 15px 35px rgba(0,0,0,0.5), 0 0 15px rgba(0, 243, 255, 0.1);
}
.subtitle {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 25px;
    letter-spacing: 2px;
    text-transform: uppercase;
}

/* Tabs switcher in login box */
.tabs {
    display: flex;
    margin-bottom: 25px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 8px;
    padding: 4px;
    border: 1px solid var(--glass-border);
}
.tabs button {
    flex: 1;
    background: transparent !important;
    border: none !important;
    color: var(--text-muted) !important;
    padding: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    border-radius: 6px;
    font-weight: bold;
    outline: none;
    box-shadow: none !important;
}
.tabs button:hover {
    color: #ffffff !important;
}
.tabs button.active {
    background: rgba(0, 243, 255, 0.12) !important;
    color: var(--neon-cyan) !important;
    text-shadow: 0 0 5px var(--neon-cyan) !important;
}

/* Fix Autocomplete Input Background (Chrome autofill light-blue fix) */
input:-webkit-autofill,
input:-webkit-autofill:hover, 
input:-webkit-autofill:focus, 
input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 30px #080814 inset !important;
    -webkit-text-fill-color: #ffffff !important;
    transition: background-color 5000s ease-in-out 0s;
}

/* 3-COLUMN DISCORD CLIENT LAYOUT */
#app-screen {
    display: flex;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    padding: var(--panel-gap);
    gap: var(--panel-gap);
    box-sizing: border-box;
}

/* COLUMN 1: Server Bar (Left) */
.server-bar {
    width: 70px;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px 0;
    gap: 15px;
    z-index: 100;
}
.servers-ul {
    list-style: none;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    flex: 1;
    overflow-y: auto;
    padding: 5px 0;
}
.server-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    color: var(--neon-cyan);
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.2, 0.6, 0.2, 1);
    position: relative;
    box-shadow: 0 0 10px rgba(0,0,0,0.3);
}
.server-icon:hover {
    border-radius: 16px;
    background: var(--neon-cyan);
    color: var(--bg-dark);
    box-shadow: 0 0 15px var(--neon-cyan);
}
.server-icon.active {
    border-radius: 16px;
    border-color: var(--neon-purple);
    box-shadow: 0 0 15px var(--neon-purple);
    background: rgba(188, 19, 254, 0.2);
    color: white;
}
.server-icon.add-server {
    color: var(--neon-green);
    border-color: var(--neon-green);
    box-shadow: 0 0 5px var(--neon-green);
    margin-top: auto;
}
.server-icon.add-server:hover {
    background: var(--neon-green);
    color: var(--bg-dark);
    box-shadow: 0 0 15px var(--neon-green);
}
.server-divider {
    width: 32px;
    height: 2px;
    background: var(--glass-border);
    margin: 8px 0;
}
.server-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: inherit;
}

/* COLUMN 2: Sidebar (Middle) */
.sidebar {
    width: 280px;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    z-index: 90;
    padding: 20px; /* Added spacing */
}
.sidebar-header {
    height: 48px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--glass-border);
    margin-bottom: 15px;
    padding-bottom: 8px;
}
.channel-list {
    flex: 1;
    overflow-y: auto;
}
.channel-list h3 {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    font-weight: bold;
    margin: 20px 0 8px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.channel-list ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.channel-list li {
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.2s;
    font-size: 0.9rem;
    color: #b9bbbe;
    position: relative;
}
.channel-list li:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #ffffff;
}
.channel-list li.active {
    background: rgba(0, 243, 255, 0.1);
    color: var(--neon-cyan);
    border-left: 3px solid var(--neon-cyan);
    padding-left: 9px;
}
.channel-list li.unread {
    font-weight: bold;
    color: #ffffff;
}

.unread-pill {
    position: absolute;
    left: -12px;
    width: 4px;
    height: 8px;
    background: #ffffff;
    border-radius: 0 4px 4px 0;
    box-shadow: 0 0 5px #ffffff;
}

/* User Controls at bottom of Sidebar */
.user-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-top: 15px;
    border-top: 1px solid var(--glass-border);
    margin-top: auto;
}
.user-info {
    flex: 1;
    overflow: hidden;
}
.user-info strong {
    display: block;
    font-size: 0.85rem;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

/* COLUMN 3: Chat Area (Right) */
.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    border-radius: 16px; /* Added for standalone feeling */
    overflow: hidden;
}
.chat-header {
    padding: 20px 25px; /* Increased padding */
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--glass-bg); /* Glassmorphism header */
    backdrop-filter: blur(10px);
}

/* Messages container */
.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 25px; /* Increased padding */
    display: flex;
    flex-direction: column;
    gap: 15px;
}
.welcome-msg {
    color: var(--text-muted);
    font-style: italic;
    font-size: 0.9rem;
    text-align: center;
    padding: 20px;
}

/* Messages design */
.msg-wrapper {
    display: flex;
    gap: 15px;
    padding: 8px 12px;
    border-radius: 10px;
    background: var(--chat-bubble-bg);
    border: 1px solid transparent;
    transition: all 0.2s ease;
    position: relative;
}
.msg-wrapper:hover {
    background: rgba(255, 255, 255, 0.025);
    border-color: rgba(255,255,255,0.02);
}
.msg-wrapper.system-msg {
    border-left: 3px solid var(--neon-purple);
    background: rgba(188, 19, 254, 0.03);
}
.msg-wrapper.mentioned-msg {
    border-left: 3px solid var(--neon-pink);
    background: rgba(255, 0, 127, 0.03);
}
.msg-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    cursor: pointer;
    flex-shrink: 0;
    transition: transform 0.2s;
}
.msg-avatar:hover {
    transform: scale(1.08);
}
.msg-content-area {
    flex: 1;
    min-width: 0;
}
.msg-header {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 4px;
}
.msg-name {
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
}
.msg-time {
    font-size: 0.7rem;
    color: var(--text-muted);
}
.msg-text {
    line-height: 1.5;
    word-break: break-word;
    color: #dcddde;
    font-size: 0.92rem;
}

/* Reply bar UI in chat area */
.chat-input-wrapper {
    padding: 20px; /* Increased padding */
    position: relative;
}
.reply-container {
    background: rgba(188, 19, 254, 0.12);
    border: 1px solid rgba(188, 19, 254, 0.2);
    border-bottom: none;
    border-left: 3px solid var(--neon-purple);
    padding: 8px 15px;
    border-radius: 8px 8px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    animation: slideUp 0.2s ease;
}
@keyframes slideUp {
    from { transform: translateY(10px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
.reply-text {
    color: #e0e0f0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-right: 15px;
}

.chat-input-area {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    padding: 12px 18px; /* Increased padding */
    display: flex;
    gap: 15px;
    align-items: center;
}
.input-wrapper {
    flex: 1;
    position: relative;
}
.chat-input-area input[type="text"] {
    margin-bottom: 0;
    background: transparent;
    border: none;
    font-size: 0.95rem;
    color: #ffffff;
    padding: 0;
}
.chat-input-area input[type="text"]:focus {
    box-shadow: none;
}

.typing-indicator {
    font-size: 0.75rem;
    color: var(--neon-cyan);
    padding-left: 25px;
    height: 16px;
    position: absolute;
    bottom: -1px;
}

/* Autocomplete Popup */
.autocomplete-popup {
    position: absolute;
    bottom: calc(100% + 15px);
    left: 0;
    width: 280px;
    max-height: 220px;
    background: #03030c;
    border: 1px solid var(--neon-cyan);
    border-radius: 8px;
    overflow-y: auto;
    z-index: 100;
    box-shadow: 0 0 15px rgba(0, 243, 255, 0.25);
}
.ac-item {
    padding: 10px 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.85rem;
    transition: background 0.2s;
}
.ac-item:hover, .ac-item.selected {
    background: rgba(0, 243, 255, 0.15);
    color: #ffffff;
}

/* EMOJI REACTIONS ON MESSAGES */
.message-actions-hover {
    position: absolute;
    top: -16px;
    right: 15px;
    background: #0b0b15;
    border: 1px solid var(--glass-border);
    border-radius: 6px;
    display: flex;
    padding: 2px;
    gap: 2px;
    opacity: 0;
    transition: opacity 0.2s;
    z-index: 5;
}
.msg-wrapper:hover .message-actions-hover {
    opacity: 1;
}
.react-picker-trigger {
    font-size: 0.9rem;
    padding: 4px 6px;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.2s;
}
.react-picker-trigger:hover {
    background: rgba(255, 255, 255, 0.1);
}

.reactions-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
}
.reaction-bubble {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.78rem;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
}
.reaction-bubble:hover {
    background: rgba(255, 255, 255, 0.07);
    border-color: var(--neon-cyan);
}
.reaction-bubble.active {
    background: rgba(0, 243, 255, 0.1);
    border-color: var(--neon-cyan);
    color: var(--neon-cyan);
    box-shadow: 0 0 5px rgba(0,243,255,0.2);
}

/* GIF POPUP PANEL */
.gif-popup {
    position: absolute;
    bottom: calc(100% + 15px);
    left: 0;
    width: 360px;
    height: 380px;
    background: rgba(3, 3, 10, 0.97);
    border: 1px solid var(--neon-purple);
    border-radius: 12px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    z-index: 100;
    box-shadow: 0 0 20px rgba(188, 19, 254, 0.25);
    animation: slideUp 0.2s ease;
}
.gif-search-header {
    margin-bottom: 10px;
}
.gif-search-header input {
    margin-bottom: 0;
}
.gif-results-grid {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    overflow-y: auto;
}
.gif-item {
    cursor: pointer;
    border-radius: 6px;
    overflow: hidden;
    height: 100px;
    background: rgba(255,255,255,0.02);
}
.gif-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.2s;
}
.gif-item:hover img {
    transform: scale(1.05);
}

/* RICH LINK PREVIEWS */
.link-preview-card {
    background: rgba(255, 255, 255, 0.02);
    border-left: 3px solid var(--neon-cyan);
    border-radius: 8px;
    margin-top: 8px;
    padding: 12px 16px;
    max-width: 480px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.85rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}
.link-preview-site {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}
.link-preview-title {
    font-weight: bold;
    color: var(--neon-cyan);
    text-decoration: none;
    line-height: 1.3;
}
.link-preview-title:hover {
    text-decoration: underline;
}
.link-preview-desc {
    color: #b9bbbe;
    line-height: 1.4;
}
.link-preview-image {
    max-width: 100%;
    max-height: 200px;
    object-fit: cover;
    border-radius: 6px;
    margin-top: 6px;
}

/* REPLIES QUOTE RENDERING */
.reply-quote-line {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-bottom: 4px;
    padding-left: 2px;
}
.reply-quote-line::before {
    content: '';
    display: inline-block;
    width: 15px;
    height: 8px;
    border-left: 2px solid var(--glass-border);
    border-top: 2px solid var(--glass-border);
    margin-top: 6px;
}
.reply-quote-user {
    font-weight: bold;
}
.reply-quote-text {
    font-style: italic;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 300px;
}

/* USER PROFILE CARD (Discord Style) */
.profile-card {
    padding: 0 !important;
    width: 320px !important;
    overflow: hidden;
    border-color: rgba(0, 243, 255, 0.25) !important;
    box-shadow: 0 0 25px rgba(0, 243, 255, 0.15) !important;
}
.profile-banner {
    height: 110px;
    background: #474973;
    background-size: cover;
    background-position: center;
}
.profile-avatar-wrapper {
    position: relative;
    height: 40px;
}
.profile-avatar {
    width: 84px;
    height: 84px;
    border-radius: 50%;
    border: 4px solid var(--bg-dark);
    position: absolute;
    top: -55px;
    left: 20px;
    background: var(--bg-dark);
    object-fit: cover;
    box-shadow: 0 0 10px rgba(0,0,0,0.5);
}
.profile-info {
    padding: 20px;
}
.profile-info h2 {
    font-size: 1.3rem;
    margin-bottom: 2px;
}
.profile-info .neon-text {
    font-size: 0.85rem;
    margin-bottom: 12px;
}

/* Level XP Bar inside Profile */
.xp-bar-container {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
}
.xp-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--neon-cyan), var(--neon-purple));
    border-radius: 4px;
    transition: width 0.4s ease-out;
}
.divider {
    height: 1px;
    background: var(--glass-border);
    margin: 15px 0;
}
.badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

/* XXL ADMIN DASHBOARD MODAL */
.admin-dashboard-box {
    background: rgba(3, 3, 10, 0.95) !important;
    border: 1px solid rgba(255, 0, 127, 0.25) !important;
    box-shadow: 0 0 30px rgba(255, 0, 127, 0.15) !important;
}
.admin-tab {
    color: var(--text-muted) !important;
}
.admin-tab.active {
    color: var(--neon-pink) !important;
    border-bottom-color: var(--neon-pink);
    text-shadow: 0 0 8px var(--neon-pink);
}
.admin-select {
    width: 100%;
    padding: 10px;
    background: rgba(0, 0, 0, 0.4);
    color: white;
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    outline: none;
    margin-bottom: 10px;
    transition: border-color 0.3s;
}
.admin-select:focus {
    border-color: var(--neon-cyan);
}

.audit-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}
.audit-table th {
    font-weight: bold;
    padding: 12px 8px;
    border-bottom: 1px solid var(--glass-border);
    font-size: 0.8rem;
    text-transform: uppercase;
}
.audit-table td {
    padding: 10px 8px;
    border-bottom: 1px solid rgba(255,255,255,0.03);
    vertical-align: middle;
}
.audit-action-tag {
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: bold;
    display: inline-block;
    text-shadow: none;
}

.word-tag {
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--glass-border);
    padding: 5px 10px;
    border-radius: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
}
.word-tag button {
    background: none;
    border: none;
    color: var(--neon-pink);
    cursor: pointer;
    font-weight: bold;
    font-size: 0.95rem;
    line-height: 1;
}

/* markdown parsed stylings */
.md-bold { font-weight: bold; }
.md-italic { font-style: italic; }
.md-underline { text-decoration: underline; }
.md-strike { text-decoration: line-through; }
.md-code { background: rgba(0, 0, 0, 0.4); font-family: monospace; padding: 2px 5px; border-radius: 4px; color: var(--neon-cyan); }
.md-quote { border-left: 3px solid var(--neon-purple); padding-left: 10px; color: var(--text-muted); margin: 5px 0; font-style: italic; }

/* RESPONSIVE LAYOUT */
@media (max-width: 1024px) {
    #app-screen {
        flex-direction: row;
    }
    .server-bar {
        height: 100vh;
        height: 100dvh;
    }
    .sidebar {
        position: fixed;
        top: 0;
        left: -320px;
        width: 250px;
        height: 100%;
        border-radius: 0;
        z-index: 1000;
        transition: left 0.3s cubic-bezier(0.2, 0.6, 0.2, 1);
        background: rgba(3, 3, 10, 0.98);
        border-right: 1px solid var(--neon-purple);
        box-shadow: 10px 0 25px rgba(0,0,0,0.5);
    }
    .sidebar.open {
        left: 72px; /* Open next to Server Bar */
    }
    #sidebar-overlay {
        position: fixed;
        top: 0; left: 0; width: 100vw; height: 100vh; height: 100dvh;
        background: rgba(0,0,0,0.6);
        backdrop-filter: blur(4px);
        z-index: 999;
    }
    .chat-area {
        height: 100%;
        width: calc(100vw - 72px);
        flex-grow: 1;
    }
    .mobile-only {
        display: block !important;
    }
    .chat-input-wrapper {
        margin: 10px;
    }
    .blob {
        display: none;
    }
}

@media (min-width: 1025px) {
    .mobile-only {
        display: none !important;
    }
}
/* --- CUSTOM UI COMPONENTS --- */

/* Custom Toggle Switch */
.custom-toggle {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
    cursor: pointer;
}

.custom-toggle .toggle-slider {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 34px;
    transition: .4s;
}

.custom-toggle .toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 4px;
    bottom: 3px;
    background-color: var(--text-muted);
    border-radius: 50%;
    transition: .4s;
}

.custom-toggle input:checked + .toggle-slider {
    background-color: var(--neon-cyan);
    border-color: var(--neon-cyan);
    box-shadow: 0 0 10px var(--neon-cyan);
}

.custom-toggle input:checked + .toggle-slider:before {
    transform: translateX(24px);
    background-color: #fff;
}

/* Color Swatches */
.color-swatch {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    transition: transform 0.2s, border-color 0.2s;
}
.color-swatch:hover {
    transform: scale(1.1);
}
.color-swatch.active {
    border-color: var(--text-main);
    box-shadow: 0 0 8px var(--text-main);
}

/* Settings Tab Navigation */
.settings-tab-btn {
    display: block;
    width: 100%;
    text-align: left;
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 10px 15px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    margin-bottom: 5px;
    transition: background 0.2s, color 0.2s;
}

.settings-tab-btn:hover {
    background: var(--glass-bg);
    color: var(--text-main);
}

.settings-tab-btn.active {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
    font-weight: bold;
}
.custom-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}
/* Cropper Circular Avatar Mode */
.is-avatar .cropper-view-box,
.is-avatar .cropper-face {
    border-radius: 50%;
}

/* Toast Notifications */
.toast-container { position: fixed; top: 20px; right: 20px; z-index: 9999; display: flex; flex-direction: column; gap: 10px; pointer-events: none; }
.toast { background: rgba(15, 15, 25, 0.9); backdrop-filter: blur(10px); border: 1px solid var(--glass-border); border-left: 4px solid var(--neon-cyan); border-radius: 8px; padding: 15px 20px; color: white; display: flex; align-items: center; gap: 12px; min-width: 300px; box-shadow: 0 8px 32px 0 rgba(0,0,0,0.5); pointer-events: auto; transform: translateX(120%); opacity: 0; transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.3s ease; }
.toast.show { transform: translateX(0); opacity: 1; }
.toast.hide { transform: translateX(120%); opacity: 0; }
.toast.success { border-left-color: #00ffaa; }
.toast.error { border-left-color: var(--neon-pink); }
.toast.info { border-left-color: var(--neon-cyan); }
.toast-icon { font-size: 1.5rem; }
.toast.success .toast-icon { color: #00ffaa; }
.toast.error .toast-icon { color: var(--neon-pink); }
.toast.info .toast-icon { color: var(--neon-cyan); }
.toast-content { flex: 1; }
.toast-title { font-weight: bold; margin-bottom: 3px; font-size: 0.95rem; }
.toast-message { font-size: 0.85rem; color: var(--text-muted); }

/* Small Avatar for Friend Requests */
.avatar-sm { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; }


.badge {
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: bold;
    color: white;
    backdrop-filter: blur(4px);
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

/* Battle Pass Timeline */
.bp-timeline-container { position: relative; padding-left: 50px; display: flex; flex-direction: column; gap: 30px; margin-top: 20px; padding-bottom: 20px; }
.bp-timeline-line { position: absolute; left: 24px; top: 10px; bottom: 10px; width: 4px; background: rgba(0, 255, 255, 0.1); border-radius: 2px; z-index: 1; }
.bp-timeline-progress { position: absolute; left: 24px; top: 10px; width: 4px; background: var(--neon-cyan); box-shadow: 0 0 10px var(--neon-cyan); border-radius: 2px; z-index: 2; transition: height 1s ease-out; }

.bp-item { 
    position: relative; 
    display: flex; 
    align-items: center; 
    justify-content: space-between; 
    padding: 15px 20px; 
    background: rgba(0, 0, 0, 0.6); 
    border: 1px solid var(--glass-border); 
    border-radius: 16px; 
    z-index: 3; 
}

.bp-item::before { 
    content: ''; 
    position: absolute; 
    left: -33px; 
    top: 50%; 
    transform: translateY(-50%); 
    width: 20px; 
    height: 20px; 
    border-radius: 50%; 
    background: var(--bg-dark); 
    border: 3px solid rgba(0,255,255,0.2); 
    z-index: 4; 
    box-shadow: 0 0 0 4px var(--bg-darker); 
    transition: all 0.3s; 
}

.bp-item.unlocked::before { 
    border-color: var(--neon-cyan); 
    background: var(--neon-cyan); 
    box-shadow: 0 0 10px var(--neon-cyan), 0 0 0 4px var(--bg-darker); 
}

.bp-item.claimed { 
    border-color: var(--neon-green); 
    background: rgba(46, 204, 113, 0.1); 
}

.bp-item.claimed::before { 
    border-color: var(--neon-green); 
    background: var(--neon-green); 
    box-shadow: 0 0 10px var(--neon-green), 0 0 0 4px var(--bg-darker); 
}

.deleted-collapsed-label {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.75rem;
    font-style: italic;
    margin: 5px 0;
    padding: 5px;
    background: rgba(255,255,255,0.02);
    border-radius: 8px;
    user-select: none;
}

