/* AI Chance — Агент Практики МФЮА */
@import url('https://fonts.googleapis.com/css2?family=Unbounded:wght@400;600;700&family=Inter:wght@300;400;500&display=swap');

#aichance-agent-btn {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 9999;
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0f0f0f 0%, #1a1a2e 50%, #0d0d1a 100%);
  border: 1.5px solid rgba(120, 80, 255, 0.6);
  box-shadow: 0 0 24px rgba(100, 60, 255, 0.45), 0 4px 20px rgba(0,0,0,0.5);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.25s cubic-bezier(.34,1.56,.64,1), box-shadow 0.25s;
  overflow: hidden;
}
#aichance-agent-btn:hover {
  transform: scale(1.1) rotate(-5deg);
  box-shadow: 0 0 36px rgba(120, 80, 255, 0.7), 0 6px 28px rgba(0,0,0,0.5);
}
#aichance-agent-btn svg {
  width: 30px;
  height: 30px;
  filter: drop-shadow(0 0 6px rgba(160,120,255,0.8));
}
#aichance-agent-btn .pulse-ring {
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid rgba(120, 80, 255, 0.4);
  animation: agentPulse 2.2s infinite ease-out;
}
@keyframes agentPulse {
  0%   { transform: scale(1);   opacity: 0.6; }
  70%  { transform: scale(1.3); opacity: 0; }
  100% { transform: scale(1.3); opacity: 0; }
}

/* ---- MODAL ---- */
#aichance-agent-modal {
  position: fixed;
  bottom: 100px;
  right: 28px;
  z-index: 9998;
  width: 380px;
  max-width: calc(100vw - 32px);
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  background: #0a0a14;
  border: 1px solid rgba(120, 80, 255, 0.35);
  border-radius: 20px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.7), 0 0 40px rgba(80,40,200,0.2);
  overflow: hidden;
  transform: translateY(20px) scale(0.96);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.3s cubic-bezier(.34,1.4,.64,1), opacity 0.25s ease;
}
#aichance-agent-modal.open {
  transform: translateY(0) scale(1);
  opacity: 1;
  pointer-events: all;
}

/* header */
.agent-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  background: linear-gradient(90deg, #0d0d1e, #130d28);
  border-bottom: 1px solid rgba(120,80,255,0.2);
  flex-shrink: 0;
}
.agent-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6030cc, #a050ff);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  box-shadow: 0 0 16px rgba(140,80,255,0.5);
  flex-shrink: 0;
}
.agent-info { flex: 1; min-width: 0; }
.agent-name {
  font-family: 'Unbounded', sans-serif;
  font-size: 12px;
  font-weight: 700;
  color: #c4a0ff;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.agent-status {
  font-family: 'Inter', sans-serif;
  font-size: 10px;
  color: #6aff9e;
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 2px;
}
.agent-status::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #6aff9e;
  box-shadow: 0 0 6px #6aff9e;
  animation: blink 1.8s infinite;
}
@keyframes blink { 50% { opacity: 0.3; } }
.agent-close {
  background: none;
  border: none;
  color: rgba(255,255,255,0.35);
  cursor: pointer;
  padding: 4px;
  font-size: 18px;
  line-height: 1;
  transition: color 0.2s;
  flex-shrink: 0;
}
.agent-close:hover { color: #ff6b6b; }

/* messages */
.agent-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
}
.agent-messages::-webkit-scrollbar { width: 4px; }
.agent-messages::-webkit-scrollbar-track { background: transparent; }
.agent-messages::-webkit-scrollbar-thumb { background: rgba(120,80,255,0.3); border-radius: 2px; }

.msg {
  max-width: 88%;
  font-family: 'Inter', sans-serif;
  font-size: 13.5px;
  line-height: 1.55;
  animation: msgIn 0.3s cubic-bezier(.34,1.3,.64,1) both;
}
@keyframes msgIn {
  from { opacity: 0; transform: translateY(8px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.msg.bot {
  align-self: flex-start;
}
.msg.user {
  align-self: flex-end;
}
.msg-bubble {
  padding: 10px 14px;
  border-radius: 14px;
  word-break: break-word;
}
.msg.bot .msg-bubble {
  background: rgba(80, 40, 160, 0.22);
  border: 1px solid rgba(120,80,255,0.2);
  color: #ddd4ff;
  border-bottom-left-radius: 4px;
}
.msg.user .msg-bubble {
  background: linear-gradient(135deg, #5020a0, #8040cc);
  color: #fff;
  border-bottom-right-radius: 4px;
  box-shadow: 0 2px 12px rgba(120,60,220,0.35);
}
.msg-time {
  font-size: 10px;
  color: rgba(255,255,255,0.25);
  margin-top: 4px;
  padding: 0 4px;
}
.msg.user .msg-time { text-align: right; }

/* typing indicator */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 10px 14px;
  background: rgba(80, 40, 160, 0.15);
  border: 1px solid rgba(120,80,255,0.15);
  border-radius: 14px;
  border-bottom-left-radius: 4px;
  width: fit-content;
}
.typing-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #a070ff;
  animation: typingBounce 1.2s infinite ease-in-out;
}
.typing-dot:nth-child(2) { animation-delay: 0.15s; }
.typing-dot:nth-child(3) { animation-delay: 0.3s; }
@keyframes typingBounce {
  0%,60%,100% { transform: translateY(0); opacity: 0.5; }
  30%          { transform: translateY(-7px); opacity: 1; }
}

/* quick actions */
.agent-quick {
  padding: 8px 12px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  border-top: 1px solid rgba(120,80,255,0.1);
  flex-shrink: 0;
}
.quick-btn {
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  padding: 5px 10px;
  border-radius: 20px;
  background: rgba(80,40,160,0.2);
  border: 1px solid rgba(120,80,255,0.3);
  color: #b090ee;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
.quick-btn:hover {
  background: rgba(100,60,200,0.4);
  color: #d4b8ff;
  border-color: rgba(160,100,255,0.6);
  transform: translateY(-1px);
}

/* input */
.agent-input-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid rgba(120,80,255,0.15);
  background: rgba(10,10,24,0.8);
  flex-shrink: 0;
}
.agent-input {
  flex: 1;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(120,80,255,0.25);
  border-radius: 12px;
  padding: 10px 14px;
  color: #e8e0ff;
  font-family: 'Inter', sans-serif;
  font-size: 13.5px;
  resize: none;
  outline: none;
  min-height: 42px;
  max-height: 110px;
  line-height: 1.45;
  transition: border-color 0.2s;
}
.agent-input::placeholder { color: rgba(200,180,255,0.3); }
.agent-input:focus { border-color: rgba(160,100,255,0.6); }
.agent-send {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #5020a0, #8040cc);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s cubic-bezier(.34,1.56,.64,1), box-shadow 0.2s;
  flex-shrink: 0;
  box-shadow: 0 2px 12px rgba(120,60,220,0.4);
}
.agent-send:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 18px rgba(140,80,255,0.6);
}
.agent-send svg { width: 16px; height: 16px; }
