/* Chatbot widget. Barvy vychází z tokenů webu (finalV1.css), s fallbacky. */
.mh-chat { position: fixed; right: 20px; bottom: 20px; z-index: 9000; font-family: 'Plus Jakarta Sans', sans-serif; font-size: 15px; line-height: 1.45; }
.mh-chat *, .mh-chat *::before, .mh-chat *::after { box-sizing: border-box; }

.mh-chat__toggle {
  width: 56px; height: 56px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--c-cta, #5A00CD); color: #fff;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 20px rgba(31, 26, 46, 0.25);
  transition: transform 0.15s ease, background 0.15s ease;
}
.mh-chat__toggle:hover { transform: scale(1.06); background: var(--c-cta-deep, #4500A0); }
.mh-chat__toggle:focus-visible, .mh-chat__send:focus-visible, .mh-chat__chip:focus-visible, .mh-chat__close:focus-visible { outline: 3px solid var(--c-accent, #E89B7E); outline-offset: 2px; }

.mh-chat__panel {
  position: absolute; right: 0; bottom: 72px;
  width: 360px; max-width: calc(100vw - 32px);
  height: 500px; max-height: calc(100vh - 110px);
  background: var(--c-surface, #fff); color: var(--c-ink, #1F1A2E);
  border: 1px solid var(--c-line, rgba(31, 26, 46, 0.1)); border-radius: 16px;
  box-shadow: 0 16px 48px rgba(31, 26, 46, 0.25);
  display: flex; flex-direction: column; overflow: hidden;
}
.mh-chat__panel[hidden] { display: none; }

.mh-chat__head { position: relative; display: flex; align-items: center; justify-content: center; min-height: 52px; padding: 12px 14px; background: var(--c-header, #D9BFFF); color: var(--c-ink, #1F1A2E); }
.mh-chat__title { display: flex; flex-direction: column; text-align: center; padding: 0 28px; }
.mh-chat__title strong { font-family: 'Nunito', sans-serif; font-weight: 900; font-size: 1rem; }
.mh-chat__title span { font-size: 0.75rem; color: var(--c-ink-soft, #4A4458); }
.mh-chat__close { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); background: none; border: 0; font-size: 28px; line-height: 1; cursor: pointer; color: inherit; padding: 0 4px; }

.mh-chat__log { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; padding: 14px; display: flex; flex-direction: column; gap: 8px; background: var(--c-bg, #FBF8F3); }
.mh-chat__msg { max-width: 85%; padding: 9px 12px; border-radius: 14px; white-space: pre-wrap; word-wrap: break-word; overflow-wrap: anywhere; }
.mh-chat__msg a { color: inherit; text-decoration: underline; }
.mh-chat__msg--bot { align-self: flex-start; background: var(--c-surface, #fff); border: 1px solid var(--c-line, rgba(31, 26, 46, 0.1)); border-bottom-left-radius: 4px; }
.mh-chat__msg--user { align-self: flex-end; background: var(--c-primary, #5B3FD9); color: #fff; border-bottom-right-radius: 4px; }
.mh-chat__msg--typing { color: var(--c-muted, #7A7488); font-style: italic; }

.mh-chat__chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 14px 10px; background: var(--c-bg, #FBF8F3); }
.mh-chat__chips[hidden] { display: none; }
.mh-chat__chip { border: 1px solid var(--c-primary, #5B3FD9); background: var(--c-primary-soft, #EFEBFE); color: var(--c-primary-deep, #3D2A99); border-radius: 999px; padding: 6px 12px; font: inherit; font-size: 0.85rem; cursor: pointer; }
.mh-chat__chip:hover { background: #e3dcfd; }

.mh-chat__form { display: flex; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--c-line, rgba(31, 26, 46, 0.1)); background: var(--c-surface, #fff); }
.mh-chat__input { flex: 1; min-width: 0; border: 1px solid var(--c-line, rgba(31, 26, 46, 0.2)); border-radius: 10px; padding: 9px 12px; font: inherit; font-size: 16px; /* 16px = iOS nezoomuje */ color: inherit; background: #fff; }
.mh-chat__input:focus { outline: 2px solid var(--c-primary, #5B3FD9); border-color: transparent; }
.mh-chat__send { border: 0; border-radius: 10px; padding: 0 16px; font: inherit; font-weight: 700; cursor: pointer; background: var(--c-cta, #5A00CD); color: #fff; }
.mh-chat__send:disabled, .mh-chat__input:disabled { opacity: 0.6; cursor: not-allowed; }

.mh-chat__note a { color: inherit; text-decoration: underline; }
.mh-chat__note { padding: 0 14px 10px; font-size: 0.78rem; color: var(--c-muted, #7A7488); background: var(--c-surface, #fff); }

@media (max-width: 480px) {
  .mh-chat { right: 14px; bottom: 14px; }
  .mh-chat__panel { position: fixed; right: 8px; left: 8px; bottom: 80px; width: auto; max-width: none; height: calc(100vh - 100px); height: calc(100dvh - 100px); max-height: 560px; overscroll-behavior: contain; }
}
@media (prefers-reduced-motion: reduce) { .mh-chat__toggle { transition: none; } }

/* Pozvánka (jen desktop) */
.mh-chat__nudge {
  position: absolute; right: 0; bottom: 72px; width: 230px;
  background: var(--c-surface, #fff); color: var(--c-ink, #1F1A2E);
  border: 1px solid var(--c-line, rgba(31, 26, 46, 0.1)); border-radius: 14px;
  box-shadow: 0 10px 32px rgba(31, 26, 46, 0.22);
  padding: 14px 16px; cursor: pointer; animation: mh-nudge-in 0.35s ease both;
}
.mh-chat__nudge::after {
  content: ''; position: absolute; right: 22px; bottom: -7px; width: 12px; height: 12px;
  background: inherit; border-right: 1px solid var(--c-line, rgba(31, 26, 46, 0.1)); border-bottom: 1px solid var(--c-line, rgba(31, 26, 46, 0.1));
  transform: rotate(45deg);
}
.mh-chat__nudge-text { padding-right: 14px; }
.mh-chat__nudge-x { position: absolute; right: 8px; top: 4px; background: none; border: 0; font-size: 22px; line-height: 1; cursor: pointer; color: var(--c-muted, #7A7488); }
.mh-chat__nudge-x:focus-visible { outline: 3px solid var(--c-accent, #E89B7E); outline-offset: 2px; }
@keyframes mh-nudge-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (max-width: 899px) { .mh-chat__nudge { display: none; } }
@media (prefers-reduced-motion: reduce) { .mh-chat__nudge { animation: none; } }

/* ===== Avatar místo ikonky chatu ===== */
.mh-chat { --mh-av: 104px; }
.mh-chat__toggle--avatar {
  width: var(--mh-av); height: var(--mh-av); padding: 0; border: 0; border-radius: 50%;
  background: var(--c-cta, #5A00CD); position: relative; overflow: visible;
  box-shadow: 0 8px 26px rgba(31, 26, 46, 0.3);
}
.mh-chat__toggle--avatar:hover { transform: scale(1.04); background: var(--c-cta, #5A00CD); }
.mh-av { display: block; width: 100%; height: 100%; position: relative; }
.mh-av__img {
  display: block; width: 100%; height: 100%; border-radius: 50%; object-fit: cover;
  border: 3px solid #fff; background: #4C03C8; user-select: none; -webkit-user-drag: none; pointer-events: none;
}
.mh-av__badge {
  position: absolute; right: -2px; bottom: -2px; width: 30px; height: 30px; border-radius: 50%;
  background: var(--c-cta, #5A00CD); color: #fff; border: 3px solid #fff;
  display: flex; align-items: center; justify-content: center; box-shadow: 0 2px 8px rgba(31, 26, 46, 0.25);
}
.mh-av__ic--x { display: none; }
.mh-chat__toggle.is-open .mh-av__ic--chat { display: none; }
.mh-chat__toggle.is-open .mh-av__ic--x { display: block; }
.mh-chat__panel { bottom: calc(var(--mh-av) + 14px); }
.mh-chat__nudge { bottom: calc(var(--mh-av) + 14px); }
@media (max-width: 480px) {
  .mh-chat { --mh-av: 72px; }
  .mh-av__badge { width: 24px; height: 24px; border-width: 2px; }
  .mh-av__badge svg { width: 13px; height: 13px; }
  .mh-chat__panel { bottom: calc(var(--mh-av) + 20px); height: calc(100vh - var(--mh-av) - 44px); height: calc(100dvh - var(--mh-av) - 44px); }
}

.mh-chat__hint { padding: 8px 14px; font-size: 0.8rem; background: #FFF4E5; color: #7A4B00; border-top: 1px solid #F1D9B0; }
.mh-chat__hint[hidden] { display: none; }
