﻿.ai-widget {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 120;
  color: #f6f5f2;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

.ai-widget-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  border: 1px solid rgba(255, 153, 0, 0.55);
  border-radius: 8px;
  padding: 0 18px;
  background: #f7f5ef;
  color: #08090c;
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.34), 0 0 40px rgba(255, 153, 0, 0.2);
  font-weight: 850;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.ai-widget-toggle:hover {
  transform: translateY(-2px);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.38), 0 0 46px rgba(255, 153, 0, 0.24);
}

.ai-widget-toggle span {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 7px;
  background: url("assets/favicon-ai.svg") center / cover no-repeat;
}

.ai-widget-panel {
  position: absolute;
  right: 0;
  bottom: 66px;
  width: min(420px, calc(100vw - 28px));
  height: min(640px, calc(100vh - 104px));
  display: none;
  grid-template-rows: auto auto 1fr auto;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background:
    radial-gradient(circle at 74% 2%, rgba(255, 153, 0, 0.13), transparent 32%),
    linear-gradient(180deg, rgba(23, 28, 38, 0.96), rgba(13, 15, 21, 0.98));
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.52);
  backdrop-filter: blur(18px);
}

.ai-widget.open .ai-widget-panel {
  display: grid;
  animation: widgetOpen 0.22s ease both;
}

.ai-widget-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 68px;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.ai-widget-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ai-widget-mark {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: url("assets/favicon-ai.svg") center / cover no-repeat;
}

.ai-widget-title strong,
.ai-widget-title span {
  display: block;
}

.ai-widget-title strong {
  font-size: 15px;
}

.ai-widget-title span {
  margin-top: 2px;
  color: #aeb6cc;
  font-size: 12px;
}

.ai-widget-close {
  width: 36px;
  height: 36px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 7px;
  background: transparent;
  color: #f6f5f2;
  cursor: pointer;
}

.ai-widget-modes {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.ai-widget-modes button {
  min-height: 36px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 7px;
  padding: 0 12px;
  background: rgba(255, 255, 255, 0.035);
  color: #aeb6cc;
  cursor: pointer;
}

.ai-widget-modes button.active {
  border-color: rgba(255, 153, 0, 0.55);
  background: rgba(255, 153, 0, 0.12);
  color: #f6f5f2;
}

.ai-widget-messages {
  overflow: auto;
  padding: 18px 16px;
}

.ai-widget-message {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 10px;
  margin-bottom: 16px;
  animation: widgetMessage 0.2s ease both;
}

.ai-widget-avatar {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.08);
  color: #ff9900;
  font-size: 11px;
  font-weight: 900;
}

.ai-widget-message.user .ai-widget-avatar {
  background: rgba(19, 153, 255, 0.16);
  color: #e9f5ff;
}

.ai-widget-bubble {
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 11px 12px;
  background: rgba(255, 255, 255, 0.045);
  color: #e8ecf8;
  font-size: 14px;
  line-height: 1.55;
}

.ai-widget-bubble strong {
  color: #fff;
}

.ai-widget-image {
  display: block;
  width: 100%;
  margin-top: 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
}

.ai-widget-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  padding: 14px 16px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.ai-widget-form textarea {
  width: 100%;
  max-height: 108px;
  min-height: 44px;
  resize: none;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: #12141a;
  color: #f6f5f2;
  padding: 12px 13px;
  font: inherit;
  line-height: 1.35;
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.ai-widget-form textarea:focus {
  border-color: rgba(255, 153, 0, 0.48);
  box-shadow: 0 0 0 3px rgba(255, 153, 0, 0.08);
}

.ai-widget-send {
  min-width: 74px;
  min-height: 44px;
  border: 1px solid #ff9900;
  border-radius: 8px;
  background: #ff9900;
  color: #08090c;
  font-weight: 850;
  cursor: pointer;
}

.ai-widget-send:disabled {
  opacity: 0.62;
  cursor: wait;
}

@keyframes widgetOpen {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes widgetMessage {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

  .ai-widget-toggle {
    min-height: 48px;
    padding: 0 14px;
  }

  .ai-widget-panel {
    right: -1px;
    bottom: 60px;
    width: calc(100vw - 28px);
    height: min(640px, calc(100vh - 92px));
  }
}
