*{margin:0;padding:0;box-sizing:border-box;}
body{font-family:'Inter',sans-serif;background:#0f0f13;color:#e0e0e0;height:100vh;overflow:hidden;}

/* AUTH */
.auth-wrap{display:flex;align-items:center;justify-content:center;height:100vh;background:linear-gradient(135deg,#0f0f13 0%,#1a1a2e 100%);}
.auth-box{background:#1a1a2e;border:1px solid #2a2a4a;border-radius:16px;padding:40px;width:360px;text-align:center;}
.auth-logo{font-size:32px;font-weight:700;color:#6c63ff;margin-bottom:8px;}
.auth-box h2{color:#fff;margin-bottom:24px;font-size:20px;}
.auth-box input{width:100%;padding:12px 16px;margin-bottom:12px;background:#0f0f1a;border:1px solid #2a2a4a;border-radius:10px;color:#e0e0e0;font-size:14px;outline:none;transition:.2s;}
.auth-box input:focus{border-color:#6c63ff;}
.auth-box button{width:100%;padding:12px;background:#6c63ff;color:#fff;border:none;border-radius:10px;font-size:15px;font-weight:600;cursor:pointer;transition:.2s;margin-top:4px;}
.auth-box button:hover{background:#5a52e0;}
.auth-switch{margin-top:16px;color:#888;font-size:13px;}
.auth-switch a{color:#6c63ff;text-decoration:none;}
.alert-err{background:#3d1a1a;border:1px solid #7f3535;color:#ff7070;padding:10px 14px;border-radius:8px;margin-bottom:16px;font-size:13px;}

/* APP LAYOUT */
.app{display:flex;height:100vh;}

/* SIDEBAR */
.sidebar{width:280px;background:#111118;border-right:1px solid #1e1e2e;display:flex;flex-direction:column;flex-shrink:0;}
.sidebar-header{display:flex;align-items:center;justify-content:space-between;padding:16px;border-bottom:1px solid #1e1e2e;}
.logo{font-size:20px;font-weight:700;color:#6c63ff;}
.icon-btn{background:#6c63ff;color:#fff;border:none;width:32px;height:32px;border-radius:8px;font-size:18px;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:.2s;}
.icon-btn:hover{background:#5a52e0;}
.search-wrap{padding:10px 12px;}
.search-wrap input{width:100%;padding:8px 12px;background:#1a1a2e;border:1px solid #2a2a4a;border-radius:8px;color:#e0e0e0;font-size:13px;outline:none;}
.rooms-list{flex:1;overflow-y:auto;padding:4px 8px;}
.rooms-list::-webkit-scrollbar{width:4px;}
.rooms-list::-webkit-scrollbar-thumb{background:#2a2a4a;border-radius:4px;}
.room-item{display:flex;align-items:center;gap:10px;padding:10px;border-radius:10px;cursor:pointer;transition:.15s;margin-bottom:2px;}
.room-item:hover{background:#1a1a2e;}
.room-item.active{background:#2a1f5e;}
.room-icon{width:36px;height:36px;background:#2a2a4a;border-radius:10px;display:flex;align-items:center;justify-content:center;font-weight:700;color:#6c63ff;font-size:15px;flex-shrink:0;}
.room-info{flex:1;min-width:0;}
.room-name{font-size:14px;font-weight:500;color:#e0e0e0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.room-desc{font-size:12px;color:#666;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.sidebar-footer{padding:12px;border-top:1px solid #1e1e2e;display:flex;align-items:center;gap:10px;}
.user-avatar{width:36px;height:36px;background:#6c63ff;border-radius:50%;display:flex;align-items:center;justify-content:center;font-weight:700;color:#fff;font-size:16px;}
.user-name{flex:1;font-size:14px;font-weight:500;}
.logout-btn{color:#555;text-decoration:none;font-size:18px;transition:.2s;}
.logout-btn:hover{color:#ff6b6b;}

/* CHAT */
.chat-area{flex:1;display:flex;flex-direction:column;min-width:0;}
.chat-header{padding:14px 20px;border-bottom:1px solid #1e1e2e;background:#111118;}
.chat-title{font-size:16px;font-weight:600;color:#fff;}
.messages{flex:1;overflow-y:auto;padding:16px;display:flex;flex-direction:column;gap:12px;}
.messages::-webkit-scrollbar{width:4px;}
.messages::-webkit-scrollbar-thumb{background:#2a2a4a;border-radius:4px;}
.empty-state{display:flex;flex-direction:column;align-items:center;justify-content:center;height:100%;color:#444;gap:12px;}
.empty-icon{font-size:48px;}

/* MESSAGES */
.msg{display:flex;align-items:flex-end;gap:8px;}
.msg-mine{flex-direction:row-reverse;}
.msg-avatar{width:32px;height:32px;background:#6c63ff;border-radius:50%;display:flex;align-items:center;justify-content:center;font-weight:700;color:#fff;font-size:13px;flex-shrink:0;}
.msg-bubble{max-width:60%;background:#1a1a2e;border-radius:14px 14px 14px 4px;padding:10px 14px;}
.msg-mine .msg-bubble{background:#2a1f5e;border-radius:14px 14px 4px 14px;}
.msg-user{font-size:11px;font-weight:600;color:#6c63ff;margin-bottom:4px;}
.msg-text{font-size:14px;line-height:1.5;word-break:break-word;white-space:pre-wrap;}
.msg-time{font-size:10px;color:#555;margin-top:4px;text-align:right;}
.msg-img{max-width:300px;max-height:300px;border-radius:8px;cursor:pointer;margin-top:4px;display:block;}
.msg-file{display:inline-block;background:#0f0f1a;border:1px solid #2a2a4a;padding:8px 12px;border-radius:8px;color:#6c63ff;text-decoration:none;font-size:13px;margin-top:4px;}
.msg-file:hover{background:#1a1a2e;}

/* INPUT */
.input-area{padding:12px 16px;border-top:1px solid #1e1e2e;background:#111118;flex-direction:column;gap:8px;}
.file-preview{display:flex;align-items:center;gap:8px;background:#1a1a2e;padding:8px 12px;border-radius:8px;font-size:13px;}
.file-preview button{background:none;border:none;color:#888;cursor:pointer;font-size:16px;}
.input-row{display:flex;align-items:flex-end;gap:8px;}
.attach-btn{background:#1a1a2e;border:none;color:#6c63ff;width:40px;height:40px;border-radius:10px;cursor:pointer;font-size:18px;flex-shrink:0;transition:.2s;}
.attach-btn:hover{background:#2a2a4a;}
#msgInput{flex:1;background:#1a1a2e;border:1px solid #2a2a4a;border-radius:10px;color:#e0e0e0;padding:10px 14px;font-size:14px;resize:none;outline:none;font-family:'Inter',sans-serif;max-height:120px;line-height:1.5;}
#msgInput:focus{border-color:#6c63ff;}
.send-btn{background:#6c63ff;color:#fff;border:none;width:40px;height:40px;border-radius:10px;cursor:pointer;font-size:18px;flex-shrink:0;transition:.2s;}
.send-btn:hover{background:#5a52e0;}

/* MODAL */
.modal{display:none;position:fixed;inset:0;background:rgba(0,0,0,.7);align-items:center;justify-content:center;z-index:100;}
.modal-box{background:#1a1a2e;border:1px solid #2a2a4a;border-radius:16px;padding:24px;width:420px;max-height:80vh;overflow-y:auto;}
.modal-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:16px;}
.modal-header h3{font-size:18px;font-weight:600;}
.modal-header button{background:none;border:none;color:#888;font-size:20px;cursor:pointer;}
.modal-box input{width:100%;padding:10px 14px;background:#0f0f1a;border:1px solid #2a2a4a;border-radius:8px;color:#e0e0e0;font-size:14px;outline:none;margin-bottom:10px;}
.btn-primary{width:100%;padding:10px;background:#6c63ff;color:#fff;border:none;border-radius:8px;font-size:14px;font-weight:600;cursor:pointer;}
.btn-sm{background:#6c63ff;color:#fff;border:none;padding:5px 12px;border-radius:6px;font-size:12px;cursor:pointer;white-space:nowrap;}
