/* ========== Brand advisor (AI chat) ========== */

.ai-chat-launcher {
  position: fixed;
  right: 12px;
  bottom: 12px;
  z-index: 60;
  transition: bottom 0.2s var(--ease);
}

.ai-chat-launcher__btn {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px 10px 10px;
  border: 1px solid var(--line);
  background: rgba(247, 243, 238, 0.96);
  backdrop-filter: blur(8px);
  box-shadow: 0 12px 32px rgba(61, 56, 51, 0.12);
  transition: border-color 0.3s var(--ease), background 0.3s var(--ease);
}

.ai-chat-launcher__btn:hover {
  border-color: var(--camel);
  background: var(--bg-warm);
}

.ai-chat-launcher__mark {
  display: inline-flex;
  width: 36px;
  height: 36px;
  align-items: center;
  justify-content: center;
  background: var(--camel-deep);
  color: var(--white);
  font-family: var(--font-body);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.14em;
}

.ai-chat-launcher__label {
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink);
}

.ai-chat-panel {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 60;
  display: flex;
  flex-direction: column;
  height: min(36rem, calc(100vh - 1.5rem));
  overflow: hidden;
  border: 1px solid var(--line);
  background: rgba(255, 254, 252, 0.98);
  backdrop-filter: blur(8px);
  box-shadow: 0 16px 40px rgba(61, 56, 51, 0.14);
  transition: bottom 0.2s var(--ease);
}

.ai-chat-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-warm);
}

.ai-chat-panel__title {
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink);
}

.ai-chat-panel__close {
  display: inline-flex;
  width: 32px;
  height: 32px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  background: var(--white);
  color: var(--muted);
  transition: border-color 0.3s var(--ease), color 0.3s var(--ease);
}

.ai-chat-panel__close:hover {
  border-color: var(--camel);
  color: var(--ink);
}

.ai-chat-panel__close-bar {
  display: block;
  width: 12px;
  height: 1px;
  background: currentColor;
}

.ai-chat-panel__messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 24px 20px;
}

.ai-chat-messages {
  display: grid;
  gap: 18px;
}

.ai-chat-messages__item {
  display: flex;
}

.ai-chat-messages__item--user {
  justify-content: flex-end;
}

.ai-chat-messages__item--assistant {
  justify-content: flex-start;
}

.ai-chat-bubble {
  max-width: 86%;
  padding: 14px 16px;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.75;
  letter-spacing: 0.01em;
}

.ai-chat-bubble--user {
  background: var(--camel-deep);
  color: var(--white);
}

.ai-chat-bubble--assistant {
  border: 1px solid var(--line);
  background: var(--bg-warm);
  color: var(--ink-soft);
}

.ai-chat-bubble__text {
  white-space: pre-line;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.ai-chat-bubble__typing {
  display: flex;
  align-items: center;
  gap: 5px;
  min-height: 1.5em;
}

.ai-chat-bubble__typing span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--camel);
  animation: ai-chat-pulse 1.2s ease-in-out infinite;
}

.ai-chat-bubble__typing span:nth-child(2) {
  animation-delay: 0.15s;
}

.ai-chat-bubble__typing span:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes ai-chat-pulse {
  0%,
  80%,
  100% {
    opacity: 0.35;
    transform: translateY(0);
  }

  40% {
    opacity: 1;
    transform: translateY(-2px);
  }
}

.ai-chat-composer {
  padding: 16px 20px 18px;
  border-top: 1px solid var(--line);
  background: rgba(255, 254, 252, 0.96);
}

.ai-chat-composer__form {
  display: flex;
  align-items: stretch;
  gap: 10px;
}

.ai-chat-composer__input {
  min-width: 0;
  flex: 1;
  padding: 12px 14px;
  border: 1px solid var(--line);
  background: var(--bg-warm);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.5;
  outline: none;
  transition: border-color 0.3s var(--ease), background 0.3s var(--ease);
}

.ai-chat-composer__input::placeholder {
  color: var(--muted);
  font-weight: 400;
}

.ai-chat-composer__input:focus {
  border-color: var(--camel);
  background: var(--white);
}

.ai-chat-composer__input:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.ai-chat-composer__send {
  flex-shrink: 0;
  min-width: 88px;
  padding: 12px 18px;
  background: var(--ink);
  color: var(--white);
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  transition: background 0.35s var(--ease);
}

.ai-chat-composer__send:hover:not(:disabled) {
  background: var(--camel-deep);
}

.ai-chat-composer__send:disabled {
  background: var(--camel-soft);
  color: rgba(255, 255, 255, 0.85);
  cursor: not-allowed;
}

.ai-chat-composer__note {
  margin-top: 12px;
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 400;
  line-height: 1.7;
  letter-spacing: 0.02em;
  color: var(--muted);
}

@media (min-width: 640px) {
  .ai-chat-launcher {
    right: 24px;
    bottom: 24px;
  }

  .ai-chat-panel {
    left: auto;
    right: 24px;
    bottom: 24px;
    width: 24rem;
    height: min(40rem, calc(100vh - 3rem));
  }
}
