/* =========================================================
   chatbot.css – AI chat widget (Karczagi General)
   ========================================================= */

#kg-chat-bubble{
  position: fixed;
  right: 20px;
  bottom: 20px;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: var(--gold, #c8a44d);
  color: #0b0b0d;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-soft, 0 14px 40px rgba(0,0,0,.35));
  z-index: 9998;
  transition: transform .16s ease, box-shadow .16s ease;
}
#kg-chat-bubble:hover{ transform: translateY(-2px); box-shadow: 0 18px 48px rgba(0,0,0,.45); }
#kg-chat-bubble svg{ width: 26px; height: 26px; }
#kg-chat-bubble .kg-chat-bubble__icon--close{ display: none; }
#kg-chat-bubble.is-open .kg-chat-bubble__icon--open{ display: none; }
#kg-chat-bubble.is-open .kg-chat-bubble__icon--close{ display: block; }

#kg-chat-window{
  position: fixed;
  right: 20px;
  bottom: 90px;
  width: min(380px, calc(100vw - 24px));
  max-height: min(600px, calc(100vh - 120px));
  border-radius: 20px;
  border: 1px solid var(--border, rgba(255,255,255,.12));
  background: rgba(11,15,20,.96);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 30px 90px rgba(0,0,0,.55);
  z-index: 9998;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(14px) scale(.98);
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
}
#kg-chat-window.is-open{
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

#kg-chat-header{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border, rgba(255,255,255,.12));
  flex-shrink: 0;
}
#kg-chat-header__title{
  font-family: "Cinzel","Inter",sans-serif;
  font-weight: 700;
  font-size: .95rem;
  color: rgba(245,238,220,.96);
  letter-spacing: .2px;
}
#kg-chat-header__sub{
  font-size: .74rem;
  color: rgba(74,222,128,.9);
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: 5px;
}
#kg-chat-header__sub::before{
  content: "";
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 0 0 rgba(74,222,128,.6);
  animation: kgChatPulse 2s infinite;
  flex-shrink: 0;
}
@keyframes kgChatPulse{
  0%   { box-shadow: 0 0 0 0 rgba(74,222,128,.6); }
  70%  { box-shadow: 0 0 0 6px rgba(74,222,128,0); }
  100% { box-shadow: 0 0 0 0 rgba(74,222,128,0); }
}
#kg-chat-close{
  width: 30px; height: 30px;
  border-radius: 8px;
  border: 1px solid var(--border, rgba(255,255,255,.12));
  background: rgba(255,255,255,.05);
  color: rgba(245,238,220,.9);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background .15s ease;
}
#kg-chat-close:hover{ background: rgba(255,255,255,.1); }
#kg-chat-close svg{ width: 15px; height: 15px; }

#kg-chat-messages{
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  min-height: 220px;
}

.kg-msg{
  max-width: 82%;
  padding: .6rem .8rem;
  border-radius: 16px;
  font-size: .85rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}
.kg-msg--bot{
  align-self: flex-start;
  background: var(--surface, rgba(255,255,255,.06));
  border: 1px solid var(--border, rgba(255,255,255,.12));
  color: var(--text, #e8eaed);
  border-bottom-left-radius: 4px;
}
.kg-msg--user{
  align-self: flex-end;
  background: var(--gold, #c8a44d);
  color: #0b0b0d;
  border-bottom-right-radius: 4px;
  font-weight: 500;
}
.kg-msg--error{
  align-self: flex-start;
  background: rgba(248,113,113,.1);
  border: 1px solid rgba(248,113,113,.3);
  color: rgba(245,238,220,.92);
  border-bottom-left-radius: 4px;
}
.kg-msg--error a{ color: var(--gold, #c8a44d); }

.kg-chat-typing{
  align-self: flex-start;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: .7rem .9rem;
  border-radius: 16px;
  border-bottom-left-radius: 4px;
  background: var(--surface, rgba(255,255,255,.06));
  border: 1px solid var(--border, rgba(255,255,255,.12));
}
.kg-chat-typing span{
  width: 6px; height: 6px;
  border-radius: 50%;
  background: rgba(234,240,246,.55);
  animation: kgChatTyping 1s infinite ease-in-out;
}
.kg-chat-typing span:nth-child(2){ animation-delay: .15s; }
.kg-chat-typing span:nth-child(3){ animation-delay: .3s; }
@keyframes kgChatTyping{
  0%, 60%, 100% { transform: translateY(0); opacity: .5; }
  30% { transform: translateY(-3px); opacity: 1; }
}

.kg-chat-quickreplies{
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 14px 12px;
}
.kg-chat-quickreply{
  font-size: .76rem;
  padding: .4rem .75rem;
  border-radius: 100px;
  border: 1px solid var(--border, rgba(255,255,255,.12));
  background: rgba(255,255,255,.04);
  color: var(--muted, rgba(234,240,246,.72));
  cursor: pointer;
  transition: border-color .15s ease, color .15s ease, background .15s ease;
}
.kg-chat-quickreply:hover{
  border-color: var(--gold, #c8a44d);
  color: var(--gold, #c8a44d);
  background: rgba(200,164,77,.08);
}

#kg-chat-form{
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--border, rgba(255,255,255,.12));
  flex-shrink: 0;
}
#kg-chat-input{
  flex: 1;
  resize: none;
  max-height: 90px;
  min-height: 38px;
  padding: .55rem .75rem;
  border-radius: 12px;
  border: 1px solid var(--border, rgba(255,255,255,.12));
  background: rgba(255,255,255,.05);
  color: var(--text, #e8eaed);
  font-family: "Inter", system-ui, sans-serif;
  font-size: .85rem;
  line-height: 1.4;
}
#kg-chat-input:focus{
  outline: none;
  border-color: var(--gold, #c8a44d);
  background: rgba(200,164,77,.04);
}
#kg-chat-send{
  width: 38px; height: 38px;
  flex-shrink: 0;
  border-radius: 10px;
  border: none;
  background: var(--gold, #c8a44d);
  color: #0b0b0d;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: filter .15s ease, opacity .15s ease;
}
#kg-chat-send:hover{ filter: brightness(1.08); }
#kg-chat-send:disabled{ opacity: .5; cursor: not-allowed; }
#kg-chat-send svg{ width: 17px; height: 17px; }

#kg-chat-hint{
  font-size: .7rem;
  color: rgba(234,240,246,.62);   /* mert: .4 -> 3,47:1 (bukott), .62 -> 5,3:1 */
  text-align: center;
  padding: 0 14px 10px;
}

/* ===== Mobil – ütközés elkerülése a sticky CTA sávval ===== */
@media (max-width: 768px){
  #kg-chat-bubble{
    right: 16px;
    bottom: calc(68px + 14px + env(safe-area-inset-bottom, 0px));
    width: 54px;
    height: 54px;
  }
  #kg-chat-window{
    right: 12px;
    left: 12px;
    width: auto;
    bottom: calc(68px + 14px + env(safe-area-inset-bottom, 0px));
    max-height: min(70vh, calc(100vh - 68px - 100px));
  }
}
