/* 상담 채팅 창 (public/chat.js). 사이트 색·모서리 값(app.css 의 변수)을 그대로 쓴다. */
.lschat { position: fixed; right: 20px; bottom: 20px; z-index: 900; font-size: 15px; }
.lschat__fab {
  width: 56px; height: 56px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--brand, #0f766e); color: #fff; box-shadow: var(--shadow-lg, 0 10px 30px rgba(0,0,0,.1));
  display: grid; place-items: center; position: relative; transition: transform .15s, background .15s;
}
.lschat__fab:hover { background: var(--brand-hover, #0c625b); transform: translateY(-1px); }
.lschat.is-open .lschat__fab { display: none; }
.lschat__badge {
  position: absolute; top: -2px; right: -2px; min-width: 20px; height: 20px; padding: 0 6px;
  border-radius: 10px; background: var(--danger, #d92d20); color: #fff; font-size: 12px; font-weight: 700;
  line-height: 20px; text-align: center; box-shadow: 0 0 0 2px #fff;
}
.lschat__panel {
  position: absolute; right: 0; bottom: 0; width: 360px; height: 540px; max-height: calc(100vh - 40px);
  display: flex; flex-direction: column; background: #fff; border-radius: var(--r-lg, 20px);
  box-shadow: 0 18px 50px rgba(0, 0, 0, .18); overflow: hidden; border: 1px solid var(--line-2, #e7e8ea);
}
.lschat__panel[hidden] { display: none; }
.lschat__head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 14px 16px; background: var(--brand, #0f766e); color: #fff;
}
.lschat__head b { display: block; font-size: 16px; }
.lschat__sub { display: block; font-size: 12px; opacity: .8; margin-top: 2px; }
.lschat__close {
  width: 32px; height: 32px; border: 0; border-radius: 50%; background: rgba(255,255,255,.15);
  color: #fff; font-size: 22px; line-height: 1; cursor: pointer;
}
.lschat__close:hover { background: rgba(255,255,255,.28); }
.lschat__log { flex: 1; overflow-y: auto; padding: 16px 14px; background: var(--tint, #f6f7f8); display: flex; flex-direction: column; gap: 10px; }
.lschat__msg { display: flex; flex-direction: column; max-width: 82%; }
.lschat__msg--me { align-self: flex-end; align-items: flex-end; }
.lschat__msg--admin { align-self: flex-start; align-items: flex-start; }
.lschat__bubble {
  padding: 9px 12px; border-radius: 14px; white-space: pre-wrap; word-break: break-word; line-height: 1.5;
}
.lschat__msg--me .lschat__bubble { background: var(--brand, #0f766e); color: #fff; border-bottom-right-radius: 4px; }
.lschat__msg--admin .lschat__bubble { background: #fff; color: var(--ink, #222); border: 1px solid var(--line-2, #e7e8ea); border-bottom-left-radius: 4px; }
.lschat__msg.is-pending { opacity: .6; }
.lschat__bubble a { color: inherit; text-decoration: underline; text-underline-offset: 2px; word-break: break-all; }
.lschat__msg--bot .lschat__bubble a, .lschat__msg--admin .lschat__bubble a { color: var(--brand, #0f766e); }

/* 누가 말했나: 챗봇은 연한 브랜드색, 상담원은 흰 바탕 + 왼쪽 선, 안내는 가운데 한 줄 */
.lschat__msg--bot { align-self: flex-start; align-items: flex-start; max-width: 88%; }
.lschat__msg--bot .lschat__bubble { background: var(--brand-softer, #f0faf9); color: var(--ink, #222); border: 1px solid var(--brand-soft, #d9f0ed); border-bottom-left-radius: 4px; }
.lschat__who { font-size: 11.5px; font-weight: 700; color: var(--muted, #5c5c5c); margin: 0 0 3px 2px; }
.lschat__msg--bot .lschat__who { color: var(--brand, #0f766e); }
.lschat__msg--admin .lschat__who { color: var(--ink, #222); }
.lschat__msg--admin .lschat__bubble { box-shadow: inset 3px 0 0 var(--ink, #222); }
.lschat__sys {
  align-self: center; max-width: 90%; text-align: center; font-size: 12.5px; line-height: 1.5;
  color: var(--muted, #5c5c5c); background: #fff; border: 1px dashed var(--line, #dadada);
  border-radius: 10px; padding: 7px 12px;
}
.lschat__sys--plain { border: 0; background: transparent; padding: 0 8px; font-size: 12px; }

/* 챗봇 버튼 */
.lschat__opts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.lschat__opt {
  border: 1px solid var(--brand, #0f766e); background: #fff; color: var(--brand, #0f766e);
  border-radius: var(--r-pill, 100px); padding: 6px 12px; font: inherit; font-size: 13.5px; cursor: pointer; text-align: left;
}
.lschat__opt:hover { background: var(--brand-softer, #f0faf9); }
.lschat__opt--human { background: var(--brand, #0f766e); color: #fff; }
.lschat__opt--human:hover { background: var(--brand-hover, #0c625b); }

/* 상담원 연결 줄 (AI 상담 중에만) */
.lschat__bar {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 8px 12px; background: #fff; border-top: 1px solid var(--line-2, #e7e8ea); font-size: 13px; color: var(--muted, #5c5c5c);
}
.lschat__bar[hidden] { display: none; }
.lschat__human {
  flex: none; border: 1px solid var(--brand, #0f766e); background: #fff; color: var(--brand, #0f766e);
  border-radius: var(--r-pill, 100px); padding: 5px 12px; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
}
.lschat__human:hover { background: var(--brand-softer, #f0faf9); }
.lschat__human:disabled { opacity: .5; cursor: default; }
.lschat__human--end { border-color: var(--line, #dadada); color: var(--muted, #5c5c5c); }
.lschat__human--end:hover { border-color: var(--danger, #d92d20); color: var(--danger, #d92d20); background: #fff; }

/* 상태에 따라 머리말 색을 살짝 바꾼다: 상담원 연결 뒤에는 짙게 */
.lschat[data-state="WAITING_ADMIN"] .lschat__head,
.lschat[data-state="ADMIN_ACTIVE"] .lschat__head { background: var(--brand-dark, #0b5551); }
.lschat__time { font-size: 11px; color: var(--muted-2, #6f6f6f); margin-top: 3px; }
.lschat__muted { display: inline-block; margin-top: 6px; font-size: 12.5px; color: var(--muted, #5c5c5c); }
.lschat__note { padding: 10px 14px; font-size: 13px; background: var(--brand-softer, #f0faf9); color: var(--brand-dark, #0b5551); border-top: 1px solid var(--line-2, #e7e8ea); }
.lschat__note--soft { background: #fff; color: var(--muted, #5c5c5c); }
.lschat__note[hidden] { display: none; }
.lschat__form { display: flex; align-items: flex-end; gap: 8px; padding: 10px; border-top: 1px solid var(--line-2, #e7e8ea); background: #fff; }
.lschat__input {
  flex: 1; resize: none; border: 1px solid var(--line, #dadada); border-radius: 12px; padding: 9px 12px;
  font: inherit; line-height: 1.45; max-height: 120px; outline: none;
}
.lschat__input:focus { border-color: var(--brand, #0f766e); }
.lschat__input:disabled { background: var(--tint, #f6f7f8); color: var(--muted-2, #6f6f6f); }
.lschat__send {
  width: 40px; height: 40px; flex: none; border: 0; border-radius: 50%; cursor: pointer;
  background: var(--brand, #0f766e); color: #fff; display: grid; place-items: center;
}
.lschat__send:disabled { background: var(--line, #dadada); cursor: default; }

/* 휴대폰: 화면을 꽉 채운다. 주소창이 접히는 브라우저를 위해 dvh. */
@media (max-width: 520px) {
  .lschat { right: 14px; bottom: 14px; }
  .lschat.is-open { inset: 0; }
  .lschat__panel { position: fixed; inset: 0; width: auto; height: 100vh; height: 100dvh; max-height: none; border-radius: 0; border: 0; }
}
@media print { .lschat { display: none; } }

/* 비회원 연락처 카드 (상담원 연결 전). 패널 아래쪽에서 올라온다 */
.lschat__contact {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 2; background: #fff;
  border-top: 1px solid var(--line-2, #e7e8ea); border-radius: 16px 16px 0 0;
  box-shadow: 0 -10px 30px rgba(0,0,0,.12); padding: 16px 16px 14px; display: flex; flex-direction: column; gap: 10px;
}
.lschat__contact[hidden] { display: none; }
.lschat__contact-title { font-size: 15.5px; }
.lschat__contact-lead { margin: -4px 0 2px; font-size: 13px; color: var(--muted, #5c5c5c); line-height: 1.5; }
.lschat__field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 600; }
.lschat__field em { font-style: normal; font-weight: 400; color: var(--muted-2, #6f6f6f); }
.lschat__field em.req { color: var(--danger, #d92d20); }
.lschat__field input { font: inherit; font-weight: 400; border: 1px solid var(--line, #dadada); border-radius: 10px; padding: 9px 11px; outline: none; }
.lschat__field input:focus { border-color: var(--brand, #0f766e); }
.lschat__agree { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; line-height: 1.45; cursor: pointer; }
.lschat__agree input { margin-top: 3px; accent-color: var(--brand, #0f766e); }
.lschat__agree small { display: block; color: var(--muted-2, #6f6f6f); font-size: 11.5px; margin-top: 2px; }
.lschat__contact-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 2px; }
.lschat__contact-actions button { font: inherit; font-size: 14px; border-radius: 10px; padding: 9px 14px; cursor: pointer; border: 1px solid var(--line, #dadada); background: #fff; }
.lschat__contact-ok { background: var(--brand, #0f766e) !important; border-color: var(--brand, #0f766e) !important; color: #fff; font-weight: 700; }
.lschat__contact-ok:disabled { opacity: .6; cursor: default; }
