/* chatbot.css — floating "getjob4u Assistant" widget.
   Built entirely on the shared design tokens in style.css (--bg-card, --border,
   --radius, --shadow-md, --grad, --accent/--accent-2, .btn) rather than a new
   visual language — this is the site's first floating/FAB-style element, so
   there is no prior widget pattern to match instead. */

.g4u-chat-launcher {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 190; /* below .site-header (200), above everything else */
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  background: var(--grad);
  color: #0b0f1a;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  transition: transform 0.15s;
}
.g4u-chat-launcher:hover { transform: translateY(-2px); }
.g4u-chat-launcher:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 3px; }
.g4u-chat-icon { width: 26px; height: 26px; }
.g4u-chat-icon-close { display: none; }
.g4u-chat-launcher.is-open .g4u-chat-icon-open { display: none; }
.g4u-chat-launcher.is-open .g4u-chat-icon-close { display: block; }

.g4u-chat-panel {
  position: fixed;
  right: 1.25rem;
  bottom: 5.25rem;
  z-index: 195;
  width: min(380px, calc(100vw - 2rem));
  height: min(560px, calc(100vh - 7rem));
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: var(--font);
}
.g4u-chat-panel[hidden] { display: none; }

.g4u-chat-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.9rem 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg-soft);
}
.g4u-chat-header-text { display: flex; flex-direction: column; gap: 0.15rem; }
.g4u-chat-header-text strong { color: var(--text); font-size: 0.98rem; }
.g4u-chat-quota { font-size: 0.75rem; }
.g4u-chat-header-actions { display: flex; align-items: center; gap: 0.35rem; flex-shrink: 0; }
.g4u-chat-header-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  padding: 0.25rem 0.55rem;
  cursor: pointer;
  font-family: var(--font);
}
.g4u-chat-header-btn:hover { background: var(--bg-hover); color: var(--text); }
.g4u-chat-close-x { font-size: 1.1rem; line-height: 1; padding: 0.15rem 0.55rem; }

.g4u-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 0.9rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.g4u-chat-msg { display: flex; }
.g4u-chat-msg-user { justify-content: flex-end; }
.g4u-chat-msg-assistant { justify-content: flex-start; }

.g4u-chat-bubble {
  max-width: 88%;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  line-height: 1.45;
  overflow-wrap: break-word;
}
.g4u-chat-msg-user .g4u-chat-bubble { background: var(--accent); color: #fff; border-bottom-right-radius: 3px; }
.g4u-chat-msg-assistant .g4u-chat-bubble { background: var(--bg-hover); color: var(--text); border-bottom-left-radius: 3px; }

.g4u-chat-bubble p { margin: 0 0 0.5rem; }
.g4u-chat-bubble p:last-child { margin-bottom: 0; }
.g4u-chat-bubble ul, .g4u-chat-bubble ol { margin: 0 0 0.5rem 1.1rem; padding: 0; }
.g4u-chat-bubble a { color: var(--accent-2); text-decoration: underline; }
.g4u-chat-bubble code { font-family: var(--mono, monospace); background: rgba(0,0,0,0.25); border-radius: 4px; padding: 0.05rem 0.3rem; font-size: 0.85em; }
.g4u-chat-bubble pre { background: rgba(0,0,0,0.3); border-radius: var(--radius-sm); padding: 0.6rem; overflow-x: auto; margin: 0 0 0.5rem; }
.g4u-chat-bubble pre code { background: none; padding: 0; }
.g4u-chat-bubble blockquote { margin: 0 0 0.5rem; padding-left: 0.6rem; border-left: 3px solid var(--border); color: var(--text-muted); }

/* Markdown tables from marked.js are wrapped in this scroller by chatbot.js so
   a wide table scrolls horizontally instead of breaking the panel layout. */
.g4u-chat-table-wrap { overflow-x: auto; margin: 0 0 0.5rem; }
.g4u-chat-bubble table { border-collapse: collapse; width: 100%; font-size: 0.82rem; }
.g4u-chat-bubble th, .g4u-chat-bubble td { border: 1px solid var(--border); padding: 0.3rem 0.5rem; text-align: left; white-space: nowrap; }
.g4u-chat-bubble th { background: var(--bg-soft); }

.g4u-chat-typing .g4u-chat-bubble { display: flex; gap: 0.25rem; align-items: center; padding: 0.7rem 0.9rem; }
.g4u-chat-typing-dot {
  width: 6px; height: 6px; border-radius: 50%; background: var(--text-dim);
  animation: g4u-chat-typing-bounce 1s infinite ease-in-out;
}
.g4u-chat-typing-dot:nth-child(2) { animation-delay: 0.15s; }
.g4u-chat-typing-dot:nth-child(3) { animation-delay: 0.3s; }
@keyframes g4u-chat-typing-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30% { transform: translateY(-4px); opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .g4u-chat-typing-dot { animation: none; }
}

.g4u-chat-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0 1rem 0.6rem;
}
.g4u-chat-chip {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: 999px;
  font-size: 0.75rem;
  padding: 0.3rem 0.65rem;
  cursor: pointer;
  font-family: var(--font);
}
.g4u-chat-chip:hover { background: var(--bg-hover); color: var(--text); }

.g4u-chat-form {
  display: flex;
  gap: 0.5rem;
  align-items: flex-end;
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--border);
}
.g4u-chat-input {
  flex: 1;
  resize: none;
  max-height: 90px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.88rem;
  padding: 0.5rem 0.65rem;
}
.g4u-chat-input:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 1px; }
.g4u-chat-input:disabled { opacity: 0.6; cursor: not-allowed; }
.g4u-chat-send:disabled { opacity: 0.6; cursor: not-allowed; }

.g4u-chat-limit-note {
  margin: 0;
  padding: 0.6rem 1rem 0.85rem;
  font-size: 0.78rem;
  color: var(--accent-warn);
}
.g4u-chat-limit-note[hidden] { display: none; }

@media (max-width: 560px) {
  .g4u-chat-panel {
    right: 0.6rem;
    left: 0.6rem;
    bottom: 0.6rem;
    width: auto;
    height: min(80vh, 620px);
  }
  .g4u-chat-launcher { right: 1rem; bottom: 1rem; }
}

/* Desktop only - see the DESKTOP_MIN_WIDTH note in chatbot.js, which removes
   the widget entirely at this same width. This rule is what stops the
   launcher flashing on a phone in the moment before that script runs, and it
   covers the no-JS case too. !important because the panel's open state is
   toggled inline by that script. */
@media (max-width: 899px) {
  .g4u-chat,
  .g4u-chat-launcher,
  .g4u-chat-panel { display: none !important; }
}
