.chat-container {
  position: relative;
  width: 100%;
  height: 100%;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.06);
  -webkit-backdrop-filter: blur(1px);
  backdrop-filter: blur(1px);
  /* overflow: hidden; */
  box-shadow: 0 10px 30px rgba(0,0,0,0.4);
}

.chat-container::before {
  content: "";
  position: absolute;
  top: -10%;
  left: -30%;
  width: 110%;
  height: 110%;
  opacity: 15%;
  background: conic-gradient(
    from 220deg,
    rgb(85, 51, 207) 0deg,
    rgb(146, 64, 222) 120deg,
    rgba(64, 64, 222, 1) 240deg,
    rgb(160, 123, 245) 360deg
  );
  filter: blur(80px);
  z-index: -1;
  border-radius: 50%; /* чтобы подсветка была плавнее */
}

/* Шапка */
.chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  background: rgba(3,6,10,0.6);
  backdrop-filter: blur(6px);
  font-size: 14px;
  color: var(--ztc-text-text-3);
}

.chat-header .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ztc-gradient);
  display: inline-block;
  margin-right: 6px;
}

/* Тело */
.chat-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.bubble {
  max-width: 85%;
  padding: 8px 14px;
  border-radius: 16px;
  font-size: 15px;
  line-height: 1.4;
  border: 1px solid rgba(255,255,255,0.1);
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
  color: var(--ztc-text-text-1);
  font-family: Arial;
  /* font-weight: bold; */
}

.left {
  align-self: flex-start;
  background: rgba(255,255,255,0.05);
}

.right {
  align-self: flex-end;
  background: rgba(255,255,255,0.08);
}


/* Голосовое сообщение */
.voice-msg {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.voice-player {
  display: flex;
  align-items: center;
  gap: 10px;
}

.play-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: var(--ztc-gradient);
  color: white;
  font-size: 14px;
  cursor: pointer;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0; /* чтобы внутренние отступы не смещали */
}

.waveform {
  display: flex;
  align-items: center; /* центрируем — волны будут и вверх, и вниз */
  gap: 2px;
  flex: 1;
  height: 50px;
  overflow: hidden;
}

.wave {
  width: 3px;
  height: 20px; /* БАЗОВАЯ высота — обязательно! */
  background: rgba(255,255,255,0.8);
  border-radius: 2px;
  animation: waveAnim 2.5s infinite ease-in-out;
  transform-origin: center center; /* центр — волна вверх и вниз */
}

/* разные задержки и скорости */
.wave:nth-child(odd)   { animation-delay: 0.2s; animation-duration: 2.8s; }
.wave:nth-child(even)  { animation-delay: 0.4s; animation-duration: 3.2s; }
.wave:nth-child(3n)    { animation-delay: 0.6s; animation-duration: 2.6s; }
.wave:nth-child(5n)    { animation-delay: 0.8s; animation-duration: 3s; }
.wave:nth-child(7n)    { animation-delay: 1s;   animation-duration: 3.4s; }

@keyframes waveAnim {
  0%, 100% { transform: scaleY(0.3); opacity: 0.6; }
  50%      { transform: scaleY(1.6); opacity: 1; }
}

.voice-player .time {
  font-size: 12px;
  color: rgba(255,255,255,0.7);
}

.voice-transcript {
  font-size: 14px;
  line-height: 1.5;
  color: var(--ztc-text-text-2);
  padding-top: 4px;
  border-top: 1px dashed rgba(255,255,255,0.1);
}

.demo-mode .chat-header {
  justify-content: center;
  font-weight: bold;
  font-size: 15px;
  color: #fff;
}

.voice-transcript {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255,255,255,0.04);
  font-size: 14px;
  line-height: 1.5;
  color: var(--ztc-text-text-1);
  border-left: 3px solid var(--ztc-gradient);
}

.auto-caption {
  margin-top: 8px;
  font-size: 12px;
  color: rgba(255,255,255,0.6);
  text-align: right;
}

.auto-caption span {
  color: var(--ztc-gradient);
  font-weight: 600;
}

@media (max-width: 768px) {
  .bubble.left.voice-msg {
    width: 100%;
    max-width: 100%;
    align-self: stretch; /* растянуть */
  }
}

@media (max-width: 768px) {
  .auto-caption {
    font-size: 12px;
    text-align: center;
  }
}

/* ====== BOT STATUS ====== */
.bot-status {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255,255,255,0.04);
  align-self: flex-end; /* справа */
}

.status-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.status-row i {
  color: #ffffff;
  background: var(--ztc-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  font-size: 16px;
}

.status-text {
  color: var(--ztc-text-text-1);
}

.typing {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 8px;
}

.typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255,255,255,0.8);
  animation: typingDots 1.4s infinite ease-in-out;
}

.typing span:nth-child(2) { animation-delay: 0.2s; }
.typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingDots {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.5; }
  40% { transform: translateY(-4px); opacity: 1; }
}

/* ====== ANALYSIS CARD ====== */
.analysis-card {
  width: 100%;
  max-width: 100%;
  background: rgba(255,255,255,0.05);
}

.analysis-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.analysis-header h5 {
  margin: 0;
  font-size: 16px;
  color: #fff;
}

.quality {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 180px;
}

.quality .label {
  font-size: 12px;
  color: rgba(255,255,255,0.7);
}

.quality-bar {
  position: relative;
  flex: 1;
  height: 8px;
  border-radius: 999px;
  background: rgba(255,255,255,0.12);
  overflow: hidden;
}

.quality-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  background: var(--ztc-gradient);
  border-radius: 999px;
  animation: qualityFillIntro 900ms ease forwards;
}

@keyframes qualityFillIntro {
  from { width: 0; }
  to   { width: var(--target-width, 86%); }
}

.quality-value {
  font-size: 12px;
  color: #fff;
  font-weight: 600;
}

.analysis-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.section-label {
  font-size: 12px;
  color: rgba(255,255,255,0.7);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  font-size: 12px;
  line-height: 1;
  border-radius: 8px;
  background: rgba(255,255,255,0.08);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.12);
}

.tag-color { background: var(--ztc-gradient)}

@media (max-width: 768px) {
  .analysis-header { flex-direction: column; align-items: stretch; }
  .quality { width: 100%; }
}

/* Hotness */
.hotness { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.hot-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 8px; /* как у .tag */
  font-size: 12px; line-height: 1; /* как у .tag */
  background: var(--ztc-gradient);
  color: #fff; border: none;
  position: relative;
}
.hot-badge i { color: inherit; }


/* Objections */
.objections-list { margin: 0; color: var(--ztc-text-text-1); }
.objections-list li { margin: 2px 0; }

.rate-status { color: white; font-weight: bold; }

/* ====== DEMO MODE COMPACT TUNING ====== */
.chat-container.demo-mode { border-radius: 16px; }
.chat-container.demo-mode .chat-header { padding: 10px 14px; font-size: 13px; }
.chat-container.demo-mode .chat-body { padding: 16px; gap: 10px; }
.chat-container.demo-mode .bubble { max-width: 82%; padding: 6px 12px; font-size: 14px; }
.chat-container.demo-mode .play-btn { width: 28px; height: 28px; font-size: 12px; }
.chat-container.demo-mode .waveform { height: 42px; gap: 2px; }
.chat-container.demo-mode .wave { width: 2px; height: 18px; }
.chat-container.demo-mode .voice-player { gap: 8px; }
.chat-container.demo-mode .voice-player .time { font-size: 11px; }
.chat-container.demo-mode .analysis-header h5 { font-size: 15px; }
.chat-container.demo-mode .section-label { font-size: 11px; }
.chat-container.demo-mode .tag { padding: 3px 8px; font-size: 11px; }
.chat-container.demo-mode .hot-badge { padding: 3px 8px; font-size: 11px; }

/* ====== MOBILE TWEAKS ====== */
@media (max-width: 576px) {
  .chat-container.demo-mode .chat-header { padding: 8px 12px; font-size: 12px; }
  .chat-container.demo-mode .chat-body { padding: 12px; gap: 8px; }
  .chat-container.demo-mode .bubble { max-width: 80%; padding: 6px 10px; font-size: 13px; border-radius: 14px; }
  .chat-container.demo-mode .voice-player { gap: 6px; }
  .chat-container.demo-mode .play-btn { width: 26px; height: 26px; font-size: 12px; }
  .chat-container.demo-mode .waveform { height: 36px; }
  .chat-container.demo-mode .wave { width: 2px; height: 16px; }
  .chat-container.demo-mode .voice-player .time { font-size: 10px; }
  .chat-container.demo-mode .analysis-header h5 { font-size: 14px; }
  .chat-container.demo-mode .section-label { font-size: 10.5px; }
  .chat-container.demo-mode .tag, 
  .chat-container.demo-mode .hot-badge { padding: 3px 7px; font-size: 10.5px; }
  /* Сделаем карточку анализа компактнее и не на всю ширину */
  .chat-container.demo-mode .analysis-card { width: auto; max-width: 92%; }
}

@media (max-width: 400px) {
  .chat-container.demo-mode .bubble { max-width: 78%; font-size: 12.5px; }
  .chat-container.demo-mode .chat-body { padding: 10px; gap: 6px; }
  .chat-container.demo-mode .analysis-card { max-width: 90%; }
}