* { box-sizing: border-box; }
body { font-family: Arial, sans-serif; margin: 0; background: #f2f2f2; color: #222; }
header { background: #222; color: #fff; padding: 10px 16px; display: flex; justify-content: space-between; align-items: center; }
header .status { font-size: 12px; }
header .status.connected { color: #7CFC00; }
header .status.disconnected { color: #ff6666; }
.hidden { display: none !important; }

/* AUTH VIEW */
#authView { max-width: 420px; margin: 40px auto; background: #fff; padding: 20px; border-radius: 6px; box-shadow: 0 0 6px rgba(0,0,0,0.15); }
#authView h2 { margin-top: 0; }
#authView .tabs { display: flex; margin-bottom: 12px; }
#authView .tabs button { flex: 1; padding: 8px; cursor: pointer; }
#authView .tabs button.active { background: #222; color: #fff; }
#authView form { display: flex; flex-direction: column; gap: 8px; }
#authView input { padding: 8px; font-size: 14px; }
#authView button[type=submit] { padding: 10px; background: #222; color: #fff; border: none; cursor: pointer; }
#authError { font-size: 13px; margin-top: 8px; }
#authError.error { color: red; }
#authError.success { color: green; }

/* APP VIEW */
#appView { display: flex; height: calc(100vh - 40px); }
#sidebar { width: 260px; background: #fff; border-right: 1px solid #ccc; overflow-y: auto; padding: 10px; flex-shrink: 0; }
#sidebar h3 { margin: 14px 0 6px; font-size: 13px; text-transform: uppercase; color: #666; }
#sidebar .row { display: flex; gap: 4px; margin-bottom: 6px; }
#sidebar input { flex: 1; padding: 6px; font-size: 13px; }
#sidebar button { padding: 6px 8px; font-size: 12px; cursor: pointer; }
#sidebar button.full { width: 100%; margin-bottom: 6px; }
#roomList div, #onlineList div { padding: 6px; font-size: 13px; border-radius: 4px; cursor: pointer; }
#roomList div.active { background: #222; color: #fff; }
#roomList div:hover { background: #eee; }
#onlineList div { cursor: default; }
.online-dot { display:inline-block; width:8px; height:8px; border-radius:50%; background:#2ecc71; margin-right:6px; }

#main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
#chatHeader { padding: 10px 16px; background: #fff; border-bottom: 1px solid #ccc; display: flex; justify-content: space-between; align-items: center; }
#chatHeader .actions button { margin-left: 6px; font-size: 12px; padding: 4px 8px; cursor: pointer; }
#messages { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 12px 16px; background: #fafafa; }
.msg { margin-bottom: 8px; font-size: 14px; overflow-wrap: anywhere; word-break: break-word; }
.msg .user { font-weight: bold; }
.msg.sys { color: #888; font-style: italic; }
#inputRow { display: flex; padding: 10px; border-top: 1px solid #ccc; background: #fff; }
#inputRow input { flex: 1; padding: 10px; font-size: 14px; }
#inputRow button { padding: 10px 16px; cursor: pointer; }

#membersPanel { width: 220px; background: #fff; border-left: 1px solid #ccc; padding: 10px; overflow-y: auto; flex-shrink: 0; }
#membersPanel h3 { font-size: 13px; text-transform: uppercase; color: #666; }
#membersPanel div { font-size: 13px; padding: 3px 0; }

#log { position: fixed; bottom: 0; left: 0; right: 0; max-height: 120px; overflow-y: auto; background: #111; color: #0f0; font-family: monospace; font-size: 11px; padding: 4px 8px; opacity: 0.9; }
#logToggle { position: fixed; bottom: 0; right: 0; background:#111; color:#fff; font-size:11px; padding:3px 8px; cursor:pointer; z-index:10; }
