/* TalBot — floating candidate assistant */

:root {
  --cb-primary: #d71920;
  --cb-primary-dark: #b0141a;
  --cb-bg: #ffffff;
  --cb-surface: #f7f7f8;
  --cb-text: #1a1a1a;
  --cb-muted: #6b7280;
  --cb-border: #e5e7eb;
  --cb-bot-bubble: #f3f4f6;
  --cb-user-bubble: #d71920;
  --cb-shadow: 0 12px 40px rgba(17, 17, 17, 0.18);
  --cb-radius: 16px;
  --cb-z: 1080;
}

#talservChatbot {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: var(--cb-z);
  font-family: inherit;
  color: var(--cb-text);
}

#talservChatbot *,
#talservChatbot *::before,
#talservChatbot *::after {
  box-sizing: border-box;
}

.cb-launcher {
  position: relative;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: none;
  background: var(--cb-primary);
  color: #fff;
  box-shadow: var(--cb-shadow);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.45rem;
  transition: transform 0.2s ease, background 0.2s ease;
}

.cb-launcher:hover,
.cb-launcher:focus-visible {
  background: var(--cb-primary-dark);
  transform: scale(1.05);
  outline: none;
}

.cb-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 999px;
  background: #111;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  display: none;
  align-items: center;
  justify-content: center;
  border: 2px solid #fff;
}

.cb-badge.is-visible {
  display: inline-flex;
}

.cb-panel {
  position: absolute;
  right: 0;
  bottom: 76px;
  width: min(380px, calc(100vw - 24px));
  height: min(560px, calc(100vh - 110px));
  background: var(--cb-bg);
  border-radius: var(--cb-radius);
  box-shadow: var(--cb-shadow);
  border: 1px solid var(--cb-border);
  display: none;
  flex-direction: column;
  overflow: hidden;
}

.cb-panel.is-open {
  display: flex;
  animation: cbPanelIn 0.22s ease;
}

.cb-panel.is-minimized .cb-body,
.cb-panel.is-minimized .cb-footer {
  display: none;
}

.cb-panel.is-minimized {
  height: auto;
}

@keyframes cbPanelIn {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.cb-header {
  background: linear-gradient(135deg, #111 0%, #2a2a2a 100%);
  color: #fff;
  padding: 14px 14px 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.cb-header-title {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.cb-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--cb-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.cb-header h2 {
  margin: 0;
  font-family: var(--font-heading, 'Poppins', sans-serif);
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.cb-header p {
  margin: 0;
  font-size: 0.72rem;
  opacity: 0.75;
}

.cb-header-actions {
  display: flex;
  gap: 4px;
}

  .cb-icon-btn {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  line-height: 1;
}

.cb-icon-btn:hover,
.cb-icon-btn:focus-visible {
  background: rgba(255, 255, 255, 0.12);
  outline: none;
}

.cb-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  background: var(--cb-surface);
  -webkit-overflow-scrolling: touch;
}

.cb-msg {
  display: flex;
  flex-direction: column;
  margin-bottom: 12px;
  max-width: 92%;
}

.cb-sender {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  margin-bottom: 4px;
  color: var(--cb-muted);
}

.cb-msg-bot .cb-sender {
  color: var(--cb-primary);
}

.cb-msg-user .cb-sender {
  text-align: right;
  color: var(--cb-muted);
}

.cb-msg-bot {
  align-items: flex-start;
}

.cb-msg-user {
  align-items: flex-end;
  margin-left: auto;
}

.cb-bubble {
  padding: 10px 12px;
  border-radius: 14px;
  font-size: 0.875rem;
  line-height: 1.45;
  word-break: break-word;
}

.cb-msg-bot .cb-bubble {
  background: var(--cb-bot-bubble);
  color: var(--cb-text);
  border-bottom-left-radius: 4px;
}

.cb-msg-user .cb-bubble {
  background: var(--cb-user-bubble);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.cb-time {
  margin-top: 4px;
  font-size: 0.68rem;
  color: var(--cb-muted);
}

.cb-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 4px 0 10px;
}

.cb-chip {
  border: 1px solid var(--cb-border);
  background: #fff;
  color: var(--cb-text);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 0.75rem;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.cb-chip:hover,
.cb-chip:focus-visible {
  border-color: var(--cb-primary);
  color: var(--cb-primary);
  outline: none;
}

.cb-jobs {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 6px 0 4px;
  width: 100%;
}

.cb-job-card {
  background: #fff;
  border: 1px solid var(--cb-border);
  border-radius: 12px;
  padding: 10px;
}

.cb-job-card strong {
  display: block;
  font-size: 0.85rem;
  margin-bottom: 2px;
}

.cb-job-meta {
  font-size: 0.72rem;
  color: var(--cb-muted);
  margin-bottom: 8px;
}

.cb-job-card a {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  color: #fff;
  background: var(--cb-primary);
  text-decoration: none;
  border-radius: 8px;
  padding: 5px 10px;
}

.cb-job-card a:hover {
  background: var(--cb-primary-dark);
}

.cb-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.cb-link {
  font-size: 0.75rem;
  color: var(--cb-primary);
  text-decoration: none;
  font-weight: 600;
}

.cb-link:hover {
  text-decoration: underline;
}

.cb-typing {
  display: none;
  align-items: center;
  gap: 4px;
  padding: 8px 10px;
  background: var(--cb-bot-bubble);
  border-radius: 14px;
  width: fit-content;
  margin-bottom: 8px;
}

.cb-typing.is-visible {
  display: inline-flex;
}

.cb-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #9ca3af;
  animation: cbDot 1.2s infinite ease-in-out;
}

.cb-typing span:nth-child(2) {
  animation-delay: 0.15s;
}

.cb-typing span:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes cbDot {
  0%,
  80%,
  100% {
    opacity: 0.35;
    transform: translateY(0);
  }
  40% {
    opacity: 1;
    transform: translateY(-3px);
  }
}

.cb-footer {
  border-top: 1px solid var(--cb-border);
  padding: 10px;
  background: #fff;
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.cb-footer textarea {
  flex: 1;
  resize: none;
  border: 1px solid var(--cb-border);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 0.875rem;
  line-height: 1.35;
  max-height: 88px;
  min-height: 42px;
  font-family: inherit;
}

.cb-footer textarea:focus {
  outline: none;
  border-color: var(--cb-primary);
  box-shadow: 0 0 0 3px rgba(215, 25, 32, 0.12);
}

.cb-send {
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  border: none;
  border-radius: 12px;
  background: var(--cb-primary);
  color: #fff;
  cursor: pointer;
  flex-shrink: 0;
}

.cb-send:hover,
.cb-send:focus-visible {
  background: var(--cb-primary-dark);
  outline: none;
}

.cb-send:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.cb-error {
  color: #b91c1c;
  font-size: 0.8rem;
}

@media (max-width: 575.98px) {
  #talservChatbot {
    right: 12px;
    bottom: 12px;
  }

  .cb-panel {
    position: fixed;
    right: 8px;
    left: 8px;
    bottom: 84px;
    width: auto;
    height: min(70vh, 560px);
  }

  .cb-launcher {
    width: 56px;
    height: 56px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .cb-panel.is-open,
  .cb-launcher,
  .cb-typing span {
    animation: none;
    transition: none;
  }
}
