/* 문의 챗봇 '한지수' 위젯 — styles.css 토큰(#1a4f34, pill 50px, 카드 15px) 준수 */
.chat[hidden] { display: none; }

.chat {
  position: fixed;
  right: 30px;
  bottom: 30px;
  z-index: 1000;
}

.chat__panel {
  width: 400px;
  height: min(700px, calc(100vh - 60px));
  background: white;
  border-radius: 15px;
  box-shadow: var(--shadow-hover);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.chat__header {
  height: 60px;
  flex-shrink: 0;
  background: var(--primary-color);
  color: white;
  padding: 0 14px 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chat__who {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.chat__avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: white;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.chat__avatar img {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

.chat__title {
  display: flex;
  flex-direction: column;
  line-height: 1.3;
  min-width: 0;
}

.chat__title strong { font-size: 0.95rem; font-weight: 700; }
.chat__title small { font-size: 0.72rem; opacity: 0.8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.chat__close {
  width: 40px;
  height: 40px;
  border: none;
  background: transparent;
  color: white;
  cursor: pointer;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.chat__close:hover { background: rgba(255, 255, 255, 0.12); }

.chat__log {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #fafbfa;
}

.chat__msg {
  max-width: 82%;
  padding: 11px 14px;
  font-size: 0.92rem;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

.chat__msg--bot {
  align-self: flex-start;
  background: white;
  color: var(--text-dark);
  border: 1px solid #ecedf0;
  border-radius: 15px 15px 15px 4px;
}

.chat__msg--user {
  align-self: flex-end;
  background: var(--primary-color);
  color: white;
  border-radius: 15px 15px 4px 15px;
}

.chat__msg--typing::after {
  content: '…';
  animation: chat-blink 1s steps(1) infinite;
}

@keyframes chat-blink { 50% { opacity: 0; } }

.chat__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-self: flex-start;
}

.chat__chip {
  border: 1.5px solid var(--primary-color);
  background: white;
  color: var(--primary-color);
  border-radius: 50px;
  padding: 7px 14px;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

.chat__chip:hover { background: var(--accent-color); }

.chat__card {
  align-self: flex-start;
  width: 90%;
  background: white;
  border: 1px solid #cfe3d5;
  border-radius: 15px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chat__card h4 {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--primary-color);
  margin: 0;
}

.chat__card dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 12px;
  margin: 0;
  font-size: 0.86rem;
}

.chat__card dt { color: var(--text-light); font-weight: 500; }
.chat__card dd { margin: 0; color: var(--text-dark); font-weight: 500; text-align: right; }

.chat__card input {
  width: 100%;
  height: 42px;
  border: 1px solid #ddd;
  border-radius: 10px;
  padding: 0 12px;
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--text-dark);
}

.chat__card input:focus { outline: 2px solid var(--secondary-color); border-color: transparent; }
.chat__card input.error { border-color: #d64545; }

.chat__card .btn {
  justify-content: center;
  padding: 12px 20px;
  font-size: 0.95rem;
  cursor: pointer;
  border: none;
  font-family: inherit;
}

.chat__card small { font-size: 0.75rem; color: var(--text-light); line-height: 1.5; }
.chat__card--done { border-color: var(--secondary-color); background: var(--accent-color); }

.chat__form {
  flex-shrink: 0;
  display: flex;
  gap: 8px;
  padding: 10px 12px 6px;
  background: white;
  border-top: 1px solid #eee;
}

.chat__input {
  flex: 1;
  height: 46px;
  border: 1px solid #ddd;
  border-radius: 50px;
  padding: 0 16px;
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--text-dark);
}

.chat__input:focus { outline: 2px solid var(--secondary-color); border-color: transparent; }

.chat__send {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: none;
  background: var(--primary-color);
  color: white;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.chat__send:disabled { opacity: 0.5; cursor: default; }



body.chat-open .launcher { display: none; }

@media (max-width: 768px) {
  body.chat-open { overflow: hidden; }
}

@media (max-width: 768px) {
  .chat {
    inset: 0;
  }

  .chat__panel {
    width: 100%;
    height: 100%;
    border-radius: 0;
    transform-origin: top left;
  }
}
