/* Chat assistant (ChatView.swift): a full-height chat on phones, a panel on wide screens. */

.page.chat {
  height: 100vh;
  height: 100dvh;
  display: flex;
  justify-content: center;
  background: var(--ct-backdrop);
}
.ct-panel {
  width: 100%;
  max-width: 640px;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--ct-backdrop);
}
@media (min-width: 900px) {
  .page.chat {
    padding: 32px 24px;
    background: var(--surface);
  }
  .ct-panel {
    overflow: hidden;
    border-radius: 22px;
    border: 1px solid var(--topbar-line);
    box-shadow: 0 20px 50px var(--panel-shadow);
  }
}
.ct-head {
  flex: none;
  padding: calc(8px + env(safe-area-inset-top, 0px)) 8px 8px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--chat-ink);
  background: var(--chat);
}
@media (min-width: 900px) {
  .ct-head {
    padding-top: 8px;
  }
}
.ct-head-icon {
  width: 38px;
  height: 38px;
  flex: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  background: rgba(255, 255, 255, 0.12);
}
.ct-head-text {
  flex: 1;
  min-width: 0;
}
.ct-title {
  font-size: 15px;
  font-weight: 600;
}
.ct-subtitle {
  padding-top: 2px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  opacity: 0.66;
}
.ct-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--mint, #3ce6b0);
}
.ct-close {
  width: 44px;
  height: 44px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  color: var(--chat-ink);
}
.ct-close .icon {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--chat-ink) 8%, transparent);
}

/* Messages */
.ct-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}
.ct-row {
  display: flex;
  padding-right: 40px;
}
.ct-row.is-user {
  justify-content: flex-end;
  padding: 0 0 0 40px;
}
.ct-bubble {
  max-width: 100%;
  padding: 10px 13px;
  border-radius: 16px 16px 16px 5px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  font-size: 14px;
  line-height: 1.45;
  color: var(--text);
  background: var(--surface);
  box-shadow: 0 1px 1px var(--ct-bubble-shadow);
}
.ct-bubble.is-user {
  border-radius: 16px 16px 5px 16px;
  color: var(--chat-ink);
  background: var(--chat);
  box-shadow: none;
}
.ct-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  user-select: text;
}
.ct-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.ct-link {
  padding: 7px 11px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ct-link);
  background: var(--ct-link-bg);
}
.ct-typing {
  padding: 13px 14px;
  border-radius: 16px;
  display: flex;
  gap: 4px;
  background: var(--surface);
}
.ct-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ct-typing);
  animation: ct-bounce 1s ease-in-out infinite;
}
.ct-typing span:nth-child(2) {
  animation-delay: 0.1s;
}
.ct-typing span:nth-child(3) {
  animation-delay: 0.2s;
}
@keyframes ct-bounce {
  0%, 60%, 100% {
    transform: none;
  }
  30% {
    transform: translateY(-3px);
  }
}

/* Suggestions */
.ct-chips {
  flex: none;
  padding: 2px 12px 4px;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
}
.ct-chips::-webkit-scrollbar {
  display: none;
}
.ct-chip {
  flex: none;
  min-height: 34px;
  margin: 5px 0;
  padding: 0 12px;
  border-radius: 17px;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  color: var(--ct-link);
  background: var(--surface);
  border: 1px solid var(--chat-deep);
}

/* Input */
.ct-bar {
  flex: none;
  padding: 10px 12px calc(12px + env(safe-area-inset-bottom, 0px));
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border-top: 1px solid var(--topbar-line);
}
.ct-input {
  flex: 1;
  min-width: 0;
  height: 42px;
  padding: 0 14px;
  border-radius: 21px;
  border: 1px solid var(--ct-input-line);
  outline: none;
  font: inherit;
  font-size: 15px;
  color: var(--text);
  background: var(--surface);
}
.ct-input:focus {
  border-color: var(--ct-input-focus);
}
.ct-input::placeholder {
  color: var(--muted);
}
.ct-send {
  width: 44px;
  height: 44px;
  flex: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: var(--chat-ink);
  background: var(--chat);
}
.ct-send:disabled {
  opacity: 0.5;
  cursor: default;
}
