/* ============================================================
   QERIONN Smart Guide — visual restyle v1 (presentational only)
   Loaded AFTER site.css. Overrides existing .guide-* classes.
   No markup / ID / JS-hook changes — safe for all guide scripts.
   ============================================================ */

/* ---------- Launcher pill ---------- */
.guide-launcher {
  min-width: auto !important;
  padding: 13px 22px 13px 14px !important;
  border-radius: 999px !important;
  border: 1px solid rgba(214, 178, 94, 0.55) !important;
  background:
    linear-gradient(135deg, rgba(214,178,94,.16), rgba(214,178,94,0) 55%),
    linear-gradient(160deg, #10233c, #081527) !important;
  box-shadow:
    0 18px 44px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(214, 178, 94, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.06) !important;
  transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease !important;
}
.guide-launcher:hover {
  transform: translateY(-3px) !important;
  border-color: #d6b25e !important;
  box-shadow:
    0 24px 60px rgba(0, 0, 0, 0.55),
    0 0 26px rgba(214, 178, 94, 0.28) !important;
}
.guide-launcher:focus-visible {
  outline: 2px solid #d6b25e !important;
  outline-offset: 3px !important;
}
.guide-launcher-mark {
  border-radius: 50% !important;
  box-shadow: 0 0 0 2px rgba(214, 178, 94, 0.45), 0 0 16px rgba(214, 178, 94, 0.3) !important;
}

/* Real defect found live (5 Aug 2026) on /students/login/ at 1274px:
   a non-!important attempt to shrink the launcher's padding/mark size
   within site.css's own 1121-1300px compact-icon tier had no effect
   at all -- this file's own base .guide-launcher/.guide-launcher-mark
   rules above use `!important` and load after site.css, so they won
   regardless of that other file's media-query specificity. The real
   fix has to live here, later in this same file, also with
   `!important`, to actually take effect. Shrinks the widget's real
   footprint enough that the ~101px of real clear space measured next
   to the sign-in form at this tier is genuinely sufficient (confirmed
   via getBoundingClientRect on both elements before deploying). */
@media (max-width: 1300px) and (min-width: 761px) {
  /* Lower bound widened 1121px -> 761px (5 Aug 2026), matching the
     same widening in site.css's QERIONN_HEADER_NAV_ACCOUNT_OVERFLOW_FIX-
     adjacent widget block -- see that file's comment for the real
     761-1120px text-overlap gap this closes. Kept in sync so the
     compact padding/mark size always matches whichever range is
     hiding the text label. */
  .guide-launcher {
    padding: 6px !important;
  }

  .guide-launcher-mark {
    width: 34px !important;
    height: 34px !important;
  }
}
/* ---------- Context-aware auto-hide (<=430px) ----------
 *
 * Owner-approved fix for the measured launcher/content overlap. Four earlier
 * rounds shrank and repositioned this widget; the mark is now exactly 44px,
 * the touch-target floor, so there is nothing left to shrink. At 320px a
 * 56x56 launcher at x=252 still clips a full-width textarea (x 41-279) by
 * 27px, and no fixed bottom-right element can avoid that while full-width
 * content scrolls past it.
 *
 * So instead of shrinking further (which would break the touch target) or
 * reserving a permanent blank strip (which would waste a fifth of the
 * screen), the launcher steps out of the way during the interactions where
 * it is genuinely in the way. State is driven by
 * guide_launcher_autohide_v1.js via one data attribute.
 *
 * Only opacity/transform/pointer-events change -- the element is
 * position:fixed, so NOTHING here can cause layout shift. Size, padding and
 * the 44px mark are untouched.
 *
 * These rules live in THIS file, not site.css, for the reason this file's
 * own earlier comment documents: it loads after site.css and its base
 * .guide-launcher rules use `!important`, so a non-!important override
 * elsewhere is silently discarded. */
@media (max-width: 430px) {
  .guide-launcher {
    transition: opacity .18s ease, transform .18s ease !important;
  }

  .guide-launcher[data-guide-autohide="hidden"] {
    opacity: 0 !important;
    /* Translated fully clear of the content area so a mid-transition frame
       cannot sit over a control. */
    transform: translateY(140%) !important;
    /* Not tappable while invisible -- an invisible hit target is worse than
       a visible one. Focusability is deliberately NOT removed. */
    pointer-events: none !important;
  }

  /* Keyboard reachability is absolute: tabbing to the launcher reveals it
     even while the auto-hide state says hidden, so a keyboard user can
     always reach support. :focus (not :focus-visible) on purpose -- this
     must hold for programmatic and assistive focus too. */
  .guide-launcher[data-guide-autohide="hidden"]:focus,
  .guide-launcher[data-guide-autohide="hidden"]:focus-within {
    opacity: 1 !important;
    transform: none !important;
    pointer-events: auto !important;
  }
}

/* Reduced motion: the launcher still hides and restores, it just does not
   animate. Suppressing the state change instead would reintroduce the
   overlap for exactly the users least able to tolerate it. */
@media (prefers-reduced-motion: reduce) {
  .guide-launcher {
    transition: none !important;
  }
}

.guide-launcher span strong {
  display: block !important;
  font-size: 0.86rem !important;
  letter-spacing: 0.02em !important;
  color: #f2ecdd !important;
}
.guide-launcher span small {
  display: flex !important;
  align-items: center !important;
  gap: 6px !important;
  font-size: 0.62rem !important;
  letter-spacing: 0.14em !important;
  text-transform: uppercase !important;
  color: #d6b25e !important;
}
/* live dot before the subtitle */
.guide-launcher span small::before {
  content: "" !important;
  width: 6px !important;
  height: 6px !important;
  border-radius: 50% !important;
  background: #3fb97e !important;
  box-shadow: 0 0 8px #3fb97e !important;
  animation: qg-pulse 2s infinite !important;
}
@keyframes qg-pulse { 50% { opacity: 0.35; } }

/* ---------- Panel shell ---------- */
.guide-panel {
  padding: 0 !important;
  border-radius: 22px !important;
  border: 1px solid rgba(214, 178, 94, 0.28) !important;
  background:
    radial-gradient(560px 300px at 85% -10%, rgba(214, 178, 94, 0.10), transparent 60%),
    linear-gradient(170deg, #0b1a2f 0%, #060f1d 100%) !important;
  box-shadow:
    0 34px 90px rgba(0, 0, 0, 0.62),
    0 0 0 1px rgba(214, 178, 94, 0.08) !important;
  overflow: hidden !important;
  overflow-y: auto !important;
}
/* gold hairline on top edge */
.guide-panel::before {
  content: "" !important;
  position: sticky !important;
  top: 0 !important;
  display: block !important;
  height: 3px !important;
  background: linear-gradient(90deg, transparent, #d6b25e 30%, #b8933f 70%, transparent) !important;
  z-index: 5 !important;
}

/* ---------- Panel header ---------- */
.guide-header,
.guide-chat-panel .guide-header {
  padding: 18px 20px 16px !important;
  border-bottom: 1px solid rgba(214, 178, 94, 0.16) !important;
  background: linear-gradient(180deg, rgba(214, 178, 94, 0.05), transparent) !important;
}
.guide-avatar {
  border-radius: 14px !important;
  box-shadow: 0 0 0 2px rgba(214, 178, 94, 0.4), 0 6px 18px rgba(0, 0, 0, 0.4) !important;
}
.guide-header .section-kicker {
  color: #d6b25e !important;
  font-size: 0.6rem !important;
  letter-spacing: 0.22em !important;
}
.guide-header h2 {
  font-size: 1.06rem !important;
  letter-spacing: 0.01em !important;
  color: #f4f0e6 !important;
}
.guide-slogan { color: #93a4b9 !important; font-size: 0.74rem !important; }
.guide-online {
  color: #7f93aa !important;
  font-size: 0.66rem !important;
}
.guide-online span {
  background: #3fb97e !important;
  box-shadow: 0 0 8px #3fb97e !important;
  animation: qg-pulse 2s infinite !important;
}
.guide-icon-button,
.guide-close {
  border: 1px solid rgba(214, 178, 94, 0.3) !important;
  border-radius: 10px !important;
  background: rgba(214, 178, 94, 0.07) !important;
  color: #d6b25e !important;
  transition: background .18s ease, transform .18s ease !important;
}
.guide-icon-button:hover,
.guide-close:hover {
  background: rgba(214, 178, 94, 0.18) !important;
  transform: scale(1.06) !important;
}

/* ---------- Profile gate (name / email / phone form) ---------- */
.guide-profile-gate {
  padding: 18px 20px 22px !important;
}
.guide-profile-gate h3 { color: #f4f0e6 !important; font-size: 0.95rem !important; }
.guide-profile-gate > p { color: #8fa0b5 !important; font-size: 0.76rem !important; }
.guide-profile-field span {
  color: #d6b25e !important;
  font-size: 0.64rem !important;
  letter-spacing: 0.1em !important;
  text-transform: uppercase !important;
  font-weight: 700 !important;
}
.guide-profile-field input,
.guide-profile-form input,
.guide-profile-form select {
  border: 1px solid rgba(214, 178, 94, 0.22) !important;
  border-radius: 12px !important;
  background: rgba(6, 14, 26, 0.85) !important;
  color: #eef2f8 !important;
  transition: border-color .18s ease, box-shadow .18s ease !important;
}
.guide-profile-field input:focus,
.guide-profile-form input:focus,
.guide-profile-form select:focus {
  border-color: #d6b25e !important;
  box-shadow: 0 0 0 3px rgba(214, 178, 94, 0.16) !important;
  outline: none !important;
}
.guide-profile-form button[type="submit"],
.guide-profile-form .guide-primary-action {
  border-radius: 999px !important;
  border: 0 !important;
  background: linear-gradient(135deg, #e2c374, #c9a24e) !important;
  color: #081527 !important;
  font-weight: 800 !important;
  letter-spacing: 0.02em !important;
  box-shadow: 0 10px 26px rgba(214, 178, 94, 0.3) !important;
  transition: transform .18s ease, box-shadow .18s ease !important;
}
.guide-profile-form button[type="submit"]:hover {
  transform: translateY(-2px) !important;
  box-shadow: 0 14px 34px rgba(214, 178, 94, 0.42) !important;
}

/* ---------- Messages area ---------- */
.guide-messages {
  padding: 16px 18px !important;
  background:
    radial-gradient(420px 240px at 12% 0%, rgba(94, 155, 214, 0.05), transparent 55%),
    transparent !important;
}
.guide-message {
  border-radius: 16px !important;
  border: 1px solid rgba(255, 255, 255, 0.05) !important;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25) !important;
  font-size: 0.82rem !important;
  line-height: 1.5 !important;
}
.guide-message-row.is-system .guide-message {
  background: linear-gradient(160deg, #12253e, #0c1b30) !important;
  border-color: rgba(214, 178, 94, 0.14) !important;
  border-top-left-radius: 6px !important;
  color: #dbe4ef !important;
}
.guide-message-row.is-user .guide-message {
  background: linear-gradient(135deg, rgba(214, 178, 94, 0.92), rgba(184, 147, 63, 0.92)) !important;
  border-color: transparent !important;
  border-top-right-radius: 6px !important;
  color: #081527 !important;
  font-weight: 600 !important;
}
.guide-message small { opacity: 0.65 !important; font-size: 0.62rem !important; }

/* ---------- Composer / inputs at bottom ---------- */
.guide-panel textarea,
.guide-panel input[type="text"]:not(.guide-profile-field input),
.guide-composer textarea,
.guide-composer input {
  border: 1px solid rgba(214, 178, 94, 0.22) !important;
  border-radius: 14px !important;
  background: rgba(6, 14, 26, 0.9) !important;
  color: #eef2f8 !important;
}
.guide-panel textarea:focus,
.guide-composer textarea:focus,
.guide-composer input:focus {
  border-color: #d6b25e !important;
  box-shadow: 0 0 0 3px rgba(214, 178, 94, 0.15) !important;
  outline: none !important;
}

/* ---------- Scrollbar ---------- */
.guide-panel::-webkit-scrollbar,
.guide-messages::-webkit-scrollbar { width: 8px !important; }
.guide-panel::-webkit-scrollbar-thumb,
.guide-messages::-webkit-scrollbar-thumb {
  background: rgba(214, 178, 94, 0.3) !important;
  border-radius: 8px !important;
}
.guide-panel::-webkit-scrollbar-track,
.guide-messages::-webkit-scrollbar-track { background: transparent !important; }

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .guide-launcher, .guide-icon-button, .guide-close { transition: none !important; }
  .guide-launcher span small::before, .guide-online span { animation: none !important; }
}

/* ============================================================
   v2 — COMPACT "standard chatbot" layout
   Tight top bar (avatar + name + online), no sprawling header,
   condensed form. CSS-only; all JS hooks untouched.
   ============================================================ */

/* panel: classic messenger proportions */
.guide-panel {
  width: min(calc(100vw - 32px), 384px) !important;
  max-height: min(620px, calc(100vh - 44px)) !important;
  display: flex !important;
  flex-direction: column !important;
}
.guide-panel::before { flex-shrink: 0; }

/* ---- header: single compact bar ---- */
.guide-header,
.guide-chat-panel .guide-header {
  flex-shrink: 0 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 10px !important;
  min-height: 0 !important;
  padding: 12px 14px !important;
  margin: 0 !important;
}
.guide-identity {
  display: flex !important;
  align-items: center !important;
  gap: 11px !important;
  margin: 0 !important;
  min-width: 0 !important;
}
.guide-identity > div { display: flex !important; flex-direction: column !important; gap: 1px !important; min-width: 0 !important; }
.guide-avatar {
  width: 38px !important;
  height: 38px !important;
  border-radius: 12px !important;
  flex-shrink: 0 !important;
}
/* kicker becomes the small over-title */
.guide-header .section-kicker {
  font-size: 0.52rem !important;
  letter-spacing: 0.2em !important;
  margin: 0 !important;
  line-height: 1.2 !important;
}
.guide-header h2 {
  font-size: 0.95rem !important;
  line-height: 1.25 !important;
  margin: 0 !important;
}
/* hide the sprawling copy — the bar speaks for itself */
.guide-slogan { display: none !important; }
.guide-online {
  margin: 1px 0 0 !important;
  font-size: 0.6rem !important;
  line-height: 1.3 !important;
  display: flex !important;
  align-items: center !important;
  gap: 5px !important;
}
.guide-online span { width: 6px !important; height: 6px !important; flex-shrink: 0 !important; }
/* shorten the long availability line visually */
.guide-online {
  max-width: 210px !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}
.guide-header-actions { display: flex !important; gap: 6px !important; flex-shrink: 0 !important; margin: 0 !important; }
.guide-icon-button, .guide-close {
  width: 30px !important;
  height: 30px !important;
  padding: 0 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 0.95rem !important;
}

/* ---- body: condensed form / messages ---- */
.guide-profile-gate {
  padding: 14px 16px 16px !important;
  overflow-y: auto !important;
}
.guide-profile-gate h3 {
  font-size: 0.86rem !important;
  margin: 0 0 4px !important;
}
.guide-profile-gate > p {
  font-size: 0.7rem !important;
  line-height: 1.45 !important;
  margin: 0 0 12px !important;
}
.guide-profile-form { display: flex !important; flex-direction: column !important; gap: 10px !important; }
.guide-profile-field { display: flex !important; flex-direction: column !important; gap: 4px !important; margin: 0 !important; }
.guide-profile-field span { font-size: 0.56rem !important; }
.guide-profile-field input,
.guide-profile-form input,
.guide-profile-form select {
  padding: 9px 12px !important;
  font-size: 0.82rem !important;
  border-radius: 10px !important;
}
.guide-profile-form button[type="submit"],
.guide-profile-form .guide-primary-action {
  padding: 11px 16px !important;
  font-size: 0.84rem !important;
  margin-top: 2px !important;
}
/* small print notes: quiet, tight */
.guide-profile-gate p:last-child,
.guide-profile-form + p,
.guide-panel .guide-footnote {
  font-size: 0.6rem !important;
  line-height: 1.45 !important;
  color: #6d8098 !important;
  margin-top: 10px !important;
}
.guide-messages { padding: 12px 14px !important; }
.guide-message { font-size: 0.8rem !important; }

@media (max-width: 480px) {
  .guide-panel { width: calc(100vw - 20px) !important; max-height: calc(100vh - 20px) !important; }
}

/* Real defect found with Playwright at phone viewports (5 Aug 2026).
   site.css's own `@media (max-width: 480px)` tier intends the launcher
   to collapse to a small icon (padding 8px, 44x44 mark), but this
   file's unconditional base rule above sets
   `padding: 13px 22px 13px 14px !important`, which wins regardless of
   that media query's specificity -- the exact same !important
   precedence trap already hit once in this file for the 1121-1300px
   tier. Measured live at 320/360/390px: the launcher was 82x72px, not
   the intended ~60x60.

   Combined with its fixed bottom-right position that was enough to
   cover real controls on 36 of 112 route/viewport combinations --
   footer links (Packages, CV Management, ATS CV Builder) and page CTAs
   (Generate ATS CV, Discuss a requirement, Start a project).

   Shrinking it here, where the !important rules actually live, is half
   the fix; the other half is the bottom safe-area in
   public_polish_v1.css so content can always scroll clear of it. */
@media (max-width: 760px) {
  .guide-launcher {
    padding: 8px !important;
    gap: 0 !important;
  }

  .guide-launcher-mark {
    width: 38px !important;
    height: 38px !important;
  }
}
