/* Ava chat widget — Avia brand (navy #0d1b3e / blue #2563b0) */

.ava-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2563b0 0%, #1a3a6b 100%);
  color: #fff;
  border: none;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(13, 27, 62, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  z-index: 9998;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.ava-fab:hover {
  transform: translateY(-2px) scale(1.04);
  box-shadow: 0 12px 32px rgba(13, 27, 62, 0.45);
}
.ava-fab.ava-hidden {
  display: none;
}
.ava-fab .ava-fab-pulse {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: #2563b0;
  opacity: 0.45;
  animation: ava-pulse 2.2s ease-out infinite;
  pointer-events: none;
}
@keyframes ava-pulse {
  0%   { transform: scale(1);   opacity: 0.5; }
  100% { transform: scale(1.7); opacity: 0; }
}

.ava-panel {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 380px;
  max-width: calc(100vw - 32px);
  height: 560px;
  max-height: calc(100vh - 48px);
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 24px 60px rgba(13, 27, 62, 0.28);
  display: none;
  flex-direction: column;
  overflow: hidden;
  z-index: 9999;
  font-family: 'Poppins', system-ui, -apple-system, sans-serif;
  color: #1a3a6b;
}
.ava-panel.ava-open { display: flex; }

.ava-header {
  background: linear-gradient(135deg, #0d1b3e 0%, #1a3a6b 60%, #2563b0 100%);
  color: #fff;
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.ava-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255,255,255,0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.ava-header-text {
  flex: 1;
  min-width: 0;
  line-height: 1.15;
}
.ava-header-title {
  font-weight: 700;
  font-size: 15px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.ava-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #36d39a;
  box-shadow: 0 0 0 3px rgba(54, 211, 154, 0.25);
  display: inline-block;
}
.ava-header-sub {
  font-size: 12px;
  opacity: 0.82;
  margin-top: 2px;
}
.ava-close {
  background: none;
  border: none;
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  padding: 4px 8px;
  opacity: 0.85;
}
.ava-close:hover { opacity: 1; }

.ava-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px;
  background: #f7f9ff;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ava-msg {
  max-width: 86%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.55;
  word-wrap: break-word;
  white-space: pre-wrap;
}
.ava-msg.ava-msg-assistant {
  align-self: flex-start;
  background: #fff;
  color: #1a3a6b;
  border: 1px solid #e0e7ff;
  border-bottom-left-radius: 4px;
  white-space: normal;
}
/* Markdown elements inside assistant messages */
.ava-msg-assistant p { margin: 0 0 8px; }
.ava-msg-assistant p:last-child { margin-bottom: 0; }
.ava-msg-assistant strong { font-weight: 700; color: #0d1b3e; }
.ava-msg-assistant em { font-style: italic; }
.ava-msg-assistant ul,
.ava-msg-assistant ol {
  margin: 4px 0 8px;
  padding-left: 20px;
}
.ava-msg-assistant li { margin-bottom: 3px; }
.ava-msg-assistant li:last-child { margin-bottom: 0; }
.ava-msg-assistant code {
  background: #eef2fb;
  color: #1a3a6b;
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 12.5px;
  font-family: 'SFMono-Regular', Menlo, Consolas, monospace;
}
.ava-msg-assistant pre {
  background: #eef2fb;
  padding: 8px 10px;
  border-radius: 8px;
  overflow-x: auto;
  margin: 6px 0;
}
.ava-msg-assistant pre code {
  background: transparent;
  padding: 0;
}
.ava-msg-assistant a {
  color: #2563b0;
  text-decoration: underline;
  word-break: break-word;
}
.ava-msg-assistant a:hover { color: #0d1b3e; }
.ava-msg-assistant blockquote {
  border-left: 3px solid #c3d1ed;
  margin: 4px 0;
  padding: 2px 10px;
  color: #4a5568;
}
.ava-msg-assistant h1,
.ava-msg-assistant h2,
.ava-msg-assistant h3,
.ava-msg-assistant h4 {
  font-weight: 700;
  color: #0d1b3e;
  margin: 6px 0 4px;
  font-size: 14px;
  line-height: 1.35;
}
.ava-msg-assistant hr {
  border: none;
  border-top: 1px solid #e0e7ff;
  margin: 8px 0;
}
.ava-msg.ava-msg-user {
  align-self: flex-end;
  background: #2563b0;
  color: #fff;
  border-bottom-right-radius: 4px;
}
.ava-msg.ava-msg-error {
  align-self: center;
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fecaca;
  font-size: 13px;
}

.ava-typing {
  align-self: flex-start;
  background: #fff;
  border: 1px solid #e0e7ff;
  border-radius: 14px;
  border-bottom-left-radius: 4px;
  padding: 10px 14px;
  display: flex;
  gap: 4px;
}
.ava-typing span {
  width: 6px;
  height: 6px;
  background: #93a3c7;
  border-radius: 50%;
  animation: ava-blink 1.2s infinite;
}
.ava-typing span:nth-child(2) { animation-delay: 0.15s; }
.ava-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes ava-blink {
  0%, 60%, 100% { opacity: 0.25; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-3px); }
}

.ava-footer {
  flex-shrink: 0;
  padding: 10px 12px 14px;
  background: #fff;
  border-top: 1px solid #e2e8f0;
}
.ava-input-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}
.ava-input {
  flex: 1;
  resize: none;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.45;
  max-height: 120px;
  min-height: 44px;
  outline: none;
  color: #1a3a6b;
}
.ava-input:focus {
  border-color: #2563b0;
  box-shadow: 0 0 0 3px rgba(37, 99, 176, 0.15);
}
.ava-send {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #2563b0;
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ava-send:disabled {
  background: #cbd5e1;
  cursor: not-allowed;
}
.ava-footer-note {
  font-size: 10.5px;
  color: #93a3c7;
  text-align: center;
  margin-top: 6px;
}
.ava-footer-note a { color: #2563b0; text-decoration: underline; }

/* Consent overlay */
.ava-consent-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(13, 27, 62, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 2;
}
.ava-consent-card {
  background: #fff;
  border-radius: 14px;
  padding: 20px;
  max-width: 320px;
  text-align: center;
  color: #1a3a6b;
}
.ava-consent-card h3 {
  font-size: 16px;
  font-weight: 700;
  margin: 0 0 8px;
}
.ava-consent-card p {
  font-size: 13px;
  line-height: 1.55;
  color: #4a5568;
  margin: 0 0 14px;
}
.ava-consent-card .ava-turnstile {
  display: flex;
  justify-content: center;
  margin: 10px 0 14px;
  min-height: 65px;
}
.ava-btn-primary {
  background: #2563b0;
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 10px 16px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  width: 100%;
  margin-bottom: 8px;
}
.ava-btn-primary:disabled { opacity: 0.55; cursor: not-allowed; }
.ava-btn-ghost {
  background: transparent;
  color: #6b7280;
  border: none;
  font-size: 12px;
  cursor: pointer;
}

/* Mobile: full-screen panel below 576px */
@media (max-width: 575px) {
  .ava-panel {
    bottom: 0;
    right: 0;
    left: 0;
    width: 100%;
    max-width: 100%;
    height: 100%;
    max-height: 100%;
    border-radius: 0;
  }
  .ava-fab {
    bottom: 16px;
    right: 16px;
  }
}
