body {
  margin: 0;
  font-family: arial, 'Segoe UI', sans-serif;
}

.container {
  display: flex;
  width: 50vw;
  height: 60vh;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 12px rgba(0,0,0,0.2);
  border-radius: 8px;
  overflow: hidden;
}

/* Sidebar */
.sidebar {
  flex: 2;
  background-color: rgba(33, 150, 243, 0.7);
  color: white;
  display: flex;
  flex-direction: column;
  padding: 10px;
  box-sizing: border-box;
  border-right: 1px solid rgba(0, 0, 0, 0.15);
}

.sidebar h3 {
  margin-top: 0;
}

.history {
  flex: 1;
  overflow-y: auto;
  margin-top: 10px;
}

.history-item {
  padding: 8px;
  background-color: rgba(255, 255, 255, 0.2);
  margin-bottom: 6px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
}

.history-item:hover {
  background-color: rgba(255, 255, 255, 0.3);
}

/* Chat Panel 전체 flex column */
.chat-panel {
  flex: 8;
  display: flex;
  flex-direction: column;
  background: #fff;
  position: relative;
}

.chat-header {
  padding: 10px 20px;
  background-color: #f5f5f5;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #ccc;
  font-size: 20px;
  box-sizing: border-box;
  width: 100%;
}

.chat-header > div:first-child {
  font-weight: bold;
  display: flex;
  align-items: center;
  gap: 15px;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 20px;
}

/* FAQ 버튼 - chat panel 내부 오른쪽 상단 */
.faq-button {
  position: absolute;
  bottom: 85px;
  right: 30px;
  width: 80px;
  height: 30px;
  background-color: #3b82f6;
  border: none;
  border-radius: 15px;
  color: white;
  font-size: 12px;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.faq-button:hover {
  background-color: #2563eb;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.mode-toggle {
  display: flex;
  gap: 10px;
}

.mode-toggle input[type="radio"] {
  display: none;
}

.mode-toggle label {
  padding: 6px 10px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 14px;
  border: 1px solid #ccc;
  transition: 0.2s;
  user-select: none;
  white-space: nowrap;
}

.mode-toggle input[type="radio"]:checked + label {
  background-color: #3b82f6;
  color: white;
  border-color: #3b82f6;
}

.chat-header button {
  padding: 8px 12px;
  border: none;
  border-radius: 4px;
  background-color: #2196f3;
  color: white;
  font-size: 14px;
  cursor: pointer;
  white-space: nowrap;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* chat-panel 내부 flex row: chat area만 사용 */
.chat-main {
  flex: 1;
  display: flex;
  overflow: hidden;
  position: relative;
}

/* 채팅 메시지 영역 */
.chat-area {
  flex: 1;
  padding: 15px 20px;
  overflow-y: auto;
  background-color: #fafafa;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-sizing: border-box;
}

.bubble {
  max-width: 70%;
  padding: 10px 14px;
  border-radius: 16px;
  line-height: 1.4;
}

.user {
  align-self: flex-end;
  background-color: #dcf8c6;
}

.bot {
  align-self: flex-start;
  background-color: #e3f2fd;
}

/* FAQ 슬라이드 모달 - chat panel 내부에서 동작 */
.faq-modal {
  position: absolute;
  top: 0;
  right: -350px;
  width: 350px;
  height: 100%;
  background-color: #f0f4ff;
  box-shadow: -5px 0 15px rgba(0, 0, 0, 0.3);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  transition: right 0.3s ease-in-out;
}

.faq-modal.show {
  right: 0;
}

.faq-modal-header {
  padding: 15px 20px;
  background-color: #3b82f6;
  color: white;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.faq-modal-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}

.faq-close {
  background: none;
  border: none;
  color: white;
  font-size: 18px;
  cursor: pointer;
  padding: 0;
  width: 25px;
  height: 25px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background-color 0.2s;
}

.faq-close:hover {
  background-color: rgba(255, 255, 255, 0.2);
}

.faq-content {
  flex: 1;
  padding: 15px;
  overflow-y: auto;
}

.faq-content ul {
  list-style: none;
  padding-left: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.faq-content ul li {
  background-color: white;
  padding: 12px 15px;
  border-radius: 8px;
  cursor: pointer;
  box-shadow: 0 2px 5px rgba(59, 130, 246, 0.2);
  transition: all 0.2s;
  font-size: 13px;
  color: #1e40af;
  user-select: none;
}

.faq-content ul li:hover {
  background-color: #3b82f6;
  color: white;
  box-shadow: 0 4px 10px rgba(59, 130, 246, 0.5);
  transform: translateY(-1px);
}

/* 모달 배경 오버레이 - chat panel 내부에서만 */
.faq-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.3);
  z-index: 999;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease-in-out, visibility 0.3s ease-in-out;
}

.faq-overlay.show {
  opacity: 1;
  visibility: visible;
}

.input-area {
  display: flex;
  padding: 10px;
  border-top: 1px solid #ddd;
}

.input-area input {
  flex: 1;
  padding: 10px;
  border: 1px solid #ccc;
  border-radius: 8px;
}

.input-area button {
  margin-left: 10px;
  padding: 10px 16px;
  font-size: 14px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  color: white;
}

.send-sql {
  background-color: #4caf50;
}

.send-gpt {
  background-color: #2196f3;
}
</style>
