.ai-chat-widget {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 9999;
  font-family: Akrobat, Arial, sans-serif;
}

.ai-chat-widget * {
  box-sizing: border-box;
}

.ai-chat-widget__launcher {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 0;
  border-radius: 999px;
  padding: 14px 18px 14px 14px;
  background: linear-gradient(135deg, #ff6b00 0%, #ff8a1f 100%);
  color: #fff;
  box-shadow: 0 16px 40px rgba(15, 20, 28, 0.28);
  cursor: pointer;
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease,
    opacity 0.2s ease;
}

.ai-chat-widget__launcher:hover {
  transform: translateY(-2px);
  box-shadow: 0 20px 48px rgba(15, 20, 28, 0.34);
}

.ai-chat-widget__launcher-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
  font-size: 18px;
}

.ai-chat-widget__launcher-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1;
}

.ai-chat-widget__launcher-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.ai-chat-widget__launcher-subtitle {
  margin-top: 3px;
  font-size: 12px;
  opacity: 0.85;
}

.ai-chat-widget__panel {
  position: absolute;
  right: 0;
  bottom: 72px;
  width: 380px;
  max-width: calc(100vw - 32px);
  max-height: min(72vh, 680px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 24px;
  background: rgba(13, 17, 23, 0.98);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.42);
  opacity: 0;
  visibility: hidden;
  transform: translateY(16px) scale(0.98);
  pointer-events: none;
  transition:
    opacity 0.2s ease,
    transform 0.2s ease,
    visibility 0.2s ease;
}

.ai-chat-widget.is-open .ai-chat-widget__panel {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.ai-chat-widget.is-open .ai-chat-widget__launcher {
  opacity: 0.9;
}

.ai-chat-widget__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 18px 14px;
  background: linear-gradient(
    180deg,
    rgba(255, 107, 0, 0.18),
    rgba(255, 107, 0, 0)
  );
}

.ai-chat-widget__title {
  font-size: 20px;
  font-weight: 700;
}

.ai-chat-widget__subtitle {
  margin-top: 4px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.72);
}

.ai-chat-widget__close {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-size: 30px;
  line-height: 1;
  cursor: pointer;
}

.ai-chat-widget__messages {
  flex: 1;
  min-height: 260px;
  overflow-y: auto;
  padding: 0 14px 14px;
}

.ai-chat-widget__message {
  display: flex;
  margin-top: 12px;
}

.ai-chat-widget__message.is-user {
  justify-content: flex-end;
}

.ai-chat-widget__bubble {
  max-width: 88%;
  padding: 12px 14px;
  border-radius: 18px;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 15px;
  line-height: 1.45;
}

.ai-chat-widget__message.is-user .ai-chat-widget__bubble {
  background: linear-gradient(135deg, #ff6b00 0%, #ff8a1f 100%);
  color: #fff;
  border-bottom-right-radius: 6px;
}

.ai-chat-widget__message.is-assistant .ai-chat-widget__bubble,
.ai-chat-widget__message.is-system .ai-chat-widget__bubble {
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-bottom-left-radius: 6px;
}

.ai-chat-widget__message.is-error .ai-chat-widget__bubble {
  background: rgba(255, 88, 88, 0.14);
  border-color: rgba(255, 88, 88, 0.24);
  color: #ffd4d4;
}

.ai-chat-widget__typing .ai-chat-widget__bubble {
  opacity: 0.8;
}

.ai-chat-widget__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 14px 14px;
}

.ai-chat-widget__chip {
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.04);
  color: rgba(255, 255, 255, 0.88);
  font-size: 13px;
  cursor: pointer;
}

.ai-chat-widget__form {
  padding: 0 14px 14px;
}

.ai-chat-widget__input {
  width: 100%;
  min-height: 92px;
  resize: vertical;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  color: #fff;
  padding: 14px 16px;
  outline: none;
  font-size: 15px;
}

.ai-chat-widget__input::placeholder {
  color: rgba(255, 255, 255, 0.45);
}

.ai-chat-widget__input:focus {
  border-color: rgba(255, 107, 0, 0.8);
  box-shadow: 0 0 0 3px rgba(255, 107, 0, 0.14);
}

.ai-chat-widget__actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
}

.ai-chat-widget__hint {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.54);
}

.ai-chat-widget__send {
  border: 0;
  border-radius: 14px;
  padding: 12px 16px;
  background: #ff6b00;
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

.ai-chat-widget__send:disabled,
.ai-chat-widget__chip:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

@media (max-width: 768px) {
  .ai-chat-widget {
    right: 14px;
    left: 14px;
    bottom: 14px;
  }

  .ai-chat-widget__launcher {
    width: 100%;
    justify-content: center;
    border-radius: 18px;
  }

  .ai-chat-widget__panel {
    width: 100%;
    max-width: 100%;
    max-height: 80vh;
    bottom: 72px;
  }

  .ai-chat-widget__bubble {
    max-width: 94%;
  }
}
