/* 꽃배달 챗봇 UI
 * 강조색은 활성 테마의 --color-primary 를 따라간다 (theme/*/theme.color.php 에서 DB cf_1 기반 주입).
 * 호버 배경은 --color-primary-20 (primary 20% + white) 자동 매칭. fallback 은 기존 파란 톤 유지.
 * 기존 selector(`.kakao_banner`, `#shopFloation`)와 충돌 회피 위해 모든 클래스는 `.chatbot_*` 또는 `#floralChatbot` 스코프.
 */

/* ───────── 트리거 (kakao_banner 위에 위치) ───────── */
.chatbot_banner {
  margin: 0 auto 1rem;
  text-align: center;
}

/* 모바일 전용 트리거: 기본 숨김 (JS가 body 직속으로 이동 후 모바일 미디어쿼리에서 표시) */
.chatbot_banner_mobile {
  display: none;
}

.chatbot_trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 5.4rem;
  height: 5.4rem;
  border-radius: 50%;
  background: var(--color-primary, #3C61DD);
  color: #fff;
  box-shadow: 0 0.4rem 1.2rem rgba(0, 0, 0, 0.18);
  cursor: pointer;
  transition: transform 0.15s ease;
  text-decoration: none;
  font-size: 2.4rem;
  position: relative;
}

.chatbot_trigger:hover {
  transform: translateY(-0.2rem);
}

.chatbot_trigger:active {
  transform: scale(0.96);
}

.chatbot_trigger .chatbot_trigger_label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ───────── 패널 ───────── */
#floralChatbot {
  position: fixed;
  right: 2rem;
  bottom: 8rem;
  width: 36rem;
  max-width: calc(100vw - 4rem);
  height: 56rem;
  max-height: calc(100vh - 12rem);
  background: #fff;
  border-radius: 1.2rem;
  box-shadow: 0 0.8rem 2.4rem rgba(0, 0, 0, 0.16);
  display: none;
  flex-direction: column;
  overflow: hidden;
  z-index: 200;
  transform-origin: bottom right;
}

#floralChatbot.is-open {
  display: flex;
  animation: chatbot-pop 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes chatbot-pop {
  from {
    transform: scale(0.92) translateY(0.6rem);
    opacity: 0;
  }
  to {
    transform: scale(1) translateY(0);
    opacity: 1;
  }
}

/* ───────── 헤더 ───────── */
.chatbot_header {
  display: flex;
  align-items: center;
  padding: 1.2rem 1.6rem;
  background: var(--color-primary, #3C61DD);
  color: #fff;
  flex-shrink: 0;
}

.chatbot_header_back {
  background: transparent;
  border: 0;
  color: inherit;
  width: 2.8rem;
  height: 2.8rem;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  border-radius: 50%;
  transition: background 0.15s;
  flex-shrink: 0;
}

.chatbot_header_back:hover {
  background: rgba(255, 255, 255, 0.18);
}

.chatbot_header_title {
  flex: 1 1 auto;
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  text-align: center;
}

.chatbot_header_close {
  background: transparent;
  border: 0;
  color: inherit;
  width: 2.8rem;
  height: 2.8rem;
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
  border-radius: 50%;
  transition: background 0.15s;
  flex-shrink: 0;
}

.chatbot_header_close:hover {
  background: rgba(255, 255, 255, 0.18);
}

/* ───────── 본문 ───────── */
.chatbot_body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 1.6rem;
  background: #FAFAFA;
  color: #333;
}

.chatbot_body_placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: #999;
  font-size: 1.3rem;
  text-align: center;
  padding: 2rem;
}

/* ───────── 입력창 ───────── */
.chatbot_input_wrap {
  display: flex;
  gap: 0.8rem;
  padding: 1rem 1.2rem;
  border-top: 0.1rem solid #EBEBEB;
  background: #fff;
  flex-shrink: 0;
}

.chatbot_input {
  flex: 1 1 auto;
  height: 3.6rem;
  padding: 0 1.2rem;
  border: 0.1rem solid #DDD;
  border-radius: 1.8rem;
  font-size: 1.3rem;
  outline: none;
  background: #fff;
  color: #333;
}

.chatbot_input:focus {
  border-color: var(--color-primary, #3C61DD);
}

.chatbot_input:disabled {
  background: #F5F5F5;
  color: #BBB;
}

.chatbot_send_btn {
  height: 3.6rem;
  padding: 0 1.4rem;
  border: 0;
  border-radius: 1.8rem;
  background: var(--color-primary, #3C61DD);
  color: #fff;
  font-size: 1.3rem;
  font-weight: 500;
  cursor: pointer;
}

.chatbot_send_btn:disabled {
  background: #DDD;
  cursor: not-allowed;
}

/* ───────── 하단 공통 버튼 ───────── */
.chatbot_footer {
  display: flex;
  border-top: 0.1rem solid #EBEBEB;
  background: #fff;
  flex-shrink: 0;
}

.chatbot_footer_btn {
  flex: 1 1 0;
  height: 4rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  background: transparent;
  border: 0;
  border-right: 0.1rem solid #EBEBEB;
  font-size: 1.2rem;
  color: #666;
  cursor: pointer;
  transition: background 0.15s;
}
.chatbot_footer_btn svg {
  display: block;
  flex-shrink: 0;
}

.chatbot_footer_btn:last-child {
  border-right: 0;
}

.chatbot_footer_btn:hover {
  background: #F5F5F5;
}

/* ───────── 메뉴 화면 공통 ───────── */
.chatbot_greeting {
  background: var(--color-primary, #3C61DD);
  margin: -1.6rem -1.6rem 1.2rem;
  padding: 1.8rem 2rem 1.4rem;
  border-radius: 0 0 1.6rem 1.6rem;
  text-align: left;
}
.chatbot_greeting_sub {
  font-size: 1.2rem;
  color: rgba(255,255,255,0.75);
  margin-bottom: 0.6rem;
}
.chatbot_greeting_main {
  font-size: 2rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.35;
  margin-bottom: 0.6rem;
}
.chatbot_greeting_desc {
  font-size: 1.25rem;
  color: rgba(255,255,255,0.85);
  line-height: 1.5;
}
.chatbot_greeting_icon {
  display: none;
}
.chatbot_greeting_line {
  display: none;
}

.chatbot_section_title {
  font-size: 1.5rem;
  font-weight: 600;
  color: #222;
  margin-bottom: 1.2rem;
}
.chatbot_section_subtitle {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 1.3rem;
  font-weight: 600;
  color: #666;
  margin: 1.6rem 0 0.8rem;
}
.chatbot_section_subtitle svg {
  display: block;
  flex-shrink: 0;
}

.chatbot_msg {
  font-size: 1.3rem;
  line-height: 1.6;
  color: #444;
  background: #fff;
  padding: 1.2rem 1.4rem;
  border-radius: 0.8rem;
  border: 0.1rem solid #EFEFEF;
  margin-bottom: 1.2rem;
  white-space: pre-line;
  word-break: keep-all;
}

.chatbot_guide {
  font-size: 1.15rem;
  color: #888;
  margin-bottom: 1rem;
}

.chatbot_note {
  font-size: 1.2rem;
  color: #888;
  margin-top: 0.6rem;
  text-align: center;
}

/* ───────── 메인 메뉴 5개 버튼 ───────── */
.chatbot_main_menu {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.chatbot_menu_btn {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.4rem;
  background: #fff;
  border: 0.1rem solid #EFEFEF;
  border-radius: 0.8rem;
  font-size: 1.4rem;
  color: #333;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s, border-color 0.15s;
}
.chatbot_menu_btn:hover {
  background: var(--color-primary-20, #EEF4FC);
  border-color: var(--color-primary, #3C61DD);
}
.chatbot_menu_icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.2rem;
  height: 2.2rem;
  flex-shrink: 0;
  color: var(--color-primary, #3C61DD);
}
.chatbot_menu_icon svg {
  display: block;
}

/* ───────── 그리드(상황별/리본 카테고리) ───────── */
.chatbot_grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.6rem;
}
.chatbot_grid_btn {
  padding: 1rem 0.8rem;
  background: #fff;
  border: 0.1rem solid #EFEFEF;
  border-radius: 0.6rem;
  font-size: 1.25rem;
  color: #333;
  cursor: pointer;
  word-break: keep-all;
  transition: background 0.15s, border-color 0.15s;
}
.chatbot_grid_btn:hover {
  background: var(--color-primary-20, #EEF4FC);
  border-color: var(--color-primary, #3C61DD);
}

/* ───────── 카드(상황별 추천) ───────── */
.chatbot_card {
  background: #fff;
  border: 0.1rem solid #EFEFEF;
  border-radius: 0.8rem;
  padding: 1rem 1.2rem;
  margin-bottom: 0.8rem;
}
.chatbot_card_label {
  font-size: 1.3rem;
  font-weight: 500;
  color: #333;
  margin-bottom: 0.6rem;
}
.chatbot_card_link {
  display: inline-block;
  font-size: 1.2rem;
  color: var(--color-primary, #3C61DD);
  text-decoration: none;
  border: 0.1rem solid var(--color-primary, #3C61DD);
  padding: 0.4rem 0.9rem;
  border-radius: 1.2rem;
}
.chatbot_card_link:hover { background: var(--color-primary, #3C61DD); color: #fff; }
.chatbot_card_links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.chatbot_card_links a {
  font-size: 1.2rem;
  color: var(--color-primary, #3C61DD);
  text-decoration: none;
  border: 0.1rem solid var(--color-primary, #3C61DD);
  padding: 0.4rem 0.9rem;
  border-radius: 1.2rem;
}
.chatbot_card_links a:hover { background: var(--color-primary, #3C61DD); color: #fff; }

/* ───────── 리본 문구 리스트 ───────── */
.chatbot_phrases {
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
}
.chatbot_phrases li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  padding: 0.7rem 1rem;
  background: #fff;
  border: 0.1rem solid #EFEFEF;
  border-radius: 0.6rem;
  margin-bottom: 0.4rem;
}
.chatbot_phrase_text {
  font-size: 1.3rem;
  color: #333;
  flex: 1 1 auto;
  word-break: keep-all;
}
.chatbot_copy_btn {
  flex-shrink: 0;
  padding: 0.3rem 0.8rem;
  background: #fff;
  border: 0.1rem solid var(--color-primary, #3C61DD);
  border-radius: 1rem;
  color: var(--color-primary, #3C61DD);
  font-size: 1.1rem;
  cursor: pointer;
}
.chatbot_copy_btn:hover { background: var(--color-primary, #3C61DD); color: #fff; }

/* ───────── Q&A 펼침 (배송/FAQ) ───────── */
.chatbot_qa_list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.chatbot_qa_item {
  background: #fff;
  border: 0.1rem solid #EFEFEF;
  border-radius: 0.6rem;
  margin-bottom: 0.5rem;
  overflow: hidden;
  transition: border-color 0.15s;
}
.chatbot_qa_item:hover {
  border-color: var(--color-primary, #3C61DD);
}
.chatbot_qa_q {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.8rem 1rem;
  background: transparent;
  border: 0;
  font-size: 1.25rem;
  color: #333;
  cursor: pointer;
  position: relative;
  transition: background 0.15s, color 0.15s;
}
.chatbot_qa_q:hover {
  background: var(--color-primary-20, #EEF4FC);
}
.chatbot_qa_q::after {
  content: "+";
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: #999;
  font-size: 1.4rem;
}
.chatbot_qa_item.is-open .chatbot_qa_q::after { content: "−"; }
.chatbot_qa_a {
  display: none;
  padding: 0.8rem 1rem 1rem;
  background: #FAFAFA;
  font-size: 1.2rem;
  color: #555;
  line-height: 1.6;
  border-top: 0.1rem solid #EFEFEF;
  white-space: pre-line;
  word-break: keep-all;
}
.chatbot_qa_item.is-open .chatbot_qa_a { display: block; }
/* ───────── 상황별 추천 탭 ───────── */
.chatbot_sit_tabs {
  display: flex;
  border-bottom: 0.2rem solid #EFEFEF;
  margin-bottom: 1.2rem;
}
.chatbot_sit_tab {
  flex: 1 1 0;
  padding: 0.8rem 0.4rem;
  background: transparent;
  border: 0;
  border-bottom: 0.2rem solid transparent;
  margin-bottom: -0.2rem;
  font-size: 1.25rem;
  font-weight: 500;
  color: #999;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
  white-space: nowrap;
}
.chatbot_sit_tab:hover {
  color: #666;
}
.chatbot_sit_tab.is-active {
  color: var(--color-primary, #3C61DD);
  border-bottom-color: var(--color-primary, #3C61DD);
  font-weight: 600;
}
.chatbot_sit_panel {
  display: none;
}
.chatbot_sit_panel.is-active {
  display: block;
}
/* 상황별 카드 공통 */
.chatbot_sit_card {
  background: #fff;
  border: 0.1rem solid #EFEFEF;
  border-radius: 0.8rem;
  padding: 1rem 1.2rem;
  margin-bottom: 0.6rem;
  transition: border-color 0.15s;
}
.chatbot_sit_card:last-child {
  margin-bottom: 0;
}
.chatbot_sit_card_label {
  font-size: 1.25rem;
  color: #333;
  word-break: keep-all;
  white-space: pre-line;
}
/* 단일 링크 카드 */
.chatbot_sit_card--link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  text-decoration: none;
  cursor: pointer;
}
.chatbot_sit_card--link:hover {
  border-color: var(--color-primary, #3C61DD);
  background: var(--color-primary-20, #EEF4FC);
}
.chatbot_sit_card--link:hover .chatbot_sit_card_arrow {
  stroke: var(--color-primary, #3C61DD);
}
.chatbot_sit_card_arrow {
  flex-shrink: 0;
  transition: stroke 0.15s;
}
/* 멀티 카테고리 카드 */
.chatbot_sit_card--multi {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
}
.chatbot_sit_card--multi .chatbot_sit_card_label {
  flex: 1 1 auto;
  min-width: 0;
}
.chatbot_sit_card_chips {
  display: flex;
  gap: 0.4rem;
  flex-shrink: 0;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.chatbot_sit_chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 1.15rem;
  color: #444;
  font-weight: 500;
  text-decoration: none;
  padding: 0.5rem 1rem;
  border-radius: 2rem;
  background: #F0F0F0;
  border: 0.1rem solid #DDD;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.chatbot_sit_chip:hover {
  background: var(--color-primary, #3C61DD);
  color: #fff;
}
.chatbot_qa_fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.8rem;
  margin-top: 1rem;
  padding: 1rem;
  background: var(--color-primary-20, #EEF4FC);
  border-radius: 0.6rem;
  font-size: 1.2rem;
  color: #666;
}

/* ───────── 상담원 연결 3버튼 ───────── */
.chatbot_agent_buttons {
  display: flex;
  gap: 0.6rem;
}
.chatbot_agent_btn {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  padding: 1.2rem 0.6rem;
  background: #fff;
  border: 0.1rem solid #EFEFEF;
  border-radius: 0.8rem;
  font-size: 1.15rem;
  color: #555;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.chatbot_agent_btn:hover {
  border-color: var(--color-primary, #3C61DD);
  background: var(--color-primary-20, #EEF4FC);
}
.chatbot_agent_icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 3.6rem;
  height: 3.6rem;
  border-radius: 50%;
  background: #F5F5F5;
  color: #666;
  transition: background 0.15s, color 0.15s;
}
.chatbot_agent_icon svg {
  display: block;
}
.chatbot_agent_btn:hover .chatbot_agent_icon {
  background: var(--color-primary, #3C61DD);
  color: #fff;
}
.chatbot_agent_btn:hover .chatbot_agent_icon svg {
  stroke: #fff;
}
.chatbot_agent_phone {
  margin-top: 1.2rem;
  text-align: center;
  font-size: 1.3rem;
  color: #555;
}
.chatbot_agent_phone a {
  color: var(--color-primary, #3C61DD);
  text-decoration: none;
  font-weight: 600;
}
.chatbot_agent_phone a:hover {
  text-decoration: underline;
}

/* ───────── 통합 검색 결과 (search 화면) ───────── */
.chatbot_search_group {
  margin-bottom: 1.6rem;
}
.chatbot_search_group_title {
  font-size: 1.3rem;
  font-weight: 700;
  color: #444;
  padding: 0.4rem 0 0.6rem;
  border-bottom: 0.1rem solid #eee;
  margin-bottom: 0.8rem;
}
.chatbot_search_item {
  display: block;
  width: 100%;
  text-align: left;
  background: #fff;
  border: 0.1rem solid #EFEFEF;
  border-radius: 0.8rem;
  padding: 1rem 1.2rem;
  font-size: 1.3rem;
  color: #444;
  cursor: pointer;
  margin-bottom: 0.6rem;
}
.chatbot_search_item:hover {
  background: var(--color-primary-20, #EEF4FC);
  border-color: var(--color-primary, #3C61DD);
  color: var(--color-primary, #3C61DD);
}

/* ───────── 링크 버튼 / 인라인 액션 ───────── */
.chatbot_link_btn {
  display: inline-block;
  padding: 0.5rem 1rem;
  background: #fff;
  border: 0.1rem solid var(--color-primary, #3C61DD);
  border-radius: 1.2rem;
  color: var(--color-primary, #3C61DD);
  font-size: 1.2rem;
  cursor: pointer;
  margin: 0.4rem 0.3rem 0 0;
}
.chatbot_link_btn:hover { background: var(--color-primary, #3C61DD); color: #fff; }
.chatbot_link {
  display: inline-block;
  margin-top: 0.5rem;
  padding: 0.4rem 0.9rem;
  border: 0.1rem solid var(--color-primary, #3C61DD);
  border-radius: 1.2rem;
  color: var(--color-primary, #3C61DD);
  text-decoration: none;
  font-size: 1.2rem;
}
.chatbot_link:hover { background: var(--color-primary, #3C61DD); color: #fff; }
.chatbot_inline_actions {
  margin-top: 0.6rem;
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

/* ───────── 모바일 + 태블릿 (#shopFloation 의 PC 분기점이 1024px 이므로 그 미만 전체 커버) ───────── */
@media screen and (max-width: 1023.99px) {
  /* 모바일 전용 트리거: 하단 메뉴(7rem) 바로 위, 우측 고정 */
  .chatbot_banner_mobile {
    display: block;
    position: fixed;
    right: 1.2rem;
    bottom: 8rem;
    z-index: 251;
    margin: 0;
  }
  /* 패널 열렸을 때는 트리거 숨김 (풀스크린 패널 위 중복 노출 방지)
   * DOM 순서: #floralChatbot → .chatbot_banner_mobile (JS가 둘 다 body 직속으로 이동) */
  #floralChatbot.is-open ~ .chatbot_banner_mobile {
    display: none;
  }
  .chatbot_trigger {
    width: 4.8rem;
    height: 4.8rem;
    font-size: 2rem;
    box-shadow: 0 0.3rem 1rem rgba(0, 0, 0, 0.2);
  }

  /* 패널: 풀스크린 */
  #floralChatbot {
    right: 0;
    bottom: 0;
    width: 100%;
    max-width: 100%;
    height: 100%;
    max-height: 100%;
    border-radius: 0;
    z-index: 251;
    transform-origin: bottom center;
  }

  /* 메인 메뉴 버튼 */
  .chatbot_menu_btn {
    padding: 1.4rem 1.6rem;
    font-size: 1.5rem;
  }

  /* 상황별 카드 */
  .chatbot_sit_card {
    padding: 1.2rem 1.4rem;
  }
  .chatbot_sit_card_label {
    font-size: 1.35rem;
  }
  .chatbot_sit_chip {
    padding: 0.6rem 1.1rem;
    font-size: 1.2rem;
  }

  /* 그리드 버튼 (리본 카테고리) */
  .chatbot_grid_btn {
    padding: 1.2rem 1rem;
    font-size: 1.35rem;
  }

  /* Q&A 항목 */
  .chatbot_qa_q {
    padding: 1.2rem 1.2rem;
    font-size: 1.35rem;
  }

  /* 리본 문구 리스트 */
  .chatbot_phrases li {
    padding: 0.9rem 1.2rem;
  }
  .chatbot_phrase_text {
    font-size: 1.35rem;
  }
  .chatbot_copy_btn {
    padding: 0.7rem 1.2rem;
    font-size: 1.2rem;
    min-height: 3.4rem;
    display: inline-flex;
    align-items: center;
  }

  /* 상담원 연결 카드 */
  .chatbot_agent_btn {
    padding: 1.4rem 0.8rem;
    font-size: 1.25rem;
  }
  .chatbot_agent_icon {
    width: 4rem;
    height: 4rem;
  }

  /* 입력창 */
  .chatbot_input {
    height: 4rem;
    font-size: 1.4rem;
  }
  .chatbot_send_btn {
    height: 4rem;
    font-size: 1.4rem;
    padding: 0 1.6rem;
  }

  /* 하단 공통 버튼 */
  .chatbot_footer_btn {
    height: 4.4rem;
    font-size: 1.3rem;
  }
}
