/* ─────────────────────────────────────────────
   SA-HR Assistant — glassmorphic floating chat
   Shared across main site and all /work/ subpages
   ───────────────────────────────────────────── */

.chat-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 90;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 54px;
  height: 54px;
  padding: 0;
  background: linear-gradient(135deg, rgba(14, 18, 26, 0.88), rgba(20, 28, 42, 0.82));
  color: #fff;
  border: 1px solid rgba(62, 168, 255, 0.32);
  border-radius: 50%;
  backdrop-filter: blur(24px) saturate(140%);
  -webkit-backdrop-filter: blur(24px) saturate(140%);
  cursor: pointer;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(62, 168, 255, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  transition: transform 220ms cubic-bezier(.2,.7,.3,1), box-shadow 220ms, border-color 220ms, width 280ms cubic-bezier(.2,.7,.3,1);
  overflow: hidden;
}
.chat-fab:hover {
  transform: translateY(-2px);
  border-color: rgba(62, 168, 255, 0.55);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.55), 0 0 28px rgba(62, 168, 255, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}
.chat-fab.hidden {
  transform: scale(0.7) translateY(10px);
  opacity: 0;
  pointer-events: none;
}
.chat-fab-sparkle,
.chat-fab-logo {
  width: 24px; height: 24px;
  flex-shrink: 0;
  filter: drop-shadow(0 0 6px rgba(0, 229, 255, 0.45));
  animation: chatFabGlow 3s ease-in-out infinite;
}
@keyframes chatFabGlow {
  0%, 100% { filter: drop-shadow(0 0 6px rgba(0, 229, 255, 0.4)); }
  50%      { filter: drop-shadow(0 0 14px rgba(0, 229, 255, 0.7)); }
}
/* Label becomes a hover tooltip, not inline text */
.chat-fab-label {
  position: absolute;
  right: calc(100% + 12px);
  top: 50%;
  transform: translateY(-50%) translateX(6px);
  padding: 7px 13px;
  background: rgba(10, 14, 22, 0.92);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(62, 168, 255, 0.25);
  border-radius: 999px;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: #fff;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms, transform 220ms;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
}
.chat-fab:hover .chat-fab-label {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}

.chat-panel {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 380px;
  height: 580px;
  max-height: calc(100vh - 48px);
  z-index: 95;
  background: linear-gradient(180deg, rgba(14, 18, 26, 0.82), rgba(10, 14, 22, 0.88));
  backdrop-filter: blur(32px) saturate(150%);
  -webkit-backdrop-filter: blur(32px) saturate(150%);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 22px;
  box-shadow: 0 32px 88px rgba(0, 0, 0, 0.62), 0 0 0 1px rgba(62, 168, 255, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform-origin: bottom right;
  transform: scale(0.85) translateY(16px);
  opacity: 0;
  pointer-events: none;
  transition: transform 340ms cubic-bezier(.2,.7,.3,1), opacity 340ms ease;
}
.chat-panel.open { transform: scale(1) translateY(0); opacity: 1; pointer-events: auto; }
.chat-panel::before {
  content: "";
  position: absolute;
  top: -40%; right: -30%;
  width: 70%; height: 70%;
  background: radial-gradient(circle, rgba(62, 168, 255, 0.14), transparent 70%);
  pointer-events: none;
  z-index: 0;
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  position: relative;
  z-index: 1;
  background: rgba(14, 18, 26, 0.4);
}
.chat-title { display: flex; align-items: center; gap: 12px; }
.chat-avatar {
  width: 38px; height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(62, 168, 255, 0.22), rgba(0, 229, 255, 0.1));
  border: 1px solid rgba(62, 168, 255, 0.35);
  display: grid;
  place-items: center;
  padding: 7px;
  box-shadow: 0 0 16px rgba(62, 168, 255, 0.2);
}
.chat-avatar svg { width: 100%; height: 100%; display: block; filter: drop-shadow(0 0 4px rgba(0, 229, 255, 0.45)); }
.chat-name { font-size: 0.9rem; font-weight: 500; color: #fff; }
.chat-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.5);
  margin-top: 2px;
}
.chat-status-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #00D97E;
  box-shadow: 0 0 6px rgba(0, 217, 126, 0.6);
  position: relative;
}
.chat-status-dot::after {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  background: #00D97E;
  animation: chatStatusPulse 2.2s ease-in-out infinite;
}
@keyframes chatStatusPulse {
  0%, 100% { opacity: 0.55; transform: scale(1); }
  50%      { opacity: 0;    transform: scale(2.6); }
}
.chat-close {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.6);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: all 180ms;
}
.chat-close:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.16);
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px 18px 8px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
  z-index: 1;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}
.chat-messages::-webkit-scrollbar { width: 6px; }
.chat-messages::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.12); border-radius: 3px; }
.chat-messages::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.2); }

.chat-msg {
  display: flex;
  max-width: 85%;
  animation: chatMsgIn 320ms cubic-bezier(.2,.7,.3,1);
}
.chat-msg-bot { align-self: flex-start; }
.chat-msg-user { align-self: flex-end; }
@keyframes chatMsgIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.chat-bubble {
  padding: 11px 14px;
  border-radius: 16px;
  font-size: 0.88rem;
  line-height: 1.5;
  word-wrap: break-word;
}
.chat-msg-bot .chat-bubble {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.07);
  color: rgba(255, 255, 255, 0.88);
  border-bottom-left-radius: 5px;
}
.chat-msg-user .chat-bubble {
  background: linear-gradient(135deg, rgba(62, 168, 255, 0.22), rgba(0, 229, 255, 0.14));
  border: 1px solid rgba(62, 168, 255, 0.28);
  color: #fff;
  border-bottom-right-radius: 5px;
}

.chat-typing { display: inline-flex; gap: 4px; padding: 13px 14px; }
.chat-typing span {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.4);
  animation: typingBounce 1.2s ease-in-out infinite;
}
.chat-typing span:nth-child(2) { animation-delay: 0.2s; }
.chat-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0);   opacity: 0.4; }
  30%           { transform: translateY(-4px); opacity: 1; }
}

.chat-input-area {
  padding: 10px 14px 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  position: relative;
  z-index: 1;
  background: rgba(10, 14, 22, 0.3);
}
.chat-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
  transition: opacity 280ms, height 280ms, margin 280ms;
  overflow: hidden;
}
.chat-suggestions.hidden { opacity: 0; height: 0; margin-bottom: 0; pointer-events: none; }
.chat-suggestion {
  padding: 6px 12px;
  font-size: 0.75rem;
  font-family: 'DM Sans', sans-serif;
  color: rgba(255, 255, 255, 0.72);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  cursor: pointer;
  transition: all 180ms;
  white-space: nowrap;
}
.chat-suggestion:hover {
  background: rgba(62, 168, 255, 0.12);
  border-color: rgba(62, 168, 255, 0.35);
  color: #fff;
}
.chat-input-form {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 6px 6px 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  transition: border-color 180ms;
}
.chat-input-form:focus-within {
  border-color: rgba(62, 168, 255, 0.5);
  box-shadow: 0 0 0 3px rgba(62, 168, 255, 0.08);
}
.chat-input {
  flex: 1;
  background: transparent;
  border: none;
  color: #fff;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.88rem;
  outline: none;
  padding: 8px 0;
}
.chat-input::placeholder { color: rgba(255, 255, 255, 0.35); }
.chat-send {
  width: 34px; height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(62, 168, 255, 0.85), rgba(0, 229, 255, 0.65));
  border: none;
  color: #0a0f18;
  display: grid;
  place-items: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 180ms;
  box-shadow: 0 4px 12px rgba(62, 168, 255, 0.35);
}
.chat-send:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(62, 168, 255, 0.5); }
.chat-send:disabled { opacity: 0.45; cursor: not-allowed; transform: none; box-shadow: none; }
.chat-footer-note {
  text-align: center;
  font-size: 0.65rem;
  color: rgba(255, 255, 255, 0.3);
  margin-top: 8px;
  letter-spacing: 0.04em;
}

@media (max-width: 520px) {
  .chat-fab { bottom: 16px; right: 16px; padding: 12px;   z-index: 60;
}
  .chat-fab-label { display: none; }
  .chat-panel {
    width: calc(100vw - 24px);
    height: calc(100vh - 88px);
    bottom: 12px; right: 12px; left: 12px;
  }
}
