/* AI Kids Cafe · public chat widget */

.aikc-chat-launcher {
  position: fixed; bottom: 22px; right: 22px;
  z-index: 9999;
  background: linear-gradient(135deg, var(--amber-500), var(--amber-400));
  color: #1b1300;
  border: 0;
  border-radius: 999px;
  padding: 12px 18px 12px 14px;
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-display); font-weight: 800; font-size: 0.95rem;
  cursor: pointer;
  box-shadow: 0 12px 28px rgba(245, 158, 11, 0.45), 0 4px 10px rgba(10, 15, 44, 0.15);
  transition: transform 160ms ease, box-shadow 160ms ease;
}
.aikc-chat-launcher:hover { transform: translateY(-2px); box-shadow: 0 16px 36px rgba(245, 158, 11, 0.55); }
.aikc-chat-launcher svg { color: #1b1300; }

.aikc-chat-panel {
  position: fixed; bottom: 90px; right: 22px;
  z-index: 9999;
  width: min(380px, calc(100vw - 36px));
  height: min(560px, calc(100vh - 120px));
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 24px 60px rgba(10, 15, 44, 0.25);
  display: none;
  flex-direction: column;
  overflow: hidden;
}
.aikc-chat-panel.open { display: flex; animation: aikc-chat-in 200ms ease-out; }

@keyframes aikc-chat-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.aikc-chat__header {
  background: linear-gradient(135deg, var(--ink-900), var(--ink-800));
  color: var(--white);
  padding: 14px 16px;
  display: flex; justify-content: space-between; align-items: center;
}
.aikc-chat__title { font-family: var(--font-display); font-weight: 800; font-size: 1rem; }
.aikc-chat__close {
  background: transparent; border: 0; color: var(--white);
  font-size: 1.6rem; line-height: 1; cursor: pointer; padding: 0 6px;
}
.aikc-chat__close:hover { color: var(--amber-400); }

.aikc-chat__list {
  flex: 1;
  padding: 14px;
  overflow-y: auto;
  background: var(--cream-50);
  display: flex; flex-direction: column; gap: 8px;
}
.aikc-chat__row { display: flex; }
.aikc-chat__row--user { justify-content: flex-end; }
.aikc-chat__row--assistant { justify-content: flex-start; }

.aikc-chat__bubble {
  max-width: 78%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 0.92rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.aikc-chat__row--user .aikc-chat__bubble {
  background: var(--amber-500);
  color: #1b1300;
  border-bottom-right-radius: 4px;
}
.aikc-chat__row--assistant .aikc-chat__bubble {
  background: var(--white);
  border: 1px solid var(--border);
  color: var(--ink-800);
  border-bottom-left-radius: 4px;
}
.aikc-chat__bubble--typing {
  display: inline-flex; gap: 4px; padding: 12px 14px;
}
.aikc-chat__bubble--typing span {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--ink-400);
  animation: aikc-typing 1.2s infinite ease-in-out;
}
.aikc-chat__bubble--typing span:nth-child(2) { animation-delay: 0.15s; }
.aikc-chat__bubble--typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes aikc-typing {
  0%, 80%, 100% { opacity: 0.25; transform: translateY(0); }
  40%           { opacity: 1;    transform: translateY(-3px); }
}

.aikc-chat__form {
  display: flex; gap: 8px;
  padding: 10px 12px;
  background: var(--white);
  border-top: 1px solid var(--border);
}
.aikc-chat__input {
  flex: 1;
  padding: 10px 12px;
  border: 1.5px solid var(--ink-200);
  border-radius: 10px;
  font: inherit;
  background: var(--white);
}
.aikc-chat__input:focus {
  outline: 0; border-color: var(--amber-500);
}
.aikc-chat__send {
  background: var(--ink-900);
  color: var(--white);
  border: 0; border-radius: 10px;
  padding: 0 14px;
  cursor: pointer;
  display: grid; place-items: center;
}
.aikc-chat__send:disabled { opacity: 0.5; cursor: not-allowed; }
.aikc-chat__send:hover:not(:disabled) { background: var(--amber-500); color: #1b1300; }

.aikc-chat__foot {
  margin: 0; padding: 8px 14px 12px;
  font-size: 0.72rem; color: var(--ink-500);
  background: var(--white);
  text-align: center;
}

@media (prefers-reduced-motion: reduce) {
  .aikc-chat-panel.open { animation: none; }
  .aikc-chat__bubble--typing span { animation: none; opacity: 0.6; }
}
