/* Anaya — Cubaroo chat assistant */
.anaya-root {
  --anaya-teal: #2e86ab;
  --anaya-teal-dark: #1a5f8a;
  --anaya-teal-light: #44a8c9;
  --anaya-shadow: 0 8px 32px rgba(15, 23, 42, 0.18);
  position: fixed;
  bottom: calc(1.25rem + env(safe-area-inset-bottom, 0px));
  right: calc(1.25rem + env(safe-area-inset-right, 0px));
  z-index: 480;
  font-family: Inter, system-ui, sans-serif;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.75rem;
}

.anaya-root.is-open {
  z-index: 530;
}

body.cn-menu-open .anaya-root {
  visibility: hidden;
  pointer-events: none;
}

.anaya-panel[hidden] {
  display: none !important;
}

.anaya-quick-replies {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  width: 100%;
}

.anaya-quick-reply {
  background: #fff;
  border: 1px solid rgba(15, 118, 110, 0.25);
  color: var(--anaya-teal);
  border-radius: 999px;
  padding: 0.55rem 0.9rem;
  font-size: 0.82rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
}

.anaya-quick-reply:hover {
  background: #f0fdfa;
  border-color: var(--anaya-teal);
}

.anaya-launcher {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--anaya-teal-light), var(--anaya-teal));
  border: none;
  cursor: pointer;
  box-shadow: var(--anaya-shadow);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: transform 0.15s;
  flex-shrink: 0;
}

.anaya-launcher:hover {
  transform: scale(1.04);
}

.anaya-launcher svg {
  width: 28px;
  height: 28px;
  fill: #fff;
}

.anaya-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  background: #ef4444;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #fff;
}

.anaya-panel {
  width: min(380px, calc(100vw - 2rem));
  height: min(560px, calc(100vh - 6rem));
  background: #fff;
  border-radius: 18px;
  box-shadow: var(--anaya-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(15, 118, 110, 0.12);
  animation: anaya-slide-up 0.3s ease;
}

.anaya-panel__header {
  background: linear-gradient(135deg, var(--anaya-teal), var(--anaya-teal-dark));
  color: #fff;
  padding: 0.85rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-shrink: 0;
}

.anaya-panel__header img {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #fff;
  padding: 2px;
}

.anaya-panel__header h2 {
  font-size: 0.95rem;
  font-weight: 600;
  margin: 0;
  flex: 1;
}

.anaya-panel__header p {
  font-size: 0.72rem;
  opacity: 0.9;
  margin: 0;
}

.anaya-panel__close {
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
}

.anaya-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  background: #f8fafc;
  min-height: 0;
}

.anaya-msg {
  max-width: 88%;
  padding: 0.65rem 0.85rem;
  border-radius: 14px;
  font-size: 0.875rem;
  line-height: 1.45;
  color: #1e293b;
}

.anaya-msg--assistant {
  align-self: flex-start;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-bottom-left-radius: 4px;
}

.anaya-msg--user {
  align-self: flex-end;
  background: var(--anaya-teal);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.anaya-msg strong {
  font-weight: 600;
}

.anaya-typing {
  align-self: flex-start;
  display: flex;
  gap: 4px;
  padding: 0.65rem 0.85rem;
  background: #fff;
  border-radius: 14px;
  border: 1px solid #e2e8f0;
}

.anaya-typing span {
  width: 6px;
  height: 6px;
  background: #94a3b8;
  border-radius: 50%;
  animation: anaya-bounce 1.2s infinite;
}

.anaya-typing span:nth-child(2) { animation-delay: 0.15s; }
.anaya-typing span:nth-child(3) { animation-delay: 0.3s; }

.anaya-panel__quick {
  padding: 0.5rem 0.75rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  border-top: 1px solid #e2e8f0;
  background: #fff;
  flex-shrink: 0;
  max-height: 120px;
  overflow-y: auto;
}

.anaya-panel__quick .anaya-quick-reply {
  font-size: 0.78rem;
  padding: 0.4rem 0.75rem;
}

.anaya-panel__input {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem;
  padding-bottom: calc(0.75rem + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid #e2e8f0;
  background: #fff;
  flex-shrink: 0;
}

.anaya-panel__input input {
  flex: 1;
  min-width: 0;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  padding: 0.55rem 0.9rem;
  font-size: 0.875rem;
  outline: none;
}

.anaya-panel__input input:focus {
  border-color: var(--anaya-teal);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.15);
}

.anaya-panel__send {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: var(--anaya-teal);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.anaya-panel__send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

@keyframes anaya-slide-up {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes anaya-bounce {
  0%, 80%, 100% { transform: translateY(0); }
  40% { transform: translateY(-4px); }
}

@media (max-width: 920px) {
  .anaya-root {
    bottom: calc(0.85rem + env(safe-area-inset-bottom, 0px));
    right: calc(0.85rem + env(safe-area-inset-right, 0px));
  }

  .anaya-root.is-open {
    inset: 0;
    bottom: 0;
    right: 0;
    left: 0;
    top: auto;
    padding: 0;
    align-items: stretch;
  }

  .anaya-panel {
    width: 100%;
    height: min(78dvh, 640px);
    max-height: calc(100dvh - env(safe-area-inset-top, 0px));
    border-radius: 18px 18px 0 0;
    margin-top: auto;
  }

  .anaya-launcher {
    width: 52px;
    height: 52px;
  }
}
