/* Shared Allyvo web AI widgets — homepage teaser + /ai/ chat */

.allyvo-chat-widget {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  border-radius: 1.25rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(12px);
  padding: 1rem;
}

.allyvo-chat-widget--page {
  border-color: rgba(20, 21, 26, 0.08);
  background: #fff;
  box-shadow: 0 8px 32px rgba(20, 21, 26, 0.06);
  min-height: min(72vh, 640px);
}

.allyvo-chat-messages {
  flex: 1;
  min-height: 200px;
  max-height: 360px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 0.25rem;
}

.allyvo-chat-widget--page .allyvo-chat-messages {
  max-height: none;
  min-height: 280px;
}

.allyvo-chat-empty {
  margin: auto;
  max-width: 18rem;
  text-align: center;
  font-size: 0.9375rem;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.65);
}

.allyvo-chat-widget--page .allyvo-chat-empty {
  color: #5c6070;
}

.allyvo-msg {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  max-width: 92%;
}

.allyvo-msg--user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.allyvo-msg--assistant {
  align-self: flex-start;
}

.allyvo-msg-avatar {
  flex-shrink: 0;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 9999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  background: linear-gradient(135deg, #5978fa, #8c5cf5);
  color: #fff;
}

.allyvo-msg-bubble {
  border-radius: 1rem;
  padding: 0.625rem 0.875rem;
  font-size: 0.875rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

.allyvo-msg--assistant .allyvo-msg-bubble {
  background: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.92);
}

.allyvo-chat-widget--page .allyvo-msg--assistant .allyvo-msg-bubble {
  background: #fff5f0;
  color: #14151a;
}

.allyvo-msg--user .allyvo-msg-bubble {
  background: linear-gradient(135deg, #5978fa, #8c5cf5);
  color: #fff;
}

.allyvo-chat-quota {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.55);
}

.allyvo-chat-widget--page .allyvo-chat-quota {
  color: #9498a8;
}

.allyvo-chat-quota--low {
  color: #f9c862 !important;
}

.allyvo-chat-quota--out {
  color: #f87171 !important;
}

.allyvo-chat-compose {
  display: flex;
  gap: 0.5rem;
  align-items: flex-end;
}

.allyvo-chat-compose textarea {
  flex: 1;
  min-height: 2.75rem;
  max-height: 8rem;
  resize: vertical;
  border-radius: 0.875rem;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(0, 0, 0, 0.2);
  color: #fff;
  padding: 0.625rem 0.875rem;
  font: inherit;
  font-size: 0.875rem;
}

.allyvo-chat-widget--page .allyvo-chat-compose textarea {
  border-color: rgba(20, 21, 26, 0.1);
  background: #f7f6f3;
  color: #14151a;
}

.allyvo-chat-compose textarea:focus {
  outline: 2px solid rgba(89, 120, 250, 0.45);
  outline-offset: 1px;
}

.allyvo-chat-compose textarea:disabled {
  opacity: 0.55;
}

.allyvo-chat-actions {
  display: flex;
  justify-content: center;
}

.allyvo-chat-toolbar {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
}

.allyvo-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.5rem;
  border-radius: 9999px;
  padding: 0 1rem;
  font-size: 0.8125rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.15s ease, opacity 0.15s ease;
}

.allyvo-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.allyvo-btn--primary {
  background: linear-gradient(135deg, #5978fa, #8c5cf5);
  color: #fff;
}

.allyvo-btn--ghost {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.allyvo-chat-widget--page .allyvo-btn--ghost {
  background: rgba(89, 120, 250, 0.1);
  color: #5978fa;
}

.allyvo-btn--pulse {
  animation: allyvo-pulse 1.4s ease infinite;
}

@keyframes allyvo-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(89, 120, 250, 0.35); }
  50% { box-shadow: 0 0 0 8px rgba(89, 120, 250, 0); }
}

.allyvo-link-btn {
  background: none;
  border: none;
  padding: 0;
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.65);
  cursor: pointer;
  text-decoration: underline;
}

.allyvo-chat-widget--page .allyvo-link-btn {
  color: #5978fa;
}

.allyvo-toast {
  position: absolute;
  left: 50%;
  bottom: 0.5rem;
  transform: translate(-50%, 12px);
  max-width: 90%;
  padding: 0.5rem 0.875rem;
  border-radius: 0.75rem;
  background: rgba(20, 21, 26, 0.92);
  color: #fff;
  font-size: 0.75rem;
  opacity: 0;
  transition: opacity 0.25s ease, transform 0.25s ease;
  pointer-events: none;
  z-index: 5;
}

.allyvo-toast--visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.allyvo-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(20, 21, 26, 0.55);
  backdrop-filter: blur(4px);
}

.allyvo-modal {
  position: relative;
  width: min(100%, 24rem);
  border-radius: 1.25rem;
  background: #fff;
  padding: 1.5rem;
  box-shadow: 0 24px 48px rgba(20, 21, 26, 0.18);
}

.allyvo-modal-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  width: 2rem;
  height: 2rem;
  border: none;
  border-radius: 9999px;
  background: #f7f6f3;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
}

.allyvo-modal-title {
  font-family: Fraunces, Georgia, serif;
  font-size: 1.25rem;
  font-weight: 600;
}

.allyvo-modal-sub {
  margin-top: 0.375rem;
  font-size: 0.875rem;
  color: #5c6070;
}

.allyvo-modal-form {
  margin-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.allyvo-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: #5c6070;
}

.allyvo-field input {
  border-radius: 0.75rem;
  border: 1px solid rgba(20, 21, 26, 0.12);
  padding: 0.625rem 0.75rem;
  font: inherit;
}

.allyvo-modal-error {
  font-size: 0.8125rem;
  color: #dc2626;
}

.allyvo-modal-foot {
  margin-top: 1rem;
  font-size: 0.8125rem;
  color: #5c6070;
  text-align: center;
}

.allyvo-modal-foot a {
  color: #5978fa;
  font-weight: 600;
}

.companion-teaser-wrap {
  position: relative;
}

.companion-teaser-head {
  margin-bottom: 0.75rem;
}

.companion-teaser-head h3 {
  font-family: Fraunces, Georgia, serif;
  font-size: 1.125rem;
  font-weight: 600;
}

.companion-teaser-head p {
  margin-top: 0.25rem;
  font-size: 0.8125rem;
  color: rgba(255, 255, 255, 0.6);
}

.ai-consent-banner {
  border-radius: 1rem;
  border: 1px solid rgba(89, 120, 250, 0.2);
  background: rgba(89, 120, 250, 0.06);
  padding: 1rem;
  font-size: 0.8125rem;
  color: #5c6070;
}

.ai-consent-banner a {
  color: #5978fa;
  font-weight: 600;
}

.ai-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.ai-mode-toggle {
  display: inline-flex;
  border-radius: 9999px;
  border: 1px solid rgba(20, 21, 26, 0.1);
  overflow: hidden;
}

.ai-mode-toggle button {
  border: none;
  background: transparent;
  padding: 0.375rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: #5c6070;
  cursor: pointer;
}

.ai-mode-toggle button.is-active {
  background: #5978fa;
  color: #fff;
}

.ai-model-select {
  border-radius: 9999px;
  border: 1px solid rgba(20, 21, 26, 0.1);
  background: #fff;
  padding: 0.375rem 0.75rem;
  font-size: 0.75rem;
  max-width: 12rem;
}

.allyvo-chat-login-gate {
  margin: auto;
  max-width: 20rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 0.5rem;
}

.allyvo-chat-login-title {
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.45;
}

.allyvo-chat-login-hint {
  font-size: 0.8125rem;
  line-height: 1.5;
  opacity: 0.75;
}

.allyvo-chat-widget--page .allyvo-chat-login-title {
  color: #14151a;
}

.allyvo-chat-widget--page .allyvo-chat-login-hint {
  color: #5c6070;
}

.allyvo-chat-widget:not(.allyvo-chat-widget--page) .allyvo-chat-login-title,
.allyvo-chat-widget:not(.allyvo-chat-widget--page) .allyvo-chat-login-hint {
  color: rgba(255, 255, 255, 0.85);
}
