* {
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
  background: #1a1a1a;
  color: #e0e0e0;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

#authBar {
  background: #2a2a2a;
  border-bottom: 1px solid #3a3a3a;
  padding: 10px 20px;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
}

#authButtons, #userInfo {
  display: flex;
  gap: 10px;
  align-items: center;
}

.auth-btn {
  padding: 8px 16px;
  background: #fff;
  color: #1a1a1a;
  border: none;
  border-radius: 7px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: background 0.2s;
}

.auth-btn:hover {
  background: #e0e0e0;
}

#usernameDisplay {
  color: #b0b0b0;
  font-size: 14px;
}

.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
}

.modal-content {
  background-color: #2a2a2a;
  margin: 10% auto;
  padding: 30px;
  border: 1px solid #3a3a3a;
  border-radius: 7px;
  width: 90%;
  max-width: 400px;
  position: relative;
}

.modal-content h2 {
  margin: 0 0 20px 0;
  color: #e0e0e0;
  font-size: 24px;
  text-align: center;
}

.modal-content p {
  text-align: center;
  color: #b0b0b0;
  font-size: 15px;
  margin: 0 0 10px 0;
}

.close, .close-welcome {
  color: #888;
  float: right;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
  line-height: 20px;
}

.close:hover, .close-welcome:hover {
  color: #e0e0e0;
}

.auth-error {
  background: #c74444;
  color: #fff;
  padding: 10px;
  border-radius: 7px;
  margin-bottom: 15px;
  display: none;
  font-size: 13px;
}

.auth-error.show {
  display: block;
}

#loginForm input, #registerForm input {
  width: 100%;
  padding: 12px;
  margin-bottom: 15px;
  background: #222;
  border: 1px solid #3a3a3a;
  border-radius: 7px;
  color: #e0e0e0;
  font-size: 14px;
  box-sizing: border-box;
}

#loginForm input:focus, #registerForm input:focus {
  outline: none;
  border-color: #fff;
}

#loginForm button, #registerForm button {
  width: 100%;
  padding: 12px;
  background: #fff;
  color: #1a1a1a;
  border: none;
  border-radius: 7px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: background 0.2s;
}

#loginForm button:hover, #registerForm button:hover {
  background: #e0e0e0;
}

.auth-switch {
  text-align: center;
  margin-top: 15px;
  color: #b0b0b0;
  font-size: 13px;
}

.auth-switch a {
  color: #fff;
  text-decoration: none;
}

.auth-switch a:hover {
  text-decoration: underline;
}

.password-requirements {
  background: #222;
  padding: 10px;
  border-radius: 7px;
  margin-bottom: 15px;
  border: 1px solid #3a3a3a;
}

.password-requirements small {
  color: #888;
  font-size: 12px;
}

.password-requirements ul {
  margin: 5px 0 0 0;
  padding-left: 20px;
  color: #b0b0b0;
  font-size: 12px;
}

.password-requirements li {
  margin: 3px 0;
}

.admin-modal {
  max-width: 800px;
  max-height: 80vh;
  overflow-y: auto;
}

.admin-tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  border-bottom: 1px solid #3a3a3a;
}

.admin-tab {
  padding: 10px 20px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: #b0b0b0;
  cursor: pointer;
  transition: all 0.2s;
}

.admin-tab.active {
  color: #fff;
  border-bottom-color: #fff;
}

.admin-tab:hover {
  background: #222;
}

.admin-room-card, .admin-user-card {
  background: #222;
  padding: 15px;
  margin-bottom: 10px;
  border-radius: 7px;
  border: 1px solid #3a3a3a;
}

.admin-room-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.admin-room-title {
  font-size: 16px;
  color: #e0e0e0;
  font-weight: 500;
}

.admin-room-stats {
  font-size: 13px;
  color: #888;
  margin-bottom: 10px;
}

.admin-room-actions {
  display: flex;
  gap: 8px;
}

.admin-btn-small {
  padding: 6px 12px;
  font-size: 12px;
}

.admin-btn-danger {
  background: #c74444;
}

.admin-btn-danger:hover {
  background: #b03838;
}

.admin-back-btn {
  margin-bottom: 15px;
  background: #3a3a3a;
}

.admin-back-btn:hover {
  background: #4a4a4a;
}

.admin-message {
  background: #1a1a1a;
  padding: 10px;
  margin-bottom: 8px;
  border-radius: 7px;
  border-left: 3px solid #fff;
}

.admin-message-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 5px;
  font-size: 12px;
  color: #888;
}

.admin-message-content {
  color: #e0e0e0;
  font-size: 14px;
}

.close-admin {
  cursor: pointer;
}

.main-container {
  flex: 1;
  display: flex;
  gap: 20px;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 20px;
}

.instructions {
  flex: 0 0 280px;
  background: #2a2a2a;
  padding: 20px;
  border-radius: 7px;
  border: 1px solid #3a3a3a;
}

.instructions h2 {
  margin: 0 0 20px 0;
  font-size: 20px;
  color: #e0e0e0;
}

.info-box {
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 1px solid #3a3a3a;
}

.info-box:last-child {
  border-bottom: none;
  margin-bottom: 0;
}

.info-box strong {
  display: block;
  margin-bottom: 8px;
  color: #fff;
  font-size: 14px;
}

.info-box p, .info-box p2 {
  margin: 5px 0;
  font-size: 13px;
  color: #b0b0b0;
  line-height: 1.4;
}

.info-box ol, .info-box ul {
  margin: 8px 0;
  padding-left: 20px;
  font-size: 13px;
  color: #b0b0b0;
}

.info-box li {
  margin: 4px 0;
}

.chat-container {
  flex: 1;
  background: #2a2a2a;
  padding: 20px;
  border-radius: 7px;
  border: 1px solid #3a3a3a;
  display: flex;
  flex-direction: column;
}

#statusContainer {
  background: #222;
  padding: 12px;
  border-radius: 7px;
  margin-bottom: 20px;
  border: 1px solid #3a3a3a;
  font-size: 13px;
}

#statusContainer strong {
  color: #fff;
}

#serverStatus, #peersStatus {
  color: #b0b0b0;
  font-size: 12px;
}

.input-group {
  margin-bottom: 15px;
}

.input-group label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  color: #b0b0b0;
  font-weight: 500;
}

.input-group .input-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.input-group .input-row input[type="text"] {
  flex: 1;
  margin-bottom: 0;
}

.input-group .input-row button {
  flex-shrink: 0;
}

input[type="text"] {
  width: 100%;
  padding: 10px;
  background: #222;
  border: 1px solid #3a3a3a;
  border-radius: 7px;
  color: #e0e0e0;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

input[type="text"]:focus {
  border-color: #fff;
}

input[type="text"]::placeholder {
  color: #666;
}

button {
  padding: 10px 16px;
  background: #fff;
  color: #1a1a1a;
  border: none;
  border-radius: 7px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: background 0.2s;
}

button:hover {
  background: #e0e0e0;
}

button:disabled {
  background: #3a3a3a;
  color: #666;
  cursor: not-allowed;
}

#disconnectBtn {
  background: #c74444;
}

#disconnectBtn:hover {
  background: #b03838;
}

.checkbox-group {
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.checkbox-group input[type="checkbox"] {
  width: auto;
  cursor: pointer;
  accent-color: #fff;
}

.checkbox-group label {
  margin: 0;
  font-size: 13px;
  color: #b0b0b0;
  cursor: pointer;
}

.help-text {
  margin-top: 6px;
  font-size: 12px;
  color: #666;
  font-style: italic;
}

#chat {
  flex: 1;
  background: #222;
  border: 1px solid #3a3a3a;
  border-radius: 7px;
  padding: 12px;
  overflow-y: auto;
  margin-bottom: 15px;
  min-height: 300px;
  max-height: 400px;
}

.your-msg {
  color: #fff;
  margin-bottom: 8px;
  word-wrap: break-word;
}

.peer-msg {
  color: #7bc96f;
  margin-bottom: 8px;
  word-wrap: break-word;
}

.system-msg {
  color: #888;
  font-style: italic;
  margin-bottom: 8px;
  font-size: 13px;
}

.chat-controls {
  display: flex;
  gap: 8px;
}

.chat-controls input[type="text"] {
  flex: 1;
}

.chat-controls button {
  flex-shrink: 0;
}

.userListPane {
  flex: 0 0 200px;
  background: #2a2a2a;
  padding: 20px;
  border-radius: 7px;
  border: 1px solid #3a3a3a;
}

.userListPane h3 {
  margin: 0 0 15px 0;
  font-size: 16px;
  color: #fff;
}

#userList {
  list-style: none;
  padding: 0;
  margin: 0;
}

#userList li {
  padding: 8px;
  margin-bottom: 6px;
  background: #222;
  border-radius: 7px;
  font-size: 13px;
  color: #b0b0b0;
  border: 1px solid #3a3a3a;
}

#publicRoomList {
  list-style: none;
  padding: 0;
  margin: 0;
}

#publicRoomList li {
  font-size: 13px;
  color: #b0b0b0;
  margin: 4px 0;
}

#chat::-webkit-scrollbar {
  width: 8px;
}

#chat::-webkit-scrollbar-track {
  background: #1a1a1a;
  border-radius: 7px;
}

#chat::-webkit-scrollbar-thumb {
  background: #3a3a3a;
  border-radius: 7px;
}

#chat::-webkit-scrollbar-thumb:hover {
  background: #4a4a4a;
}

@media (max-width: 768px) {
  .main-container {
    flex-direction: column;
  }
  
  .instructions, .chat-container, .userListPane {
    flex: 1 1 auto;
    width: 100%;
  }
  
  body {
    padding: 10px;
  }
}
