/* 기본 스타일 */
body {
  margin: 0;
  font-family: 'Segoe UI', sans-serif;
  font-size: 18px;
  transition: background-color 0.3s, color 0.3s;
}

/* 라이트 모드 조정 */
body.light {
  background-color: #f5f5f5;
  color: #111;
}

body.light .case-card {
  border: 1px solid #111;  
}

/* 다크 모드 조정 */
body.dark {
  background-color: #2a2a2a;
  color: #eee;
}
body.dark .case-card {
  background: #eeeeee;
  color: #111;
}

body.dark .modal-content {
  color: #111;
}

.container {
  display: flex;
  height: 100vh;
}

/* 좌측 메뉴 */
.menubar {
  position: fixed;
  top: 8px;
  left: 8px;
  background: #2e2e2e;
  color: white;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 10px;
  overflow: hidden;
  z-index: 1000;
  transition: width 0.3s ease, height 0.3s ease, top 0.3s ease, left 0.3s ease, border-radius 0.3s ease;
  width: 15vw;
  max-width: 60px;
  height: 50px;
  border-radius: 8px;
}
.menubar.visible {
  width: 70vw;
  max-width: 250px;
  height: 100%;
  top: 0;
  left: 0;
  border-radius: 0;
}

.menu-toggle {
  background: #444;
  border: none;
  color: white;
  font-size: 26px;
  width: 100%;
  height: 56px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: justify-content 0.3s ease, background-color 0.3s ease;
  border-radius: 6px;
}
.menubar.visible .menu-toggle {
  justify-content: flex-start;
}

.menu-items {
  display: none;
  flex-direction: column;
  gap: 18px;
  margin-top: 12px;
}
.menubar.visible .menu-items {
  display: flex;
}

.menu-items button,
.menu-items a,
.menubar button,
.menubar a {
  color: white;
  background: transparent;
  border: none;
  text-align: left;
  cursor: pointer;
  font-size: 18px;
  text-decoration: none;
  padding: 8px 0;
}
.menubar button:hover,
.menubar a:hover {
  text-decoration: underline;
}

/* 채팅 영역 */
.chat-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 24px;
  margin-left: 80px;
  transition: margin-left 0.3s ease, margin-top 0.3s ease;
}
.chat-log {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  transition: padding-top 0.3s ease;
}

/* 말풍선 */
.chat-message {
  padding: 14px 20px;
  border-radius: 22px;
  max-width: 70%;
  word-wrap: break-word;
  display: inline-block;
  font-size: 17px;
}
.user-message {
  align-self: flex-end;
  background-color: #4e9cff;
  color: white;
  text-align: right;
}
.bot-message {
  align-self: flex-start;
  background-color: #e0e0e0;
  color: #111;
  text-align: left;
}

/* 입력 영역 */
.input-area {
  display: flex;
  gap: 12px;
}
.input-area input {
  flex: 1;
  padding: 14px;
  border-radius: 24px;
  border: 1px solid #ccc;
  font-size: 18px;
}
.input-area button {
  padding: 12px 24px;
  border-radius: 24px;
  border: none;
  background-color: #4e9cff;
  color: white;
  cursor: pointer;
  font-size: 18px;
  margin-right: 5px;
}

/* 우측 패널 */
.right-panel {
  width: 270px;
  background: #f0f0f0;
  padding: 24px;
  font-size: 18px;
  transition: transform 0.3s ease;
}
body.dark .right-panel {
  background: #2e2e2e;
  color: #eee;
}

/* 우측 패널 카드 */
.case-card {
  width: 90%;
  margin: 12px auto;
  padding: 12px;
  background: #f3f3f3;
  border-radius: 8px;
  margin-bottom: 12px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.1);
}


/* 설정 팝업 */
.overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
}
.overlay.hidden {
  display: none;
}
.settings-panel {
  background: white;
  padding: 32px;
  border-radius: 12px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.3);
}
.settings-panel h3 {
  color: black;
  font-size: 20px;
}
.settings-panel button {
  display: block;
  margin: 12px 0;
  width: 100%;
  padding: 14px;
  font-size: 18px;
  cursor: pointer;
}

/* 모달 스타일 */
.modal-overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100vw; height: 100vh;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

.modal-box {
  background: white;
  padding: 24px;
  max-width: 80vw;
  max-height: 80vh;
  overflow: auto;
  border-radius: 12px;
  font-size: 14px;
  white-space: pre-wrap;
}

.modal-close-btn {
  float: right;
  margin-bottom: 12px;
  background: #f44336;
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
}

.modal-content {
  white-space: pre-wrap;
  line-height: 1.6;
}

/* 데스크탑 전용: 메뉴 확장 시 채팅 영역 밀기 */
@media (min-width: 1081px) {
  .menubar.visible ~ .chat-area {
    margin-left: 270px;
  }

  .menubar ~ .chat-area {
    margin-left: 80px;
  }
  
  .container {
    height: 100vh;
    overflow: hidden;
  }

  .chat-area {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
  }

  .chat-log {
    flex: 1;
    overflow-y: auto;
  }

  .right-panel {
    height: 100vh;
    overflow-y: auto;
  }
}

/* 모바일 레이아웃 */
@media (max-width: 1080px) {
  .container {
    flex-direction: column;
    height: 100vh;
    overflow-x: hidden;
  }
  .menubar.visible {
    width: 70vw;
    max-width: 150px;
  }

  .chat-area {
    flex: 1;
    height: calc(80vh - 80px);
    margin-top: 80px;
    margin-left: 0;
    width: 90%;
    overflow-y: auto;
  }

  .right-panel {
    width: 100%;
    text-align: center;
    font-size: 16px;
    margin-left: 0;
    overflow-y: auto;
    transition: none;
  }

  body.dark .right-panel {
    background: #2e2e2e;
    color: #eee;
  }

  .case-card {
    width: 90%;
    align-content: center;
    text-align: center;
    word-wrap: break-word;
    word-break: break-word;
    white-space: normal;
    font-size: 16px;
  }
}