/* 임시 챗봇 보이게 하기*/
/* #chat-container {
    overflow: hidden;
    z-index: 9999;
    display: block;
} */

/* ============================================
 * 챗봇 모달 전용 스타일 (#chat-container)
 * 기존 .krds-modal.frame 공통 스타일에 영향 없음 
 * 한기범 차장님 코드(퍼블 배포시 덮어써져서 여기로 위치 이동 26.01.19)
 * ============================================ */

/* 챗봇 모달 다이얼로그 크기 조정 */
#chat-container.krds-modal.bot .modal-dialog {
  width: 42rem;
  top: 12rem;
  max-height: calc(100vh - 14rem);
}

/* 챗봇 모달 콘텐츠 영역 */
#chat-container .modal-conts {
  overflow: hidden;
}

/* 챗봇 버튼 스타일 */
.map_tools.bot {
  position: fixed;
  right: 20px;
  bottom: 52px;
  z-index: 5;
}

#chat-container ~ .map_tools.bot .map_tools_item,
.map_tools.bot .map_tools_item {
  transition: all 0.3s ease;
}
.map_tools.bot .map_tools_item.active {
  background-color: rgba(224, 31, 38, 1);
  box-shadow: 0 0 0 3px rgba(224, 31, 38, 0.35), 0 2px 8px rgba(0, 0, 0, 0.2);
}
.map_tools.bot .map_tools_item.active .bot-button.ico-bot {
  animation: pulse-bot 2s infinite;
}
@keyframes pulse-bot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

/* 챗봇 채팅 영역 레이아웃 */
#chat-container .chat-wrapper {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 20rem);
  min-height: 40rem;
  max-height: 64rem;
  overflow: hidden;
}

#chat-container .chat-inner {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  flex: 1;
  min-height: 0;
  row-gap: 1.2rem;
  padding: 1.6rem;
  padding-right: 1.2rem;
  overflow-y: auto;
}

#chat-container .chat-bottom-area {
  margin-top: 0;
}

/* 챗봇 추천 질문 영역 */
#chat-container .chat-tag-area {
  display: flex;
  flex-direction: column;
  background: linear-gradient(to top, rgba(248, 250, 252, 0.98) 0%, rgba(248, 250, 252, 0.95) 100%);
  border-top: 1px solid var(--krds-color-light-gray-20);
}

#chat-container .chat-tag-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 0.8rem 1.6rem;
  cursor: pointer;
  transition: all 0.2s;
}
#chat-container .chat-tag-header:hover {
  background-color: rgba(0, 0, 0, 0.02);
}
#chat-container .chat-tag-header:focus,
#chat-container .chat-tag-header:focus-visible,
#chat-container .chat-tag-header:active {
  outline: none !important;
  box-shadow: none !important;
  border: none !important;
}
#chat-container .chat-tag-header:hover .chat-tag-header-text {
  color: var(--krds-color-light-primary-50);
}
#chat-container .chat-tag-header-text {
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--krds-color-light-gray-50);
  transition: color 0.2s;
}
#chat-container .chat-tag-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.6rem;
  height: 1.6rem;
  border: none;
  background: transparent;
  cursor: pointer;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
#chat-container .chat-tag-toggle.expanded {
  transform: rotate(180deg);
}
#chat-container .chat-tag-toggle::after {
  content: "";
  width: 0.6rem;
  height: 0.6rem;
  border-right: 1.5px solid var(--krds-color-light-gray-50);
  border-bottom: 1.5px solid var(--krds-color-light-gray-50);
  transform: rotate(45deg);
  margin-top: -0.15rem;
}

/* 챗봇 추천 질문 리스트 */
#chat-container .chat-tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1),
              padding 0.35s cubic-bezier(0.4, 0, 0.2, 1),
              opacity 0.25s ease;
  padding: 0 1.2rem;
  opacity: 0;
}
#chat-container .chat-tag-list.expanded {
  max-height: 20rem;
  padding: 0 1.2rem 1.2rem 1.2rem;
  opacity: 1;
}
#chat-container .chat-tag-list .chat-tag:focus {
  box-shadow: 0 0 0 2px var(--krds-color-light-primary-30);
}

#chat-container .chat-tag-item {
  flex: 0 0 auto;
}

/* 챗봇 추천 질문 버튼 */
#chat-container .chat-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 2.6rem;
  border-radius: 1.3rem;
  padding: 0 1rem;
  font-size: 1.15rem;
  font-weight: 500;
  white-space: nowrap;
  color: var(--krds-color-light-gray-70);
  background-color: #fff;
  border: 1px solid var(--krds-color-light-gray-25);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
}
#chat-container .chat-tag::before {
  display: none;
}
#chat-container .chat-tag:hover:not(:disabled) {
  color: var(--krds-color-light-primary-50);
  border-color: var(--krds-color-light-primary-40);
  background-color: var(--krds-color-light-primary-5);
  box-shadow: 0 2px 4px rgba(0, 102, 204, 0.1);
  transform: translateY(-1px);
}
#chat-container .chat-tag:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}
#chat-container .chat-tag.active {
  color: #fff;
  background-color: var(--krds-color-light-primary-50);
  border-color: var(--krds-color-light-primary-50);
}
#chat-container .chat-tag:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

/* 챗봇 테이블 래퍼 스크롤바 */
#chat-container .chat-llm-table-wrap {
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 transparent;
}
#chat-container .chat-llm-table-wrap::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
#chat-container .chat-llm-table-wrap::-webkit-scrollbar-track {
  background: transparent;
}
#chat-container .chat-llm-table-wrap::-webkit-scrollbar-thumb {
  background-color: #cbd5e1;
  border-radius: 3px;
}
#chat-container .chat-llm-table-wrap::-webkit-scrollbar-thumb:hover {
  background-color: #94a3b8;
}

/* 챗봇 모달 반응형 (1200px 이하) */
@media (max-width: 1200px) {
  #chat-container .header .header_inner {
    height: 100%;
  }
  #chat-container .header .header_inner .header_logo {
    height: 44px;
    display: flex;
    align-items: center;
  }
  #chat-container.krds-modal.frame .modal-content {
    display: flex;
    flex-direction: column;
    height: 100%;
  }
  #chat-container.krds-modal.frame .modal-conts {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
  }
  #chat-container.krds-modal.frame .modal-dialog {
    top: 0;
    right: 0;
    left: 0;
    bottom: 32px;
    padding: 9.5rem 0 0 0;
    height: auto;
    max-height: calc(100% - 32px);
  }
  #chat-container .chat-wrapper {
    height: auto;
    max-height: none;
    flex: 1;
  }
  #chat-container .chat-inner {
    height: auto;
    flex: 1;
  }
  #chat-container.krds-modal.frame .footer {
    display: none;
  }
}

/* ============================================
 * 테이블 상세보기 모달 전용 스타일 (#tableModal)
 * ============================================ */
#tableModal.krds-modal {
  z-index: 10001 !important;
}

#tableModal .modal-dialog {
  width: fit-content;
  min-width: 24rem;
  max-width: 90vw;
  max-height: 60vh;
  margin: auto;
}

#tableModal .modal-content {
  max-height: 60vh;
  border-radius: 1.2rem;
}

#tableModal .modal-header {
  padding: 0 1.6rem;
  height: 4rem;
}

#tableModal .modal-header .modal-logo-text {
  font-size: 1.4rem;
}

#tableModal .modal-conts {
  padding: 0;
  overflow: hidden;
  background-color: var(--krds-color-light-primary-5);
}

#tableModal #modalTableContainer {
  padding: 1.2rem;
  max-height: calc(60vh - 4rem);
  overflow: auto;
}

/* 테이블 모달 스크롤바 */
#tableModal .modal-table-wrap {
  scrollbar-width: thin;
  scrollbar-color: #94a3b8 transparent;
}
#tableModal .modal-table-wrap::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
#tableModal .modal-table-wrap::-webkit-scrollbar-track {
  background: transparent;
}
#tableModal .modal-table-wrap::-webkit-scrollbar-thumb {
  background-color: #94a3b8;
  border-radius: 3px;
}
#tableModal .modal-table-wrap::-webkit-scrollbar-thumb:hover {
  background-color: #64748b;
}


/* 임시 챗봇 결과 테이블 보여주는 모달창 */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.modal .modal-content {
    max-width: 90vw;
    max-height: 90vh;
    background: white;
    padding: 20px;
    border-radius: 12px;
    overflow: auto;
}

.modal .modal-close {
    float: right;
    margin-bottom: 10px;
    font-size: 14px;
    padding: 4px 10px;
}

/* 모달 내 테이블 스타일 */
.md-modal-table {
  border-collapse: collapse;
  width: 100%;
  font-size: 14px;
}

.md-modal-table th,
.md-modal-table td {
  border: 1px solid #ddd;
  padding: 10px 14px;
  text-align: left;
}

.md-modal-table th {
  background-color: #f5f5f5;
  font-weight: 600;
  color: #333;
}

.md-modal-table tr:hover {
  background-color: #fafafa;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}


/* 마크다운 콘텐츠 격리 스타일 */
.chat-bubble-content[class*="md-content-"] {
  /* 기본 텍스트 스타일 */
  font-size: 14px;
  line-height: 1.6;
  color: #333;
}

.chat-bubble-content[class*="md-content-"] p {
  margin: 0 0 12px 0;
  padding: 0;
}

.chat-bubble-content[class*="md-content-"] p:last-child {
  margin-bottom: 0;
}

/* 제목 스타일 */
.chat-bubble-content[class*="md-content-"] h1,
.chat-bubble-content[class*="md-content-"] h2,
.chat-bubble-content[class*="md-content-"] h3,
.chat-bubble-content[class*="md-content-"] h4,
.chat-bubble-content[class*="md-content-"] h5,
.chat-bubble-content[class*="md-content-"] h6 {
  margin: 16px 0 12px 0;
  padding: 0;
  font-weight: 600;
  line-height: 1.4;
  color: #1a1a1a;
}

.chat-bubble-content[class*="md-content-"] h1:first-child,
.chat-bubble-content[class*="md-content-"] h2:first-child,
.chat-bubble-content[class*="md-content-"] h3:first-child {
  margin-top: 0;
}

.chat-bubble-content[class*="md-content-"] h1 {
  font-size: 24px;
}

.chat-bubble-content[class*="md-content-"] h2 {
  font-size: 20px;
}

.chat-bubble-content[class*="md-content-"] h3 {
  font-size: 18px;
}

.chat-bubble-content[class*="md-content-"] h4 {
  font-size: 16px;
}

/* 리스트 스타일 */
.chat-bubble-content[class*="md-content-"] ul,
.chat-bubble-content[class*="md-content-"] ol {
  margin: 8px 0 12px 0;
  padding-left: 24px;
}

.chat-bubble-content[class*="md-content-"] li {
  margin: 4px 0;
  padding: 0;
}

.chat-bubble-content[class*="md-content-"] ul ul,
.chat-bubble-content[class*="md-content-"] ul ol,
.chat-bubble-content[class*="md-content-"] ol ul,
.chat-bubble-content[class*="md-content-"] ol ol {
  margin: 4px 0;
}

/* 강조 텍스트 */
.chat-bubble-content[class*="md-content-"] strong {
  font-weight: 600;
  color: #000;
}

.chat-bubble-content[class*="md-content-"] em {
  font-style: italic;
}

/* 링크 스타일 */
.chat-bubble-content[class*="md-content-"] a {
  color: #0066cc;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s;
}

.chat-bubble-content[class*="md-content-"] a:hover {
  border-bottom-color: #0066cc;
}

/* 코드 스타일 */
.chat-bubble-content[class*="md-content-"] code {
  background-color: #f5f5f5;
  padding: 2px 6px;
  border-radius: 3px;
  font-family: 'Courier New', monospace;
  font-size: 13px;
  color: #d63384;
}

.chat-bubble-content[class*="md-content-"] pre {
  background-color: #f5f5f5;
  padding: 12px;
  border-radius: 6px;
  overflow-x: auto;
  margin: 12px 0;
}

.chat-bubble-content[class*="md-content-"] pre code {
  background-color: transparent;
  padding: 0;
  color: #333;
}

/* 인용구 스타일 */
.chat-bubble-content[class*="md-content-"] blockquote {
  margin: 12px 0;
  padding: 8px 16px;
  border-left: 4px solid #ddd;
  background-color: #f9f9f9;
  color: #666;
}

/* 구분선 */
.chat-bubble-content[class*="md-content-"] hr {
  border: none;
  border-top: 1px solid #ddd;
  margin: 16px 0;
}

/* 이미지 스타일 */
.chat-bubble-content[class*="md-content-"] img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 12px 0;
  border-radius: 4px;
}


/* 쓸데없는 스크롤 제거를 위한 임시 조치 */
html, body {
  margin: 0;
  padding: 0;
  overflow: hidden; /* 스크롤바 생성 자체 차단 */
}

/* 챗봇 내용 축척 시 x축 , y 축 깨지는 현상을 막기 위한 임시 조치 */
#chatbot-modal-conts{
  overflow-y: hidden !important;
  overflow-x: hidden !important;
}
