/* ============================================================
 * Vilkax · vlx-chat - the in-product assistant + Report surface.
 *
 * Two modes inside one panel:
 *   ASK     - conversational, free-form questions.
 *   REPORT  - categorised message form for bugs, customer service,
 *             scam reports, business enquiries.
 *
 * Sizing pass: tighter footprint on desktop, full-width on mobile
 * with a top-anchored header so the close button is always thumb-
 * reachable.
 * ============================================================ */

.vlx-chat-launcher {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 2147483540;
  width: 56px;
  height: 56px;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 30% 30%, rgba(127,207,230,0.92), rgba(11,20,38,0.92)),
    linear-gradient(135deg, #0B1426, #1f3a5a);
  color: #ffffff;
  box-shadow:
    0 10px 28px rgba(0, 0, 0, 0.55),
    0 0 0 1px rgba(127, 207, 230, 0.22) inset,
    0 0 26px rgba(127, 207, 230, 0.28);
  transition: transform 0.22s ease, box-shadow 0.22s ease;
}
.vlx-chat-launcher:hover {
  transform: translateY(-2px) scale(1.04);
  box-shadow:
    0 14px 36px rgba(0, 0, 0, 0.6),
    0 0 0 1px rgba(127, 207, 230, 0.35) inset,
    0 0 38px rgba(127, 207, 230, 0.45);
}
.vlx-chat-launcher:focus-visible { outline: 2px solid #7FCFE6; outline-offset: 4px; }
.vlx-chat-launcher-svg {
  width: 22px; height: 22px;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.4));
}
.vlx-chat-launcher::after {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 1px solid rgba(127, 207, 230, 0.32);
  animation: vlx-chat-pulse 2.6s ease-out infinite;
  pointer-events: none;
}
@keyframes vlx-chat-pulse {
  0%   { opacity: 0.7; transform: scale(1);    }
  70%  { opacity: 0;   transform: scale(1.35); }
  100% { opacity: 0;   transform: scale(1.35); }
}
@media (prefers-reduced-motion: reduce) {
  .vlx-chat-launcher::after { animation: none; opacity: 0; }
}

/* ── Panel ───────────────────────────────────────────────── */
.vlx-chat-panel {
  position: fixed;
  right: 22px;
  bottom: 92px;
  width: min(360px, calc(100vw - 28px));
  height: min(560px, calc(100vh - 130px));
  max-height: 560px;
  background: linear-gradient(180deg, rgba(15, 27, 50, 0.96), rgba(11, 20, 38, 0.98));
  border: 1px solid rgba(127, 207, 230, 0.22);
  border-radius: 20px;
  box-shadow:
    0 24px 64px rgba(0, 0, 0, 0.62),
    0 0 0 1px rgba(127, 207, 230, 0.08) inset,
    0 0 44px rgba(127, 207, 230, 0.16);
  z-index: 2147483541;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  font-family: 'Manrope', system-ui, -apple-system, sans-serif;
  color: #cfe6f1;
  opacity: 0;
  transform: translateY(10px) scale(0.98);
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease;
}
.vlx-chat-panel.is-open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* Mobile: full-width-ish, never larger than the viewport allows,
 * close-button is anchored top-right with a 44×44 hit target. */
@media (max-width: 520px) {
  .vlx-chat-panel {
    right: 8px;
    left: 8px;
    bottom: 82px;
    width: auto;
    height: min(72vh, 520px);
    max-height: 72vh;
    border-radius: 16px;
  }
  .vlx-chat-launcher {
    width: 52px; height: 52px;
    right: 14px; bottom: 14px;
  }
}
/* Tall phones: don't let the panel dwarf the launcher zone */
@media (max-width: 520px) and (min-height: 720px) {
  .vlx-chat-panel { height: 520px; }
}

/* ── Header ──────────────────────────────────────────────── */
.vlx-chat-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 12px 12px 16px;
  border-bottom: 1px solid rgba(127, 207, 230, 0.10);
  flex-shrink: 0;
}
.vlx-chat-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #7FCFE6, #1f3a5a);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: #0B1426;
  font-weight: 800;
  box-shadow: 0 0 12px rgba(127, 207, 230, 0.45);
  flex-shrink: 0;
  overflow: hidden;
}
.vlx-chat-avatar img { width: 100%; height: 100%; object-fit: cover; }
.vlx-chat-titleblock { flex: 1; min-width: 0; }
.vlx-chat-title {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: #ffffff;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}
.vlx-chat-sub {
  margin: 1px 0 0;
  font-size: 10.5px;
  color: #8fa0bb;
  display: flex; align-items: center; gap: 6px;
}
.vlx-chat-sub-dot {
  width: 5px; height: 5px; border-radius: 50%;
  background: #7be6c2;
  box-shadow: 0 0 6px rgba(123, 230, 194, 0.7);
}
/* The close button is a comfortable 44×44 hit target with a visible
 * crisp X, anchored top-right with proper margin so on iOS it never
 * slips under the safe area. */
.vlx-chat-close {
  appearance: none;
  width: 44px; height: 44px;
  border-radius: 50%;
  background: rgba(127, 207, 230, 0.10);
  border: 1px solid rgba(127, 207, 230, 0.28);
  color: #ffffff;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, transform 0.12s ease;
}
.vlx-chat-close:hover  { background: rgba(127, 207, 230, 0.24); transform: scale(1.05); }
.vlx-chat-close:focus-visible { outline: 2px solid #7FCFE6; outline-offset: 2px; }

/* ── Mode tabs (Ask / Report) ─────────────────────────────── */
.vlx-chat-modes {
  display: flex;
  gap: 4px;
  padding: 8px 12px 0;
  flex-shrink: 0;
}
.vlx-chat-mode {
  appearance: none;
  flex: 1;
  padding: 8px 10px;
  background: transparent;
  border: 1px solid transparent;
  color: #8fa0bb;
  border-radius: 10px;
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.vlx-chat-mode:hover { background: rgba(127, 207, 230, 0.06); color: #cfe6f1; }
.vlx-chat-mode.is-active {
  background: rgba(127, 207, 230, 0.16);
  border-color: rgba(127, 207, 230, 0.36);
  color: #ffffff;
}

/* ── Thread (Ask mode) ──────────────────────────────────── */
.vlx-chat-thread {
  flex: 1;
  overflow-y: auto;
  padding: 12px 14px 6px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  scroll-behavior: smooth;
}
.vlx-chat-msg {
  max-width: 86%;
  padding: 9px 12px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.5;
  word-break: break-word;
  white-space: pre-wrap;
  animation: vlx-chat-pop 0.22s ease-out;
}
@keyframes vlx-chat-pop {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0);   }
}
.vlx-chat-msg.is-bot {
  align-self: flex-start;
  background: rgba(127, 207, 230, 0.08);
  border: 1px solid rgba(127, 207, 230, 0.16);
  color: #e6f4f9;
  border-bottom-left-radius: 4px;
}
.vlx-chat-msg.is-user {
  align-self: flex-end;
  background: linear-gradient(135deg, rgba(127, 207, 230, 0.88), rgba(127, 207, 230, 0.72));
  color: #0B1426;
  font-weight: 500;
  border-bottom-right-radius: 4px;
  box-shadow: 0 4px 12px rgba(127, 207, 230, 0.25);
}
.vlx-chat-msg.is-error {
  background: rgba(255, 136, 150, 0.10);
  border: 1px solid rgba(255, 136, 150, 0.32);
  color: #ff8896;
  align-self: flex-start;
}
.vlx-chat-msg.is-success {
  background: rgba(123, 230, 194, 0.10);
  border: 1px solid rgba(123, 230, 194, 0.32);
  color: #7be6c2;
  align-self: flex-start;
}

/* Typing indicator */
.vlx-chat-typing {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 10px 13px;
  border-radius: 14px;
  background: rgba(127, 207, 230, 0.08);
  border: 1px solid rgba(127, 207, 230, 0.16);
  border-bottom-left-radius: 4px;
}
.vlx-chat-typing span {
  width: 5px; height: 5px; border-radius: 50%;
  background: #7FCFE6; opacity: 0.5;
  animation: vlx-chat-bounce 1.2s ease-in-out infinite;
}
.vlx-chat-typing span:nth-child(2) { animation-delay: 0.15s; }
.vlx-chat-typing span:nth-child(3) { animation-delay: 0.30s; }
@keyframes vlx-chat-bounce {
  0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
  30%           { opacity: 1;   transform: translateY(-2px); }
}

/* Suggestion chips */
.vlx-chat-suggestions {
  display: flex; flex-wrap: wrap; gap: 5px;
  padding: 2px 14px 6px;
  flex-shrink: 0;
}
.vlx-chat-chip {
  appearance: none;
  background: rgba(127, 207, 230, 0.06);
  border: 1px solid rgba(127, 207, 230, 0.22);
  color: #cfe6f1;
  padding: 6px 11px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
  font-family: inherit;
  line-height: 1.2;
}
.vlx-chat-chip:hover {
  background: rgba(127, 207, 230, 0.14);
  border-color: rgba(127, 207, 230, 0.45);
}

/* ── Composer (Ask mode) ─────────────────────────────────── */
.vlx-chat-composer {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  padding: 8px 10px 10px;
  border-top: 1px solid rgba(127, 207, 230, 0.10);
  background: rgba(11, 20, 38, 0.55);
  flex-shrink: 0;
}
.vlx-chat-input {
  flex: 1;
  appearance: none;
  background: rgba(11, 20, 38, 0.85);
  border: 1px solid rgba(127, 207, 230, 0.22);
  border-radius: 12px;
  padding: 9px 12px;
  color: #ffffff;
  font-family: inherit;
  font-size: 13px;
  resize: none;
  max-height: 92px;
  outline: none;
  transition: border-color 0.15s ease;
  line-height: 1.45;
}
.vlx-chat-input:focus { border-color: rgba(127, 207, 230, 0.55); }
.vlx-chat-send {
  appearance: none;
  background: linear-gradient(135deg, #7FCFE6, #5fb2cf);
  color: #0B1426;
  border: none;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  box-shadow: 0 4px 10px rgba(127, 207, 230, 0.32);
}
.vlx-chat-send:hover  { transform: translateY(-1px); box-shadow: 0 6px 14px rgba(127, 207, 230, 0.45); }
.vlx-chat-send:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.vlx-chat-send svg { width: 14px; height: 14px; }

/* Footer hint */
.vlx-chat-footer {
  padding: 0 14px 10px;
  font-size: 10px;
  color: #6b7c97;
  text-align: center;
  flex-shrink: 0;
  letter-spacing: 0.02em;
}
.vlx-chat-footer a { color: #7FCFE6; text-decoration: none; }
.vlx-chat-footer a:hover { text-decoration: underline; }

/* ── Report mode (categorised contact form) ───────────────── */
.vlx-chat-report {
  flex: 1;
  overflow-y: auto;
  padding: 14px 14px 6px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.vlx-chat-report h4 {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: 0.01em;
}
.vlx-chat-report p {
  margin: 0 0 4px;
  font-size: 11.5px;
  color: #8fa0bb;
  line-height: 1.5;
}
.vlx-chat-cats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.vlx-chat-cat {
  appearance: none;
  background: rgba(127, 207, 230, 0.06);
  border: 1px solid rgba(127, 207, 230, 0.22);
  color: #cfe6f1;
  padding: 10px 8px;
  border-radius: 10px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.vlx-chat-cat-meta {
  display: block;
  font-size: 10px;
  color: #8fa0bb;
  font-weight: 500;
  margin-top: 2px;
}
.vlx-chat-cat:hover { background: rgba(127, 207, 230, 0.14); border-color: rgba(127, 207, 230, 0.45); }
.vlx-chat-cat.is-active {
  background: rgba(127, 207, 230, 0.20);
  border-color: rgba(127, 207, 230, 0.7);
  color: #ffffff;
}
.vlx-chat-field {
  display: flex; flex-direction: column; gap: 4px;
}
.vlx-chat-field label {
  font-size: 10px;
  color: #8fa0bb;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.vlx-chat-field input,
.vlx-chat-field textarea {
  appearance: none;
  background: rgba(11, 20, 38, 0.85);
  border: 1px solid rgba(127, 207, 230, 0.22);
  border-radius: 10px;
  padding: 9px 11px;
  color: #ffffff;
  font-family: inherit;
  font-size: 12.5px;
  outline: none;
}
.vlx-chat-field input:focus,
.vlx-chat-field textarea:focus { border-color: rgba(127, 207, 230, 0.55); }
.vlx-chat-field textarea { resize: vertical; min-height: 84px; max-height: 180px; line-height: 1.5; }
.vlx-chat-report-actions {
  display: flex; gap: 8px; padding: 10px 14px 14px; flex-shrink: 0;
  border-top: 1px solid rgba(127, 207, 230, 0.10);
  background: rgba(11, 20, 38, 0.55);
}
.vlx-chat-report-submit {
  appearance: none;
  flex: 1;
  background: linear-gradient(135deg, #7FCFE6, #5fb2cf);
  color: #0B1426;
  border: none;
  padding: 10px 14px;
  border-radius: 999px;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.vlx-chat-report-submit:hover  { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(127, 207, 230, 0.45); }
.vlx-chat-report-submit:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.vlx-chat-report-status {
  padding: 0 14px 10px;
  font-size: 11px;
  color: #8fa0bb;
  text-align: center;
  flex-shrink: 0;
  min-height: 1.2em;
}
.vlx-chat-report-status.is-ok  { color: #7be6c2; }
.vlx-chat-report-status.is-err { color: #ff8896; }
