/* Pokalbių valdiklis */
.chat-widget {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 10050;
  font-family: var(--fontas);
}

.chat-launcher {
  width: 56px;
  height: 56px;
  border: none;
  border-radius: 50%;
  background: var(--spalva-akcentas);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 8px 24px var(--spalva-seselis-stiprus);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--perėjimas);
}

.chat-launcher:hover,
.chat-launcher:focus-visible {
  background: var(--spalva-akcentas-tamsus);
  transform: translateY(-2px);
}

.chat-panel {
  position: absolute;
  right: 0;
  bottom: 72px;
  width: min(380px, calc(100vw - 40px));
  max-height: min(520px, calc(100vh - 120px));
  background: #fff;
  border: 1px solid var(--spalva-riba);
  border-radius: var(--radius);
  box-shadow: 0 16px 48px var(--spalva-seselis-stiprus);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(16px) scale(0.96);
  transition: all 0.35s ease;
  pointer-events: none;
}

.chat-panel--open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: var(--spalva-akcentas);
  color: #fff;
}

.chat-header h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
}

.chat-close {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  cursor: pointer;
  font-size: 1rem;
  transition: all var(--perėjimas);
}

.chat-close:hover {
  background: rgba(255, 255, 255, 0.28);
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--spalva-fonas-svelnus);
  min-height: 200px;
}

.chat-msg {
  max-width: 88%;
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 0.9rem;
  line-height: 1.5;
}

.chat-msg--user {
  align-self: flex-end;
  background: var(--spalva-akcentas);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.chat-msg--bot {
  align-self: flex-start;
  background: #fff;
  border: 1px solid var(--spalva-riba);
  color: var(--spalva-tekstas);
  border-bottom-left-radius: 4px;
}

.chat-msg--bot a {
  color: var(--spalva-akcentas);
  font-weight: 600;
}

.chat-msg--bot ul {
  margin: 8px 0 0;
  padding-left: 20px;
}

.chat-form {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--spalva-riba);
  background: #fff;
}

.chat-form input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid var(--spalva-riba);
  border-radius: var(--radius);
  font-family: var(--fontas);
  font-size: 0.9rem;
}

.chat-form input:focus {
  outline: none;
  border-color: var(--spalva-akcentas);
  box-shadow: 0 0 0 3px rgba(45, 90, 61, 0.15);
}

.chat-send {
  padding: 10px 16px;
  font-size: 0.85rem;
}

.chat-typing span {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin: 0 2px;
  background: var(--spalva-tekstas-svelnus);
  border-radius: 50%;
  animation: chat-typing 1.2s infinite ease-in-out;
}

.chat-typing span:nth-child(2) {
  animation-delay: 0.15s;
}

.chat-typing span:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes chat-typing {
  0%,
  80%,
  100% {
    opacity: 0.3;
    transform: translateY(0);
  }

  40% {
    opacity: 1;
    transform: translateY(-4px);
  }
}

.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) {
  .chat-widget {
    right: 12px;
    bottom: 12px;
  }

  .chat-panel {
    position: fixed;
    inset: 0;
    width: 100%;
    max-height: 100%;
    border-radius: 0;
    bottom: 0;
    transform: translateY(100%);
  }

  .chat-panel--open {
    transform: translateY(0);
  }

  .chat-launcher {
    position: fixed;
    right: 12px;
    bottom: 12px;
    z-index: 1;
  }
}
