/* ===== 모토 챗 비서 ===== */

#motoChat {
  font-family: 'Pretendard', -apple-system, sans-serif;
  --moto-primary: #047857;
  --moto-dark: #065F46;
  --moto-bubble-bot: #f3f4f6;
  --moto-bubble-user: #047857;
}

/* ===== FAB 버튼 (우측 하단) ===== */
.moto-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, #047857, #065F46);
  box-shadow: 0 8px 24px rgba(0,255,166, 0.4);
  cursor: pointer;
  z-index: 9998;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s, box-shadow 0.2s;
  animation: motoBounce 2s ease-in-out infinite;
}
.moto-fab:hover {
  transform: scale(1.08);
  box-shadow: 0 12px 32px rgba(0,255,166, 0.5);
}
.moto-fab svg { width: 48px; height: 48px; }

@keyframes motoBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
.moto-fab.open { animation: none; }

.moto-fab__badge {
  position: absolute;
  top: -2px;
  right: -2px;
  background: #EA580C;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 999px;
  min-width: 18px;
  text-align: center;
  border: 2px solid #fff;
  display: none;
}
.moto-fab__badge.visible { display: block; }

/* ===== 채팅 패널 ===== */
.moto-panel {
  position: fixed;
  bottom: 100px;
  right: 24px;
  width: 380px;
  height: 600px;
  max-height:calc(100vh - 140px);max-height:calc(100dvh - 140px);
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.18);
  display: none;
  flex-direction: column;
  overflow: hidden;
  z-index: 9999;
  border: 1px solid #e8eaed;
  transform-origin: bottom right;
  animation: motoSlideIn 0.25s ease-out;
}
.moto-panel.open { display: flex; }

@keyframes motoSlideIn {
  from { opacity: 0; transform: translateY(20px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ===== 헤더 ===== */
.moto-header {
  padding: 16px 18px;
  background: linear-gradient(135deg, #047857, #065F46);
  color: #fff;
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
}
.moto-header__avatar {
  width: 44px;
  height: 44px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.moto-header__avatar svg { width: 38px; height: 38px; }
.moto-header__info { flex: 1; }
.moto-header__name {
  font-size: 16px;
  font-weight: 700;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}
.moto-header__status {
  font-size: 11px;
  opacity: 0.9;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 4px;
}
.moto-status-dot {
  width: 6px;
  height: 6px;
  background: #4ade80;
  border-radius: 50%;
  display: inline-block;
}

.moto-header__actions {
  display: flex;
  gap: 4px;
}
.moto-header__btn {
  background: rgba(255, 255, 255, 0.15);
  border: none;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  color: #fff;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.moto-header__btn:hover { background: rgba(255, 255, 255, 0.25); }

/* ===== 메시지 영역 ===== */
.moto-messages {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  background: #fafbfc;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.moto-messages::-webkit-scrollbar { width: 6px; }
.moto-messages::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }

.moto-msg-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}
.moto-msg-row.user { flex-direction: row-reverse; }

.moto-msg-avatar {
  width: 28px;
  height: 28px;
  background: linear-gradient(135deg, #047857, #065F46);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.moto-msg-avatar svg { width: 24px; height: 24px; }
.moto-msg-row.user .moto-msg-avatar { display: none; }

.moto-bubble {
  max-width: 75%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.5;
  word-wrap: break-word;
}
.moto-msg-row.bot .moto-bubble {
  background: var(--moto-bubble-bot);
  color: #1a1a1a;
  border-bottom-left-radius: 4px;
}
.moto-msg-row.user .moto-bubble {
  background: var(--moto-bubble-user);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.moto-time {
  font-size: 10px;
  color: #475569;
  margin-top: 2px;
  padding: 0 6px;
}
.moto-msg-row.user .moto-time { text-align: right; }

/* 타이핑 인디케이터 */
.moto-typing {
  display: inline-flex;
  gap: 3px;
  padding: 12px 14px;
}
.moto-typing span {
  width: 6px;
  height: 6px;
  background: #64748b;
  border-radius: 50%;
  animation: motoTyping 1.2s ease-in-out infinite;
}
.moto-typing span:nth-child(2) { animation-delay: 0.2s; }
.moto-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes motoTyping {
  0%, 60%, 100% { opacity: 0.3; transform: scale(0.8); }
  30% { opacity: 1; transform: scale(1); }
}

/* 임베디드 카드 (바이크/보험) */
.moto-card {
  background: #fff;
  border: 1px solid #e8eaed;
  border-radius: 14px;
  padding: 12px;
  margin: 6px 0;
  max-width: 280px;
}
.moto-card__img {
  height: 80px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 50px;
  margin-bottom: 8px;
}
.moto-card__brand { font-size: 10px; color: #4b5563; font-weight: 600; }
.moto-card__name { font-size: 14px; font-weight: 700; margin: 2px 0; }
.moto-card__spec { font-size: 11px; color: #4b5563; margin-bottom: 8px; }
.moto-card__price {
  font-size: 14px; font-weight: 800;
  color: var(--moto-primary);
}
.moto-card__match {
  display: inline-block;
  background: #fef3c7;
  color: #a16207;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  margin-bottom: 4px;
}
.moto-card__actions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}
.moto-card__btn {
  flex: 1;
  padding: 6px 10px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 8px;
  border: 1px solid var(--moto-primary);
  background: #fff;
  color: var(--moto-primary);
  cursor: pointer;
}
.moto-card__btn.primary {
  background: var(--moto-primary);
  color: #fff;
}

/* 보험사 미니 카드 */
.moto-ins-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  background: #fff;
  border: 1px solid #e8eaed;
  border-radius: 10px;
  margin: 4px 0;
}
.moto-ins-logo {
  width: 36px; height: 36px;
  border-radius: 8px;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.moto-ins-info { flex: 1; min-width: 0; }
.moto-ins-name { font-size: 12px; font-weight: 700; }
.moto-ins-price { font-size: 13px; font-weight: 800; color: var(--moto-primary); }

/* ===== Quick Reply ===== */
.moto-quick-replies {
  padding: 10px 16px 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  background: #fff;
  border-top: 1px solid #f0f2f5;
}
.moto-qr {
  padding: 8px 14px;
  background: #fff;
  border: 1.5px solid var(--moto-primary);
  color: var(--moto-primary);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}
.moto-qr:hover {
  background: var(--moto-primary);
  color: #fff;
  transform: translateY(-1px);
}

/* ===== 입력 영역 ===== */
.moto-input-area {
  display: flex;
  gap: 8px;
  padding: 12px 16px 16px;
  background: #fff;
  border-top: 1px solid #f0f2f5;
}
.moto-input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid #e8eaed;
  border-radius: 999px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
}
.moto-input:focus { border-color: var(--moto-primary); }
.moto-send {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--moto-primary);
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.moto-send:hover { background: var(--moto-dark); }
.moto-send:disabled { background: #cbd5e1; cursor: not-allowed; }

/* ===== Proactive 툴팁 (페이지 진입 후 자동) ===== */
.moto-tip {
  position: fixed;
  bottom: 100px;
  right: 24px;
  background: #fff;
  padding: 14px 18px;
  border-radius: 16px 16px 4px 16px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  font-size: 13px;
  max-width: 240px;
  z-index: 9997;
  display: none;
  animation: motoTipIn 0.3s ease-out;
}
.moto-tip.visible { display: block; }
.moto-tip::after {
  content: '';
  position: absolute;
  bottom: -8px;
  right: 20px;
  width: 0; height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-top: 8px solid #fff;
}
@keyframes motoTipIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
.moto-tip__close {
  position: absolute;
  top: 4px; right: 6px;
  background: none; border: none;
  font-size: 14px;
  color: #475569;
  cursor: pointer;
}

/* ===== 모바일 풀스크린 ===== */
@media (max-width: 768px) {
  .moto-panel {
    width: 100vw;
    height:100vh;height:100dvh;
    max-height:100vh;max-height:100dvh;
    bottom: 0;
    right: 0;
    border-radius: 0;
  }
  .moto-fab {
    bottom: 16px;
    right: 16px;
    width: 56px;
    height: 56px;
  }
  .moto-tip { right: 16px; bottom: 84px; }
}
