/* ── Kalar Widget ─────────────────────────────────────────── */
#kalar-widget {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
  font-family: inherit;
}

#kalar-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #0a1628;
  color: #c9a84c;
  border: 2px solid #c9a84c;
  border-radius: 28px;
  padding: 10px 18px 10px 14px;
  cursor: pointer;
  font-weight: 700;
  font-size: 14px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.25);
  transition: transform 0.15s, box-shadow 0.15s;
  letter-spacing: 0.02em;
}
#kalar-toggle:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,0.3); }
#kalar-toggle:focus-visible { outline: 2px solid #c9a84c; outline-offset: 3px; }

#kalar-panel {
  display: none;
  flex-direction: column;
  width: 350px;
  height: 500px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.22);
  overflow: hidden;
}
#kalar-panel.open { display: flex; animation: kalar-up 0.22s ease; }

@keyframes kalar-up {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

#kalar-header {
  background: #0a1628;
  color: #fff;
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.03em;
  flex-shrink: 0;
}

#kalar-close {
  background: none;
  border: none;
  color: rgba(255,255,255,0.7);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  padding: 2px 4px;
  transition: color 0.15s;
}
#kalar-close:hover { color: #fff; }

#kalar-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}

.kalar-msg {
  max-width: 82%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.55;
  word-break: break-word;
}
.kalar-msg--user      { align-self: flex-end; background: #0a1628; color: #fff; border-bottom-right-radius: 4px; }
.kalar-msg--assistant { align-self: flex-start; background: #f0f2f5; color: #1a1a2e; border-bottom-left-radius: 4px; }

#kalar-typing {
  padding: 4px 16px 10px;
  display: flex;
  gap: 5px;
  align-items: center;
  flex-shrink: 0;
}
.kalar-typing-dot {
  width: 8px;
  height: 8px;
  background: #c9a84c;
  border-radius: 50%;
  animation: kalar-bounce 1.2s infinite ease-in-out;
}
.kalar-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.kalar-typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes kalar-bounce {
  0%, 80%, 100% { transform: scale(0.55); opacity: 0.35; }
  40%           { transform: scale(1);    opacity: 1; }
}

#kalar-input-area {
  display: flex;
  border-top: 1px solid #e8e8e8;
  padding: 10px 12px;
  gap: 8px;
  flex-shrink: 0;
}
#kalar-input {
  flex: 1;
  border: 1px solid #ddd;
  border-radius: 20px;
  padding: 8px 14px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s;
  font-family: inherit;
}
#kalar-input:focus { border-color: #c9a84c; }
#kalar-input:disabled { opacity: 0.5; }

#kalar-send {
  background: #c9a84c;
  border: none;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  flex-shrink: 0;
  transition: background 0.15s;
}
#kalar-send:hover    { background: #b8933e; }
#kalar-send:disabled { opacity: 0.45; cursor: not-allowed; }

@media (max-width: 480px) {
  #kalar-panel  { position: fixed; inset: 0; width: 100%; height: 100%; border-radius: 0; }
  #kalar-widget { bottom: 16px; right: 16px; }
  .kalar-label  { display: none; }
  #kalar-toggle { border-radius: 50%; padding: 13px; width: 50px; height: 50px; justify-content: center; }
}
