/* =========================================================================
   Upcallo - "Zeptejte se": maly chat s pruvodkyni na vsech strankach.
   Tokeny ze site.css. Bez JS neni videt nic (blok ma v HTML `hidden`).
   ========================================================================= */

.ask {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 60;
  font-family: var(--sans);
}

/* Spoustec - tonalni (accentTint + prstenec), orb v obrysu: sekundarni, primarni
   CTA stranky zustava jedno. Orb vzdy doprovazi slovo. */
.ask-launch {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 0 20px 0 14px;
  border-radius: var(--r-pill);
  border: 0;
  background: var(--accent-tint);
  color: var(--accent-ink);
  font: inherit;
  font-weight: 600;
  font-size: 0.9375rem;
  cursor: pointer;
  box-shadow: 0 0 0 1px var(--accent-tint-border), 0 6px 22px rgba(18, 23, 22, 0.12);
  transition: transform 160ms var(--ease), box-shadow 160ms var(--ease);
}
.ask-launch:hover { transform: translateY(-1px); box-shadow: 0 0 0 1px var(--accent), 0 6px 22px rgba(18, 23, 22, 0.12); }
.ask-launch:focus-visible,
.ask-chip:focus-visible,
.ask-close:focus-visible,
.ask-send:focus-visible,
.ask-input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ask-launch svg { width: 24px; height: 24px; flex: none; color: var(--accent-ink); }
.ask[data-open="true"] .ask-launch { display: none; }

.ask-panel {
  display: none;
  flex-direction: column;
  width: min(400px, calc(100vw - 32px));
  max-height: min(640px, calc(100vh - 32px));
  max-height: min(640px, calc(100dvh - 32px));
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-sheet);
  box-shadow: 0 18px 60px rgba(18, 23, 22, 0.18);
  overflow: hidden;
}
.ask[data-open="true"] .ask-panel {
  display: flex;
  animation: ask-rise 200ms var(--ease);
}
@keyframes ask-rise {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}

/* Telefon: dolni list pres celou sirku, jako v appce. */
@media (max-width: 560px) {
  .ask { left: auto; }
  .ask[data-open="true"] { left: 12px; right: 12px; bottom: 12px; }
  .ask[data-open="true"] .ask-panel { width: 100%; max-height: calc(100dvh - 24px); }
}

.ask-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 8px 12px 16px;
  border-bottom: 1px solid var(--border-subtle);
}
.ask-head svg { width: 22px; height: 22px; color: var(--accent); flex: none; }
.ask-title { flex: 1; margin: 0; font-size: 1.0625rem; font-weight: 600; line-height: 1.25; }
.ask-close {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px;
  border: 0; border-radius: var(--r-button);
  background: transparent; color: var(--ink-2);
  cursor: pointer;
}
.ask-close:hover { background: var(--surface-sunken); }
.ask-close svg { width: 20px; height: 20px; }

.ask-log {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overscroll-behavior: contain;
}

.ask-bubble {
  max-width: 88%;
  padding: 10px 12px;
  border-radius: var(--r-card);
  font-size: 0.9375rem;
  line-height: 1.45;
  white-space: pre-line;
  overflow-wrap: anywhere;
}
.ask-bubble--guide {
  align-self: flex-start;
  background: var(--accent-tint);
  border: 1px solid var(--accent-tint-border);
  color: var(--accent-pressed);
  border-bottom-left-radius: 4px;
}
.ask-bubble--you {
  align-self: flex-end;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--ink);
  border-bottom-right-radius: 4px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .ask-bubble--guide { color: var(--night-bubble-ink); }
}

/* Nacitani = skeleton, ne spinner. */
.ask-skeleton { align-self: flex-start; width: 62%; display: grid; gap: 8px; }
.ask-skeleton span {
  display: block; height: 12px; border-radius: var(--r-chip);
  background: var(--border-subtle);
  animation: ask-pulse 1.1s ease-in-out infinite alternate;
}
.ask-skeleton span:last-child { width: 55%; }
@keyframes ask-pulse { from { opacity: 0.45; } to { opacity: 0.9; } }

.ask-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.ask-chip {
  min-height: 36px;
  padding: 7px 14px;
  border-radius: var(--r-pill);
  border: 1px solid var(--accent-tint-border);
  background: var(--surface);
  color: var(--accent-pressed);
  font: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.3;
  text-align: left;
  cursor: pointer;
}
.ask-chip:hover { border-color: var(--accent); }
.ask-chip[disabled] { color: var(--ink-faint); cursor: default; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .ask-chip,
  :root:not([data-theme="light"]) .ask-launch { color: var(--night-bubble-ink); }
}

.ask-cta { align-self: flex-start; }

/* Chyba: veta, ktera nikoho neobvinuje, a jedna akce. Ikona + slovo, ne jen barva. */
.ask-problem {
  display: grid;
  gap: 10px;
  padding: 12px;
  border-radius: var(--r-tile);
  border: 1px solid var(--warning-border);
  background: var(--warning-bg);
  color: var(--ink-2);
  font-size: 0.9375rem;
  line-height: 1.45;
}
.ask-problem p { margin: 0; display: flex; gap: 8px; }
.ask-problem p::before { content: "!"; flex: none; width: 20px; height: 20px; border-radius: 50%; background: var(--warning); color: var(--surface); font-weight: 600; font-size: 0.8125rem; display: inline-flex; align-items: center; justify-content: center; }
.ask-problem .btn { justify-self: start; }

.ask-form {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--border-subtle);
}
.ask-input {
  flex: 1;
  min-width: 0;
  min-height: 48px;
  padding: 12px 14px;
  border-radius: var(--r-button);
  border: 1.5px solid var(--border);
  background: var(--surface-sunken);
  color: var(--ink);
  font: inherit;
  font-size: 1rem;
}
.ask-input:focus { border-color: var(--accent); }
.ask-send {
  flex: none;
  width: 48px; height: 48px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: var(--r-button);
  background: var(--accent-tint); color: var(--accent-pressed);
  cursor: pointer;
}
.ask-send[disabled] { opacity: 0.55; cursor: default; }
.ask-send svg { width: 20px; height: 20px; }
.ask-note { margin: 0; padding: 0 12px 10px; font-size: 0.75rem; color: var(--ink-muted); }

.ask .sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (prefers-reduced-motion: reduce) {
  .ask[data-open="true"] .ask-panel { animation: none; }
  .ask-skeleton span { animation: none; opacity: 0.7; }
  .ask-launch { transition: none; }
}

@media print { .ask { display: none !important; } }
