/* Wavy Assistant chat */
.chat-page {
  max-width: 720px;
  margin: 0 auto;
}

.chat-shell {
  display: flex;
  flex-direction: column;
  height: min(72vh, 640px);
  min-height: 420px;
  background: var(--wavy-surface);
  border: 1px solid var(--wavy-border);
  border-radius: var(--wavy-radius-xl);
  overflow: hidden;
  box-shadow: var(--wavy-shadow-purple);
}

.chat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.25), rgba(212, 175, 55, 0.08));
  border-bottom: 1px solid var(--wavy-border);
}

.chat-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--wavy-purple-dim);
  border: 1px solid var(--wavy-border-gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}

.chat-header-text h2 {
  font-size: 0.95rem;
  font-weight: 600;
  margin: 0;
}

.chat-header-text p {
  font-size: 0.75rem;
  color: var(--wavy-muted);
  margin: 2px 0 0;
}

.chat-status {
  margin-left: auto;
  font-size: 0.7rem;
  color: var(--wavy-success);
  display: flex;
  align-items: center;
  gap: 6px;
}

.chat-status::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--wavy-success);
  box-shadow: 0 0 8px var(--wavy-success);
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
}

.chat-msg {
  max-width: 88%;
  animation: chatIn 0.28s var(--wavy-ease);
}

@keyframes chatIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.chat-msg--bot {
  align-self: flex-start;
}

.chat-msg--user {
  align-self: flex-end;
}

.chat-bubble {
  padding: 12px 14px;
  border-radius: 16px;
  font-size: 0.88rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

.chat-msg--bot .chat-bubble {
  background: var(--wavy-surface2);
  border: 1px solid var(--wavy-border);
  border-bottom-left-radius: 4px;
  color: var(--wavy-text-soft);
}

.chat-msg--user .chat-bubble {
  background: linear-gradient(135deg, var(--wavy-purple-dark), var(--wavy-purple));
  border-bottom-right-radius: 4px;
  color: #fff;
}

.chat-msg--typing .chat-bubble {
  display: flex;
  gap: 5px;
  padding: 14px 18px;
}

.chat-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--wavy-muted);
  animation: chatDot 1.2s infinite;
}

.chat-dot:nth-child(2) { animation-delay: 0.15s; }
.chat-dot:nth-child(3) { animation-delay: 0.3s; }

@keyframes chatDot {
  0%, 60%, 100% { opacity: 0.35; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-4px); }
}

.chat-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 16px 12px;
}

.chat-quick-btn {
  font-family: inherit;
  font-size: 0.8rem;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--wavy-border-gold);
  background: var(--wavy-gold-dim);
  color: var(--wavy-gold-light);
  cursor: pointer;
  transition: background 0.15s, transform 0.15s;
}

.chat-quick-btn:hover {
  background: rgba(212, 175, 55, 0.22);
  transform: translateY(-1px);
}

.chat-quick-btn--primary {
  border-color: var(--wavy-purple);
  background: var(--wavy-purple-dim);
  color: var(--wavy-purple-light);
}

.chat-form-inline {
  padding: 0 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chat-form-inline select,
.chat-form-inline input {
  font-family: inherit;
  font-size: 0.85rem;
  padding: 10px 12px;
  border-radius: var(--wavy-radius);
  border: 1px solid var(--wavy-border);
  background: var(--wavy-surface2);
  color: var(--wavy-text);
}

.chat-form-inline button {
  font-family: inherit;
  font-size: 0.85rem;
  padding: 10px;
  border-radius: var(--wavy-radius);
  border: none;
  background: var(--wavy-gold);
  color: var(--wavy-black);
  font-weight: 600;
  cursor: pointer;
}

.chat-input-bar {
  display: flex;
  gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid var(--wavy-border-subtle);
  background: var(--wavy-surface2);
}

.chat-input-bar input {
  flex: 1;
  font-family: inherit;
  font-size: 0.88rem;
  padding: 11px 14px;
  border-radius: 999px;
  border: 1px solid var(--wavy-border);
  background: var(--wavy-surface);
  color: var(--wavy-text);
  outline: none;
}

.chat-input-bar input:focus {
  border-color: var(--wavy-purple);
  box-shadow: 0 0 0 3px var(--wavy-purple-dim);
}

.chat-input-bar input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.chat-send {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: var(--wavy-gold);
  color: var(--wavy-black);
  font-size: 1.1rem;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.15s, opacity 0.15s;
}

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

.chat-send:not(:disabled):hover {
  transform: scale(1.05);
}

.chat-link-card {
  margin-top: 8px;
  padding: 12px;
  border-radius: var(--wavy-radius);
  background: var(--wavy-gold-dim);
  border: 1px solid var(--wavy-border-gold);
}

.chat-link-card .link-url {
  font-size: 0.78rem;
  word-break: break-all;
  color: var(--wavy-gold-light);
  margin: 8px 0;
  padding: 8px;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 8px;
}

.chat-link-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.chat-link-actions button {
  font-family: inherit;
  font-size: 0.75rem;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid var(--wavy-border);
  background: var(--wavy-surface);
  color: var(--wavy-text);
  cursor: pointer;
}

.chat-link-actions button:first-child {
  background: var(--wavy-gold);
  border-color: var(--wavy-gold);
  color: var(--wavy-black);
  font-weight: 600;
}

.chat-fee-note {
  font-size: 0.75rem;
  color: var(--wavy-muted);
  margin-top: 6px;
}

@media (max-width: 600px) {
  .chat-shell { height: calc(100vh - var(--wavy-header-h) - 120px); min-height: 360px; }
  .chat-msg { max-width: 92%; }
}

/* Floating chat widget (homepage) */
.wavy-float-chat {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 500;
  font-family: var(--wavy-font);
}

.wavy-float-chat-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 18px;
  border: 1px solid var(--wavy-border-gold);
  border-radius: 999px;
  background: linear-gradient(135deg, var(--wavy-purple-dark), var(--wavy-purple));
  color: #fff;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--wavy-shadow-purple), 0 8px 32px rgba(0, 0, 0, 0.45);
  transition: transform 0.2s, box-shadow 0.2s;
}

.wavy-float-chat-toggle:hover {
  transform: translateY(-2px);
  box-shadow: var(--wavy-shadow-gold), 0 12px 40px rgba(0, 0, 0, 0.5);
}

.wavy-float-chat-toggle.is-open {
  display: none;
}

.wavy-float-chat-icon { font-size: 1.2rem; }

.wavy-float-chat-panel {
  position: absolute;
  bottom: 0;
  right: 0;
  width: min(380px, calc(100vw - 32px));
  height: min(520px, calc(100vh - 100px));
  display: none;
  flex-direction: column;
  background: var(--wavy-surface);
  border: 1px solid var(--wavy-border);
  border-radius: var(--wavy-radius-xl);
  box-shadow: var(--wavy-shadow-purple), 0 24px 64px rgba(0, 0, 0, 0.55);
  overflow: hidden;
  z-index: 2;
}

.wavy-float-chat-panel.is-visible,
.wavy-float-chat-panel:not([hidden]) {
  display: flex;
  animation: chatIn 0.25s var(--wavy-ease);
}

.wavy-float-chat-panel[hidden] {
  display: none !important;
}

.wavy-float-chat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.3), rgba(212, 175, 55, 0.1));
  border-bottom: 1px solid var(--wavy-border);
  flex-shrink: 0;
  position: relative;
  z-index: 2;
}

.wavy-float-chat-head strong {
  display: block;
  font-size: 0.9rem;
}

.wavy-float-chat-head span {
  font-size: 0.72rem;
  color: var(--wavy-muted);
}

.wavy-float-chat-close {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: var(--wavy-text);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
  position: relative;
  z-index: 3;
}

.wavy-float-chat-close:hover {
  background: rgba(255, 255, 255, 0.16);
}

.wavy-float-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.wavy-float-chat-quick {
  padding: 0 12px 8px;
}

.wavy-float-chat-form {
  padding: 0 12px 8px;
}

.wavy-float-chat-inputbar {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid var(--wavy-border-subtle);
  background: var(--wavy-surface2);
}

.wavy-float-chat-inputbar input {
  flex: 1;
  font-family: inherit;
  font-size: 0.85rem;
  padding: 10px 12px;
  border-radius: 999px;
  border: 1px solid var(--wavy-border);
  background: var(--wavy-surface);
  color: var(--wavy-text);
  outline: none;
}

.wavy-float-chat-expand {
  display: block;
  text-align: center;
  padding: 8px;
  font-size: 0.72rem;
  color: var(--wavy-gold);
  text-decoration: none;
  border-top: 1px solid var(--wavy-border-subtle);
}

.wavy-float-chat-expand:hover { text-decoration: underline; }

@media (max-width: 480px) {
  .wavy-float-chat { bottom: 16px; right: 16px; }
  .wavy-float-chat-label { display: none; }
  .wavy-float-chat-toggle { padding: 14px; border-radius: 50%; }
}
