/* ===== КНОПКА ===== */
#stm-chat-btn {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0085C3 0%, #006FA0 100%);
  color: white;
  font-size: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 6px 24px rgba(0,133,195,0.45);
  z-index: 9999;
  transition: all 0.3s;
  animation: stm-pulse 3s infinite;
}
#stm-chat-btn:hover { transform: scale(1.1); box-shadow: 0 8px 32px rgba(0,133,195,0.6); }
#stm-chat-btn.hidden { display: none; }

@keyframes stm-pulse {
  0%, 100% { box-shadow: 0 6px 24px rgba(0,133,195,0.45); }
  50% { box-shadow: 0 6px 32px rgba(0,133,195,0.7); }
}

/* ===== ОКНО ЧАТА ===== */
#stm-chat-window {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 480px;
  height: 650px;
  background: #FFFFFF;
  border-radius: 20px;
  box-shadow: 0 12px 48px rgba(0,0,0,0.18);
  display: none;
  flex-direction: column;
  z-index: 10000;
  overflow: hidden;
  border: 1px solid rgba(0,133,195,0.1);
}
#stm-chat-window.open { display: flex; }

@media (max-width: 480px) {
  #stm-chat-window {
    width: 100%;
    height: 100%;
    bottom: 0;
    right: 0;
    border-radius: 0;
  }
}

/* ===== ШАПКА ===== */
.stm-chat-header {
  background: linear-gradient(135deg, #0085C3 0%, #006FA0 100%);
  color: white;
  padding: 16px 20px;
  font-family: 'Montserrat', sans-serif;
  font-weight: 700;
  font-size: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.stm-chat-header span:first-child::before {
  content: '\1F916 ';
}
.stm-chat-close {
  cursor: pointer;
  font-size: 1.3rem;
  opacity: 0.8;
  transition: opacity 0.2s;
}
.stm-chat-close:hover { opacity: 1; }

/* ===== СООБЩЕНИЯ ===== */
.stm-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #F8FAFB;
}

.stm-msg {
  max-width: 82%;
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 0.95rem;
  line-height: 1.5;
  word-wrap: break-word;
  white-space: pre-wrap;
}
.stm-msg.bot {
  background: #FFFFFF;
  color: #1A1A2E;
  align-self: flex-start;
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.stm-msg.user {
  background: linear-gradient(135deg, #0085C3 0%, #006FA0 100%);
  color: white;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
  box-shadow: 0 2px 8px rgba(0,133,195,0.25);
}
.stm-msg.typing {
  color: #9CA3AF;
  font-style: italic;
  background: transparent;
  box-shadow: none;
  padding: 8px 0;
}

/* Markdown-like formatting */
.stm-msg.bot strong, .stm-msg.bot b {
  color: #0085C3;
}

/* ===== ВВОД ===== */
.stm-chat-input {
  display: flex;
  border-top: 1px solid #E5E7EB;
  padding: 12px 14px;
  gap: 10px;
  background: white;
}
.stm-chat-input input {
  flex: 1;
  border: 2px solid #E5E7EB;
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 0.95rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}
.stm-chat-input input:focus { border-color: #0085C3; }
.stm-chat-input button {
  background: linear-gradient(135deg, #0085C3 0%, #006FA0 100%);
  color: white;
  border: none;
  border-radius: 12px;
  width: 46px;
  font-size: 1.3rem;
  cursor: pointer;
  transition: all 0.2s;
}
.stm-chat-input button:hover { transform: scale(1.05); }
.stm-chat-input button:disabled { opacity: 0.5; cursor: not-allowed; }

/* ===== СКРОЛЛБАР ===== */
.stm-chat-messages::-webkit-scrollbar { width: 4px; }
.stm-chat-messages::-webkit-scrollbar-track { background: transparent; }
.stm-chat-messages::-webkit-scrollbar-thumb { background: #CBD5E0; border-radius: 4px; }

/* ===== RESIZE HANDLE ===== */
.stm-chat-resize {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 18px;
  height: 18px;
  cursor: nwse-resize;
  z-index: 10;
}
.stm-chat-resize::after {
  content: '';
  position: absolute;
  bottom: 4px;
  right: 4px;
  width: 8px;
  height: 8px;
  border-right: 2px solid #CBD5E0;
  border-bottom: 2px solid #CBD5E0;
}
@media (max-width: 768px) {
  .stm-chat-resize { display: none; }
}
