/* ========== GLOBAL STYLING ========== */
@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@600&family=Open+Sans&display=swap');

:root {
  --header-font: 'Montserrat', sans-serif;
  --paragraph-font: 'Open Sans', sans-serif;
  --main-color: #2a9d8f;
  --secondary-color: #264653;
  --accent-color: rgba(42, 157, 143, 0.1);
  --background-color: linear-gradient(120deg, #4f8cff 0%, #a1e3ff 100%);
  --white: #e0f7f5;
  --black: #000000;
}

* {
  padding: 0;
  margin: 0;
  box-sizing: border-box;
  scroll-behavior: smooth;
}

body {
  font-family: var(--paragraph-font);
  background-color: var(--background-color);
  color: var(--white);
  padding: 2rem;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--header-font);
}

img {
  pointer-events: none;
}

/* ========== CHAT STYLING ========== */
.chat-container {
  background: #fff;
  max-width: 420px;
  margin: 40px auto;
  border-radius: 12px;
  box-shadow: 0 6px 32px rgba(0, 0, 0, 0.15);
  padding: 24px 20px 16px 20px;
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 10px;
}

h2 {
  text-align: center;
  color: #4f8cff;
  letter-spacing: 1px;
}

.messages {
  height: 300px;
  overflow-y: auto;
  border: 1px solid #e2e2e2;
  border-radius: 8px;
  padding: 12px;
  background: #f8fbff;
  margin-bottom: 18px;
  box-sizing: border-box;
}

.message {
  margin-bottom: 10px;
  padding: 6px 10px;
  border-radius: 6px;
  background: #eaf4ff;
  color: #222;
  font-size: 1rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.message.me {
  background: #d1ffe7;
  align-self: flex-end;
}

.timestamp {
  color: #888;
  font-size: 0.9em;
  margin-right: 6px;
  min-width: 64px;
  text-align: right;
  font-family: monospace;
}

.nickname {
  font-weight: bold;
  color: #4f8cff;
  margin-right: 4px;
}

#chat-form {
  display: flex;
  gap: 8px;
}

#nickname,
#message {
  flex: 1;
  padding: 7px 10px;
  border: 1px solid #bcd;
  border-radius: 5px;
  font-size: 1em;
}

#nickname {
  max-width: 120px;
}

#message {
  max-width: 180px;
}

button[type='submit'] {
  background: #4f8cff;
  color: #fff;
  border: none;
  border-radius: 5px;
  padding: 8px 18px;
  font-size: 1em;
  cursor: pointer;
}

button[type='submit']:hover {
  background: #357ae8;
}

/* ========== DARK MODE ========== */
#darkmode-toggle {
  background: #f4f4f4;
  color: #333;
  border: none;
  border-radius: 5px;
  padding: 6px 12px;
  font-size: 1em;
  cursor: pointer;
  margin-left: 30px;
  transition: ease-in 0.2s;
}

#darkmode-toggle:hover {
  background: #ffe066;
}

body.darkmode #darkmode-toggle {
  background: #23283a;
  color: #ffe066;
}

body.darkmode #darkmode-toggle:hover {
  background: #ffe066;
  color: #23283a;
}

body.darkmode {
  background: #181c25;
  color: #f2f2f2;
}

body.darkmode .chat-container {
  background: #23283a;
  box-shadow: 0 6px 32px rgba(0, 0, 0, 0.4);
}

body.darkmode .messages {
  background: #202334;
  border-color: #33384c;
}

body.darkmode .message {
  background: #2d3148;
  color: #e2e2e2;
}

body.darkmode .message.me {
  background: #1b3c36;
}

body.darkmode .nickname {
  color: #ffe066;
}

body.darkmode button[type='submit'] {
  background: #33384c;
  color: #ffe066;
}

body.darkmode button[type='submit']:hover {
  background: #ffe066;
  color: #23283a;
}
