/* --- Celý chat box jako flex-container --- */
/* skryjeme tlačítka Zavřít a Nový chat dokud není chat otevřený */
#chatbot-float-close,
#chatbot-reset-chat {
  display: none;
}

.input-row {
  display: flex;
  width: 100%;
  align-items: flex-end; 
position: relative;
  overflow: visible;  
}
#chat-input {
  flex: 1 1 0%;
  margin: 0;
  padding: 0.5rem 3rem 0.5rem 0.5rem;
  background-color: #fff; /* bílé pozadí */
  border-top: 1px solid #f0f0f0; /* tmavě šedý horní okraj */
  border-left: none;
  border-right: none;
  min-height: 2.5rem;
  max-height: 6rem;
  resize: vertical;
  overflow-y: auto;
  white-space: pre-wrap;
  word-wrap: break-word;
  box-sizing: border-box;
  min-width: 100%;
  width: 100%;
}

#chat-send {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  width: 24px;
  height: 24px;
  padding: 0;
  margin: 0;
  background: none;
  border: none;
  cursor: pointer;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
}

#chat-send img {
  display: block;
  width: 50px;
  height: 50px;
}

#ai-chatbot-box {
  display: flex;
  flex-direction: column;
  height: 100%;            /* nebo: 100% rodiče */
  width: 100%;
  max-width: 400px;
  border: 1px solid #ccc;
  background: #fff;
}

/* --- Výstup zpráv se scrolluje --- */
#chat-output {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  margin-bottom: 10px;
  margin-top: 10px;
}

/* --- Typing indicator (tři blikající tečky) --- */
#typing-indicator {
  display: flex;
  align-items: center;
  padding: 0.5rem 1rem;
}
.typing-indicator .dot {
  width: 8px;
  height: 8px;
  margin: 0 4px;
  border-radius: 50%;
  background-color: #999;
  opacity: 0.4;
  animation: blink 1s infinite;
}
.typing-indicator .dot1 { animation-delay: 0s; }
.typing-indicator .dot2 { animation-delay: 0.2s; }
.typing-indicator .dot3 { animation-delay: 0.4s; }

@keyframes blink {
  0%, 80%, 100% { opacity: 0.4; }
  40%           { opacity: 1;   }
}

/* --- Základní styl zpráv a jejich zalamování --- */
.user-msg,
.bot-msg {
  max-width: 75%;
  margin: 0.5rem;
  padding: 0.5rem 0.95rem;
  border-radius: 2rem;
  color: #000;
  overflow-wrap: break-word;
  word-wrap: break-word;
  word-break: break-word;
  line-height: 20px!important;
  font-size: 14px!important;
  font-weight: 400;
  font-family: "Segoe UI", Tahoma, Arial, sans-serif;
}

/* Uživatelská zpráva vlevo */
.user-msg {
//  background-color: #87b725;
  text-align: left;
  align-self: flex-start;
}

/* Asistentova zpráva vpravo */
.bot-msg {
  background-color: #f5f5f5;
  text-align: right;
  align-self: flex-end;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  position: relative;
}
.bot-msg .bot-text {
  margin-right: 0.5rem;
}
.bot-msg .bot-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
}




/* Tlačítko Nový chat (100% šířky pod input) */
#chatbot-reset-chat {
    position: absolute;
  top: -50px;         /* vyneseš ho nad horní hranu chat-boxu */
  right: 60px;  
  padding: 4px 15px!important; 
  font-size: 14px;
  background: none;
  border: none;
  color: #292929;
  cursor: pointer;
  border-radius: 15px;
  transition: background 0.2s, color 0.2s;
  margin-left: 0;          /* zrušit předchozí odsazení */
  z-index: 100000;
  font-weight: 400;
  background-color: #f0f0f0;
}
#chatbot-reset-chat:hover {
  color: #c00!important;
  background: #ffeaea!important;
}

/* --- Textový odkaz pro operátora --- */
#chat-operator-link {
  padding: 0.5rem 0;
  text-align: center;
  background-color: #f5f5f5;
  font-family: "Segoe UI", Tahoma, Arial, sans-serif;
  font-size:14px;
}
#chat-operator-link a {
  color: #1d1d1d;
  text-decoration: underline;
  cursor: pointer;
}
#chat-operator-link a:hover {
  color: #1d1d1d;
  text-decoration: underline;
}

/* --- Postranní tlačítko pro operátora --- */
.chatbot-operator-btn {
  position: fixed;
  bottom: 100px;
  right: 30px;
  z-index: 9999;
  background: #ff8000;
  color: white;
  border: none;
  border-radius: 20px;
  padding: 10px 20px;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
  font-weight: bold;
  font-size: 14px;
  font-family: "Segoe UI", Tahoma, Arial, sans-serif; 
}

/* --- Modal pro operátora --- */
.chatbot-operator-modal {
  position: fixed;
  z-index: 10000;
  left: 0; top: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
}
.chatbot-operator-modal-content {
  background: #fff;
  padding: 24px;
  border-radius: 12px;
  min-width: 300px;
  max-width: 90vw;
  box-shadow: 0 4px 24px rgba(0,0,0,0.18);
  position: relative;
}
#chatbot-operator-modal-close {
  position: absolute;
  right: 12px;
  top: 10px;
  font-size: 22px;
  cursor: pointer;
}

#chatbot-float-toggle {
  position: fixed;
  right: 32px;
  bottom: 32px;
  z-index: 100000; /* nad chatboxem */
  width: 56px;
  height: 56px;
  background: none;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 24px rgba(0,0,0,0.15);
  border-radius: 50%;
  padding: 0;
  transition: box-shadow 0.2s;
}

/* Tento wrapper už klidně ani nemusí být, ale pokud ano: */
#chatbot-floating-wrapper {
  position: fixed;
  right: 10px;
  bottom: 30px; /* posune chat výš pod tlačítko */
  z-index: 99999;
    overflow: visible;      /* aby tlačítko “přečnívalo” ven */

}


/* Chat box – hlavní úprava je tady: změnit na FIXED */
#chatbot-floating-box {
  position: relative; /* ‹ TADY JE TO KLÍČOVÉ! */
  right: 10px;
  bottom: 10px;
  width: 380px;
  max-width: 96vw;
  height: 80vh;
  max-height: 80vh;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.22);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: chatbotFadeIn 0.33s;
  z-index: 99999; /* nižší než tlačítko */
}

/* Mobilní přizpůsobení */
@media (max-width: 768px) {
  #chatbot-floating-wrapper {
    right: 0;
    left: 0;
  }

  #chatbot-floating-box {
    width: calc(100% - 20px); /* 100% minus 2x10px mezera */
    margin: 0 auto;
    right: auto;
    left: auto;
  }
}

@keyframes chatbotFadeIn {
  from { opacity: 0; transform: translateY(30px); }
  to   { opacity: 1; transform: translateY(0);  }
}

#chatbot-float-close {
  position: absolute;
  top: -50px;
  right: 20px;
  width: 30px;
  height: 30px;
  padding: 0;
  background-color: #757575;
  border: 1px solid #757575;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #fff;               /* barva „čar“ v SVG */
  transition: background-color .2s, color .2s, border-color .2s;
}

#chatbot-float-close:hover {
  background-color: #fff;
  border-color: #292929;
  color: #292929!important;
}


/* --- Tlačítko resetování chatu (bez margin-left) --- */
.chatbot-reset-btn {
  background: none; 
  border: none;
  color: #FFF;
  cursor: pointer;
  font-size: 14px!important;
  font-family: "Segoe UI", Tahoma, Arial, sans-serif; 
  
  border-radius: 5px; 
  margin-left: 0;
  transition: background 0.2s, color 0.2s;
}
.chatbot-reset-btn:hover { 

color: #292929; 
background: #ffeaea; 
}


 /* pokud je wrapper zavřený, skryjeme close i reset */
#chatbot-floating-wrapper.chat-closed #chatbot-float-close,
#chatbot-floating-wrapper.chat-closed #chatbot-reset-chat {
  display: none;
}

#chatbot-operator-send {
 
 background-color: #FFF;
 border-radius: 15px;
 color: #292929;
 border: 1px solid #292929;
 cursor: pointer!important;
}

#chatbot-operator-send:hover {
 background-color: #757575;
 border-radius: 15px;
 color: #FFF;
 border: 1px solid #757575;
}

/* nejdřív zajistíme, že uvnitř float-toggle div má přechody */
#chatbot-float-toggle > div {
  transition: 
    transform 0.5s ease,        /* pro škálování/rotaci */
    background-color 0.5s ease;  /* pokud by se měnila barva pozadí */
}

/* animace při najetí myší */
#chatbot-float-toggle:hover > div {
  transform: scale(1.1);
}

/* a přechod barvy ikonky SVG, pokud chcete i změnu barvy */
#chatbot-float-toggle > div svg {
  transition: fill 0.5s ease;
}
#chatbot-float-toggle:hover > div svg {
  fill: #000; /* nebo jiná kontrastní barva */
}

/* --- Přesunutí avatara nad bublinu a roztažení textu --- */
.bot-msg {
  /* přidáme horní odsazení pro prostor nad bublinou */
  padding-top: 10px;
  padding-bottom: 10px;
  margin-top:30px;
  /* zrušíme flex, aby text mohl zabrat 100 % šířky */
  display: block;
}

.bot-msg .bot-text {
  /* textová část je block-level a zabere celou šířku */
  display: block;
  width: 100%;
  margin: 0;              /* odstraníme pravé odsazení, které dělalo místo ikoně */
  text-align: right;      /* pokud chcete text stále zarovnaný doprava */
}

.bot-msg .bot-avatar {
  /* absolutní pozice relativně k .bot-msg */
  position: absolute;
  top: -30px;             /* vysune avatar ven z bubliny */
  right: 12px;            /* odsazení odpovídá paddingu bubliny */
  width: 25px;
  height: 25px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid #ccc; /* volitelně rámeček */
  background: #fff;       /* volitelně bílé pozadí */
  z-index: 1;             /* nad textem */
  
}



/* —————————————————————————————————————————
   Globální velikost písma a font pro všechna input/textarea
   uvnitř chatovacího pluginu
   ————————————————————————————————————————— */
#ai-chatbot-box input,
#ai-chatbot-box textarea,
.chatbot-operator-modal-content input,
.chatbot-operator-modal-content textarea {
  font-size: 14px;               
  font-family: "Segoe UI", Tahoma, Arial, sans-serif;
  line-height: 1.4;
  
}

/* Placeholder stejným fontem */
#ai-chatbot-box input::placeholder,
#ai-chatbot-box textarea::placeholder,
.chatbot-operator-modal-content input::placeholder,
.chatbot-operator-modal-content textarea::placeholder {
  font-size: 14px;
  font-family: inherit;
  color: #888;
}

