/* Налоговый Лоцман — Web-виджет чата v9_0
 * Совпадает с палитрой landing v8 (--primary, --bg-dark, --text, и т.д.)
 */

/* ── Overlay ─────────────────────────────────────── */
.tlw-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 9998;
}
.tlw-open .tlw-overlay { display: block; }

/* ── Panel ───────────────────────────────────────── */
.tlw-panel {
  display: none;
  flex-direction: column;
  position: fixed;
  bottom: 96px;
  right: 24px;
  width: 400px;
  max-width: calc(100vw - 32px);
  height: 560px;
  max-height: calc(100vh - 120px);
  background: #1e293b;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 40px rgba(99, 102, 241, 0.15);
  z-index: 9999;
  overflow: hidden;
  animation: tlw-slide-up 0.3s ease;
}
.tlw-open .tlw-panel { display: flex; }

@keyframes tlw-slide-up {
  from { opacity: 0; transform: translateY(20px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ── Header ──────────────────────────────────────── */
.tlw-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  color: #fff;
}
.tlw-header-info { display: flex; align-items: center; gap: 12px; }
.tlw-avatar {
  width: 40px;
  height: 40px;
  background: rgba(255,255,255,0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}
.tlw-title { font-weight: 600; font-size: 15px; }
.tlw-status { font-size: 12px; opacity: 0.85; }
.tlw-close {
  background: rgba(255,255,255,0.15);
  border: none;
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}
.tlw-close:hover { background: rgba(255,255,255,0.25); }

/* ── Messages ────────────────────────────────────── */
.tlw-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.tlw-msg {
  max-width: 85%;
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.5;
  word-break: break-word;
}
.tlw-msg--bot {
  align-self: flex-start;
  background: #0f172a;
  color: #e2e8f0;
  border-bottom-left-radius: 4px;
}
.tlw-msg--user {
  align-self: flex-end;
  background: #6366f1;
  color: #fff;
  border-bottom-right-radius: 4px;
}
.tlw-msg--loading {
  padding: 16px 20px;
}
.tlw-source {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(255,255,255,0.1);
  font-size: 12px;
  color: #94a3b8;
}

/* ── Typing dots ─────────────────────────────────── */
.tlw-dots { display: flex; gap: 4px; }
.tlw-dots span {
  width: 8px;
  height: 8px;
  background: #94a3b8;
  border-radius: 50%;
  animation: tlw-bounce 1.4s infinite ease-in-out;
}
.tlw-dots span:nth-child(2) { animation-delay: 0.16s; }
.tlw-dots span:nth-child(3) { animation-delay: 0.32s; }
@keyframes tlw-bounce {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

/* ── Input area ──────────────────────────────────── */
.tlw-input-area {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid rgba(255,255,255,0.1);
  background: #1e293b;
}
#tlw-input {
  flex: 1;
  background: #0f172a;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  padding: 10px 14px;
  color: #e2e8f0;
  font-size: 14px;
  font-family: inherit;
  resize: none;
  outline: none;
  transition: border-color 0.2s;
}
#tlw-input:focus {
  border-color: #6366f1;
}
#tlw-input::placeholder { color: #64748b; }

.tlw-send {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: #6366f1;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, transform 0.1s;
  flex-shrink: 0;
}
.tlw-send:hover { background: #4f46e5; }
.tlw-send:active { transform: scale(0.95); }

/* ── Footer ──────────────────────────────────────── */
.tlw-footer {
  padding: 6px 16px;
  text-align: center;
  font-size: 11px;
  color: #64748b;
  background: #1e293b;
}

/* ── FAB (Floating Action Button) ────────────────── */
.tlw-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  min-width: 64px;
  height: 56px;
  padding: 0 22px;
  border-radius: 28px;
  border: none;
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(99, 102, 241, 0.4);
  z-index: 9997;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: transform 0.2s, box-shadow 0.2s;
}
.tlw-fab:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 28px rgba(99, 102, 241, 0.5);
}
.tlw-fab-icon { font-size: 26px; line-height: 1; }
.tlw-fab-label {
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  color: #fff;
}
.tlw-open .tlw-fab { display: none; }

/* ── Hint bubble (притягивает внимание) ──────────── */
.tlw-hint {
  display: none;
  position: fixed;
  bottom: 96px;
  right: 24px;
  max-width: 300px;
  padding: 12px 16px;
  background: #0f172a;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  border-bottom-right-radius: 4px;
  color: #e2e8f0;
  font-size: 13px;
  line-height: 1.45;
  cursor: pointer;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  z-index: 9996;
  animation: tlw-slide-up 0.4s ease 1.2s backwards;
}
.tlw-open .tlw-hint { display: none; }
#taxloc-widget:not(.tlw-open) .tlw-hint { display: block; }
.tlw-hint-hide { display: none !important; }
@media (max-width: 480px) {
  .tlw-hint { right: 16px; left: 16px; max-width: none; }
}

/* ── Pulse animation ─────────────────────────────── */
.tlw-fab-pulse { display: none; }
@keyframes tlw-pulse {
  0% { transform: scale(1); opacity: 1; }
  100% { transform: scale(1.8); opacity: 0; }
}

/* ── Mobile ──────────────────────────────────────── */
@media (max-width: 480px) {
  .tlw-panel {
    bottom: 0;
    right: 0;
    width: 100%;
    height: 100%;
    max-height: 100vh;
    border-radius: 0;
    max-width: 100%;
  }
  .tlw-fab { bottom: 16px; right: 16px; }
}
