/* DeepChat widget — scoped, reusable on any theme */
.deepchat-root {
  --dc-primary: #0c2d6b;
  --dc-accent: #d4a017;
  --dc-surface: #f7f2ea;
  --dc-text: #0c2d6b;
  --dc-user-text: #fff;
  --dc-radius: 14px;
  --dc-x: 20px;
  --dc-y: 20px;
  font-family: inherit;
  color: var(--dc-text);
  z-index: 9990;
}

.deepchat-root[hidden] { display: none !important; }

.deepchat-launcher,
.deepchat-greet,
.deepchat-panel {
  position: fixed;
  z-index: inherit;
  box-sizing: border-box;
}

.deepchat-root.is-right .deepchat-launcher,
.deepchat-root.is-right .deepchat-panel,
.deepchat-root.is-right .deepchat-greet {
  right: var(--dc-x);
  left: auto;
}

.deepchat-root.is-left .deepchat-launcher,
.deepchat-root.is-left .deepchat-panel,
.deepchat-root.is-left .deepchat-greet {
  left: var(--dc-x);
  right: auto;
}

.deepchat-launcher {
  bottom: var(--dc-y);
  width: 56px;
  height: 56px;
  border: 0;
  border-radius: 50%;
  background: #0c2d6b;
  background: var(--dc-primary, #0c2d6b);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(12, 45, 107, 0.28);
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-appearance: none;
  appearance: none;
}

.deepchat-launcher svg {
  stroke: currentColor;
  fill: none;
  flex-shrink: 0;
}

.deepchat-launcher:focus-visible {
  outline: 2px solid var(--dc-accent);
  outline-offset: 3px;
}

.deepchat-greet {
  bottom: calc(var(--dc-y) + 68px);
  max-width: min(240px, calc(100vw - 96px));
  background: #fff;
  color: var(--dc-text);
  padding: 10px 12px;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(12, 45, 107, 0.14);
  font-size: 13px;
  line-height: 1.4;
  opacity: 0;
  pointer-events: none;
  transform: translateY(6px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.deepchat-greet.is-on {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.deepchat-root.is-open .deepchat-greet {
  display: none;
}

.deepchat-root.is-docked .deepchat-launcher,
.site-dock .deepchat-launcher {
  position: static;
  width: 52px;
  height: 52px;
  margin: 0;
  background: #0c2d6b;
  background: var(--dc-primary, #0c2d6b);
  color: #fff;
  box-shadow: 0 8px 18px rgba(12, 45, 107, 0.28);
}

.site-dock .deepchat-launcher svg {
  stroke: #fff;
}

.deepchat-root.is-docked .deepchat-greet {
  left: 50%;
  right: auto;
  bottom: calc(78px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%) translateY(6px);
}

.deepchat-root.is-docked .deepchat-greet.is-on {
  transform: translateX(-50%) translateY(0);
}

.deepchat-root.is-docked .deepchat-panel,
.deepchat-root.is-docked.is-right .deepchat-panel,
.deepchat-root.is-docked.is-left .deepchat-panel {
  left: 50%;
  right: auto;
  transform: translateX(-50%);
  width: min(380px, calc(100vw - 16px));
  top: max(8px, env(safe-area-inset-top, 0px));
  bottom: calc(72px + env(safe-area-inset-bottom, 0px));
  height: auto;
  max-height: none;
}

.deepchat-panel {
  display: none;
  bottom: calc(var(--dc-y) + 68px);
  width: min(380px, calc(100vw - 24px));
  height: min(560px, calc(100dvh - 100px));
  background: var(--dc-surface);
  border-radius: var(--dc-radius);
  box-shadow: 0 18px 50px rgba(12, 45, 107, 0.22);
  overflow: hidden;
  flex-direction: column;
  min-height: 0;
}

.deepchat-root.is-open .deepchat-panel {
  display: flex;
}

.deepchat-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 14px 14px 16px;
  background: var(--dc-primary);
  color: #fff;
  flex-shrink: 0;
}

.deepchat-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255,255,255,0.16);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  overflow: hidden;
  flex-shrink: 0;
}

.deepchat-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.deepchat-head-copy {
  min-width: 0;
  flex: 1;
}

.deepchat-head-copy strong {
  display: block;
  font-size: 14px;
  letter-spacing: 0.04em;
}

.deepchat-head-copy span {
  display: block;
  font-size: 11px;
  opacity: 0.82;
}

.deepchat-close {
  border: 0;
  background: transparent;
  color: #fff;
  width: 36px;
  height: 36px;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.deepchat-log {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px 14px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-anchor: none;
}

.deepchat-msg {
  max-width: 86%;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.45;
  white-space: pre-wrap;
}

.deepchat-msg.is-bot {
  align-self: flex-start;
  background: #fff;
  color: var(--dc-text);
}

.deepchat-msg.is-user {
  align-self: flex-end;
  background: var(--dc-primary);
  color: var(--dc-user-text);
}

.deepchat-msg.is-system {
  align-self: center;
  background: transparent;
  color: #6b7280;
  font-size: 12px;
  padding: 0;
}

.deepchat-typing {
  align-self: flex-start;
  display: flex;
  gap: 4px;
  padding: 10px 12px;
  background: #fff;
  border-radius: 12px;
}

.deepchat-typing i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--dc-primary);
  opacity: 0.35;
  animation: dcDot 1s infinite;
}

.deepchat-typing i:nth-child(2) { animation-delay: 0.15s; }
.deepchat-typing i:nth-child(3) { animation-delay: 0.3s; }

@keyframes dcDot {
  0%, 80%, 100% { opacity: 0.25; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-3px); }
}

.deepchat-choices {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 14px 10px;
  flex-shrink: 0;
}

.deepchat-choice,
.deepchat-action {
  appearance: none;
  border: 1.5px solid rgba(12, 45, 107, 0.22);
  background: #fff;
  color: var(--dc-primary);
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.deepchat-action.is-primary {
  background: var(--dc-primary);
  color: #fff;
  border-color: var(--dc-primary);
}

.deepchat-composer {
  display: flex;
  gap: 8px;
  padding: 10px 12px 8px;
  border-top: 1px solid rgba(12, 45, 107, 0.1);
  background: var(--dc-surface);
  flex-shrink: 0;
}

.deepchat-composer[hidden],
.deepchat-choices[hidden] {
  display: none !important;
}

.deepchat-composer input,
.deepchat-composer textarea,
.deepchat-composer select {
  flex: 1;
  min-width: 0;
  border: 1px solid rgba(12, 45, 107, 0.18);
  border-radius: 8px;
  padding: 10px 12px;
  font: inherit;
  font-size: 14px;
  background: #fff;
  color: var(--dc-text);
}

.deepchat-composer textarea {
  min-height: 64px;
  resize: none;
}

.deepchat-send,
.deepchat-skip {
  border: 0;
  border-radius: 8px;
  padding: 0 12px;
  font-weight: 700;
  cursor: pointer;
}

.deepchat-send {
  background: var(--dc-primary);
  color: #fff;
}

.deepchat-skip {
  background: transparent;
  color: var(--dc-primary);
}

.deepchat-hp {
  position: absolute;
  left: -9999px;
  opacity: 0;
}

.deepchat-foot {
  padding: 6px 12px 10px;
  text-align: center;
  font-size: 10px;
  letter-spacing: 0.04em;
  color: #6b7280;
  flex-shrink: 0;
  background: var(--dc-surface);
}

.deepchat-foot a {
  color: inherit;
  text-decoration: none;
}

.deepchat-error {
  color: #b42318;
  font-size: 12px;
  padding: 0 14px 8px;
}

@media (max-width: 480px) {
  .deepchat-panel {
    width: calc(100vw - 16px);
    height: calc(100dvh - 88px);
    bottom: calc(var(--dc-y) + 64px);
  }

  .deepchat-root.is-docked .deepchat-panel,
  .deepchat-root.is-docked.is-right .deepchat-panel,
  .deepchat-root.is-docked.is-left .deepchat-panel {
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    width: calc(100vw - 16px);
    top: max(8px, env(safe-area-inset-top, 0px));
    bottom: calc(72px + env(safe-area-inset-bottom, 0px));
    height: auto;
    max-height: none;
  }
}

body.nav-open .deepchat-root:not(.is-docked) {
  opacity: 0;
  pointer-events: none;
}

body.nav-open .deepchat-root.is-docked .deepchat-panel,
body.nav-open .deepchat-root.is-docked .deepchat-greet {
  opacity: 0;
  pointer-events: none;
}
