.ai-composer {
  position: relative;
  flex-shrink: 0;
  z-index: 120;
}

.composer {
  z-index: 90;
}

.ai-composer-trigger {
  width: 40px;
  min-width: 40px;
  height: 40px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: var(--bubble-ai-text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  font: inherit;
  cursor: pointer;
  transition:
    border-color 0.15s ease,
    background 0.15s ease,
    color 0.15s ease,
    transform 0.15s ease;
}

.ai-composer-trigger:hover,
.ai-composer-trigger:focus {
  outline: none;
  background: var(--bubble-ai);
}

.ai-composer-trigger:active {
  transform: scale(0.97);
}

.ai-composer-trigger[aria-expanded="true"],
.ai-composer-trigger.is-active {
  border-color: var(--bubble-ai);
  background: var(--bubble-ai);
}

.ai-composer-menu-icon {
  width: 28px;
  min-width: 28px;
  height: 28px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: var(--bubble-ai);
  color: var(--bubble-ai-text);
}

.ai-composer-trigger-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  color: currentColor;
}

.ai-composer-trigger-icon svg,
.ai-composer-menu-icon svg {
  width: 18px;
  height: 18px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ai-composer-trigger-icon svg {
  width: 20px;
  height: 20px;
}

.ai-composer-trigger-label {
  display: none;
}

.ai-composer-menu {
  position: absolute;
  left: 0;
  bottom: calc(100% + 10px);
  z-index: 130;
  width: 260px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--bar);
  box-shadow: var(--panel-shadow);
  opacity: 1;
}

.ai-composer-menu button {
  width: 100%;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  text-align: left;
  font: inherit;
  cursor: pointer;
}

.ai-composer-menu button:hover,
.ai-composer-menu button:focus {
  outline: none;
  background: var(--bubble-ai);
  background: color-mix(in srgb, var(--bubble-ai) 36%, transparent);
}

.ai-composer-menu button[aria-checked="true"] {
  background: var(--bubble-ai);
  background: color-mix(in srgb, var(--bubble-ai) 58%, transparent);
}

.ai-composer-menu strong {
  display: block;
  font-size: 14px;
  line-height: 1.25;
}

.ai-composer-menu small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.composer-input-wrap--ai {
  border-radius: 8px;
  outline: none;
  box-shadow: none;
  filter: drop-shadow(0 0 12px transparent);
  filter: drop-shadow(0 0 12px color-mix(in srgb, var(--bubble-ai-ring) 22%, transparent));
}

.composer-input-wrap--ai::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  border: 1px solid var(--bubble-ai-ring);
  border-radius: 8px;
  box-shadow: 0 0 0 2px transparent;
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--bubble-ai-ring) 18%, transparent);
}

.composer-img-btn.is-ai-disabled {
  display: none;
}

.composer-quote {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--bubble-ai-ring);
  background: color-mix(in srgb, var(--bubble-ai) 42%, transparent);
}

.composer-quote-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.composer-quote-label {
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--bubble-ai-text);
  line-height: 1.3;
}

.composer-quote-text {
  display: block;
  font-size: 13px;
  line-height: 1.4;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.composer-quote-close {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}

.composer-quote-close:hover,
.composer-quote-close:focus {
  outline: none;
  background: color-mix(in srgb, var(--bubble-ai) 55%, transparent);
  color: var(--text);
}

@media (max-width: 520px) {
  .ai-composer-trigger {
    min-width: 40px;
    width: 40px;
  }

  .composer-input-wrap--ai textarea {
    white-space: nowrap;
    overflow-x: hidden;
    text-overflow: ellipsis;
  }

  .ai-composer-menu {
    width: min(236px, calc(100vw - 24px));
  }
}
