/* KoreaDaddy Medical Chatbot v2 */
#kd-chat-box {
  font-family: 'Segoe UI', 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', sans-serif;
}
#kd-chat-box, #kd-chat-box * {
  font-family: 'Segoe UI', 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', Arial, sans-serif;
}
#kd-chat-btn {
  position: fixed; bottom: 24px; right: 24px;
  width: 58px; height: 58px;
  background: linear-gradient(135deg, #1a6fc4, #0ea5e9);
  border-radius: 50%; border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 20px rgba(26,111,196,.5);
  z-index: 999999; transition: transform .2s, box-shadow .2s;
}
#kd-chat-btn:hover { transform: scale(1.1); box-shadow: 0 6px 24px rgba(26,111,196,.6); }
#kd-chat-btn svg { width: 26px; height: 26px; fill: #fff; }
.kd-badge {
  position: absolute; top: -2px; right: -2px;
  background: #ef4444; color: #fff; font-size: 10px; font-weight: 700;
  min-width: 18px; height: 18px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center; padding: 0 4px;
}

#kd-chat-box {
  position: fixed; bottom: 92px; right: 24px;
  width: 360px; max-height: 580px;
  background: #fff; border-radius: 16px;
  box-shadow: 0 8px 40px rgba(0,0,0,.18);
  display: none; flex-direction: column;
  z-index: 999998; overflow: hidden;
  font-family: 'Segoe UI', sans-serif; font-size: 14px;
}
#kd-chat-box.open { display: flex; }

/* remaining 완전 숨김 */
#kd-remaining { display: none !important; }

/* 플로우 버튼 */
.kd-flow-btns { display: flex; flex-wrap: wrap; gap: 6px; padding: 4px 0; }
.kd-flow-btn { padding: 7px 14px; background: #f1f5f9; border: none; border-radius: 20px; font-size: 13px; cursor: pointer; color: #1e293b; transition: background .15s; }
.kd-flow-btn:hover { background: #e0effe; color: #1a6fc4; }
.kd-flow-back { padding: 5px 12px; background: none; border: none; font-size: 12px; color: #94a3b8; cursor: pointer; }
.kd-flow-back:hover { color: #1a6fc4; }

.kd-header {
  background: linear-gradient(135deg, #1a6fc4, #0ea5e9);
  color: #fff; padding: 14px 16px;
  display: flex; align-items: center; justify-content: space-between;
}
.kd-header-left { display: flex; align-items: center; gap: 10px; }
.kd-avatar { width: 38px; height: 38px; background: rgba(255,255,255,.2); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 18px; }
.kd-title { font-weight: 700; font-size: 14px; }
.kd-subtitle { font-size: 11px; opacity: .85; }
.kd-close { background: none; border: none; color: #fff; font-size: 20px; cursor: pointer; padding: 0; line-height: 1; opacity: .8; }
.kd-close:hover { opacity: 1; }

.kd-body { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; min-height: 220px; max-height: 380px; }

/* 언어 */
.kd-lang-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.kd-lang-btn { padding: 10px; border: 1.5px solid #e2e8f0; border-radius: 8px; background: #f8fafc; cursor: pointer; font-size: 13px; transition: all .15s; }
.kd-lang-btn:hover { background: #1a6fc4; color: #fff; border-color: #1a6fc4; }

/* 메시지 */
.kd-msg { display: flex; gap: 8px; animation: kdFadeIn .2s ease; }
.kd-msg.user { flex-direction: row-reverse; }
.kd-bubble { max-width: 82%; padding: 9px 12px; border-radius: 12px; font-size: 13px; line-height: 1.65; }
.kd-msg.bot .kd-bubble { background: #f1f5f9; color: #1e293b; border-bottom-left-radius: 4px; }
.kd-msg.user .kd-bubble { background: linear-gradient(135deg,#1a6fc4,#0ea5e9); color: #fff; border-bottom-right-radius: 4px; }
.kd-msg-av { width: 28px; height: 28px; border-radius: 50%; background: #e0effe; display: flex; align-items: center; justify-content: center; font-size: 14px; flex-shrink: 0; margin-top: 2px; }
@keyframes kdFadeIn { from{opacity:0;transform:translateY(4px)} to{opacity:1;transform:translateY(0)} }

/* 빠른 질문 */
.kd-quick-btns { display: flex; flex-wrap: wrap; gap: 6px; padding: 4px 0; }
.kd-quick-btn { padding: 6px 12px; background: #f0f9ff; border: 1px solid #bae6fd; border-radius: 20px; font-size: 12px; color: #0369a1; cursor: pointer; transition: all .15s; }
.kd-quick-btn:hover { background: #0ea5e9; color: #fff; border-color: #0ea5e9; }

/* 병원 카드 */
.kd-hosp-card { background: #f0f9ff; border: 1px solid #bae6fd; border-radius: 10px; padding: 10px 12px; }
.kd-hosp-card p { font-size: 12px; color: #0369a1; margin-bottom: 6px; }
.kd-hosp-link { display: inline-flex; align-items: center; padding: 5px 10px; background: #0ea5e9; color: #fff; border-radius: 6px; font-size: 12px; text-decoration: none; }

/* 이메일 수집 */
.kd-email-box {
  background: #f0fdf4; border: 1.5px solid #86efac; border-radius: 12px;
  padding: 16px; display: flex; flex-direction: column; gap: 8px;
}
.kd-email-icon { font-size: 28px; text-align: center; }
.kd-email-box p { font-size: 13px; color: #166534; text-align: center; line-height: 1.5; }
.kd-email-box input { padding: 9px 12px; border: 1px solid #86efac; border-radius: 8px; font-size: 13px; outline: none; background: #fff; }
.kd-email-box input:focus { border-color: #16a34a; }
.kd-email-btns { display: flex; gap: 8px; }
.kd-btn-primary { flex: 1; padding: 9px; background: #16a34a; color: #fff; border: none; border-radius: 8px; cursor: pointer; font-size: 13px; font-weight: 600; }
.kd-btn-skip { padding: 9px 14px; background: none; border: 1px solid #86efac; border-radius: 8px; cursor: pointer; font-size: 12px; color: #64748b; }

/* 문의 버튼 */
.kd-inquiry-btn { display: flex; align-items: center; justify-content: center; gap: 6px; padding: 10px; background: #16a34a; color: #fff; border-radius: 8px; font-size: 13px; font-weight: 600; text-decoration: none; margin-top: 4px; }
.kd-inquiry-btn:hover { background: #15803d; }

/* 캡차 */
.kd-captcha { background: #fffbeb; border: 1px solid #fde68a; border-radius: 10px; padding: 16px; text-align: center; }
.kd-captcha p { font-size: 13px; color: #92400e; margin-bottom: 10px; }
.kd-captcha-q { font-size: 22px; font-weight: 700; margin-bottom: 12px; }

/* 타이핑 */
.kd-typing { display: flex; gap: 4px; }
.kd-typing span { width: 6px; height: 6px; background: #94a3b8; border-radius: 50%; animation: kdBounce .8s infinite; }
.kd-typing span:nth-child(2){animation-delay:.15s} .kd-typing span:nth-child(3){animation-delay:.3s}
@keyframes kdBounce{0%,80%,100%{transform:translateY(0)}40%{transform:translateY(-6px)}}

/* 입력 */
.kd-footer { padding: 10px 12px; border-top: 1px solid #e2e8f0; display: flex; gap: 8px; }
.kd-input { flex: 1; padding: 9px 12px; border: 1px solid #e2e8f0; border-radius: 8px; font-size: 13px; outline: none; resize: none; font-family: inherit; }
.kd-input:focus { border-color: #1a6fc4; }
.kd-send { width: 38px; height: 38px; background: linear-gradient(135deg,#1a6fc4,#0ea5e9); border: none; border-radius: 8px; cursor: pointer; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.kd-send svg { width: 16px; height: 16px; fill: #fff; }
.kd-send:disabled { background: #cbd5e1; cursor: not-allowed; }

@media(max-width:400px) { #kd-chat-box{width:calc(100vw - 20px);right:10px;bottom:80px;} }