.ccai-widget {
  --ccai-navy: #25233a;
  --ccai-blue: #5ba8d9;
  --ccai-blue-dark: #4b97c7;
  --ccai-text: #2f789c;
  --ccai-soft: #f6fafd;
  --ccai-line: #d9eaf5;
  position: fixed;
  right: 20px;
  bottom: 24px;
  z-index: 99999;
  font-family: Manrope, Arial, sans-serif;
}

.ccai-panel {
  position: absolute;
  right: 0;
  bottom: 82px;
  width: min(320px, calc(100vw - 36px));
  height: min(560px, calc(100vh - 116px));
  overflow: hidden;
  border-radius: 24px;
  background: #fff;
  box-shadow: 0 18px 48px rgba(20, 42, 42, 0.22);
  opacity: 0;
  pointer-events: none;
  transform: translateY(16px) scale(0.96);
  transform-origin: right bottom;
  transition: opacity 0.22s ease, transform 0.22s ease;
}

.ccai-widget.is-open .ccai-panel {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.ccai-header {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 16px;
  color: #fff;
  background: var(--ccai-navy);
}

.ccai-avatar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(91, 168, 217, 0.28);
}

.ccai-avatar::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 2px;
  width: 10px;
  height: 10px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: var(--ccai-blue);
}

.ccai-avatar svg,
.ccai-whatsapp svg,
.ccai-launcher svg {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ccai-avatar svg {
  width: 23px;
  height: 23px;
  stroke-width: 1.9;
}

.ccai-heading strong,
.ccai-heading span {
  display: block;
}

.ccai-heading strong {
  font-size: 14px;
  font-weight: 800;
  line-height: 1.2;
}

.ccai-heading span {
  position: relative;
  margin-top: 4px;
  padding-left: 12px;
  font-size: 11px;
  line-height: 1.35;
}

.ccai-heading span::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ccai-blue);
}

.ccai-close {
  position: relative;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.22);
  cursor: pointer;
}

.ccai-close span,
.ccai-close span::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 15px;
  height: 2px;
  border-radius: 999px;
  background: #fff;
}

.ccai-close span {
  transform: translate(-50%, -50%) rotate(45deg);
}

.ccai-close span::after {
  transform: translate(-50%, -50%) rotate(90deg);
}

.ccai-body {
  display: flex;
  flex-direction: column;
  height: calc(100% - 70px);
  padding: 12px 14px 14px;
}

.ccai-messages {
  flex: 1;
  overflow-y: auto;
  padding-right: 2px;
}

.ccai-message {
  max-width: 92%;
  margin-bottom: 9px;
  padding: 10px 12px;
  border-radius: 14px;
  font-size: 12px;
  line-height: 1.45;
}

.ccai-message p {
  margin: 0;
  font-size: inherit;
  line-height: inherit;
}

.ccai-message small {
  display: block;
  margin-top: 6px;
  color: #8090a2;
  font-size: 10px;
  font-weight: 700;
}

.ccai-message__links {
  display: grid;
  gap: 6px;
  margin-top: 9px;
}

.ccai-message__link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 34px;
  padding: 7px 10px;
  border: 1px solid #dceaf5;
  border-radius: 10px;
  color: #2f789c !important;
  background: #fff;
  font-size: 10px;
  font-weight: 800;
  line-height: 1.3;
  text-decoration: none;
}

.ccai-message__link:hover {
  background: #eef7fd;
}

.ccai-message--assistant {
  border: 1px solid var(--ccai-line);
  background: var(--ccai-soft);
  color: #3b3b3b;
}

.ccai-message--user {
  margin-left: auto;
  color: #fff;
  background: var(--ccai-blue);
}

.ccai-product {
  display: grid;
  grid-template-columns: 46px 1fr;
  gap: 9px;
  align-items: center;
  margin-top: 8px;
  padding: 7px;
  border: 1px solid var(--ccai-line);
  border-radius: 12px;
  color: #1f2937;
  background: #fff;
}

.ccai-product img {
  width: 46px;
  height: 46px;
  object-fit: cover;
  border-radius: 9px;
  background: #e2e2e2;
}

.ccai-product strong,
.ccai-product span {
  display: block;
}

.ccai-product strong {
  font-size: 11px;
  line-height: 1.25;
}

.ccai-product span {
  margin-top: 3px;
  color: #5f6b7a;
  font-size: 10px;
}

.ccai-actions {
  display: grid;
  gap: 7px;
  margin: 10px 0;
}

.ccai-actions button {
  display: grid;
  grid-template-columns: 22px 1fr;
  align-items: center;
  gap: 10px;
  min-height: 38px;
  padding: 6px 11px;
  border: 1px solid var(--ccai-line);
  border-radius: 13px;
  color: var(--ccai-text);
  background: var(--ccai-soft);
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  text-align: left;
}

.ccai-actions svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ccai-input {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 7px;
  margin-bottom: 9px;
}

.ccai-input input {
  min-width: 0;
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--ccai-line);
  border-radius: 13px;
  font: inherit;
  font-size: 12px;
  outline: none;
}

.ccai-input button,
.ccai-whatsapp {
  border: 0;
  border-radius: 13px;
  color: #fff !important;
  background: var(--ccai-blue);
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.ccai-input button {
  height: 38px;
  padding: 0 12px;
}

.ccai-whatsapp {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  height: 44px;
  text-decoration: none;
}

.ccai-whatsapp:hover,
.ccai-input button:hover {
  background: var(--ccai-blue-dark);
}

.ccai-whatsapp svg {
  width: 20px;
  height: 20px;
  stroke-width: 1.9;
}

.ccai-hours {
  margin-top: 8px;
  color: #aeb7c5;
  font-size: 10px;
  font-weight: 700;
  text-align: center;
}

.ccai-launcher {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  margin-left: auto;
  border: 0;
  border-radius: 50%;
  color: #fff;
  background: var(--ccai-blue);
  box-shadow: 0 18px 36px rgba(75, 151, 199, 0.3);
  cursor: pointer;
  isolation: isolate;
}

.ccai-launcher::before,
.ccai-launcher::after {
  content: "";
  position: absolute;
  inset: -26px;
  z-index: -1;
  border-radius: 50%;
  background: rgba(91, 168, 217, 0.18);
  animation: ccai-pulse 2.6s ease-out infinite;
}

.ccai-launcher::after {
  inset: -44px;
  animation-delay: 0.6s;
}

.ccai-launcher svg {
  position: relative;
  z-index: 1;
  width: 24px;
  height: 24px;
  stroke-width: 1.8;
  opacity: 1;
  visibility: visible;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.ccai-launcher__close,
.ccai-launcher__close::after {
  content: "";
  position: absolute;
  width: 28px;
  height: 2px;
  border-radius: 999px;
  background: #fff;
  opacity: 0;
  transition: opacity 0.18s ease;
}

.ccai-launcher__close {
  z-index: 2;
  transform: rotate(45deg);
}

.ccai-launcher__close::after {
  left: 0;
  opacity: 1;
  transform: rotate(90deg);
}

.ccai-widget:not(.is-open) .ccai-launcher__chat {
  opacity: 1;
  visibility: visible;
  transform: scale(1);
}

.ccai-widget.is-open .ccai-launcher__chat {
  opacity: 0;
  visibility: hidden;
  transform: scale(0.8);
}

.ccai-widget.is-open .ccai-launcher__close {
  opacity: 1;
}

@keyframes ccai-pulse {
  0% {
    opacity: 0.95;
    transform: scale(0.62);
  }

  70% {
    opacity: 0.1;
    transform: scale(0.8);
  }

  100% {
    opacity: 0;
    transform: scale(1);
  }
}

@media (max-width: 480px) {
  .ccai-widget {
    right: 18px;
    bottom: 22px;
  }

  .ccai-panel {
    bottom: 76px;
  }

  .ccai-launcher {
    width: 72px;
    height: 72px;
  }
}

/* Premium menu experience */
.ccai-panel {
  width: min(380px, calc(100vw - 28px));
  height: min(650px, calc(100vh - 104px));
  border: 1px solid rgba(37, 35, 58, 0.08);
  border-radius: 22px;
  box-shadow: 0 24px 70px rgba(37, 35, 58, 0.2);
}

.ccai-header {
  min-height: 74px;
  padding: 16px 18px;
}

.ccai-heading strong {
  font-size: 15px;
}

.ccai-heading span {
  color: rgba(255, 255, 255, 0.82);
}

.ccai-heading span::before,
.ccai-avatar::after {
  background: #27ae60;
}

.ccai-body {
  height: calc(100% - 74px);
  padding: 0;
  background: #fff;
}

.ccai-content {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 18px;
  scroll-behavior: smooth;
}

.ccai-welcome {
  margin-bottom: 16px;
  color: #25233a;
}

.ccai-welcome strong {
  display: block;
  font-size: 19px;
  font-weight: 800;
  line-height: 1.25;
}

.ccai-welcome p {
  margin: 7px 0 0;
  color: #5f6470;
  font-size: 12px;
  line-height: 1.55;
}

.ccai-menu {
  display: none;
  gap: 10px;
}

.ccai-menu.is-active {
  display: grid;
  animation: ccai-menu-in 0.24s ease both;
}

.ccai-card {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  gap: 11px;
  align-items: center;
  width: 100%;
  min-height: 62px;
  padding: 10px 12px;
  border: 1px solid #dceaf5;
  border-radius: 16px;
  color: #25233a;
  background: #f8fbfd;
  cursor: pointer;
  font: inherit;
  text-align: left;
  transition: transform 0.22s ease, box-shadow 0.22s ease, background 0.22s ease;
}

.ccai-card--large {
  min-height: 94px;
  padding: 14px;
}

.ccai-card:hover,
.ccai-card:focus-visible {
  background: #eef7fd;
  box-shadow: 0 10px 24px rgba(62, 119, 154, 0.13);
  outline: none;
  transform: translateY(-4px);
}

.ccai-card__icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #eaf5fb;
  font-size: 20px;
}

.ccai-card__copy {
  min-width: 0;
}

.ccai-card__copy strong,
.ccai-card__copy small,
.ccai-card__copy em {
  display: block;
}

.ccai-card__copy strong {
  font-size: 13px;
  font-weight: 800;
  line-height: 1.3;
}

.ccai-card__copy small {
  margin-top: 4px;
  color: #5f6470;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.4;
}

.ccai-card__copy em {
  margin-top: 8px;
  color: #438dbb;
  font-size: 10px;
  font-style: normal;
  font-weight: 800;
}

.ccai-card__copy em span,
.ccai-card__arrow {
  display: inline-block;
  transition: transform 0.2s ease;
}

.ccai-card:hover .ccai-card__copy em span,
.ccai-card:hover .ccai-card__arrow {
  transform: translateX(4px);
}

.ccai-card__arrow {
  color: #5ba8d9;
  font-size: 18px;
}

.ccai-back {
  justify-self: start;
  padding: 7px 4px;
  border: 0;
  color: #5f6470;
  background: transparent;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 800;
}

.ccai-back:hover {
  color: #25233a;
}

.ccai-messages {
  overflow: visible;
  padding: 0;
}

.ccai-messages:not(:empty) {
  margin-top: 16px;
}

.ccai-message {
  max-width: 88%;
  padding: 11px 13px;
  border-radius: 16px 16px 16px 5px;
  color: #25233a;
  font-size: 12px;
}

.ccai-message--user {
  border-radius: 16px 16px 5px 16px;
  background: #5ba8d9;
}

.ccai-footer {
  flex: none;
  padding: 11px 14px 13px;
  border-top: 1px solid #edf2f6;
  background: #fff;
  box-shadow: 0 -8px 20px rgba(37, 35, 58, 0.035);
}

.ccai-restart {
  display: block;
  margin: 0 auto 8px;
  padding: 2px 8px;
  border: 0;
  color: #5f6470;
  background: transparent;
  cursor: pointer;
  font: inherit;
  font-size: 10px;
  font-weight: 800;
}

.ccai-restart:hover,
.ccai-restart:focus-visible {
  color: #2f789c;
  outline: none;
  text-decoration: underline;
}

.ccai-input[hidden] {
  display: none;
}

.ccai-input {
  margin-bottom: 9px;
}

.ccai-input input {
  height: 42px;
  border-radius: 14px;
  color: #25233a;
}

.ccai-input input:focus {
  border-color: #5ba8d9;
  box-shadow: 0 0 0 3px rgba(91, 168, 217, 0.13);
}

.ccai-input button {
  width: 42px;
  height: 42px;
  padding: 0;
  border-radius: 14px;
  font-size: 18px;
}

.ccai-whatsapp {
  height: 45px;
  border-radius: 14px;
}

.ccai-hours {
  margin-top: 6px;
  color: #7c8390;
  font-weight: 600;
}

@keyframes ccai-menu-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 480px) {
  .ccai-panel {
    right: -4px;
    bottom: 72px;
    height: min(640px, calc(100vh - 98px));
  }

  .ccai-launcher {
    width: 58px;
    height: 58px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ccai-menu.is-active,
  .ccai-card,
  .ccai-card__arrow,
  .ccai-card__copy em span {
    animation: none;
    transition: none;
  }
}
