@import url('https://fonts.googleapis.com/css2?family=Nanum+Gothic:wght@400;700&display=swap');

:root {
  --sidebar-width: 280px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  width: 100%;
  font-family: 'Nanum Gothic', 'Noto Sans KR', sans-serif;
  background-color: #faf7f0;  /* 크림 베이지톤 */
  color: #4a4a4a;             /* 차분한 다크 그레이 */
  overflow: hidden;
  display: flex;
}

#sidebar {
  width: var(--sidebar-width);
  height: 100vh;
  background-color: #fff8e7;  /* 아주 연한 크림색 */
  border-right: 1px solid #e5e1d8; /* 베이지톤 경계 */
  padding: 24px 20px;
  box-sizing: border-box;
  overflow-y: auto;
  flex-shrink: 0;
  user-select: none;
  box-shadow: 3px 0 15px rgba(0,0,0,0.04);
}

#sidebar h2 {
  color: #b28d5c;  /* 따뜻한 황토빛 */
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 16px;
  line-height: 1.2;
  white-space: nowrap;
  user-select: none;
}

#room-list {
  flex: 1;
  overflow-y: auto;
  background: #fefbf5;  /* 밝은 크림톤 */
  border-radius: 12px;
  border: 1px solid #e5e1d8;
  padding: 8px 0;
  scrollbar-width: thin;
  scrollbar-color: #b28d5c transparent;
  margin-bottom: 16px;
}

#room-list ul {
  list-style: none;
}

#room-list li {
  padding: 12px 24px;
  cursor: pointer;
  color: #7e7a72; /* 부드러운 그레이 브라운 */
  transition: background-color 0.25s ease, color 0.25s ease, border-left-color 0.25s ease;
  border-left: 4px solid transparent;
  border-radius: 0 8px 8px 0;
  font-weight: 600;
}

#room-list li:hover {
  background-color: #fff7db;  /* 은은한 황토빛 배경 */
  color: #5e4a22;  /* 톤 다운된 브라운 */
}

#room-list li.active {
  background-color: #f1e4b3;  /* 부드러운 머스터드 톤 */
  color: #6f5823;
  border-left-color: #b28d5c;
}

#new-room-btn {
  background-color: #b28d5c;
  color: #fff8e7;
  border: none;
  border-radius: 12px;
  font-weight: 700;
  font-size: 14px;
  padding: 10px 16px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(178, 141, 92, 0.4);
  user-select: none;
  transition: background-color 0.3s ease, transform 0.1s ease;
  width: 100%;
  box-sizing: border-box;
  margin-top: auto;
}

#new-room-btn:hover {
  background-color: #8e6f3f;
}

#new-room-btn:active {
  transform: translateY(2px);
}

#main-area {
  flex-grow: 1;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: #fffaf1;  /* 크림톤 배경 */
  overflow: hidden;
  position: relative;
}

#chat-container {
  flex-grow: 1;
  overflow-y: auto;
  padding: 24px 24px 90px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  scrollbar-width: thin;
  scrollbar-color: #b28d5c transparent;
  background-color: #fffaf1;
}

@keyframes fadeSlideUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.message {
  max-width: 75%;
  padding: 18px 26px;
  border-radius: 26px;
  font-size: 17px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  opacity: 0;
  animation: fadeSlideUp 0.4s forwards;
  position: relative;
  user-select: text;
  transition: background-color 0.25s ease;
}

.message.user {
  background: linear-gradient(135deg, #c9b380, #a68d3a);
  color: #fff8e7;
  align-self: flex-end;
  border-bottom-right-radius: 8px;
  box-shadow: 0 6px 20px rgba(166, 141, 58, 0.3);
}

.message.bot {
  background-color: #fefaf3;
  color: #6b6552;
  align-self: flex-start;
  border-bottom-left-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
}

pre {
  background-color: #fdf9f0; /* 완전 밝고 부드러운 크림색 */
  border-radius: 16px;
  padding: 20px 28px;
  overflow-x: auto;
  margin-top: 14px;
  border: 1px solid #e5deca; /* 살짝 연한 베이지 라인 */
  font-family: 'JetBrains Mono', monospace;
  font-size: 15px;
  color: #5e533e; /* 따뜻한 갈색 계열 글자색 */
  box-shadow: 0 3px 10px rgba(180, 160, 110, 0.1); /* 부드러운 그림자 */
  position: relative;
  user-select: text;
}

.copy-btn {
  position: absolute;
  top: 12px;
  right: 14px;
  background-color: #a68d3a;
  color: #fff8e7;
  border: none;
  border-radius: 8px;
  padding: 6px 14px;
  font-size: 13px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.3s ease;
  user-select: none;
}

pre:hover .copy-btn {
  opacity: 1;
}

#input-area {
  position: fixed;
  bottom: 0;
  left: var(--sidebar-width);
  right: 0;
  height: 60px;
  background-color: #f5f1e7;
  border-top: 1px solid #e5decf;
  box-shadow: 0 -1px 15px rgba(0, 0, 0, 0.03);
  display: flex;
  align-items: center;
  padding: 0 24px;
  z-index: 9999;
}

#input-text {
  flex: 1;
  font-size: 17px;
  border: 1.8px solid #d6cfa8;
  border-radius: 30px;
  padding: 14px 24px;
  resize: none;
  min-height: 36px;
  max-height: 100px;
  font-family: 'Nanum Gothic', monospace;
  background-color: #fff8e7;
  color: #4a4a4a;
  outline-offset: 4px;
  box-shadow: inset 0 0 8px #d2c589;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

#input-text:focus {
  border-color: #b28d5c;
  box-shadow: 0 0 0 6px rgba(178, 141, 92, 0.3);
}

#send-btn {
  background-color: #b28d5c;
  color: #fff8e7;
  border: none;
  font-weight: 700;
  padding: 0 30px;
  margin-left: 18px;
  border-radius: 34px;
  cursor: pointer;
  font-size: 17px;
  box-shadow: 0 6px 18px rgba(178, 141, 92, 0.4);
  user-select: none;
  transition: background-color 0.3s ease, transform 0.12s ease;
  height: 40px;
  align-self: center;
}

#send-btn:hover {
  background-color: #8e6f3f;
}

#send-btn:active {
  transform: translateY(2px);
}

#send-btn:disabled {
  background-color: #d6cfa8;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

#room-list::-webkit-scrollbar,
#chat-container::-webkit-scrollbar {
  width: 8px;
}

#room-list::-webkit-scrollbar-track,
#chat-container::-webkit-scrollbar-track {
  background: transparent;
}

#room-list::-webkit-scrollbar-thumb,
#chat-container::-webkit-scrollbar-thumb {
  background-color: #b28d5c;
  border-radius: 6px;
  border: 2px solid transparent;
  background-clip: content-box;
}

@media (max-width: 900px) {
  #sidebar {
    width: 220px;
    padding: 20px 16px;
    font-size: 14px;
  }
  #chat-container {
    padding: 20px 16px 90px 16px;
  }
  .message {
    max-width: 85%;
    font-size: 16px;
    padding: 16px 20px;
  }
  #input-text {
    font-size: 16px;
    padding: 14px 20px;
  }
  #send-btn {
    padding: 0 24px;
    font-size: 16px;
    margin-left: 14px;
  }
  #input-area {
    left: 220px;
  }
}

@media (max-width: 600px) {
  #sidebar {
    display: none;
  }
  #main-area {
    height: 100vh;
  }
  #input-text {
    font-size: 15px;
    padding: 12px 16px;
  }
  #send-btn {
    padding: 0 20px;
    font-size: 15px;
    margin-left: 10px;
  }
  .message {
    max-width: 90%;
    font-size: 15px;
    padding: 14px 18px;
  }
  #input-area {
    left: 0;
  }
}

