/* Site assistant chat widget */
.tsr-assistant {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 9990;
  font-family: inherit;
}

.tsr-assistant-launcher {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.75rem 1rem 0.75rem 0.85rem;
  border: none;
  border-radius: 999px;
  background: linear-gradient(135deg, #1a5fb4 0%, #0c1f3d 100%);
  color: #fff;
  font: inherit;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  box-shadow: 0 8px 28px rgba(12, 31, 61, 0.35);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.tsr-assistant-launcher:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(12, 31, 61, 0.4);
}

.tsr-assistant-launcher-icon {
  flex-shrink: 0;
}

.tsr-assistant-panel {
  position: absolute;
  right: 0;
  bottom: calc(100% + 0.75rem);
  width: min(380px, calc(100vw - 2rem));
  max-height: min(560px, calc(100vh - 6rem));
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 16px 48px rgba(12, 31, 61, 0.22);
  border: 1px solid rgba(12, 31, 61, 0.08);
  overflow: hidden;
}

.tsr-assistant-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.9rem 1rem;
  background: linear-gradient(135deg, #0c1f3d 0%, #1a5fb4 100%);
  color: #fff;
}

.tsr-assistant-header-main {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
}

.tsr-assistant-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  flex-shrink: 0;
}

.tsr-assistant-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.2;
}

.tsr-assistant-subtitle {
  margin: 0.15rem 0 0;
  font-size: 0.78rem;
  opacity: 0.88;
}

.tsr-assistant-close {
  border: none;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  width: 2rem;
  height: 2rem;
  border-radius: 8px;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
}

.tsr-assistant-header-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}

.tsr-assistant-voice {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border: none;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  cursor: pointer;
  flex-shrink: 0;
}

.tsr-assistant-voice:hover,
.tsr-assistant-close:hover {
  background: rgba(255, 255, 255, 0.25);
}

.tsr-assistant-voice-off .tsr-assistant-voice-on {
  display: none;
}

.tsr-assistant-voice:not(.tsr-assistant-voice-off) .tsr-assistant-voice-off {
  display: none;
}

.tsr-assistant-speaking .tsr-assistant-avatar,
.tsr-assistant-speaking .tsr-assistant-msg-avatar {
  animation: miki-pulse 1.2s ease-in-out infinite;
}

@keyframes miki-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(26, 95, 180, 0.45);
  }
  50% {
    box-shadow: 0 0 0 6px rgba(26, 95, 180, 0);
  }
}

.tsr-assistant-close:hover {
  background: rgba(255, 255, 255, 0.25);
}

.tsr-assistant-messages {
  flex: 1;
  overflow-y: auto;
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  background: #f6f8fb;
  min-height: 200px;
}

.tsr-assistant-msg {
  display: flex;
  gap: 0.5rem;
  max-width: 100%;
}

.tsr-assistant-msg-user {
  justify-content: flex-end;
}

.tsr-assistant-msg-user .tsr-assistant-msg-body {
  background: #1a5fb4;
  color: #fff;
  border-radius: 14px 14px 4px 14px;
}

.tsr-assistant-msg-bot .tsr-assistant-msg-body {
  background: #fff;
  border: 1px solid #e4e9f0;
  border-radius: 14px 14px 14px 4px;
}

.tsr-assistant-msg-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  background: #0c1f3d;
  color: #fff;
  font-size: 0.55rem;
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 0.15rem;
}

.tsr-assistant-msg-body {
  padding: 0.6rem 0.75rem;
  font-size: 0.88rem;
  line-height: 1.45;
  max-width: calc(100% - 2.25rem);
}

.tsr-assistant-msg-body p {
  margin: 0 0 0.45rem;
}

.tsr-assistant-msg-body p:last-child {
  margin-bottom: 0;
}

.tsr-assistant-msg-body ul {
  margin: 0.35rem 0;
  padding-left: 1.1rem;
}

.tsr-assistant-links {
  list-style: none;
  margin: 0.35rem 0;
  padding: 0;
}

.tsr-assistant-links li {
  margin: 0.25rem 0;
}

.tsr-assistant-links a {
  color: #1a5fb4;
  font-weight: 600;
  text-decoration: none;
}

.tsr-assistant-links a:hover {
  text-decoration: underline;
}

.tsr-assistant-meta {
  color: #64748b;
  font-size: 0.8rem;
}

.tsr-assistant-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0.5rem 0.75rem 0;
  background: #f6f8fb;
}

.tsr-assistant-chip {
  border: 1px solid #c8d4e6;
  background: #fff;
  color: #0c1f3d;
  border-radius: 999px;
  padding: 0.3rem 0.65rem;
  font: inherit;
  font-size: 0.75rem;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease;
}

.tsr-assistant-chip:hover {
  background: #eef4fc;
  border-color: #1a5fb4;
}

.tsr-assistant-form {
  display: flex;
  gap: 0.4rem;
  padding: 0.65rem 0.75rem 0.75rem;
  background: #fff;
  border-top: 1px solid #e4e9f0;
}

.tsr-assistant-input {
  flex: 1;
  min-width: 0;
  border: 1px solid #c8d4e6;
  border-radius: 10px;
  padding: 0.55rem 0.7rem;
  font: inherit;
  font-size: 0.88rem;
}

.tsr-assistant-input:focus {
  outline: 2px solid #1a5fb4;
  outline-offset: 1px;
  border-color: #1a5fb4;
}

.tsr-assistant-send {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border: none;
  border-radius: 10px;
  background: #1a5fb4;
  color: #fff;
  cursor: pointer;
  flex-shrink: 0;
}

.tsr-assistant-send:hover {
  background: #0c1f3d;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 480px) {
  .tsr-assistant {
    right: 0.75rem;
    bottom: 0.75rem;
  }

  .tsr-assistant-launcher-text {
    display: none;
  }

  .tsr-assistant-launcher {
    width: 3.25rem;
    height: 3.25rem;
    padding: 0;
    justify-content: center;
    border-radius: 50%;
  }

  .tsr-assistant-panel {
    width: calc(100vw - 1.5rem);
    max-height: calc(100vh - 5rem);
  }
}

@media (prefers-reduced-motion: reduce) {
  .tsr-assistant-launcher {
    transition: none;
  }
}
