/* TLive Education / TIME Soft Solution — marketing-site chat widget */
.ts-chat-root {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 2147483000;
  font-family: var(--ts-font, "Segoe UI", system-ui, -apple-system, Roboto, sans-serif);
}

.ts-chat-launcher {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  border: none;
  background: var(--ts-blue, #1a4a7a);
  color: #fff;
  font-size: 1.4rem;
  box-shadow: 0 8px 24px rgba(10, 22, 40, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
  position: relative;
}

.ts-chat-launcher:hover {
  background: var(--ts-blue-light, #3d8fd9);
  transform: scale(1.05);
}

.ts-chat-launcher__badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--ts-accent, #e85d4c);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

.ts-chat-panel {
  position: absolute;
  right: 0;
  bottom: 72px;
  width: 340px;
  max-width: calc(100vw - 32px);
  max-height: min(520px, calc(100vh - 110px));
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 16px 48px rgba(10, 22, 40, 0.28);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--ts-border, #d8e0ea);
}

.ts-chat-panel[hidden] {
  display: none;
}

.ts-chat-panel__header {
  background: var(--ts-navy, #0a1628);
  color: #fff;
  padding: 0.85rem 1rem;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
}

.ts-chat-panel__title {
  font-weight: 700;
  font-size: 1rem;
}

.ts-chat-panel__subtitle {
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.72);
  margin-top: 2px;
}

.ts-chat-panel__close {
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.85);
  font-size: 1rem;
  cursor: pointer;
  line-height: 1;
  padding: 2px;
}

.ts-chat-panel__close:hover {
  color: #fff;
}

.ts-chat-panel__body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  background: #f6f8fb;
  min-height: 180px;
}

.ts-chat-msg {
  max-width: 85%;
  padding: 0.55rem 0.75rem;
  border-radius: 12px;
  font-size: 0.9rem;
  line-height: 1.4;
  white-space: pre-wrap;
  word-break: break-word;
}

.ts-chat-msg--bot {
  align-self: flex-start;
  background: #fff;
  border: 1px solid var(--ts-border, #d8e0ea);
  color: var(--ts-text, #1e293b);
}

.ts-chat-msg--user {
  align-self: flex-end;
  background: var(--ts-blue, #1a4a7a);
  color: #fff;
}

.ts-chat-msg--error {
  align-self: flex-start;
  background: #fdecea;
  border: 1px solid #f5c2bd;
  color: #8a2e24;
}

.ts-chat-msg--typing {
  align-self: flex-start;
  display: flex;
  gap: 4px;
  padding: 0.6rem 0.85rem;
}

.ts-chat-msg--typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ts-muted, #5c6b7a);
  opacity: 0.5;
  animation: tsChatBlink 1.2s infinite ease-in-out;
}

.ts-chat-msg--typing span:nth-child(2) { animation-delay: 0.15s; }
.ts-chat-msg--typing span:nth-child(3) { animation-delay: 0.3s; }

@keyframes tsChatBlink {
  0%, 80%, 100% { opacity: 0.35; }
  40% { opacity: 1; }
}

.ts-chat-panel__prompts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0 0.85rem 0.6rem;
  background: #f6f8fb;
}

.ts-chat-prompt {
  border: 1px solid var(--ts-border, #d8e0ea);
  background: #fff;
  color: var(--ts-blue, #1a4a7a);
  font-size: 0.78rem;
  border-radius: 999px;
  padding: 0.3rem 0.65rem;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.ts-chat-prompt:hover {
  background: var(--ts-blue, #1a4a7a);
  color: #fff;
}

.ts-chat-panel__form {
  display: flex;
  gap: 0.5rem;
  padding: 0.65rem;
  border-top: 1px solid var(--ts-border, #d8e0ea);
  background: #fff;
}

.ts-chat-panel__input {
  flex: 1 1 auto;
  border: 1px solid var(--ts-border, #d8e0ea);
  border-radius: 999px;
  padding: 0.5rem 0.9rem;
  font-size: 0.9rem;
  outline: none;
}

.ts-chat-panel__input:focus {
  border-color: var(--ts-blue-light, #3d8fd9);
  box-shadow: 0 0 0 3px rgba(61, 143, 217, 0.18);
}

.ts-chat-panel__send {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: var(--ts-accent, #e85d4c);
  color: #fff;
  cursor: pointer;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease;
}

.ts-chat-panel__send:hover {
  background: var(--ts-accent-hover, #d14a3a);
}

.ts-chat-panel__send:disabled,
.ts-chat-panel__input:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

@media (max-width: 480px) {
  .ts-chat-root {
    right: 12px;
    bottom: 12px;
  }

  .ts-chat-panel {
    width: calc(100vw - 24px);
    bottom: 68px;
  }
}
