/* Clone Discord-like — thème sombre */
* { margin:0; padding:0; box-sizing:border-box; }
:root {
  --bg-0:#1e1f22; --bg-1:#2b2d31; --bg-2:#313338; --bg-3:#383a40;
  --txt:#dbdee1; --muted:#949ba4; --brand:#5865f2; --green:#23a55a;
  --red:#f23f43; --radius:8px;
}
html,body { height:100%; font-family:'gg sans','Segoe UI',system-ui,sans-serif; background:var(--bg-2); color:var(--txt); overflow:hidden; }
.hidden { display:none !important; }
.muted { color:var(--muted); }
button { font:inherit; cursor:pointer; border:none; background:none; color:inherit; }
input,textarea { font:inherit; color:var(--txt); background:var(--bg-0); border:1px solid #1e1f22; border-radius:var(--radius); padding:10px 12px; outline:none; }
input:focus,textarea:focus { border-color:var(--brand); }

/* ---------- auth ---------- */
.auth-screen { position:fixed; inset:0; display:flex; align-items:center; justify-content:center; background:var(--bg-2); z-index:100; }
.auth-card { width:400px; max-width:92vw; background:var(--bg-1); border-radius:12px; padding:32px; display:flex; flex-direction:column; gap:12px; box-shadow:0 8px 30px rgba(0,0,0,.4); }
.auth-card h1 { font-size:24px; text-align:center; }
.auth-card p { font-size:13px; text-align:center; }
.discord-btn { display:block; text-align:center; text-decoration:none; background:#5865f2; color:#fff; padding:12px; border-radius:var(--radius); font-weight:700; font-size:15px; transition:filter .15s; }
.discord-btn:hover { filter:brightness(1.15); }
.auth-sep { color:var(--muted); font-size:12px; text-align:center; margin:4px 0; }
.auth-card input { font-size:15px; }
.auth-buttons { display:flex; gap:10px; }
.auth-buttons .btn { flex:1; }
.error { color:var(--red); font-size:13px; text-align:center; min-height:18px; }
.btn { padding:10px 14px; border-radius:var(--radius); font-size:14px; font-weight:600; transition:filter .15s, background .15s; }
.btn.primary { background:var(--brand); color:#fff; }
.btn.primary:hover { filter:brightness(1.1); }
.btn.ghost { background:transparent; border:1px solid #4e5058; color:var(--txt); }
.btn.ghost:hover { background:var(--bg-3); }
.btn.danger { background:var(--red); color:#fff; }

/* ---------- layout ---------- */
.app { display:grid; grid-template-columns:72px 240px 1fr 240px; height:100vh; }
.guild-rail { background:var(--bg-0); display:flex; flex-direction:column; align-items:center; padding:12px 0; gap:8px; overflow-y:auto; }
.guild-btn { width:48px; height:48px; border-radius:50%; background:var(--bg-1); display:flex; align-items:center; justify-content:center; font-size:20px; transition:border-radius .15s, background .15s; }
.guild-btn:hover { border-radius:16px; background:var(--brand); color:#fff; }
.guild-btn.active { border-radius:16px; background:var(--brand); color:#fff; }
.guild-btn.add { color:var(--green); font-size:26px; }
.guild-btn.add:hover { background:var(--green); color:#fff; }
.guild-btn.home { font-size:22px; }
.guild-sep { width:32px; height:2px; background:#35363c; border-radius:1px; }

.sidebar { background:var(--bg-1); display:flex; flex-direction:column; min-width:0; }
.sidebar-header { padding:14px 16px; font-weight:700; font-size:15px; border-bottom:1px solid rgba(0,0,0,.25); box-shadow:0 1px 0 rgba(0,0,0,.15); }
.channel-list { flex:1; overflow-y:auto; padding:8px; }
.chan-cat { color:var(--muted); font-size:11px; font-weight:700; text-transform:uppercase; letter-spacing:.5px; padding:14px 8px 4px; display:flex; justify-content:space-between; }
.chan-cat button { color:var(--muted); font-size:14px; }
.chan { display:flex; align-items:center; gap:6px; padding:6px 8px; border-radius:6px; color:var(--muted); font-size:15px; margin-bottom:2px; }
.chan .hash { font-size:17px; }
.chan:hover { background:var(--bg-3); color:var(--txt); }
.chan.active { background:var(--bg-3); color:#fff; }
.chan .del { margin-left:auto; opacity:0; color:var(--red); font-size:13px; padding:0 4px; }
.chan:hover .del { opacity:1; }
.me { padding:8px; background:#232428; display:flex; align-items:center; gap:8px; }
.avatar { width:32px; height:32px; border-radius:50%; background:var(--brand); color:#fff; display:flex; align-items:center; justify-content:center; font-weight:700; flex-shrink:0; position:relative; }
.avatar.sm { width:28px; height:28px; font-size:12px; }
.avatar.lg { width:40px; height:40px; font-size:16px; }
.dot { position:absolute; bottom:-2px; right:-2px; width:12px; height:12px; border-radius:50%; border:3px solid #232428; background:var(--muted); }
.dot.on { background:var(--green); }
.me .name { font-size:13px; font-weight:600; line-height:1.1; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.me .sub { font-size:11px; color:var(--muted); }

/* ---------- main ---------- */
.main { display:flex; flex-direction:column; min-width:0; }
.main-header { padding:12px 16px; border-bottom:1px solid rgba(0,0,0,.2); box-shadow:0 1px 0 rgba(0,0,0,.1); font-weight:700; display:flex; gap:8px; align-items:center; }
.hash { color:var(--muted); font-size:20px; }
.topic { color:var(--muted); font-weight:400; font-size:13px; margin-left:8px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.messages { flex:1; overflow-y:auto; padding:16px 0 8px; }
.msg { display:flex; gap:12px; padding:4px 16px; position:relative; }
.msg:hover { background:rgba(0,0,0,.08); }
.msg.first { margin-top:12px; }
.msg .body { min-width:0; flex:1; }
.msg .author { font-size:14px; font-weight:600; margin-right:6px; }
.msg .time { font-size:11px; color:var(--muted); }
.msg .content { font-size:15px; line-height:1.35; word-wrap:break-word; white-space:pre-wrap; }
.msg .content .mention { background:rgba(88,101,242,.3); color:#c9cdfb; border-radius:3px; padding:0 2px; }
.msg .edited { font-size:10px; color:var(--muted); }
.msg-actions { position:absolute; top:-14px; right:16px; background:var(--bg-1); border:1px solid #1e1f22; border-radius:6px; display:none; gap:2px; padding:2px; }
.msg:hover .msg-actions { display:flex; }
.msg-actions button { padding:4px 8px; border-radius:4px; font-size:13px; }
.msg-actions button:hover { background:var(--bg-3); }
.reactions { display:flex; gap:4px; flex-wrap:wrap; margin-top:4px; }
.reaction { background:var(--bg-1); border:1px solid transparent; border-radius:6px; padding:2px 6px; font-size:13px; display:flex; gap:4px; align-items:center; }
.reaction.mine { border-color:var(--brand); background:rgba(88,101,242,.15); }
.reaction:hover { border-color:var(--muted); }
.day-sep { display:flex; align-items:center; gap:12px; padding:8px 16px; color:var(--muted); font-size:12px; font-weight:600; }
.day-sep::before,.day-sep::after { content:""; flex:1; height:1px; background:rgba(255,255,255,.06); }
.typing-bar { min-height:22px; padding:0 16px; font-size:12px; color:var(--muted); }
.typing-bar .dots { animation:blink 1.2s infinite; }
@keyframes blink { 50% { opacity:.3; } }

.composer { padding:0 16px 18px; display:flex; gap:8px; align-items:flex-end; }
.composer textarea { flex:1; resize:none; max-height:150px; font-size:15px; line-height:1.4; background:var(--bg-1); border-radius:var(--radius); padding:11px 12px; }
.icon-btn { padding:8px; font-size:20px; border-radius:50%; }
.icon-btn:hover { background:var(--bg-3); }
.icon-btn.send { color:var(--brand); font-size:18px; }

/* ---------- membres ---------- */
.members { background:var(--bg-1); overflow-y:auto; padding:16px 8px; }
.members h3 { color:var(--muted); font-size:11px; text-transform:uppercase; letter-spacing:.5px; padding:4px 8px 8px; }
.member { display:flex; gap:8px; align-items:center; padding:5px 8px; border-radius:6px; font-size:15px; }
.member:hover { background:var(--bg-3); }
.member.off { opacity:.4; }
.member .tag { margin-left:auto; font-size:10px; background:var(--brand); border-radius:4px; padding:1px 4px; color:#fff; }

/* ---------- modales & popups ---------- */
.modal-overlay { position:fixed; inset:0; background:rgba(0,0,0,.6); display:flex; align-items:center; justify-content:center; z-index:50; }
.modal { background:var(--bg-1); border-radius:10px; padding:24px; width:440px; max-width:92vw; display:flex; flex-direction:column; gap:12px; box-shadow:0 8px 30px rgba(0,0,0,.5); }
.modal h2 { font-size:20px; }
.modal .row { display:flex; gap:8px; justify-content:flex-end; }
.emoji-pop { position:fixed; bottom:80px; left:calc(72px + 240px + 16px); background:var(--bg-1); border-radius:10px; padding:8px; box-shadow:0 4px 20px rgba(0,0,0,.5); z-index:60; }
#emoji-grid { display:grid; grid-template-columns:repeat(8,1fr); gap:2px; max-height:220px; overflow-y:auto; }
#emoji-grid button { font-size:22px; padding:4px; border-radius:6px; }
#emoji-grid button:hover { background:var(--bg-3); }
.toasts { position:fixed; bottom:16px; right:16px; display:flex; flex-direction:column; gap:8px; z-index:70; }
.toast { background:var(--bg-1); border-left:4px solid var(--brand); padding:12px 16px; border-radius:8px; font-size:14px; box-shadow:0 4px 16px rgba(0,0,0,.4); animation:slide .2s ease; }
.toast.err { border-color:var(--red); }
@keyframes slide { from { transform:translateX(30px); opacity:0; } }

::-webkit-scrollbar { width:8px; }
::-webkit-scrollbar-thumb { background:#1a1b1e; border-radius:4px; }
::-webkit-scrollbar-track { background:transparent; }

@media (max-width:900px){ .app { grid-template-columns:64px 180px 1fr 0; } .members { display:none; } }
