.ai-agent {
  position: fixed;
  right: 84px;
  bottom: 18px;
  z-index: 30;
  width: 56px;
  color: #101820;
  font-family: inherit;
}

.ai-agent.is-open {
  width: min(560px, calc(100vw - 180px));
}

.ai-agent-panel {
  position: absolute;
  right: 0;
  bottom: 74px;
  width: min(430px, calc(100vw - 28px));
  height: min(560px, calc(100vh - 130px));
  overflow: hidden;
  border: 1px solid rgba(16, 24, 32, 0.1);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 28px 80px rgba(16, 24, 32, 0.24);
  backdrop-filter: blur(18px);
}

.ai-agent-panel[hidden] {
  display: none;
}

.ai-agent-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 70px;
  padding: 14px 16px 14px 18px;
  border-bottom: 1px solid rgba(16, 24, 32, 0.08);
}

.ai-agent-identity {
  display: flex;
  align-items: center;
  gap: 11px;
}

.ai-agent-identity strong,
.ai-agent-identity span {
  display: block;
}

.ai-agent-identity strong {
  font-size: 0.98rem;
}

.ai-agent-identity span {
  color: #66717a;
  font-size: 0.78rem;
}

.ai-agent-header-actions {
  display: flex;
  gap: 6px;
}

.ai-agent-icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: #39434b;
  background: #eef2f3;
  cursor: pointer;
}

.ai-agent-icon-button:hover {
  color: #fff;
  background: #008b83;
}

.ai-agent-icon-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.ai-agent-messages {
  height: calc(100% - 104px);
  overflow-y: auto;
  padding: 18px 16px 28px;
  scroll-behavior: smooth;
}

.ai-agent-message {
  display: flex;
  margin: 0 0 10px;
}

.ai-agent-message--user {
  justify-content: flex-end;
}

.ai-agent-bubble {
  max-width: 86%;
  padding: 12px 14px;
  border-radius: 17px 17px 17px 5px;
  color: #253039;
  background: #eef3f4;
  font-size: 0.92rem;
  line-height: 1.48;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.ai-agent-message--user .ai-agent-bubble {
  border-radius: 17px 17px 5px;
  color: #fff;
  background: #101820;
}

.ai-agent-bubble a {
  color: #007b74;
  font-weight: 750;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.ai-agent-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 5px 0 16px;
}

.ai-agent-suggestions button {
  padding: 9px 12px;
  border: 1px solid rgba(0, 139, 131, 0.28);
  border-radius: 999px;
  color: #006f69;
  background: #f2fbfa;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 800;
  cursor: pointer;
}

.ai-agent-suggestions button:hover {
  color: #fff;
  background: #008b83;
}

.ai-agent-form {
  display: none;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px;
  min-height: 62px;
  padding: 8px 9px 8px 12px;
  border: 1px solid rgba(16, 24, 32, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 16px 44px rgba(16, 24, 32, 0.19);
  backdrop-filter: blur(20px);
}

.ai-agent.is-open .ai-agent-form {
  display: grid;
}

.ai-agent-launch {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  padding: 0;
  border: 1px solid rgba(16, 24, 32, 0.1);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 12px 30px rgba(16, 24, 32, 0.18);
  cursor: pointer;
  backdrop-filter: blur(16px);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.ai-agent-launch:hover,
.ai-agent-launch:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 16px 36px rgba(16, 24, 32, 0.24);
}

.ai-agent.is-open .ai-agent-launch {
  display: none;
}

.ai-agent-launch .ai-agent-orb {
  width: 31px;
  height: 31px;
}

.ai-agent-hint {
  position: absolute;
  right: 66px;
  bottom: 8px;
  width: max-content;
  max-width: 190px;
  margin: 0;
  padding: 10px 14px 10px 39px;
  border: 1px solid transparent;
  border-radius: 18px;
  color: #2d383f;
  background:
    linear-gradient(rgba(255, 255, 255, 0.97), rgba(255, 255, 255, 0.97)) padding-box,
    linear-gradient(120deg, rgba(0, 139, 131, 0.7), rgba(0, 187, 168, 0.38), rgba(255, 179, 89, 0.72)) border-box;
  box-shadow: 0 12px 30px rgba(16, 24, 32, 0.16), 0 0 24px rgba(0, 187, 168, 0.08);
  font-size: 0.8rem;
  font-weight: 800;
  line-height: 1.2;
  opacity: 0;
  pointer-events: none;
  transform: translateX(8px) scale(0.96);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.ai-agent-hint::before {
  position: absolute;
  top: 50%;
  left: 13px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 34% 28%, #e6fffb 0 8%, transparent 30%),
    conic-gradient(from 40deg, #00bba8, #008b83, #ffb359, #00bba8);
  box-shadow: 0 0 0 4px rgba(0, 139, 131, 0.08), 0 0 14px rgba(0, 187, 168, 0.3);
  content: "";
  transform: translateY(-50%);
}

.ai-agent.is-noticing .ai-agent-hint,
.ai-agent:has(.ai-agent-launch:hover) .ai-agent-hint,
.ai-agent:has(.ai-agent-launch:focus-visible) .ai-agent-hint {
  opacity: 1;
  transform: translateX(0) scale(1);
}

.ai-agent.is-noticing .ai-agent-hint {
  animation: aiHintBubble 2.4s ease-in-out 1;
}

.ai-agent.is-noticing .ai-agent-hint::before,
.ai-agent:has(.ai-agent-launch:hover) .ai-agent-hint::before,
.ai-agent:has(.ai-agent-launch:focus-visible) .ai-agent-hint::before {
  animation: aiHintOrb 2.8s ease-in-out infinite;
}

.ai-agent.is-open .ai-agent-hint {
  display: none;
}

.ai-agent-input {
  min-width: 0;
  height: 44px;
  padding: 0 4px;
  border: 0;
  outline: 0;
  color: #101820;
  background: transparent;
  font: inherit;
  font-size: 0.92rem;
}

.ai-agent-input::placeholder {
  color: #737d84;
}

.ai-agent-orb,
.ai-agent-thinking {
  position: relative;
  display: inline-block;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 28%, #d7fff9 0 6%, transparent 24%),
    linear-gradient(145deg, #00bba8, #008b83 46%, #ffb359 100%);
  box-shadow: 0 0 0 5px rgba(0, 139, 131, 0.08), 0 7px 18px rgba(0, 139, 131, 0.22);
}

.ai-agent-thinking {
  width: 25px;
  height: 25px;
  margin: 9px 8px 0 0;
  animation: aiThinking 1.4s ease-in-out infinite;
}

.ai-agent-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: #fff;
  background: #101820;
  cursor: pointer;
}

.ai-agent-action:disabled {
  color: #8e979d;
  background: #e8edef;
  cursor: default;
}

.ai-agent-action svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.ai-agent-voice {
  color: #48535b;
  background: transparent;
}

.ai-agent-voice.is-recording {
  color: #fff;
  background: #dc3e52;
  animation: aiVoice 1s ease-in-out infinite;
}

.ai-agent-status {
  position: absolute;
  right: 18px;
  bottom: calc(100% + 17px);
  z-index: 2;
  color: #6c767d;
  font-size: 0.75rem;
  pointer-events: none;
}

.ai-agent.is-open .ai-agent-status {
  right: 22px;
  bottom: calc(100% + 86px);
}

.ai-agent.is-noticing .ai-agent-launch {
  animation: aiNotice 2.2s ease-in-out 1;
}

.ai-agent.is-noticing .ai-agent-launch .ai-agent-orb {
  animation: aiOrbNotice 2.2s ease-in-out 1;
}

@keyframes aiNotice {
  0%, 100% { box-shadow: 0 12px 30px rgba(16, 24, 32, 0.18); }
  35% { box-shadow: 0 12px 30px rgba(16, 24, 32, 0.18), 0 0 0 9px rgba(0, 139, 131, 0.12); }
}

@keyframes aiOrbNotice {
  0%, 100% { transform: rotate(0deg) scale(1); }
  35% { transform: rotate(10deg) scale(1.08); }
}

@keyframes aiHintBubble {
  0%, 100% { transform: translateX(0) translateY(0) scale(1); }
  38% { transform: translateX(-3px) translateY(-2px) scale(1.025); }
}

@keyframes aiHintOrb {
  0%, 100% { transform: translateY(-50%) rotate(0deg) scale(1); filter: hue-rotate(0deg); }
  50% { transform: translateY(-50%) rotate(18deg) scale(1.12); filter: hue-rotate(16deg); }
}

@keyframes aiThinking {
  50% { transform: scale(1.08); filter: hue-rotate(16deg); }
}

@keyframes aiVoice {
  50% { box-shadow: 0 0 0 7px rgba(220, 62, 82, 0.18); }
}

@media (max-width: 720px) {
  .ai-agent {
    right: 72px;
    bottom: 10px;
    width: 54px;
  }

  .ai-agent.is-open {
    left: 10px;
    right: 72px;
    width: auto;
  }

  .ai-agent-panel {
    position: fixed;
    inset: 10px 10px 82px;
    width: auto;
    height: auto;
    border-radius: 20px;
  }

  .ai-agent-form {
    grid-template-columns: auto minmax(0, 1fr) auto auto;
    min-height: 56px;
    padding: 6px 7px 6px 10px;
  }

  .ai-agent-launch {
    width: 54px;
    height: 54px;
  }

  .ai-agent-orb {
    width: 30px;
    height: 30px;
  }

  .ai-agent-action {
    width: 38px;
    height: 38px;
  }

  .ai-agent-input {
    font-size: 0.84rem;
  }

  .whatsapp-float {
    right: 10px;
    bottom: 10px;
    width: 54px;
    height: 54px;
  }
}

@media (max-width: 430px) {
  .ai-agent {
    right: 70px;
    width: 54px;
  }

  .ai-agent.is-open {
    left: 10px;
    right: 70px;
    width: auto;
  }

  .ai-agent-form > .ai-agent-orb {
    display: none;
  }

  .ai-agent-form {
    grid-template-columns: minmax(0, 1fr) auto auto;
  }

  .ai-agent-hint {
    max-width: 150px;
    border-radius: 16px;
    line-height: 1.3;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ai-agent-orb,
  .ai-agent-thinking,
  .ai-agent-voice.is-recording,
  .ai-agent.is-noticing .ai-agent-launch,
  .ai-agent.is-noticing .ai-agent-launch .ai-agent-orb,
  .ai-agent.is-noticing .ai-agent-hint,
  .ai-agent.is-noticing .ai-agent-hint::before,
  .ai-agent:has(.ai-agent-launch:hover) .ai-agent-hint::before,
  .ai-agent:has(.ai-agent-launch:focus-visible) .ai-agent-hint::before {
    animation: none;
  }

  .ai-agent-hint {
    transition: none;
  }
}
