/* =============================================================================
   Career Chatbot Widget — chatbot.css
   Standalone stylesheet; no Tailwind / framework dependency.
   Uses CSS custom properties so it adapts to CoreUI light/dark themes.
   ============================================================================= */

:root {
  --chat-accent:        #4f46e5;
  --chat-accent-dark:   #3730a3;
  --chat-accent-light:  #e0e7ff;
  --chat-bot-bg:        #ffffff;
  --chat-user-bg:       #4f46e5;
  --chat-user-text:     #ffffff;
  --chat-bot-text:      #1e293b;
  --chat-panel-bg:      rgba(255, 255, 255, 0.97);
  --chat-panel-border:  rgba(79, 70, 229, 0.18);
  --chat-shadow:        0 24px 60px rgba(0, 0, 0, 0.18), 0 4px 16px rgba(79, 70, 229, 0.12);
  --chat-radius:        18px;
  --chat-radius-sm:     10px;
  --chat-panel-w:       380px;
  --chat-panel-h:       540px;
  --chat-z:             9999;
}

@media (prefers-color-scheme: dark) {
  :root {
    --chat-bot-bg:      #1e293b;
    --chat-bot-text:    #e2e8f0;
    --chat-panel-bg:    rgba(15, 23, 42, 0.97);
    --chat-panel-border:rgba(79, 70, 229, 0.30);
  }
}

/* ── Toggle Button ─────────────────────────────────────────────────────────── */
.chatbot-toggle {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: var(--chat-z);
  width: 58px;
  height: 58px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, var(--chat-accent) 0%, #7c3aed 100%);
  color: #fff;
  font-size: 24px;
  cursor: pointer;
  box-shadow: 0 6px 24px rgba(79, 70, 229, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  outline: none;
}
.chatbot-toggle:hover {
  transform: scale(1.08);
  box-shadow: 0 8px 32px rgba(79, 70, 229, 0.60);
}
.chatbot-toggle:focus-visible {
  outline: 3px solid var(--chat-accent-light);
  outline-offset: 3px;
}
/* Pulse animation when panel is closed */
.chatbot-toggle:not(.is-open)::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid var(--chat-accent);
  animation: chatbot-pulse 2.4s ease-out infinite;
  pointer-events: none;
}
@keyframes chatbot-pulse {
  0%   { transform: scale(1);   opacity: 0.7; }
  70%  { transform: scale(1.4); opacity: 0;   }
  100% { transform: scale(1.4); opacity: 0;   }
}

.chatbot-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  background: #ef4444;
  color: #fff;
  border-radius: 50%;
  width: 18px;
  height: 18px;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #fff;
}

/* ── Panel ─────────────────────────────────────────────────────────────────── */
.chatbot-panel {
  position: fixed;
  bottom: 98px;
  right: 28px;
  z-index: var(--chat-z);
  width: var(--chat-panel-w);
  height: var(--chat-panel-h);
  background: var(--chat-panel-bg);
  border: 1px solid var(--chat-panel-border);
  border-radius: var(--chat-radius);
  box-shadow: var(--chat-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  /* Hidden state */
  opacity: 0;
  transform: translateY(16px) scale(0.97);
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease;
}
.chatbot-panel.is-open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

/* ── Header ────────────────────────────────────────────────────────────────── */
.chatbot-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: linear-gradient(135deg, var(--chat-accent) 0%, #7c3aed 100%);
  color: #fff;
  flex-shrink: 0;
}
.chatbot-header-info {
  display: flex;
  align-items: center;
  gap: 10px;
}
.chatbot-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.chatbot-header-name {
  font-weight: 700;
  font-size: 15px;
  line-height: 1.2;
}
.chatbot-header-status {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  opacity: 0.85;
}
.chatbot-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 6px #4ade80;
  animation: chatbot-blink 2s ease infinite;
}
@keyframes chatbot-blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}
.chatbot-close-btn {
  background: rgba(255,255,255,0.18);
  border: none;
  color: #fff;
  border-radius: 50%;
  width: 30px;
  height: 30px;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
  flex-shrink: 0;
}
.chatbot-close-btn:hover { background: rgba(255,255,255,0.32); }

/* ── Message Area ──────────────────────────────────────────────────────────── */
.chatbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scrollbar-width: thin;
  scrollbar-color: rgba(0,0,0,0.15) transparent;
}
.chatbot-messages::-webkit-scrollbar        { width: 4px; }
.chatbot-messages::-webkit-scrollbar-thumb  { background: rgba(0,0,0,0.15); border-radius: 4px; }

/* Individual message bubbles */
.chatbot-msg {
  display: flex;
  flex-direction: column;
  max-width: 82%;
  animation: chatbot-msg-in 0.2s ease;
}
@keyframes chatbot-msg-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.chatbot-msg.bot  { align-self: flex-start; }
.chatbot-msg.user { align-self: flex-end;   }

.chatbot-bubble {
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.55;
  word-break: break-word;
}
.chatbot-msg.bot  .chatbot-bubble {
  background: var(--chat-bot-bg);
  color: var(--chat-bot-text);
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}
.chatbot-msg.user .chatbot-bubble {
  background: var(--chat-user-bg);
  color: var(--chat-user-text);
  border-bottom-right-radius: 4px;
}
.chatbot-msg-time {
  font-size: 11px;
  color: #94a3b8;
  margin-top: 3px;
  padding: 0 4px;
}
.chatbot-msg.user .chatbot-msg-time { text-align: right; }

/* ── Typing Indicator ──────────────────────────────────────────────────────── */
.chatbot-typing {
  padding: 8px 18px;
  flex-shrink: 0;
}
.chatbot-typing-dots {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--chat-bot-bg);
  padding: 8px 14px;
  border-radius: 16px;
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}
.chatbot-typing-dots span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #94a3b8;
  animation: chatbot-dot-bounce 1.2s ease-in-out infinite;
}
.chatbot-typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.chatbot-typing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes chatbot-dot-bounce {
  0%, 80%, 100% { transform: scale(0.7); opacity: 0.5; }
  40%           { transform: scale(1);   opacity: 1;   }
}

/* ── Quick-Action Chips ────────────────────────────────────────────────────── */
.chatbot-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 6px 14px;
  flex-shrink: 0;
}
.chatbot-chip {
  padding: 5px 13px;
  border-radius: 20px;
  border: 1.5px solid var(--chat-accent);
  background: var(--chat-accent-light);
  color: var(--chat-accent-dark);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
.chatbot-chip:hover {
  background: var(--chat-accent);
  color: #fff;
}

/* ── Input Bar ─────────────────────────────────────────────────────────────── */
.chatbot-input-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid rgba(0,0,0,0.07);
  flex-shrink: 0;
}
.chatbot-input {
  flex: 1;
  border: 1.5px solid rgba(0,0,0,0.12);
  border-radius: 24px;
  padding: 9px 16px;
  font-size: 14px;
  outline: none;
  background: transparent;
  color: inherit;
  transition: border-color 0.15s;
}
.chatbot-input:focus {
  border-color: var(--chat-accent);
}
.chatbot-send-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  background: var(--chat-accent);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, transform 0.15s;
  flex-shrink: 0;
}
.chatbot-send-btn:hover    { background: var(--chat-accent-dark); transform: scale(1.06); }
.chatbot-send-btn:disabled { background: #cbd5e1; cursor: not-allowed; transform: none; }

/* ── Powered-by footer ─────────────────────────────────────────────────────── */
.chatbot-powered-by {
  text-align: center;
  font-size: 11px;
  color: #94a3b8;
  padding: 5px 14px 9px;
  flex-shrink: 0;
}

/* ── File Upload Components ────────────────────────────────────────────────── */
.chatbot-upload-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1.5px dashed var(--chat-accent);
  background: var(--chat-accent-light);
  color: var(--chat-accent-dark);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  flex-shrink: 0;
  font-size: 16px;
}
.chatbot-upload-btn:hover {
  background: var(--chat-accent);
  color: #fff;
  border-style: solid;
}
.chatbot-upload-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.chatbot-upload-card {
  border: 1.5px dashed var(--chat-accent);
  background: var(--chat-accent-light);
  border-radius: 12px;
  padding: 12px 14px;
  margin: 4px 0;
  text-align: center;
  font-size: 13px;
  color: var(--chat-accent-dark);
  cursor: pointer;
  transition: all 0.15s ease;
}
.chatbot-upload-card:hover {
  background: rgba(79, 70, 229, 0.15);
}
.chatbot-upload-card.drag-over {
  border-color: #4338ca;
  background: rgba(79, 70, 229, 0.25);
  transform: scale(1.02);
}

/* ── Responsive ────────────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  :root {
    --chat-panel-w: calc(100vw - 24px);
    --chat-panel-h: 70vh;
  }
  .chatbot-panel {
    right: 12px;
    bottom: 90px;
  }
  .chatbot-toggle {
    right: 16px;
    bottom: 20px;
  }
}
