html,
body {
  height: -webkit-fill-available;
}

body {
  margin: 0;
  padding: 0;
  height: 100%;
  width: 100%;
  font-family: 'Pretendard Variable', sans-serif;
}

/********** 1. 기타  **********/
#chatbot-container {
  position: fixed;
  bottom: 60px;
  right: 60px;
}

/* iPhone SE (375px 이하) */
@media (max-width: 375px) {
  #chatbot-container {
    bottom: 20px;
    right: 20px;
  }
}

/* iPhone 12 Pro, 14 Pro Max, Galaxy S20 Ultra (376px ~ 480px) */
@media (min-width: 376px) and (max-width: 480px) {
  #chatbot-container {
    bottom: 25px;
    right: 25px;
  }
}

/* iPad Mini (768px) */
@media (min-width: 700px) and (max-width: 820px) {
  #chatbot-container {
    bottom: 30px;
    right: 30px;
  }
}

/* iPad, iPad Air (820px ~ 1024px) */
@media (min-width: 821px) and (max-width: 1080px) {
  #chatbot-container {
    bottom: 40px;
    right: 40px;
  }
}

/* iPad Pro (1024px ~ 1440px) */
@media (min-width: 1081px) and (max-width: 1440px) {
  #chatbot-container {
    bottom: 50px;
    right: 50px;
  }
}

/* FHD ~ QHD (1441px 이상) */
@media (min-width: 1441px) {
  #chatbot-container {
    bottom: 60px;
    right: 60px;
  }
}

#chatbot {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: absolute;
  bottom: 0;
  right: 0;
  width: 400px;
  height: 600px;
  background-color: white;
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

@media (max-width: 760px) {
  #chatbot {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    border-radius: 0 !important;
    transform: translateY(100%) !important;
  }

  #chatbot-container.expanded #chatbot {
    transform: translateY(0) !important;
  }

  /* Safari 전용 높이 조정 */
  @supports (-webkit-touch-callout: none) {
    #chatbot {
      height: calc(100dvh - env(safe-area-inset-bottom));
      max-height: calc(100dvh - env(safe-area-inset-bottom));
    }
  }
}

/* 스크롤 금지 */
#chatbot-toggle-btn,
#chatbot-header,
.bot-avatar {
  user-select: none;
}
/********** 1. 기타  **********/


/********** 2. 스크롤 바(공통)  **********/
::-webkit-scrollbar {
  width: 4px;
  height: 4px;
}

::-webkit-scrollbar-track {
  background: rgba(241, 241, 241, 0.15);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb {
  background: rgba(136, 136, 136, 0.3);
  border-radius: 10px;
  border: 2px solid rgba(241, 241, 241, 0.05);
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(85, 85, 85, 0.5);
}
/********** 2. 스크롤 바(공통)  **********/


/********** 3. REDACTED  **********/
/********** 3. REDACTED  *********/

/********** 4. 챗봇 토글 버튼  **********/
#chatbot-toggle-btn {
  cursor: pointer;
  max-width: 250px;
  height: auto;
}

/* iPhone SE (375px 이하) */
@media (max-width: 375px) {
  #chatbot-toggle-btn {
    width: 30vw;
  }
}

/* iPhone 12 Pro, 14 Pro Max, Galaxy S20 Ultra (376px ~ 480px) */
@media (min-width: 376px) and (max-width: 480px) {
  #chatbot-toggle-btn {
    width: 30vw;
  }
}

/* iPad Mini (768px) */
@media (min-width: 700px) and (max-width: 820px) {
  #chatbot-toggle-btn {
    width: 25vw;
  }
}

/* iPad, iPad Air (820px ~ 1024px) */
@media (min-width: 821px) and (max-width: 1080px) {
  #chatbot-toggle-btn {
    width: 18vw;
  }
}

/* iPad Pro (1024px ~ 1440px) */
@media (min-width: 1081px) and (max-width: 1440px) {
  #chatbot-toggle-btn {
    width: 17vw;
  }
}

#chatbot-toggle-btn:hover {
  transform: scale(1.1);
}
/********** 4. 챗봇 토글 버튼  **********/


/********** 5. expanded 상태 관리 **********/
#chatbot-toggle-btn {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

#chatbot {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(0px);
  transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease;
}

/* iPad Mini보다 작은 경우 (699px 이하에서만 적용) */
@media (max-width: 699px) {
  #chatbot {
    height: 100vh;
  }
}

#chatbot-container.expanded #chatbot-toggle-btn {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

#chatbot-container.expanded #chatbot {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(-20px);
  transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease;
}
/*********** 5. expanded 상태 관리 **********/


/********** 6. 챗봇 헤더 **********/
#chatbot-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px;
  color: white;
  background-color: #302b6c;
}

#powered-by {
  font-size: 11px;
  font-weight: 400;
  color: white;
}

#header-title {
  font-weight: 500;
}

#header-actions button {
  border: none;
  cursor: pointer;
  font-size: 20px;
  margin-left: 8px;
  color: white;
  background: transparent;
  transition: transform 0.15s ease;
}

#header-actions button:hover {
  color: #cce4ff;
  transform: scale(1.2);
}

/* 768px 이하 */
@media (max-width: 768px) {
  #chatbot-header {
    padding: 10px 12px;
    height: 40px;
  }

  #powered-by {
    font-size: 9px;
  }

  #header-title {
    font-size: 12px;
  }

  #header-actions button {
    font-size: 14px;
    margin-left: 4px;
  }
}

/* 375px 이하 */
@media (max-width: 375px) {
  #chatbot-header {
    padding: 8px 10px;
    height: 36px;
  }

  #powered-by {
    font-size: 8px;
  }

  #header-title {
    font-size: 11px;
  }

  #header-actions button {
    font-size: 12px;
  }
}
/********** 6. 챗봇 헤더 **********/


/********** 7. 메시지(공통) **********/
#chat-messages {
  flex: 1;
  padding: 10px;
  overflow-y: auto;
  background-color: #fafafa;
}

.message {
  padding: 14px 18px;
  margin-bottom: 12px;
  border-radius: 20px;
  width: fit-content;
  max-width: 80%;
  font-size: 14px;
  font-weight: 400;
  overflow-wrap: break-word;
}
/********** 7. 메시지(공통) **********/


/********** 8. 유저 메시지 **********/
.message.user {
  margin-left: auto;
  align-self: flex-end;
  color: white;
  background-color: #302b6c;
}
/********** 8. 유저 메시지 **********/


/********** 9. 챗봇 메시지 **********/
.bot-message-container {
  display: grid;
  grid-template-columns: 35px 1fr;
}

.message.bot {
  margin-right: auto;
  align-self: flex-start;
  color: white;
  background-color: #00ade6;
}

.bot-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  align-self: end;
  object-fit: cover;
  flex-shrink: 0;
  image-rendering: -webkit-optimize-contrast;
}
/********** 9. 챗봇 메시지 **********/


/********** 10. 메시지 입력 **********/
#input-container {
  display: flex;
  padding: 10px;
  background-color: #fafafa;
}

#user-input {
  flex: 1;
  padding: 10px;
  border-radius: 14px;
  border: 2px solid rgba(204, 204, 204, 0.2);
  font-size: 13px;
  font-family: 'Pretendard Variable', sans-serif;
  transition: border-color 0.3s ease;

  overflow-y: auto;
  overflow-x: hidden;
  resize: none;
  height: 45px;
  max-height: 100px;
  box-sizing: border-box;

  display: flex;
  align-items: center;
  line-height: 1.5;

  scrollbar-width: none;
  -ms-overflow-style: none;
}

#user-input:focus {
  outline: none;
  border: 2px solid #302b6c;
}
/********** 10. 메시지 입력 **********/


/********** 11. 메시지 전송 **********/
#send-btn {
  margin-left: 8px;
  padding: 10px 14px;
  border: none;
  align-self: flex-end;
  font-size: 16px;
  border-radius: 14px;
  cursor: pointer;
  height: 45px;
  color: white;
  background: #302b6c;
  transition: all 0.2s ease;
}

#send-btn:hover {
  background: #4d3fa5;
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

#send-btn:disabled {
  background-color: #ccc;
  color: #666;
  cursor: not-allowed;
  opacity: 0.8;
}
/********** 11. 메시지 전송 **********/


/********** 12. 메시지 응답 대기 **********/
.wait-msg {
  color: rgba(255, 255, 255, 0.6);
  margin-right: 8px;
}

.loader {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  /* 흐린 흰색 */
  border-top: 2px solid rgba(0, 0, 0, 0.4);
  /* 짙은 회색으로 회전 느낌 */
  border-radius: 50%;
  animation: spin 1s linear infinite;
  vertical-align: middle;
}

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

  100% {
    transform: rotate(360deg);
  }
}
/********** 12. 메시지 응답 대기 **********/


/********** 13. 모달(공통) **********/
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  background-color: rgba(0, 0, 0, 0.4);
}

.fade-in {
  animation: fadeIn 0.3s ease forwards;
}

.fade-out {
  animation: fadeOut 0.3s ease forwards;
}

.modal {
  padding: 24px;
  text-align: center;
  border-radius: 12px;
  width: 70%;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  background-color: white;
}

.modal-title {
  font-size: 16px;
  font-weight: bold;
  margin-bottom: 12px;
}

.modal-content {
  font-size: 14px;
  color: #555;
  margin-bottom: 20px;
  line-height: 1.5;
}

.modal-buttons {
  display: flex;
  justify-content: space-between;
}

.modal-buttons button {
  flex: 1;
  border-radius: 8px;
  padding: 10px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid rgba(128, 128, 128, 0.3);
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeOut {
  from {
    opacity: 1;
    transform: translateY(0px);
  }

  to {
    opacity: 0;
    transform: translateY(20px);
  }
}
/********** 13. 모달(공통) **********/


/********** 14. 초기화 모달 **********/
#cancel-reset-btn {
  margin-right: 8px;
  color: #333;
  background-color: transparent;
}

#confirm-reset-btn {
  color: white;
  background-color: #e30000;
}

#cancel-reset-btn:hover {
  color: #111;
  background-color: rgba(0, 0, 0, 0.05);
  transition: background-color 0.2s ease, color 0.2s ease;
}

#confirm-reset-btn:hover {
  background-color: #b20000;
  box-shadow: 0 0 8px rgba(227, 0, 0, 0.7);
  transition: background-color 0.2s ease, box-shadow 0.2s ease;
}
/********** 14. 초기화 모달 **********/


/********** 15. 정보 모달 **********/
.modal-content.scrollable {
  overflow-y: auto;
  max-height: 300px;
  margin-bottom: 20px;
}

#info-modal .modal-title {
  font-size: 20px;
}

#info-modal ul {
  margin-left: -24px;
}

#info-modal li {
  text-align: left;
  padding-bottom: 10px;
}

#info-modal .highlight {
  color: #302b6c;
  font-weight: 500;
}

.modal-buttons.single {
  display: flex;
  justify-content: center;
}

#confirm-info-btn {
  color: white;
  background-color: #302b6c;
  transition: background-color 0.25s ease, box-shadow 0.25s ease;
}

#confirm-info-btn:hover {
  background: #4d3fa5;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}
/********** 15. 정보 모달 **********/


/********** 16. 언어 선택 드롭다운 **********/
.dropdown-container {
  position: relative;
  display: inline-block;
}

#lang-dropdown {
  display: none;
  position: absolute;
  top: 120%;
  left: 0;
  width: 60px;
  z-index: 1000;
}

#lang-list {
  border-radius: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
  background-color: #ffffff;
  border: 1px solid rgba(128, 128, 128, 0.3);
}

#lang-list li {
  padding: 8px 10px;
  font-size: 14px;
  font-weight: 500;
  color: #333;
  cursor: pointer;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

#lang-list li:hover {
  background-color: rgba(0, 173, 230, 0.3);
}

#lang-dropdown.fade-in {
  display: block;
  animation: fadeIn 0.3s ease forwards;
}

#lang-dropdown.fade-out {
  animation: fadeOut 0.3s ease forwards;
}

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

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeOut {
  from {
    opacity: 1;
    transform: translateY(0);
  }

  to {
    opacity: 0;
    transform: translateY(10px);
  }
}
/********** 16. 언어 선택 드롭다운 **********/


/********** 17. 메시지 애니메이션 **********/
.message.user.animate,
.bot-message-container.animate {
  animation: slideUp 0.3s ease forwards;
}

@keyframes slideUp {
  0% {
    opacity: 0;
    transform: translateY(10px);
  }

  100% {
    opacity: 1;
    transform: translateY(0);
  }
}
/********** 17. 메시지 애니메이션 **********/


/********** 18. 설문조사 레이아웃 **********/
.survey-container {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 250px;
  -webkit-tap-highlight-color: transparent;
}

.survey-question {
  width: 100%;
  margin: 0;
  font-weight: 600;
  font-size: 1rem;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.3);
}
/********** 18. 설문조사 레이아웃 **********/


/********** 19. 설문조사 진행도 **********/
.survey-progress {
  width: 100%;
  height: 12px;
  background-color: rgba(0, 0, 0, 0.15);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 5px;
}

.progress-bar {
  width: 25%;
  height: 100%;
  background: linear-gradient(90deg, #ffffff, #c0eaff);
  transition: width 0.4s ease-out;
  border-radius: 4px;
}
/********** 19. 설문조사 진행도 **********/


/********** 20. 설문조사 페이지 **********/
.survey-page {
  display: none;
  animation: popIn 0.4s ease-out forwards;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.survey-page.active {
  display: flex;
}
/********** 20. 설문조사 페이지 **********/


/********** 21. 설문조사 애니메이션 **********/
@keyframes popIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.95);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
/********** 21. 설문조사 애니메이션 **********/


/********** 22. 설문조사 시작 **********/
.survey-intro {
  font-weight: 600;
  font-size: 16px;
  text-align: center;
  animation: popIn 0.4s ease-out;
}
/********** 22. 설문조사 시작 **********/


/********** 23. 카테고리 설문조사 **********/
.survey-categories {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 10px;
  width: 100%;
  margin-top: 10px;
}

.category-card {
  position: relative;
  background: rgba(255, 255, 255, 0.08);
  border: 2px solid rgba(255, 255, 255, 0.25);
  border-radius: 12px;
  padding: 12px 0;
  text-align: center;
  color: white;
  font-weight: 500;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.25s ease;
  user-select: none;
  overflow: hidden;
}

.category-card:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: scale(1.03);
}

.category-card input[type="radio"] {
  display: none;
}

.category-card input[type="radio"]:checked+span {
  background: none;
}

.category-card:has(input[type="radio"]:checked) {
  background: linear-gradient(45deg, #ffffff, #d8f3ff);
  color: #0077b6;
  font-weight: 600;
  border: 2px solid #d8f3ff;
  transform: scale(1.05);
}

.category-card span {
  display: inline-block;
  width: 100%;
  pointer-events: none;
}
/********** 23. 카테고리 설문조사 **********/


/********** 24. 별점 설문조사 **********/
.star-rating {
  display: flex;
  flex-direction: row-reverse;
  justify-content: flex-end;
  gap: 8px;

  /* 드래그 방지 */
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  -webkit-user-drag: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.star-rating input[type="radio"] {
  display: none;
}

.star-rating label {
  font-size: 30px;
  color: rgba(255, 255, 255, 0.4);
  cursor: pointer;
  transition: color 0.2s ease-out;
  transform-origin: center;
}

.star-rating label:hover,
.star-rating label:hover~label,
.star-rating input[type="radio"]:checked~label {
  color: #FFD700;
}

.star-rating label:hover {
  transform: scale(1.2);
}
/********** 24. 별점 설문조사 **********/


/********** 25. [답변 속도, 정확도] 설문조사 **********/
.survey-options {
  display: flex;
  flex-direction: column;
  gap: 5px;
  align-items: center;
  width: 100%;
  max-width: 400px;
  margin-top: 5px;
}

.feedback-metric {
  width: 85%;
  padding: 8px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-radius: 10px;

  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(2px);
  color: #fff;
  transition: all 0.15s ease-in-out;
  margin-bottom: 6px;
}

.metric-label {
  font-size: 0.95rem;
  font-weight: 500;
  color: #ffffff;
}

.feedback-metric .metric-label {
  flex: 0 0 100px;
  text-align: left;
}

.feedback-metric .metric-buttons {
  display: flex;
  justify-content: space-evenly;
  flex: 1;
}

.feedback-button {
  font-size: 1.4rem;
  border: none;
  background: transparent;
  cursor: pointer;
  transition: transform 0.15s ease, filter 0.2s ease, opacity 0.2s;
  user-select: none;
  opacity: 0.6;
}

.feedback-button.active {
  opacity: 1;
  transform: scale(1.25);
}

.feedback-button:hover {
  opacity: 1;
  transform: scale(1.25);
}
/********** 25. [답변 속도, 정확도] 설문조사 **********/


/********** 26. 의견 입력 설문조사 **********/
.survey-textarea {
  width: 100%;
  min-height: 80px;
  max-height: 120px;

  color: white;
  background-color: rgba(255, 255, 255, 0.15);

  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 12px;

  padding: 12px;
  margin-top: 5px;

  font-size: 13px;
  font-family: 'Pretendard Variable', sans-serif;
  
  display: flex;
  overflow-y: auto;
  overflow-x: hidden;
  box-sizing: border-box;
  align-items: center;
  line-height: 1.5;
  transition: border-color 0.3s ease;

  resize: none;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.survey-textarea::placeholder {
  color: rgba(255, 255, 255, 0.6);
}

.survey-textarea:focus {
  outline: none;
  border-color: rgba(255, 255, 255, 0.7);
}
/********** 26. 의견 입력 설문조사 **********/


/********** 27. 설문조사 버튼 **********/
.survey-button-container {
  width: 100%;
  display: flex;
  justify-content: space-between;
  margin-top: 10px;
}

.survey-button {
  background: linear-gradient(45deg, #ffffff, #f0f8ff);
  color: #0083B0;
  border: none;
  padding: 10px 22px;
  border-radius: 30px;
  font-weight: bold;
  font-size: 15px;
  cursor: pointer;
  transition: all 0.1s ease-in-out;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.survey-button:hover {
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.15);
}

.survey-button:disabled {
  background: #c0c0c0;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}
/********** 27. 설문조사 버튼 **********/


/********** 28. 설문조사 종료 **********/
.survey-end {
  font-weight: 600;
  font-size: 16px;
  text-align: center;
  animation: popIn 0.4s ease-out;
  line-height: 1.6;
  color: white;
  padding: 15px;
}

.survey-end p {
  margin: 6px 0;
}

.survey-link {
  display: inline-block;
  margin-top: 5px;
  background: linear-gradient(45deg, #ffffff, #dff6ff);
  color: #0077b6;
  padding: 10px 22px;
  border-radius: 25px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.1s ease-in-out;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15);
}

.survey-link:hover {
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 5px 12px rgba(0, 0, 0, 0.25);
}
/********** 28. 설문조사 종료 **********/