/* Platform assistant (EKI). Placed like the EKI of the UCSM portal: the mascot stands bottom right with no background, a speech
   bubble introduces it, a click opens the window. Colours and type come from site.css (--ink, --red, --line, Montserrat). */
.eki { position: fixed; right: 18px; bottom: 14px; z-index: 60; display: flex; flex-direction: column; align-items: flex-end; max-width: calc(100vw - 24px); font-family: inherit; }
.eki[hidden] { display: none; }

.eki-launch { display: flex; align-items: flex-end; gap: 4px; padding: 0; border: 0; background: transparent; cursor: pointer; font: inherit; text-align: left; }
.eki-launch:focus-visible, .eki-close:focus-visible, .eki-send:focus-visible, .eki-chip:focus-visible, .eki-form input:focus-visible { outline: 3px solid var(--focus, #1566d8); outline-offset: 2px; }

.eki-mascot { display: block; flex: 0 0 auto; width: 104px; height: auto; filter: drop-shadow(0 12px 18px rgba(15, 23, 42, .22)); transition: transform .18s ease; }
.eki-launch:hover .eki-mascot { transform: translateY(-3px); }

.eki-bubble {
  position: relative; width: 212px; margin-bottom: 58px; padding: 10px 14px; border-radius: 16px;
  background: rgba(255, 255, 255, .96); border: 1px solid rgba(148, 163, 184, .28); box-shadow: 0 14px 30px rgba(15, 23, 42, .14);
  color: var(--ink, #252728); font-size: 13.5px; font-weight: 600; line-height: 19px;
}
.eki-bubble::after {
  content: ""; position: absolute; right: -7px; bottom: 16px; width: 12px; height: 12px; background: inherit;
  border-right: 1px solid rgba(148, 163, 184, .28); border-top: 1px solid rgba(148, 163, 184, .28); transform: rotate(45deg);
}
.eki-open .eki-bubble { display: none; }

.eki-panel {
  width: min(380px, calc(100vw - 24px)); max-height: min(540px, calc(100vh - 240px)); margin-bottom: 8px;
  display: flex; flex-direction: column; background: #fff; color: var(--ink, #252728); box-shadow: 0 16px 48px rgba(37, 39, 40, .34);
}
.eki-panel[hidden] { display: none; }

.eki-head { display: flex; align-items: center; gap: 12px; padding: 10px 8px 10px 12px; background: var(--ink, #252728); color: #fff; }
.eki-avatar { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; object-position: 50% 10%; background: #fff; }
.eki-head-text { display: flex; flex-direction: column; flex: 1; min-width: 0; line-height: 20px; }
.eki-head-text span { font-size: 12px; opacity: .8; }
.eki-close { display: grid; place-items: center; width: 40px; height: 40px; border: 0; background: transparent; color: #fff; cursor: pointer; }
.eki-close:hover { background: rgba(255, 255, 255, .14); }

.eki-body { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; background: var(--bg-soft, #efefef); min-height: 160px; }
.eki-msg { max-width: 92%; padding: 10px 14px; font-size: 14px; line-height: 21px; overflow-wrap: anywhere; }
.eki-bot { align-self: flex-start; background: #fff; border-left: 3px solid var(--red, #d70c19); }
.eki-you { align-self: flex-end; background: var(--ink, #252728); color: #fff; }
.eki-msg p { margin: 0; }
.eki-msg p + p { margin-top: 8px; }
.eki-msg a { color: var(--red, #d70c19); font-weight: 600; text-decoration: underline; }
.eki-tag { display: block; margin-bottom: 4px; font-size: 11px; letter-spacing: .04em; text-transform: uppercase; color: var(--muted, #6f6d6f); }

.eki-chips { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.eki-chip {
  max-width: 100%; padding: 8px 12px; border: 1px solid var(--ink, #252728); background: #fff; color: var(--ink, #252728);
  font: inherit; font-size: 13px; line-height: 19px; text-align: left; cursor: pointer;
}
.eki-chip:hover { background: var(--ink, #252728); color: #fff; }

.eki-form { display: flex; border-top: 1px solid var(--line, #d4d8db); }
.eki-form input { flex: 1; min-width: 0; padding: 14px 16px; border: 0; font: inherit; font-size: 14px; background: #fff; color: var(--ink, #252728); }
.eki-send { display: grid; place-items: center; width: 52px; border: 0; background: var(--red, #d70c19); color: #fff; cursor: pointer; }
.eki-send:hover { background: #a80913; }
.eki-note { margin: 0; padding: 8px 16px 12px; font-size: 12px; line-height: 18px; color: var(--muted, #6f6d6f); background: #fff; }
.eki-note a { color: inherit; text-decoration: underline; }

@media (max-width: 767px) {
  .eki { right: 10px; bottom: 10px; }
  .eki-mascot { width: 78px; }
  .eki-bubble { width: 150px; margin-bottom: 42px; font-size: 12.5px; line-height: 17px; padding: 8px 12px; }
  .eki-panel { max-height: calc(100vh - 220px); }
}
@media (max-width: 359px) { .eki-bubble { display: none; } }
@media (prefers-reduced-motion: no-preference) {
  .eki-panel { animation: eki-in .18s ease-out; }
  @keyframes eki-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
}
@media (prefers-reduced-motion: reduce) { .eki-mascot { transition: none; } }
