/* 掛件樣式：預設對齊「人工智慧全景地圖」配色，可用 CSS 變數覆蓋 */

:root {
  --mapchat-bg: #f7f3ec;
  --mapchat-ink: #182033;
  --mapchat-muted: #657085;
  --mapchat-card: rgba(255, 255, 255, 0.96);
  --mapchat-accent: #f1932c;
  --mapchat-dark: #10162d;
  --mapchat-shadow: 0 10px 28px rgba(24, 32, 51, 0.16);
  --mapchat-radius: 16px;
}

#mapchat-root {
  font-family: "Noto Sans TC", "Inter", system-ui, sans-serif;
  color: var(--mapchat-ink);
}

#mapchat-toggle {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 9998;
  width: 56px;
  height: 56px;
  border: 0;
  border-radius: 50%;
  background: var(--mapchat-dark);
  color: #fff;
  box-shadow: var(--mapchat-shadow);
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
}

#mapchat-toggle:hover {
  background: #1c2440;
}

#mapchat-panel {
  position: fixed;
  right: 20px;
  bottom: 88px;
  z-index: 9999;
  width: 380px;
  max-width: calc(100vw - 24px);
  height: min(640px, calc(100vh - 120px));
  display: none;
  flex-direction: column;
  background: var(--mapchat-card);
  border-radius: var(--mapchat-radius);
  box-shadow: var(--mapchat-shadow);
  overflow: hidden;
}

#mapchat-root.is-open #mapchat-panel {
  display: flex;
}

#mapchat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: var(--mapchat-dark);
  color: #fff;
}

#mapchat-header strong {
  font-size: 15px;
  font-weight: 600;
}

#mapchat-close {
  border: 0;
  background: transparent;
  color: #fff;
  font-size: 20px;
  cursor: pointer;
}

#mapchat-modelbar {
  padding: 8px 12px 6px;
  background: #fff;
  border-bottom: 1px solid rgba(24, 32, 51, 0.08);
}

#mapchat-models {
  display: inline-flex;
  padding: 2px;
  border-radius: 999px;
  background: rgba(16, 22, 45, 0.06);
}

#mapchat-models button {
  border: 0;
  border-radius: 999px;
  padding: 4px 12px;
  background: transparent;
  color: var(--mapchat-muted);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

#mapchat-models button.is-active {
  background: var(--mapchat-dark);
  color: #fff;
}

#mapchat-model-hint {
  margin: 6px 0 0;
  color: var(--mapchat-muted);
  font-size: 10px;
  line-height: 1.3;
}

#mapchat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px 14px 8px;
  background: var(--mapchat-bg);
}

.mapchat-bubble {
  max-width: 92%;
  margin: 0 0 10px;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.mapchat-bubble.user {
  margin-left: auto;
  background: var(--mapchat-dark);
  color: #fff;
}

.mapchat-bubble.bot {
  background: #fff;
  box-shadow: 0 4px 12px rgba(24, 32, 51, 0.06);
}

.mapchat-bubble.error {
  background: #fff4e8;
  color: #8a3b00;
}

#mapchat-form {
  display: flex;
  gap: 8px;
  padding: 10px 12px 4px;
  border-top: 1px solid rgba(24, 32, 51, 0.08);
  background: #fff;
}

#mapchat-input {
  flex: 1;
  min-height: 40px;
  max-height: 96px;
  resize: none;
  border: 1px solid rgba(24, 32, 51, 0.12);
  border-radius: 10px;
  padding: 8px 10px;
  font: inherit;
  color: var(--mapchat-ink);
}

#mapchat-send {
  border: 0;
  border-radius: 10px;
  padding: 0 14px;
  background: var(--mapchat-accent);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}

#mapchat-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

#mapchat-meta {
  display: flex;
  justify-content: space-between;
  padding: 0 12px 8px;
  background: #fff;
  color: var(--mapchat-muted);
  font-size: 11px;
}

#mapchat-disclaimer {
  padding: 0 12px 10px;
  background: #fff;
  color: var(--mapchat-muted);
  font-size: 11px;
  line-height: 1.4;
}

#mapchat-disclaimer a {
  color: inherit;
  text-decoration: underline;
}

#mapchat-turnstile {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

@media (max-width: 768px) {
  /* 避開頁尾聯絡信箱，不改地圖本體樣式 */
  #mapchat-toggle {
    right: 12px;
    bottom: 56px;
  }
}

@media (max-width: 640px) {
  #mapchat-panel {
    inset: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    max-width: none;
    border-radius: 0;
  }
}
