/* ═══════════════════════════════════════════════
   무무공방 챗봇 위젯
   디자인 토큰: est.html 기준 크림/갈색 팔레트
   ═══════════════════════════════════════════════ */

:root {
  --mmc-paper:        #faf8f4;
  --mmc-paper-warm:   #f3efe8;
  --mmc-rule:         #d4cfc6;
  --mmc-rule-dark:    #a09890;
  --mmc-accent:       #8b6f47;
  --mmc-accent-light: #c4a882;
  --mmc-accent-pale:  #f0e8d8;
  --mmc-ink:          #1a1a1a;
  --mmc-ink-light:    #555;
  --mmc-ink-faint:    #999;
  --mmc-radius:       6px;
  --mmc-shadow:       0 2px 16px rgba(139, 111, 71, 0.12);
}

/* ── 섹션 래퍼 ── */
#mmc-chatbot-section {
  width: 100%;
  padding: 48px 20px;
  background: var(--mmc-paper-warm);
  border-top: 1px solid var(--mmc-rule);
  border-bottom: 1px solid var(--mmc-rule);
  display: none; /* JS가 show */
}

#mmc-chatbot-section.mmc-visible {
  display: block;
}

.mmc-container {
  max-width: 720px;
  margin: 0 auto;
}

/* ── 섹션 헤더 ── */
.mmc-section-header {
  text-align: center;
  margin-bottom: 28px;
}

.mmc-section-header h2 {
  font-family: 'Noto Serif KR', serif;
  font-size: 22px;
  font-weight: 400;
  color: var(--mmc-ink);
  letter-spacing: 0.08em;
  margin-bottom: 6px;
}

.mmc-section-header p {
  font-size: 13px;
  color: var(--mmc-ink-light);
  letter-spacing: 0.03em;
}

/* ── 채팅 박스 ── */
.mmc-chat-box {
  border: 1px solid var(--mmc-rule-dark);
  border-radius: var(--mmc-radius);
  background: var(--mmc-paper);
  box-shadow: var(--mmc-shadow);
  display: flex;
  flex-direction: column;
  height: 480px;
  overflow: hidden;
}

/* ── 메시지 영역 ── */
.mmc-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
}

.mmc-messages::-webkit-scrollbar {
  width: 4px;
}
.mmc-messages::-webkit-scrollbar-track {
  background: transparent;
}
.mmc-messages::-webkit-scrollbar-thumb {
  background: var(--mmc-rule-dark);
  border-radius: 2px;
}

/* ── 메시지 버블 ── */
.mmc-bubble-wrap {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.mmc-bubble-wrap.user {
  flex-direction: row-reverse;
}

.mmc-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--mmc-accent-pale);
  border: 1px solid var(--mmc-rule-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  flex-shrink: 0;
}

.mmc-bubble {
  max-width: 72%;
  padding: 10px 14px;
  border-radius: var(--mmc-radius);
  font-size: 13.5px;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
}

.mmc-bubble-wrap.assistant .mmc-bubble {
  background: var(--mmc-paper-warm);
  border: 1px solid var(--mmc-rule);
  color: var(--mmc-ink);
  border-bottom-left-radius: 2px;
}

.mmc-bubble-wrap.user .mmc-bubble {
  background: var(--mmc-accent);
  color: #fff;
  border-bottom-right-radius: 2px;
}

.mmc-bubble-wrap.operator .mmc-bubble {
  background: #2c3e50;
  color: #ecf0f1;
  border-bottom-left-radius: 2px;
}

/* 스트리밍 커서 */
.mmc-cursor::after {
  content: '▋';
  animation: mmc-blink 0.8s step-start infinite;
  font-size: 12px;
  opacity: 0.7;
}

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

/* ── 입력 영역 ── */
.mmc-input-bar {
  border-top: 1px solid var(--mmc-rule);
  padding: 12px 14px;
  display: flex;
  gap: 8px;
  align-items: flex-end;
  background: var(--mmc-paper);
}

.mmc-input {
  flex: 1;
  resize: none;
  border: 1px solid var(--mmc-rule-dark);
  border-radius: var(--mmc-radius);
  padding: 9px 12px;
  font-family: 'Noto Sans KR', sans-serif;
  font-size: 13.5px;
  color: var(--mmc-ink);
  background: var(--mmc-paper-warm);
  line-height: 1.5;
  max-height: 100px;
  outline: none;
  transition: border-color 0.15s;
}

.mmc-input:focus {
  border-color: var(--mmc-accent-light);
}

.mmc-input::placeholder {
  color: var(--mmc-ink-faint);
}

.mmc-send-btn {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: var(--mmc-radius);
  background: var(--mmc-accent);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, opacity 0.15s;
}

.mmc-send-btn:hover {
  background: var(--mmc-accent-light);
}

.mmc-send-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* 전송 아이콘 */
.mmc-send-btn svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

/* ── 플로팅 버튼 ── */
#mmc-float-btn {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 9000;
  background: var(--mmc-accent);
  color: #fff;
  border: none;
  border-radius: 50px;
  padding: 12px 22px;
  font-family: 'Noto Sans KR', sans-serif;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.04em;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(139, 111, 71, 0.35);
  display: flex;
  align-items: center;
  gap: 8px;
  transition: transform 0.15s, box-shadow 0.15s, background 0.15s;
}

#mmc-float-btn:hover {
  background: var(--mmc-ink);
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(26, 26, 26, 0.22);
}

#mmc-float-btn.mmc-hidden {
  display: none;
}

/* ── 재방문 배너 ── */
.mmc-revisit-banner {
  background: var(--mmc-accent-pale);
  border: 1px solid var(--mmc-accent-light);
  border-radius: var(--mmc-radius);
  padding: 10px 14px;
  font-size: 12.5px;
  color: var(--mmc-accent);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.mmc-revisit-banner button {
  background: none;
  border: none;
  color: var(--mmc-ink-faint);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 0;
}

/* ── 완료 배너 ── */
.mmc-done-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  font-size: 13px;
  color: var(--mmc-ink-light);
  border-top: 1px solid var(--mmc-rule);
  background: var(--mmc-accent-pale);
  flex-wrap: wrap;
}

.mmc-done-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.mmc-reopen-btn,
.mmc-new-chat-btn {
  background: none;
  border: 1px solid var(--mmc-accent);
  border-radius: var(--mmc-radius);
  padding: 6px 14px;
  font-family: 'Noto Sans KR', sans-serif;
  font-size: 12.5px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}

.mmc-reopen-btn {
  color: var(--mmc-accent);
}

.mmc-reopen-btn:hover {
  background: var(--mmc-accent-pale);
}

.mmc-new-chat-btn {
  background: var(--mmc-accent);
  color: #fff;
  border-color: var(--mmc-accent);
}

.mmc-new-chat-btn:hover {
  background: var(--mmc-ink);
  border-color: var(--mmc-ink);
}

/* ── 세션 구분선 ── */
.mmc-session-sep {
  text-align: center;
  font-size: 11.5px;
  color: var(--mmc-ink-faint);
  padding: 4px 0;
  position: relative;
}

/* ── 반응형 ── */
@media (max-width: 480px) {
  .mmc-chat-box {
    height: 420px;
  }

  .mmc-bubble {
    max-width: 85%;
    font-size: 13px;
  }

  #mmc-float-btn {
    bottom: 20px;
    right: 16px;
    padding: 11px 18px;
    font-size: 13px;
  }
}


/* ── 챗봇 내 이미지 ── */
.mmc-chat-img {
  display: block;
  max-width: 100%;
  max-height: 260px;
  width: auto;
  border-radius: 8px;
  margin: 6px 0 2px;
  object-fit: cover;
  cursor: pointer;
  transition: opacity 0.2s;
}

.mmc-chat-img:hover {
  opacity: 0.88;
}

.mmc-bubble a {
  color: var(--mmc-accent, #8b6f47);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.mmc-bubble strong {
  font-weight: 600;
}

/* ── 공용 숨김 클래스 ── */
.mmc-hidden {
  display: none !important;
}

/* ── 채팅폼 아래 바 ── */
.mmc-below-bar {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  padding: 10px 0 0;
}

/* ── 아래 바 버튼 공통 ── */
#mmc-resume-btn,
#mmc-new-chat-action-btn,
#mmc-end-chat-btn {
  background: none;
  border: none;
  font-family: 'Noto Sans KR', sans-serif;
  font-size: 11.5px;
  color: var(--mmc-ink-faint);
  cursor: pointer;
  padding: 2px 4px;
  letter-spacing: 0.02em;
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color 0.15s;
}

#mmc-resume-btn:hover,
#mmc-new-chat-action-btn:hover,
#mmc-end-chat-btn:hover {
  color: var(--mmc-accent);
}

/* ── 시스템 버블 내 이어하기 UI ── */
.mmc-system-bubble {
  padding: 12px 14px;
}

.mmc-resume-prompt-text {
  font-size: 13px;
  color: var(--mmc-ink);
  margin: 0 0 10px;
  line-height: 1.6;
}

.mmc-session-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 10px;
}

.mmc-session-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: var(--mmc-paper);
  border: 1px solid var(--mmc-accent-light);
  border-radius: var(--mmc-radius);
  padding: 8px 12px;
  font-family: 'Noto Sans KR', sans-serif;
  font-size: 12.5px;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s, border-color 0.15s;
  width: 100%;
}

.mmc-session-item:hover {
  background: var(--mmc-accent-pale);
  border-color: var(--mmc-accent);
}

.mmc-session-item-label {
  color: var(--mmc-ink);
  font-weight: 500;
  flex: 1;
}

.mmc-session-item-date {
  color: var(--mmc-ink-faint);
  font-size: 11.5px;
  flex-shrink: 0;
}

.mmc-history-badge {
  display: inline-block;
  margin-left: 6px;
  font-size: 10.5px;
  font-weight: 400;
  color: var(--mmc-ink-faint);
  background: var(--mmc-rule);
  border-radius: 3px;
  padding: 1px 5px;
  vertical-align: middle;
}

.mmc-resume-or {
  font-size: 12px;
  color: var(--mmc-ink-faint);
  margin: 8px 0 6px;
}

.mmc-code-prompt-btn {
  background: none;
  border: 1px solid var(--mmc-accent);
  border-radius: var(--mmc-radius);
  padding: 5px 12px;
  font-family: 'Noto Sans KR', sans-serif;
  font-size: 12.5px;
  color: var(--mmc-accent);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.mmc-code-prompt-btn:hover {
  background: var(--mmc-accent-pale);
}

.mmc-inline-code-row {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-top: 6px;
}

.mmc-resume-input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--mmc-rule-dark);
  border-radius: var(--mmc-radius);
  padding: 7px 10px;
  font-family: 'Noto Sans KR', sans-serif;
  font-size: 13px;
  color: var(--mmc-ink);
  background: var(--mmc-paper-warm);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  outline: none;
  transition: border-color 0.15s;
}

.mmc-resume-input:focus {
  border-color: var(--mmc-accent-light);
}

.mmc-resume-submit {
  background: var(--mmc-accent);
  color: #fff;
  border: none;
  border-radius: var(--mmc-radius);
  padding: 7px 12px;
  font-family: 'Noto Sans KR', sans-serif;
  font-size: 12.5px;
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
  flex-shrink: 0;
}

.mmc-resume-submit:hover {
  background: var(--mmc-ink);
}

.mmc-resume-submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.mmc-resume-cancel {
  background: none;
  border: none;
  color: var(--mmc-ink-faint);
  font-size: 18px;
  cursor: pointer;
  padding: 0 2px;
  line-height: 1;
  flex-shrink: 0;
  transition: color 0.15s;
}

.mmc-resume-cancel:hover {
  color: var(--mmc-ink);
}

.mmc-resume-error {
  font-size: 11.5px;
  color: #c0392b;
  margin: 8px 0 0;
}

/* ── 종료/새 상담 확인 버블 ── */
.mmc-action-confirm {
  padding: 4px 0;
}

.mmc-confirm-btns {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.mmc-confirm-no,
.mmc-confirm-yes {
  border-radius: var(--mmc-radius);
  padding: 6px 14px;
  font-family: 'Noto Sans KR', sans-serif;
  font-size: 12.5px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}

.mmc-confirm-no {
  background: none;
  border: 1px solid var(--mmc-rule-dark);
  color: var(--mmc-ink-light);
}

.mmc-confirm-no:hover {
  border-color: var(--mmc-accent);
  color: var(--mmc-accent);
}

.mmc-confirm-yes {
  background: var(--mmc-accent);
  border: 1px solid var(--mmc-accent);
  color: #fff;
}

.mmc-confirm-yes:hover {
  background: var(--mmc-ink);
  border-color: var(--mmc-ink);
}

/* ── 연락처 타입 선택 ── */
.mmc-contact-type-row {
  display: flex;
  gap: 8px;
  margin: 0 0 8px;
}

.mmc-type-btn {
  background: none;
  border: 1px solid var(--mmc-rule-dark);
  border-radius: var(--mmc-radius);
  padding: 5px 14px;
  font-family: 'Noto Sans KR', sans-serif;
  font-size: 12.5px;
  color: var(--mmc-ink-light);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.mmc-type-btn:hover {
  border-color: var(--mmc-accent-light);
  color: var(--mmc-accent);
}

.mmc-type-btn-active {
  background: var(--mmc-accent-pale);
  border-color: var(--mmc-accent);
  color: var(--mmc-accent);
  font-weight: 500;
}

/* ── 마스터 테스트 모드 배지 ── */
#mmc-admin-badge {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 10001;
  background: #2a2620;
  color: #e6d9b8;
  font-family: 'Noto Sans KR', sans-serif;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  padding: 4px 9px;
  border-radius: 4px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
  opacity: 0.78;
  pointer-events: none;
  user-select: none;
}

/* ── 봇 요청 단독 연락처 폼 ── */
.mmc-contact-form .mmc-contact-form-fields {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 6px;
}

.mmc-contact-form .mmc-contact-name {
  margin: 0;
}

