/* ============================================================
   Careerraft — Job Chatbot
   /assets/css/chatbot.css
   ============================================================ */

/* ── Bubble ──────────────────────────────────────────────── */
.chat-bubble {
  position: fixed;
  bottom: 5.5rem;   /* above mobile bottom nav */
  right: 1.25rem;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--accent, #e8642c);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(232,100,44,.45);
  z-index: 900;
  transition: transform .2s, box-shadow .2s;
}

.chat-bubble:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 28px rgba(232,100,44,.55);
}

.chat-bubble svg { transition: opacity .2s, transform .2s; }
.chat-bubble .icon-close { display: none; }

.chat-bubble.open .icon-chat  { display: none; }
.chat-bubble.open .icon-close { display: block; }

/* Unread dot */
.chat-bubble-dot {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #22c55e;
  border: 2px solid var(--bg, #fff);
  animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
  0%, 100% { transform: scale(1); }
  50%       { transform: scale(1.25); }
}

/* On desktop push bubble up less */
@media (min-width: 768px) {
  .chat-bubble { bottom: 2rem; right: 1.5rem; }
}

/* ── Chat window ─────────────────────────────────────────── */
.chat-window {
  position: fixed;
  bottom: 8rem;
  right: 1.25rem;
  width: calc(100vw - 2.5rem);
  max-width: 380px;
  height: 520px;
  max-height: calc(100vh - 10rem);
  background: var(--surface, #1a1a2e);
  border: 1.5px solid var(--border, rgba(255,255,255,.1));
  border-radius: 18px;
  box-shadow: 0 16px 48px rgba(0,0,0,.35);
  display: flex;
  flex-direction: column;
  z-index: 901;
  overflow: hidden;

  opacity: 0;
  transform: translateY(12px) scale(.97);
  pointer-events: none;
  transition: opacity .22s ease, transform .22s ease;
}

.chat-window.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

@media (min-width: 768px) {
  .chat-window { bottom: 5.5rem; right: 1.5rem; }
}

/* ── Window header ───────────────────────────────────────── */
.chat-header {
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: .9rem 1.1rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.chat-header-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent, #e8642c), #f59e0b);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .85rem;
  flex-shrink: 0;
}

.chat-header-info { flex: 1; min-width: 0; }

.chat-header-name {
  font-size: .85rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}

.chat-header-status {
  font-family: var(--mono, monospace);
  font-size: .62rem;
  color: #22c55e;
  display: flex;
  align-items: center;
  gap: 4px;
}

.chat-header-status::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #22c55e;
  display: inline-block;
}

.chat-header-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  padding: .25rem;
  border-radius: 6px;
  transition: color .15s, background .15s;
  display: flex;
  align-items: center;
}

.chat-header-close:hover {
  color: var(--text);
  background: var(--surface2, rgba(255,255,255,.05));
}

/* ── Messages area ───────────────────────────────────────── */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: .75rem;
  scroll-behavior: smooth;
}

.chat-messages::-webkit-scrollbar { width: 4px; }
.chat-messages::-webkit-scrollbar-track { background: transparent; }
.chat-messages::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

/* ── Message bubbles ─────────────────────────────────────── */
.chat-msg {
  display: flex;
  flex-direction: column;
  max-width: 88%;
}

.chat-msg.bot  { align-self: flex-start; }
.chat-msg.user { align-self: flex-end; }

.chat-msg-bubble {
  padding: .6rem .85rem;
  border-radius: 12px;
  font-size: .83rem;
  line-height: 1.6;
  word-break: break-word;
}

.chat-msg.bot .chat-msg-bubble {
  background: var(--surface2, rgba(255,255,255,.06));
  border: 1px solid var(--border);
  color: var(--text);
  border-bottom-left-radius: 4px;
}

.chat-msg.user .chat-msg-bubble {
  background: var(--accent, #e8642c);
  color: #fff;
  border-bottom-right-radius: 4px;
}

/* Bold inside bot messages */
.chat-msg.bot .chat-msg-bubble strong {
  color: var(--accent);
  font-weight: 700;
}

/* ── Typing indicator ────────────────────────────────────── */
.chat-typing {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: .6rem .85rem;
  background: var(--surface2, rgba(255,255,255,.06));
  border: 1px solid var(--border);
  border-radius: 12px;
  border-bottom-left-radius: 4px;
  width: fit-content;
}

.chat-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--muted);
  animation: typing-dot 1.2s infinite;
}

.chat-typing span:nth-child(2) { animation-delay: .2s; }
.chat-typing span:nth-child(3) { animation-delay: .4s; }

@keyframes typing-dot {
  0%, 80%, 100% { transform: scale(.8); opacity: .5; }
  40%           { transform: scale(1.1); opacity: 1; }
}

/* ── Job cards inside chat ───────────────────────────────── */
.chat-job-cards {
  display: flex;
  flex-direction: column;
  gap: .5rem;
  margin-top: .25rem;
  max-width: 100%;
  align-self: flex-start;
  width: 100%;
}

.chat-job-card {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .65rem .85rem;
  background: var(--surface, #1a1a2e);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  text-decoration: none;
  transition: border-color .15s, transform .15s;
  cursor: pointer;
}

.chat-job-card:hover {
  border-color: var(--accent);
  transform: translateX(2px);
}

.chat-job-card.featured {
  border-color: rgba(245,158,11,.35);
}

.chat-job-info { flex: 1; min-width: 0; }

.chat-job-title {
  font-size: .8rem;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: .15rem;
}

.chat-job-meta {
  font-family: var(--mono, monospace);
  font-size: .62rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: .3rem;
  flex-wrap: wrap;
}

.chat-job-mode {
  padding: .1rem .4rem;
  border-radius: 4px;
  font-size: .58rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.chat-job-mode.remote { background: rgba(34,197,94,.12); color: #22c55e; }
.chat-job-mode.hybrid { background: rgba(59,130,246,.12); color: #60a5fa; }
.chat-job-mode.onsite { background: rgba(168,85,247,.12); color: #c084fc; }

.chat-job-arrow {
  font-family: var(--mono);
  font-size: .7rem;
  color: var(--accent);
  flex-shrink: 0;
}

/* ── More button ─────────────────────────────────────────── */
.chat-more-btn {
  align-self: flex-start;
  font-family: var(--mono, monospace);
  font-size: .72rem;
  color: var(--accent);
  background: rgba(232,100,44,.08);
  border: 1px solid rgba(232,100,44,.2);
  border-radius: 8px;
  padding: .35rem .85rem;
  cursor: pointer;
  transition: background .15s;
  margin-top: .15rem;
}

.chat-more-btn:hover { background: rgba(232,100,44,.15); }

/* ── Quick reply chips ───────────────────────────────────── */
.chat-quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  margin-top: .25rem;
  align-self: flex-start;
}

.chat-chip {
  font-family: var(--mono, monospace);
  font-size: .7rem;
  padding: .28rem .7rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
}

.chat-chip:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(232,100,44,.06);
}

/* ── Auth prompt inside chat ─────────────────────────────── */
.chat-auth-prompt {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  padding: 1.5rem;
  text-align: center;
  gap: .75rem;
}

.chat-auth-icon { font-size: 2rem; }

.chat-auth-title {
  font-size: .95rem;
  font-weight: 700;
  color: var(--text);
}

.chat-auth-sub {
  font-size: .8rem;
  color: var(--muted);
  line-height: 1.6;
}

.chat-auth-btn {
  display: inline-flex;
  align-items: center;
  padding: .55rem 1.4rem;
  background: var(--accent);
  color: #fff;
  border-radius: 8px;
  font-weight: 700;
  font-size: .82rem;
  text-decoration: none;
  transition: opacity .15s;
  margin-top: .25rem;
}

.chat-auth-btn:hover { opacity: .88; }

/* ── Input bar ───────────────────────────────────────────── */
.chat-input-bar {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .75rem 1rem;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.chat-input {
  flex: 1;
  background: var(--surface2, rgba(255,255,255,.05));
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: .55rem .85rem;
  font-size: .83rem;
  color: var(--text);
  outline: none;
  transition: border-color .15s;
  font-family: inherit;
}

.chat-input::placeholder { color: var(--muted2, #666); }

.chat-input:focus { border-color: var(--accent); }

.chat-send-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: opacity .15s, transform .15s;
}

.chat-send-btn:hover  { opacity: .88; transform: scale(1.05); }
.chat-send-btn:disabled { opacity: .4; cursor: not-allowed; transform: none; }