/* TELEGRAM CHAT */
.tg-chat {
  margin-top: 1rem;
  background: var(--tg-bg);
  border-radius: 12px;
  max-width: 700px;
  width: 100%;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255,255,255,0.05);
  position: relative;
  z-index: 2;
}

.tg-chat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  text-align: left;
  background: #17212b;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  transition: background 0.4s ease;
}

.tg-chat-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  transition: transform 0.4s ease, box-shadow 0.4s ease;
}

.tg-chat.switching .tg-chat-avatar {
  transform: scale(1.1);
  box-shadow: 0 0 16px var(--accent);
}

.tg-chat.switching {
  box-shadow: 0 0 0 1px var(--accent), 0 20px 60px rgba(88, 166, 255, 0.25);
  transition: box-shadow 0.4s ease;
}

.tg-chat-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.tg-chat-name {
  font-size: 0.95rem;
  font-weight: 600;
  color: #e1e3e6;
  transition: color 0.3s ease;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tg-chat-status {
  font-size: 0.7rem;
  color: var(--accent);
}

.tg-chat-btn {
  margin-left: auto;
  padding: 6px 16px;
  font-size: 0.75rem;
  font-family: 'JetBrains Mono', monospace;
  color: var(--bg-primary);
  border: none;
  border-radius: 6px;
  background: var(--accent);
  cursor: pointer;
  transition: all 0.3s;
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
  box-shadow: 0 0 16px rgba(88, 166, 255, 0.3);
}

.tg-chat-btn:hover {
  box-shadow: 0 0 24px rgba(88, 166, 255, 0.5);
  transform: translateY(-1px);
}

.tg-chat-footer {
  padding: 12px 16px 16px;
}

.tg-chat-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  max-width: 700px;
  width: 100%;
  margin-top: 1rem;
  padding: 16px 24px;
  font-size: 1.05rem;
  font-weight: 600;
  font-family: 'JetBrains Mono', monospace;
  color: #fff;
  background: var(--cta-color, var(--accent-red));
  border: none;
  border-radius: 12px;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.4s ease;
  box-shadow: 0 4px 24px var(--cta-glow, rgba(255,123,114,0.35));
  letter-spacing: 0.02em;
}

.tg-chat-cta:hover {
  box-shadow: 0 6px 32px var(--cta-glow, rgba(255,123,114,0.5));
  transform: translateY(-2px);
}

.tg-chat-cta-arrow {
  font-size: 1.2rem;
  transition: transform 0.3s;
}

.tg-chat-cta:hover .tg-chat-cta-arrow {
  transform: translateX(4px);
}

.tg-chat-body {
  padding: 20px;
  height: 400px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scrollbar-width: none;
  text-align: left;
}

.tg-chat-body::-webkit-scrollbar { display: none; }

.tg-msg {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  max-width: 85%;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.tg-msg.visible {
  opacity: 1;
  transform: translateY(0);
}

.tg-msg.outgoing {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.tg-msg-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.tg-msg-bubble {
  padding: 8px 12px;
  border-radius: 12px;
  font-size: 0.88rem;
  line-height: 1.45;
  position: relative;
  word-wrap: break-word;
}

.tg-msg.incoming .tg-msg-bubble {
  background: var(--tg-incoming);
  color: #e1e3e6;
  border-bottom-left-radius: 4px;
}

.tg-msg.outgoing .tg-msg-bubble {
  background: var(--tg-outgoing);
  color: #e1e3e6;
  border-bottom-right-radius: 4px;
}

/* Typing indicator */
.tg-typing {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  max-width: 85%;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.tg-typing.visible {
  opacity: 1;
}

.tg-typing-dots {
  display: flex;
  gap: 4px;
  padding: 12px 16px;
  background: var(--tg-incoming);
  border-radius: 12px;
  border-bottom-left-radius: 4px;
}

.tg-typing-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: typingBounce 1.2s ease-in-out infinite;
}

.tg-typing-dot:nth-child(2) { animation-delay: 0.15s; }
.tg-typing-dot:nth-child(3) { animation-delay: 0.3s; }

.tg-typing.outgoing {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.tg-typing.outgoing .tg-typing-dots {
  background: var(--tg-outgoing);
  border-bottom-left-radius: 12px;
  border-bottom-right-radius: 4px;
}

.tg-typing.outgoing .tg-msg-avatar {
  display: none;
}

@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-6px); opacity: 1; }
}

@media (max-width: 480px) {
  .tg-chat { margin-top: 2rem; }
  .tg-chat-body { height: 400px; padding: 12px; }
  .tg-msg { max-width: 92%; }
}
