/* =====================================================================
   EASYKREST — AI CHAT ASSISTANT WIDGET
   chat.css
   ===================================================================== */

.ekc {
  --ekc-blue: var(--color-blue, #1545d8);
  --ekc-blue-deep: var(--color-blue-deep, #0b256f);
  --ekc-red: var(--color-red, #d61f38);
  --ekc-text: var(--color-text, #111111);
  --ekc-muted: var(--color-muted, #576072);
  --ekc-surface: var(--color-surface, #f5f8ff);
  --ekc-border: var(--color-border, rgba(17, 17, 17, 0.09));
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 110;           /* below the newsletter overlay (120) */
  font-family: "Manrope", sans-serif;
  color: var(--ekc-text);
}

/* ── Launcher ─────────────────────────────────────────────────────── */
.ekc-launcher {
  position: relative;
  display: grid;
  place-items: center;
  width: 62px;
  height: 62px;
  margin-left: auto;
  border: 0;
  border-radius: 50%;
  color: #fff;
  background: linear-gradient(145deg, var(--ekc-blue), var(--ekc-blue-deep));
  box-shadow: 0 14px 34px rgba(11, 37, 111, 0.38);
  cursor: pointer;
  transition: transform 240ms ease, box-shadow 240ms ease;
}

.ekc-launcher:hover { transform: translateY(-2px); box-shadow: 0 18px 40px rgba(11, 37, 111, 0.45); }
.ekc-launcher:focus-visible { outline: 3px solid rgba(21, 69, 216, 0.4); outline-offset: 3px; }

.ekc-launcher::after {   /* red "online" pip */
  content: "";
  position: absolute;
  top: 6px;
  right: 6px;
  width: 12px;
  height: 12px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: var(--ekc-red);
}

.ekc.is-open .ekc-launcher::after { display: none; }
.ekc-launcher__close { display: none; }
.ekc.is-open .ekc-launcher__chat { display: none; }
.ekc.is-open .ekc-launcher__close { display: block; }

/* ── Greeting teaser ──────────────────────────────────────────────── */
.ekc-teaser {
  position: absolute;
  right: 0;
  bottom: 78px;
  width: 250px;
  padding: 16px 34px 16px 18px;
  background: #fff;
  border-radius: 18px 18px 4px 18px;
  box-shadow: 0 18px 45px rgba(7, 16, 37, 0.18);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 280ms ease, transform 280ms ease;
}

.ekc-teaser.is-visible { opacity: 1; transform: translateY(0); }

.ekc-teaser__text {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1.45;
  cursor: pointer;
}

.ekc-teaser__close {
  position: absolute;
  top: 6px;
  right: 8px;
  padding: 2px 6px;
  border: 0;
  background: none;
  color: var(--ekc-muted);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
}

/* ── Panel ────────────────────────────────────────────────────────── */
.ekc-panel {
  position: absolute;
  right: 0;
  bottom: 78px;
  display: flex;
  flex-direction: column;
  width: 380px;
  height: min(600px, calc(100vh - 130px));
  overflow: hidden;
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 30px 80px rgba(6, 8, 13, 0.28);
  opacity: 0;
  visibility: hidden;
  transform: translateY(14px) scale(0.98);
  transform-origin: bottom right;
  transition: opacity 260ms ease, transform 260ms ease, visibility 260ms ease;
}

.ekc.is-open .ekc-panel { opacity: 1; visibility: visible; transform: none; }

.ekc-panel__head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  color: #fff;
  background: linear-gradient(135deg, var(--ekc-blue-deep), var(--ekc-blue));
}

.ekc-panel__avatar {
  display: grid;
  place-items: center;
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
  font-family: "Oswald", sans-serif;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.ekc-panel__title { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ekc-panel__title strong { font-family: "Oswald", sans-serif; font-weight: 500; font-size: 1.08rem; letter-spacing: 0.02em; }
.ekc-panel__title span { display: flex; align-items: center; gap: 6px; font-size: 0.78rem; opacity: 0.85; }

.ekc-dot { width: 8px; height: 8px; border-radius: 50%; background: #3ddc84; }

.ekc-panel__close {
  margin-left: auto;
  padding: 4px 8px;
  border: 0;
  background: none;
  color: #fff;
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0.85;
}

.ekc-panel__close:hover { opacity: 1; }

/* ── Messages ─────────────────────────────────────────────────────── */
.ekc-log {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 18px 16px;
  overflow-y: auto;
  background: var(--ekc-surface);
  overscroll-behavior: contain;
}

.ekc-msg {
  max-width: 86%;
  padding: 11px 14px;
  font-size: 0.92rem;
  line-height: 1.5;
  word-wrap: break-word;
  overflow-wrap: anywhere;
}

.ekc-msg--assistant {
  align-self: flex-start;
  background: #fff;
  border: 1px solid var(--ekc-border);
  border-radius: 4px 16px 16px 16px;
}

.ekc-msg--user {
  align-self: flex-end;
  color: #fff;
  background: var(--ekc-blue);
  border-radius: 16px 4px 16px 16px;
  white-space: pre-wrap;
}

.ekc-msg--error { border-color: rgba(214, 31, 56, 0.35); background: #fff6f7; }

.ekc-msg p { margin: 0 0 8px; }
.ekc-msg p:last-child { margin-bottom: 0; }
.ekc-msg ul, .ekc-msg ol { margin: 4px 0 8px; padding-left: 20px; }
.ekc-msg ul:last-child, .ekc-msg ol:last-child { margin-bottom: 0; }
.ekc-msg li { margin: 2px 0; }
.ekc-msg a { color: var(--ekc-blue); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }

.ekc-msg--typing { display: flex; gap: 5px; padding: 14px 16px; }
.ekc-msg--typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ekc-muted);
  animation: ekc-bounce 1.2s infinite ease-in-out;
}
.ekc-msg--typing span:nth-child(2) { animation-delay: 0.15s; }
.ekc-msg--typing span:nth-child(3) { animation-delay: 0.3s; }

@keyframes ekc-bounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.4; }
  40% { transform: translateY(-5px); opacity: 1; }
}

/* ── Suggestions ──────────────────────────────────────────────────── */
.ekc-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 16px 12px;
  background: var(--ekc-surface);
}

.ekc-chips[hidden] { display: none; }

.ekc-chip {
  padding: 7px 12px;
  border: 1px solid rgba(21, 69, 216, 0.3);
  border-radius: 999px;
  background: #fff;
  color: var(--ekc-blue);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 200ms ease, color 200ms ease;
}

.ekc-chip:hover { background: var(--ekc-blue); color: #fff; }

/* ── Composer ─────────────────────────────────────────────────────── */
.ekc-form {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 12px 12px 8px;
  border-top: 1px solid var(--ekc-border);
}

.ekc-input {
  flex: 1;
  min-height: 42px;
  max-height: 120px;
  padding: 10px 14px;
  border: 1px solid var(--ekc-border);
  border-radius: 14px;
  background: #fff;
  color: var(--ekc-text);
  font-size: 0.92rem;
  line-height: 1.4;
  resize: none;
}

.ekc-input:focus { outline: none; border-color: var(--ekc-blue); box-shadow: 0 0 0 3px rgba(21, 69, 216, 0.12); }

.ekc-send {
  display: grid;
  place-items: center;
  flex: none;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 12px;
  color: #fff;
  background: var(--ekc-red);
  cursor: pointer;
  transition: opacity 200ms ease;
}

.ekc-send:disabled { opacity: 0.5; cursor: wait; }

.ekc-note {
  margin: 0;
  padding: 0 14px 10px;
  color: var(--ekc-muted);
  font-size: 0.7rem;
  line-height: 1.4;
  text-align: center;
}

.ekc-note a { color: inherit; text-decoration: underline; }

/* ── Mobile: full-screen panel ────────────────────────────────────── */
@media (max-width: 720px) {
  .ekc { right: 16px; bottom: 16px; }
  .ekc-launcher { width: 56px; height: 56px; }
  .ekc-teaser { bottom: 70px; width: min(250px, calc(100vw - 32px)); }

  .ekc-panel {
    position: fixed;
    inset: 0;
    width: auto;
    height: auto;
    border-radius: 0;
  }

  .ekc.is-open .ekc-launcher { display: none; }
  .ekc-input { font-size: 16px; }   /* stops iOS zoom-on-focus */
}

@media (prefers-reduced-motion: reduce) {
  .ekc-panel, .ekc-teaser, .ekc-launcher { transition: none; }
  .ekc-msg--typing span { animation: none; }
}
