<style>
/* Osnovni kontejner i prelom redova */
.chat-message {
  white-space: pre-line;
}

#ba-widget-container {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  z-index: 99999;
  position: fixed;
  bottom: 20px;
  right: 20px;
}

/* Floating Dugme za otvaranje čata */
#ba-chat-btn {
  background: #20c997;
  color: #ffffff;
  border: none;
  padding: 12px 20px;
  border-radius: 30px;
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 15px rgba(32, 201, 151, 0.35);
  transition: all 0.2s ease;
}

#ba-chat-btn:hover {
  background: #1baa80;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(32, 201, 151, 0.45);
}

/* Prozor Čata (Desktop default) */
#ba-chat-box {
  display: none;
  flex-direction: column;
  width: 360px;
  height: 520px;
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  overflow: hidden;
  position: absolute;
  bottom: 0;
  right: 0;
  border: 1px solid #eef2f5;
}

/* Header (Zaglavlje) */
.ba-chat-header {
  background-color: #121921;
  color: #ffffff;
  border-bottom: 2px solid #20c997;
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.ba-header-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ba-header-title small {
  display: block;
  color: #94a3b8;
  font-size: 11px;
}

.ba-chat-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #20c997;
  display: inline-block;
}

#ba-close-btn {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 24px;
  cursor: pointer;
  line-height: 1;
  transition: color 0.2s ease;
}

#ba-close-btn:hover {
  color: #ffffff;
}

/* Kontejner za poruke */
#ba-chat-messages {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  background: #f8fafc;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Oblačići poruka */
.ba-msg {
  max-width: 82%;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.45;
  word-wrap: break-word;
  white-space: pre-line; /* Dodato i na nivo poruke radi pouzdanosti */
}

/* Bot poruka - Svetlo siva sa finom ivicom */
.ba-msg.ba-bot {
  background-color: #ffffff;
  color: #1e293b;
  align-self: flex-start;
  border: 1px solid #e2e8f0;
  border-bottom-left-radius: 2px;
}

/* User poruka - Brendirana zelena sa sajta */
.ba-msg.ba-user {
  background-color: #20c997;
  color: #ffffff;
  align-self: flex-end;
  border-bottom-right-radius: 2px;
}

/* Input Polje */
#ba-chat-input-container {
  padding: 12px;
  background: #ffffff;
  border-top: 1px solid #e2e8f0;
  display: flex;
  gap: 8px;
  align-items: center;
}

#ba-chat-input {
  flex: 1;
  border: 1px solid #cbd5e1;
  padding: 10px 14px;
  border-radius: 20px;
  outline: none;
  font-size: 14px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

#ba-chat-input:focus {
  border-color: #20c997;
  box-shadow: 0 0 0 3px rgba(32, 201, 151, 0.15);
}

/* Taster za slanje */
#ba-send-btn {
  background: #20c997;
  color: #ffffff;
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, transform 0.1s ease;
}

#ba-send-btn:hover {
  background: #1baa80;
  transform: scale(1.05);
}

#ba-send-btn:active {
  transform: scale(0.95);
}

/* Indikator kucanja */
.ba-typing {
  font-style: italic;
  color: #64748b;
  font-size: 12px;
}

/* OPTIMIZACIJA ZA MOBILNE TELEFONE */
@media (max-width: 480px) {
  /* Kontejner ostaje u donjem desnom uglu radi dugmeta */
  #ba-widget-container {
    position: fixed !important;
    bottom: 15px !important;
    right: 15px !important;
    top: auto !important;
    left: auto !important;
  }

  /* Sam prozor čata ide preko celog ekrana preko viewport-a */
  #ba-chat-box {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100dvh !important;
    max-width: 100% !important;
    max-height: 100% !important;
    border-radius: 0 !important;
    z-index: 999999 !important;
  }

  #ba-chat-messages {
    flex: 1 !important;
    overflow-y: auto !important;
  }

  #ba-chat-input-container {
    background: #ffffff !important;
    padding: 10px 12px 16px 12px !important;
    border-top: 1px solid #e2e8f0 !important;
    flex-shrink: 0 !important;
  }

  #ba-chat-input {
    font-size: 16px !important; /* Sprečava automatski zoom na mobilnom */
  }
}
</style>