/* ===================================================
   CHATBOT.CSS — Style widgetu chatbota
   =================================================== */

/* === FLOATING BUTTON === */
#chatbot-btn {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 200;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--color-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(44, 95, 138, 0.4);
  transition: transform 0.2s, box-shadow 0.2s, background 0.2s;
  user-select: none;
}

#chatbot-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 28px rgba(44, 95, 138, 0.5);
  background: var(--color-primary-dark);
}

#chatbot-btn:active {
  transform: scale(0.96);
}

/* Badge z liczbą nowych wiadomości */
#chatbot-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #EF4444;
  color: #fff;
  font-size: 0.75rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #fff;
  animation: pulseBadge 2s ease-in-out infinite;
}

@keyframes pulseBadge {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

/* === OKNO CHATBOTA === */
#chatbot-okno {
  position: fixed;
  bottom: 5.5rem;
  right: 1.5rem;
  z-index: 199;
  width: calc(100vw - 3rem);
  max-width: 380px;
  height: 520px;
  max-height: calc(100svh - 7rem);
  background: #fff;
  border-radius: var(--border-radius-lg);
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.18);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: slideUp 0.25s ease-out;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* === HEADER CHATBOTA === */
#chatbot-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  background: var(--color-primary);
  color: #fff;
  flex-shrink: 0;
}

#chatbot-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 1rem;
  flex-shrink: 0;
}

.chatbot-header-info {
  flex: 1;
  min-width: 0;
}

#chatbot-imie {
  font-weight: 600;
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#chatbot-status {
  font-size: 0.78rem;
  opacity: 0.8;
}

.chatbot-zamknij-btn {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.8);
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s, background 0.2s;
  flex-shrink: 0;
}

.chatbot-zamknij-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.15);
}

/* === OBSZAR WIADOMOŚCI === */
#chatbot-wiadomosci {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
  scroll-behavior: smooth;
}

/* Scrollbar */
#chatbot-wiadomosci::-webkit-scrollbar {
  width: 4px;
}
#chatbot-wiadomosci::-webkit-scrollbar-track {
  background: transparent;
}
#chatbot-wiadomosci::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.15);
  border-radius: 2px;
}

/* Bąbelki wiadomości */
.chatbot-babelka {
  max-width: 82%;
  padding: 0.625rem 0.875rem;
  border-radius: 16px;
  font-size: 0.9rem;
  line-height: 1.55;
  word-break: break-word;
}

.chatbot-babelka.user {
  align-self: flex-end;
  background: var(--color-primary);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.chatbot-babelka.assistant {
  align-self: flex-start;
  background: #F3F4F6;
  color: var(--color-text-dark);
  border-bottom-left-radius: 4px;
}

.chatbot-babelka.blad {
  background: #FEF2F2;
  color: #DC2626;
  border: 1px solid #FECACA;
}

/* Animacja "pisze..." */
.chatbot-typing {
  align-self: flex-start;
  background: #F3F4F6;
  border-radius: 16px;
  border-bottom-left-radius: 4px;
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  gap: 5px;
}

.typing-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--color-text-muted);
  animation: typing 1.2s ease-in-out infinite;
}

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

@keyframes typing {
  0%, 80%, 100% {
    transform: translateY(0);
    opacity: 0.4;
  }
  40% {
    transform: translateY(-5px);
    opacity: 1;
  }
}

/* === INPUT OBSZAR === */
#chatbot-input-obszar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 0.875rem;
  border-top: 1px solid #E5E7EB;
  background: #fff;
  flex-shrink: 0;
}

#chatbot-input {
  flex: 1;
  padding: 0.625rem 0.875rem;
  border: 1.5px solid #D1D5DB;
  border-radius: 24px;
  font-size: 0.9rem;
  font-family: var(--font-main);
  color: var(--color-text-dark);
  background: #F9FAFB;
  outline: none;
  transition: border-color 0.2s;
}

#chatbot-input:focus {
  border-color: var(--color-primary);
  background: #fff;
}

#chatbot-input::placeholder {
  color: var(--color-text-muted);
}

#chatbot-wyslij {
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--color-primary);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, transform 0.1s;
}

#chatbot-wyslij:hover {
  background: var(--color-primary-dark);
  transform: scale(1.05);
}

#chatbot-wyslij:active {
  transform: scale(0.95);
}

#chatbot-wyslij:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* === RESPONSYWNOŚĆ === */
@media (max-width: 480px) {
  #chatbot-okno {
    right: 0.75rem;
    left: 0.75rem;
    width: auto;
    max-width: none;
    bottom: 5.25rem;
  }

  #chatbot-btn {
    right: 1rem;
    bottom: 1rem;
  }
}
