/* Kod2Kids embeddable chat widget (WordPress plugin) */
.k2k-chat-root {
  --k2k-primary: #0d9488;
  --k2k-primary-dark: #0f766e;
  --k2k-accent: #f59e0b;
  --k2k-bg: #f0fdfa;
  --k2k-surface: #ffffff;
  --k2k-text: #134e4a;
  --k2k-muted: #5b7c78;
  --k2k-border: #99f6e4;
  --k2k-shadow: 0 12px 40px rgba(13, 148, 136, 0.22);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, sans-serif;
  font-size: 15px;
  line-height:1.45;
  box-sizing: border-box;
}
.k2k-chat-root *, .k2k-chat-root *::before, .k2k-chat-root *::after { box-sizing: inherit; }

.k2k-chat-launcher {
  position: fixed;
  z-index: 99998;
  bottom: 1.25rem;
  right: 1.25rem;
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  background: linear-gradient(145deg, var(--k2k-primary), var(--k2k-primary-dark));
  color: #fff;
  box-shadow: var(--k2k-shadow);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.k2k-chat-launcher:hover {
  transform: scale(1.06);
  box-shadow: 0 14px 44px rgba(13, 148, 136, 0.3);
}
.k2k-chat-launcher:focus-visible {
  outline: 3px solid var(--k2k-accent);
  outline-offset: 3px;
}
.k2k-chat-launcher svg { width: 1.65rem; height: 1.65rem; }

.k2k-chat-panel {
  position: fixed;
  z-index: 99999;
  bottom: 5.5rem;
  right: 1.25rem;
  width: min(100vw - 2rem, 400px);
  max-height: min(560px, calc(100vh - 7rem));
  background: var(--k2k-surface);
  border-radius: 1rem;
  box-shadow: var(--k2k-shadow);
  border: 1px solid var(--k2k-border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px) scale(0.96);
  transition: opacity 0.22s ease, transform 0.22s ease, visibility 0.22s;
}
.k2k-chat-panel.k2k-open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.k2k-chat-header {
  background: linear-gradient(135deg, var(--k2k-primary), var(--k2k-primary-dark));
  color: #fff;
  padding: 0.9rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.65rem;
}
.k2k-chat-header-avatar {
  width: 2.5rem;
 height: 2.5rem;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
}
.k2k-chat-header-text h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
}
.k2k-chat-header-text p {
  margin: 0.15rem 0 0;
  font-size: 0.75rem;
  opacity: 0.92;
}
.k2k-chat-close {
  margin-left: auto;
  background: rgba(255,255,255,0.15);
  border: none;
  color: #fff;
  width: 2rem;
  height: 2rem;
  border-radius: 0.4rem;
  cursor: pointer;
  font-size: 1.25rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.k2k-chat-close:hover { background: rgba(255,255,255,0.28); }

.k2k-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  background: var(--k2k-bg);
  min-height: 200px;
}
.k2k-msg {
  max-width: 92%;
  padding: 0.65rem 0.85rem;
  border-radius: 0.85rem;
  margin-bottom: 0.65rem;
  word-break: break-word;
}
.k2k-msg-bot {
  background: var(--k2k-surface);
  border: 1px solid var(--k2k-border);
  color: var(--k2k-text);
  margin-right: auto;
}
.k2k-msg-user {
  background: var(--k2k-primary);
  color: #fff;
  margin-left: auto;
}
.k2k-msg a {
  color: var(--k2k-primary-dark);
  font-weight: 600;
}
.k2k-msg-user a { color: #fef3c7; }

.k2k-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.5rem;
}
.k2k-quick button {
  font-size: 0.72rem;
  padding: 0.35rem 0.6rem;
  border-radius: 999px;
  border: 1px solid var(--k2k-border);
  background: #fff;
  color: var(--k2k-primary-dark);
  cursor: pointer;
  font-family: inherit;
}
.k2k-quick button:hover {
  background: #ccfbf1;
  border-color: var(--k2k-primary);
}

.k2k-chat-input-row {
  padding: 0.65rem 0.75rem;
  border-top: 1px solid var(--k2k-border);
  display: flex;
  gap: 0.5rem;
  background: var(--k2k-surface);
}
.k2k-chat-input-row input {
  flex: 1;
  border: 1px solid var(--k2k-border);
  border-radius: 0.65rem;
  padding: 0.55rem 0.75rem;
  font-size: 0.9rem;
  font-family: inherit;
  color: var(--k2k-text);
}
.k2k-chat-input-row input:focus {
  outline: none;
  border-color: var(--k2k-primary);
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.2);
}
.k2k-chat-input-row button[type="submit"] {
  background: var(--k2k-accent);
  color: #1c1917;
  border: none;
  border-radius: 0.65rem;
  padding: 0 1rem;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.85rem;
}
.k2k-chat-input-row button[type="submit"]:hover {
  filter: brightness(1.05);
}
.k2k-chat-input-row button[type="submit"]:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.k2k-typing {
  display: inline-flex;
  gap: 4px;
  padding: 0.35rem 0;
}
.k2k-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--k2k-muted);
  animation: k2k-bounce 1.2s infinite ease-in-out;
}
.k2k-typing span:nth-child(2) { animation-delay: 0.15s; }
.k2k-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes k2k-bounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.5; }
  40% { transform: translateY(-5px); opacity: 1; }
}

@media (max-width: 480px) {
  .k2k-chat-panel {
    right: 0.75rem;
    left: 0.75rem;
    width: auto;
    bottom: 5rem;
  }
  .k2k-chat-launcher { right: 0.75rem; bottom: 0.75rem; }
}
