/* --- Reset & base --- */
* {
  box-sizing: border-box;
}
body, html {
  margin: 0; padding: 0; height: 100%;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: #eee;
  user-select: none;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* --- Container --- */
#menu, #chatUI {
  padding: 24px;
  flex-shrink: 0;
}

#chatUI {
  flex-grow: 1;
  display: flex;
  height: calc(100vh - 96px);
  background: rgba(0,0,0,0.3);
  border-radius: 12px 12px 0 0;
  box-shadow: 0 12px 20px rgba(0,0,0,0.4);
  backdrop-filter: blur(10px);
  overflow: hidden;
}

/* --- Hidden toggle --- */
.hidden {
  display: none !important;
}

/* --- Sidebar --- */
#sidebar {
  width: 280px;
  background: rgba(0,0,0,0.6);
  padding: 20px;
  border-right: 2px solid #9f7aea;
  display: flex;
  flex-direction: column;
  border-radius: 12px 0 0 12px;
  box-shadow: inset -3px 0 8px rgba(159,122,234,0.6);
}

#nickname {
  padding: 12px 14px;
  border-radius: 8px;
  border: none;
  font-size: 16px;
  background: #6b46c1;
  color: #fff;
  margin-bottom: 24px;
  box-shadow: 0 0 10px #9f7aea;
  transition: background-color 0.3s ease;
}

#nickname:focus {
  outline: none;
  background: #805ad5;
  box-shadow: 0 0 15px #c4b5fd;
}

#users {
  flex-grow: 1;
  overflow-y: auto;
  font-weight: 600;
  font-size: 15px;
  letter-spacing: 0.04em;
  color: #d6bcfa;
}

#users b {
  display: block;
  margin-bottom: 12px;
  font-size: 18px;
  color: #e9d8fd;
}

/* --- Chat area --- */
#chat {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  padding: 20px;
  background: rgba(34, 0, 67, 0.75);
  border-radius: 0 12px 12px 0;
  box-shadow: inset 3px 0 8px rgba(159,122,234,0.7);
}

/* --- Messages --- */
#messages {
  flex-grow: 1;
  overflow-y: auto;
  padding: 10px 12px;
  background: rgba(26, 5, 54, 0.9);
  border-radius: 10px;
  box-shadow: 0 0 20px #805ad5 inset;
  font-family: 'Courier New', Courier, monospace;
  font-size: 14px;
  line-height: 1.4;
  color: #ddd;
  scrollbar-width: thin;
  scrollbar-color: #9f7aea transparent;
}

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

#messages::-webkit-scrollbar-thumb {
  background-color: #9f7aea;
  border-radius: 6px;
  box-shadow: inset 0 0 6px #764ba2;
}

/* --- Chat input --- */
#chatInput {
  margin-top: 12px;
  padding: 14px 16px;
  border-radius: 14px;
  border: none;
  background: #9f7aea;
  color: #1a202c;
  font-size: 16px;
  font-weight: 600;
  box-shadow: 0 0 15px #d6bcfa;
  resize: none;
  transition: background-color 0.3s ease;
}

#chatInput:focus {
  outline: none;
  background: #c4b5fd;
  box-shadow: 0 0 25px #d6bcfa;
}

/* --- Buttons --- */
button {
  font-weight: 700;
  font-size: 16px;
  color: #fff;
  padding: 12px 20px;
  border: none;
  border-radius: 12px;
  background: #9f7aea;
  cursor: pointer;
  transition: background-color 0.3s ease, box-shadow 0.3s ease;
  user-select: none;
  margin-left: 12px;
  box-shadow: 0 4px 10px #764ba2;
}

button:hover {
  background: #c4b5fd;
  box-shadow: 0 6px 15px #d6bcfa;
}

button:active {
  background: #805ad5;
  box-shadow: 0 2px 7px #764ba2 inset;
}

/* --- Menu area --- */
#menu {
  background: rgba(0,0,0,0.45);
  border-radius: 12px;
  width: 320px;
  margin: 24px auto 0;
  padding: 32px 24px;
  box-shadow: 0 12px 25px rgba(0,0,0,0.5);
  text-align: center;
}

#menu h2 {
  margin-bottom: 24px;
  font-weight: 900;
  letter-spacing: 0.05em;
  color: #d6bcfa;
  font-size: 28px;
}

#roomInput {
  width: 100%;
  padding: 16px 18px;
  border-radius: 14px;
  border: none;
  font-size: 18px;
  font-weight: 700;
  box-shadow: 0 0 20px #805ad5 inset;
  margin-bottom: 20px;
  color: #1a202c;
}

#roomInput::placeholder {
  color: #805ad5;
  font-weight: 600;
  opacity: 0.75;
}

/* --- Animations --- */
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 5px #9f7aea; }
  50% { box-shadow: 0 0 20px #c4b5fd; }
}
button, #nickname, #roomInput, #chatInput {
  animation: pulse 5s ease-in-out infinite;
}

/* --- Scrollbar for entire page --- */
::-webkit-scrollbar {
  width: 12px;
}

::-webkit-scrollbar-thumb {
  background: #9f7aea;
  border-radius: 20px;
  box-shadow: inset 0 0 8px #764ba2;
}
