/* FER Ask FER widget — shared public/candidate/employer/recruiter UI */
:root {
  --fer-chat-navy: #082556;
  --fer-chat-blue: #2f5fe3;
  --fer-chat-purple: #6954df;
  --fer-chat-bg: #ffffff;
  --fer-chat-soft: #f5f7fb;
  --fer-chat-border: #e4e9f2;
  --fer-chat-text: #10213f;
  --fer-chat-muted: #69758d;
  --fer-chat-success: #0d7c66;
  --fer-chat-danger: #a63f4a;
}

#fer-ai-chat-root {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 2147482000;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--fer-chat-text);
}

.fer-ai-chat-launcher {
  min-width: 116px;
  height: 52px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--fer-chat-blue), var(--fer-chat-purple));
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 0 18px;
  font: inherit;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: .01em;
  box-shadow: 0 16px 38px rgba(34, 61, 132, .28);
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease, opacity .18s ease;
}

.fer-ai-chat-launcher:hover {
  transform: translateY(-2px);
  box-shadow: 0 20px 44px rgba(34, 61, 132, .34);
}

.fer-ai-chat-launcher:focus-visible,
.fer-ai-chat-panel button:focus-visible,
.fer-ai-chat-panel textarea:focus-visible {
  outline: 3px solid rgba(47, 95, 227, .22);
  outline-offset: 2px;
}

.fer-ai-chat-launcher-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255,255,255,.18);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  flex: 0 0 auto;
}

.fer-ai-chat-panel {
  position: absolute;
  right: 0;
  bottom: 66px;
  width: min(390px, calc(100vw - 32px));
  height: min(590px, calc(100vh - 110px));
  min-height: 430px;
  background: var(--fer-chat-bg);
  border: 1px solid var(--fer-chat-border);
  border-radius: 22px;
  box-shadow: 0 28px 75px rgba(14, 33, 76, .24);
  overflow: hidden;
  display: grid;
  grid-template-rows: auto 1fr auto;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px) scale(.985);
  transform-origin: bottom right;
  transition: opacity .17s ease, transform .17s ease, visibility .17s ease;
}

.fer-ai-chat-panel.is-open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.fer-ai-chat-header {
  background: linear-gradient(135deg, #092758, #153b82);
  color: #fff;
  padding: 16px 16px 14px;
  display: flex;
  align-items: center;
  gap: 11px;
}

.fer-ai-chat-brand {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: rgba(255,255,255,.14);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  flex: 0 0 auto;
}

.fer-ai-chat-heading {
  flex: 1;
  min-width: 0;
}

.fer-ai-chat-title {
  margin: 0;
  font-size: 16px;
  font-weight: 850;
  line-height: 1.2;
}

.fer-ai-chat-subtitle {
  margin: 3px 0 0;
  color: rgba(255,255,255,.72);
  font-size: 11.5px;
  line-height: 1.3;
}

.fer-ai-chat-close {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 10px;
  background: rgba(255,255,255,.12);
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-size: 20px;
  line-height: 1;
}

.fer-ai-chat-body {
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 16px;
  background:
    radial-gradient(circle at top right, rgba(47,95,227,.045), transparent 34%),
    var(--fer-chat-soft);
  scroll-behavior: smooth;
}

.fer-ai-chat-message {
  display: flex;
  margin-bottom: 12px;
}

.fer-ai-chat-message.user {
  justify-content: flex-end;
}

.fer-ai-chat-bubble {
  max-width: 88%;
  padding: 10px 12px;
  border-radius: 15px;
  font-size: 13.5px;
  line-height: 1.48;
  white-space: pre-wrap;
  word-break: break-word;
}

.fer-ai-chat-message.assistant .fer-ai-chat-bubble {
  background: #fff;
  border: 1px solid var(--fer-chat-border);
  border-bottom-left-radius: 6px;
  box-shadow: 0 4px 12px rgba(38, 54, 88, .045);
}

.fer-ai-chat-message.user .fer-ai-chat-bubble {
  background: linear-gradient(135deg, var(--fer-chat-blue), var(--fer-chat-purple));
  color: #fff;
  border-bottom-right-radius: 6px;
}

.fer-ai-chat-message.error .fer-ai-chat-bubble {
  color: var(--fer-chat-danger);
  background: #fff8f8;
  border-color: #f0d5d8;
}

.fer-ai-chat-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: -4px 0 14px;
}

.fer-ai-chat-action {
  appearance: none;
  border: 1px solid #cad5f3;
  background: #fff;
  color: #214aa7;
  border-radius: 999px;
  padding: 7px 10px;
  font: inherit;
  font-size: 11.5px;
  font-weight: 800;
  cursor: pointer;
}

.fer-ai-chat-action:hover {
  background: #eff4ff;
  border-color: #9fb3ed;
}

.fer-ai-chat-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 4px;
}

.fer-ai-chat-quick button {
  border: 1px solid var(--fer-chat-border);
  background: #fff;
  color: #364766;
  border-radius: 999px;
  padding: 7px 10px;
  font: inherit;
  font-size: 11.5px;
  font-weight: 720;
  cursor: pointer;
}

.fer-ai-chat-quick button:hover {
  border-color: #b8c7ed;
  background: #f8faff;
}

.fer-ai-chat-typing {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  min-width: 42px;
}

.fer-ai-chat-typing i {
  display: block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #8794aa;
  animation: fer-ai-chat-bounce 1.05s infinite ease-in-out;
}

.fer-ai-chat-typing i:nth-child(2) { animation-delay: .12s; }
.fer-ai-chat-typing i:nth-child(3) { animation-delay: .24s; }

@keyframes fer-ai-chat-bounce {
  0%, 80%, 100% { transform: translateY(0); opacity: .5; }
  40% { transform: translateY(-4px); opacity: 1; }
}

.fer-ai-chat-footer {
  border-top: 1px solid var(--fer-chat-border);
  background: #fff;
  padding: 10px 12px 9px;
}

.fer-ai-chat-compose {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.fer-ai-chat-input {
  resize: none;
  width: 100%;
  min-height: 42px;
  max-height: 112px;
  border: 1px solid #d8deea;
  border-radius: 13px;
  padding: 10px 11px;
  font: inherit;
  font-size: 13px;
  line-height: 1.4;
  color: var(--fer-chat-text);
  background: #fff;
  box-sizing: border-box;
}

.fer-ai-chat-input::placeholder {
  color: #8b96a9;
}

.fer-ai-chat-send {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  border: 0;
  border-radius: 13px;
  background: var(--fer-chat-blue);
  color: #fff;
  cursor: pointer;
  font-size: 18px;
  font-weight: 900;
}

.fer-ai-chat-send:disabled,
.fer-ai-chat-input:disabled {
  opacity: .58;
  cursor: not-allowed;
}

.fer-ai-chat-note {
  margin: 7px 2px 0;
  color: var(--fer-chat-muted);
  text-align: center;
  font-size: 9.5px;
  line-height: 1.35;
}

body.fer-ai-chat-open-mobile {
  overflow: hidden;
}

@media (max-width: 640px) {
  #fer-ai-chat-root {
    right: 14px;
    bottom: 14px;
  }

  .fer-ai-chat-launcher {
    min-width: 54px;
    width: 54px;
    height: 54px;
    padding: 0;
  }

  .fer-ai-chat-launcher-text {
    display: none;
  }

  .fer-ai-chat-launcher-icon {
    width: 31px;
    height: 31px;
  }

  .fer-ai-chat-panel {
    position: fixed;
    left: 10px;
    right: 10px;
    top: 10px;
    bottom: 10px;
    width: auto;
    height: auto;
    min-height: 0;
    border-radius: 18px;
    transform-origin: bottom right;
  }

  .fer-ai-chat-body {
    padding: 14px;
  }

  .fer-ai-chat-bubble {
    max-width: 92%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .fer-ai-chat-launcher,
  .fer-ai-chat-panel,
  .fer-ai-chat-typing i {
    transition: none !important;
    animation: none !important;
  }
}
