/* Скин только виджета чата (для сторонних сайтов). Синхронизировать при крупных правках .chatbot в styles.css SiM. */
:root {
  --text: #e8edff;
  --muted: #94a3c8;
  --primary: #6b8cff;
  --primary-deep: #4a6cf5;
  --border: #1e2a45;
  --shadow-sm: 0 4px 14px rgba(0, 0, 0, 0.28);
  --shadow-md: 0 12px 32px rgba(0, 0, 0, 0.38);
  --shadow-lg: 0 24px 48px rgba(0, 0, 0, 0.45);
  --shadow-glow: 0 0 0 1px rgba(107, 140, 255, 0.12), 0 12px 40px rgba(74, 108, 245, 0.22);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring: cubic-bezier(0.34, 1.2, 0.64, 1);
}

.chatbot-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 37;
  background: rgba(6, 8, 14, 0.48);
  backdrop-filter: blur(3px);
}

body.chatbot-open .chatbot-backdrop {
  display: block;
}

.chatbot {
  position: fixed;
  left: 20px;
  bottom: 20px;
  z-index: 39;
}

.chatbot-toggle {
  width: 52px;
  height: 52px;
  border: 0;
  border-radius: 50%;
  font-size: 1.1rem;
  color: #fff;
  background: linear-gradient(135deg, var(--primary-deep), #8b6fff);
  cursor: pointer;
  box-shadow: var(--shadow-glow);
  transition: transform 0.22s var(--ease-spring), box-shadow 0.22s var(--ease-out);
}

.chatbot-toggle:hover {
  transform: scale(1.05);
  box-shadow: var(--shadow-md), 0 0 0 1px rgba(107, 140, 255, 0.2);
}

.chatbot-toggle:active {
  transform: scale(0.96);
}

.chatbot-toggle.chatbot-toggle--image,
.chatbot-toggle--image {
  font-size: 0;
  padding: 0;
  overflow: hidden;
  background: #1f2c34;
}

.chatbot-toggle-img {
  width: 32px;
  height: 32px;
  object-fit: contain;
  display: block;
  margin: 10px auto;
}

.chatbot-panel {
  position: absolute;
  bottom: 64px;
  left: 0;
  width: min(380px, 92vw);
  background: #0b141a;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: var(--shadow-lg), 0 24px 48px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(12px);
}

.chatbot-header {
  padding: 11px 14px;
  font-weight: 600;
  font-size: 0.95rem;
  color: #fff;
  background: linear-gradient(180deg, #075e54 0%, #064942 100%);
  border-bottom: 1px solid rgba(0, 0, 0, 0.2);
}

.chatbot-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 10px 14px;
  max-height: min(52vh, 380px);
  overflow-y: auto;
  overflow-x: hidden;
  background: #0b141a;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

.chatbot-row {
  display: flex;
  width: 100%;
}

.chatbot-row--user {
  justify-content: flex-end;
}

.chatbot-row--bot {
  justify-content: flex-start;
}

.chatbot-bubble {
  max-width: 84%;
  padding: 8px 12px 9px;
  border-radius: 12px;
  font-size: 0.94rem;
  line-height: 1.42;
  word-wrap: break-word;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.chatbot-bubble--user {
  background: #005c4b;
  color: #e9edef;
  border-radius: 12px 4px 12px 12px;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.2);
}

.chatbot-bubble--bot {
  background: #202c33;
  color: #e9edef;
  border-radius: 4px 12px 12px 12px;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.18);
}

.chatbot-form {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 8px 8px 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  background: #1f2c34;
}

.chatbot-photo-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.chatbot-attach {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  min-width: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(233, 237, 239, 0.85);
  cursor: pointer;
  transition: background 0.2s var(--ease-out), color 0.2s var(--ease-out), transform 0.15s var(--ease-spring);
}

.chatbot-attach:hover {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
}

.chatbot-attach[data-has-photo] {
  background: rgba(0, 168, 132, 0.28);
  color: #b8f5e8;
}

.chatbot-attach:active {
  transform: scale(0.96);
}

.chatbot-attach-icon {
  width: 22px;
  height: 22px;
  display: block;
}

.chatbot-bubble-media {
  display: block;
  max-width: 100%;
  max-height: 220px;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 8px;
  margin-bottom: 4px;
}

.chatbot-bubble-media--video {
  background: #000;
  max-height: 200px;
}

.chatbot-bubble-text {
  white-space: pre-wrap;
}

.chatbot-form .chatbot-input {
  flex: 1;
  box-sizing: border-box;
  display: block;
  width: 100%;
  min-height: 44px;
  max-height: 168px;
  border: 0;
  background: #2a3942;
  color: #e9edef;
  padding: 10px 14px;
  margin: 0;
  border-radius: 20px;
  font-size: 16px;
  font-family: inherit, system-ui, sans-serif;
  line-height: 1.35;
  resize: none;
  overflow-y: hidden;
  overflow-wrap: anywhere;
  word-break: break-word;
  -webkit-appearance: none;
  appearance: none;
  outline: none;
}

.chatbot-form .chatbot-input::placeholder {
  color: rgba(233, 237, 239, 0.45);
}

.chatbot-form .chatbot-input:focus {
  box-shadow: 0 0 0 1px rgba(0, 168, 132, 0.45);
}

.chatbot-form .chatbot-send {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  min-width: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #00a884;
  color: #fff;
  cursor: pointer;
  font: inherit;
  transition: background 0.2s var(--ease-out), transform 0.15s var(--ease-spring);
}

.chatbot-form .chatbot-send-icon {
  width: 22px;
  height: 22px;
  display: block;
  margin-inline-start: 2px;
  margin-block-end: 1px;
}

.chatbot-form .chatbot-send:hover {
  background: #06c59a;
}

.chatbot-form .chatbot-send:active {
  transform: scale(0.96);
}

@media (max-width: 768px) {
  .chatbot {
    left: 14px;
    bottom: 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .chatbot-toggle {
    transition: none !important;
  }
  .chatbot-toggle:hover {
    transform: none !important;
    filter: none !important;
  }
}
