* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Roboto', sans-serif;
}

body {
  background-color: #f5f5f5;
}

.hidden {
  display: none !important;
}

#chat-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 1000;
}

.chat-button {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background-color: #1976d2;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
  transition: transform 0.2s;
}

.chat-button:hover {
  transform: scale(1.05);
}

.chat-window {
  position: fixed;
  bottom: 90px;
  right: 20px;
  width: 350px;
  height: 500px;
  background-color: white;
  border-radius: 10px;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
}

.chat-header {
  padding-left: 15px;
  padding-top: 10px;
  background-color: #1976d2;
  color: white;
  border-radius: 10px 10px 0 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chat-header h2 {
  font-size: 1.2rem;
  font-weight: 500;
}

.close-button {
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  padding: 5px;
}

.messages-container {
  flex: 1;
  overflow-y: auto;
  padding: 15px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.messages {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.message {
  max-width: 80%;
  padding: 10px 15px;
  border-radius: 15px;
  font-size: 0.9rem;
  line-height: 1.4;
}

.message.user {
  align-self: flex-end;
  background-color: #1976d2;
  color: white;
}

.message.bot {
  align-self: flex-start;
  background-color: #f0f0f0;
  color: #333;
}

.message.slack {
  align-self: flex-start;
  background-color: #4A154B;
  color: white;
  position: relative;
}

.message.slack .ip-info {
  font-size: 0.5rem;
  color: #E6E6E6;
  opacity: 0.8;
}

.message.slack .thread-info {
  font-size: 0.7rem;
  color: #E6E6E6;
  margin-top: 2px;
  opacity: 0.8;
  font-style: italic;
}

.message.slack.thread-not-found {
  background-color: #E01E5A;  /* 에러 상태를 나타내는 빨간색 */
}

.message.slack.thread-not-found .thread-info {
  color: #FFB6C1;  /* 연한 빨간색 */
}

.message.slack[data-ip="192.168.0.7"] {
  background-color: #2EB67D;  /* Slack의 초록색 */
}

.message.slack[data-ip="192.168.0.8"] {
  background-color: #ECB22E;  /* Slack의 노란색 */
}

.message.slack[data-ip="192.168.0.9"] {
  background-color: #E01E5A;  /* Slack의 빨간색 */
}

.message.error {
  align-self: center;
  background-color: #E01E5A;
  color: white;
  font-size: 0.9rem;
  padding: 8px 12px;
  border-radius: 8px;
  margin: 8px 0;
  text-align: center;
  animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.input-container {
  padding: 15px;
  border-top: 1px solid #eee;
  display: flex;
  gap: 10px;
}

.message-input {
  flex: 1;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 20px;
  outline: none;
  font-size: 0.9rem;
}

.message-input:focus {
  border-color: #1976d2;
}

.send-button {
  background-color: #1976d2;
  color: white;
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.2s;
}

.send-button:hover {
  background-color: #1565c0;
}

.loading {
  display: flex;
  justify-content: center;
  padding: 10px;
}

.spinner {
  width: 30px;
  height: 30px;
  border: 3px solid #f3f3f3;
  border-top: 3px solid #1976d2;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@media screen and (max-width: 768px) {
  #chat-container {
    bottom: 10px;
    right: 10px;
  }

  .chat-button {
    width: 50px;
    height: 50px;
  }

  .chat-window {
    position: fixed;
    bottom: 70px;
    right: 10px;
    width: calc(100% - 20px);
    height: calc(100% - 90px);
    max-width: 350px;
    max-height: 500px;
    border-radius: 15px;
  }

  .message {
    max-width: 85%;
    font-size: 0.85rem;
    padding: 8px 12px;
  }

  .message.error {
    max-width: 90%;
    font-size: 0.8rem;
    padding: 6px 10px;
  }

  .input-container {
    padding: 10px;
  }

  .message-input {
    font-size: 0.85rem;
    padding: 8px 12px;
  }

  .send-button {
    width: 36px;
    height: 36px;
  }

  .material-icons {
    font-size: 1.2rem;
  }
}

/* iOS Safari에서의 입력 필드 자동 확대 방지 */
@supports (-webkit-touch-callout: none) {
  .message-input {
    font-size: 16px;
  }
}

/* 모바일에서 스크롤 부드럽게 */
.messages-container {
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
}

/* 모바일에서 터치 영역 확대 */
.chat-button,
.close-button,
.send-button {
  min-width: 44px;
  min-height: 44px;
}

/* 모바일에서 입력 필드 포커스 시 줌 방지 */
.message-input:focus {
  font-size: 16px;
  transform: scale(1);
}
