/* ═══════════════════════════════════════
   NEURO FLOAT CHATBOT
   Floating button + popup — bottom right
   Neumorphism · Purple accent
═══════════════════════════════════════ */

#nfloat-root {
  --bg:       #e8e6f0;
  --bg-d:     #dddae8;
  --bg-l:     #f3f1fb;
  --acc:      #7c5cbf;
  --acc2:     #a98eda;
  --acc-g:    rgba(124,92,191,0.32);
  --txt:      #3d3650;
  --txt2:     #7a7390;
  --txt3:     #b5afca;
  --green:    #4cba90;
  --sh-out:   6px 6px 16px #cbc9d8, -6px -6px 16px #ffffff;
  --sh-in:    inset 4px 4px 10px #cbc9d8, inset -4px -4px 10px #ffffff;
  --sh-sm:    3px 3px 8px #cbc9d8, -3px -3px 8px #ffffff;
  --sh-acc:   4px 4px 14px rgba(124,92,191,0.38), -2px -2px 8px #ffffff;
  --r:        18px;

  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 999999;
  font-family: 'DM Sans', system-ui, -apple-system, sans-serif;
}

/* ── FAB BUTTON ── */
#nfloat-fab {
  width: 58px;
  height: 58px;
  border-radius: 18px;
  border: none;
  background: var(--bg);
  box-shadow: var(--sh-out);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--acc);
  transition: all 0.3s cubic-bezier(.34,1.5,.64,1);
  position: relative;
  margin-left: auto;
}

#nfloat-fab:hover {
  transform: scale(1.08) translateY(-3px);
  box-shadow: 8px 8px 20px #cbc9d8, -8px -8px 20px #ffffff;
}

#nfloat-fab:active {
  box-shadow: var(--sh-in);
  transform: scale(0.95);
}

#nfloat-fab.is-open {
  background: linear-gradient(135deg, var(--acc), var(--acc2));
  box-shadow: var(--sh-acc);
  color: #fff;
}

.nfloat-fab-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.25s ease;
}

/* Unread badge */
.nfloat-unread {
  position: absolute;
  top: -5px;
  right: -5px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f87171, #ef4444);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: nfBadgePop 0.4s cubic-bezier(.34,1.5,.64,1);
}

@keyframes nfBadgePop {
  from { transform: scale(0); }
  to   { transform: scale(1); }
}

/* ── POPUP ── */
#nfloat-popup {
  position: absolute;
  bottom: 72px;
  right: 0;
  width: 340px;
  background: var(--bg);
  border-radius: 22px;
  box-shadow: var(--sh-out);
  overflow: hidden;
  transform-origin: bottom right;
  transition: transform 0.35s cubic-bezier(.34,1.4,.64,1), opacity 0.3s ease;
}

#nfloat-popup.nfloat-hidden {
  transform: scale(0.85) translateY(12px);
  opacity: 0;
  pointer-events: none;
}

#nfloat-popup.nfloat-visible {
  transform: scale(1) translateY(0);
  opacity: 1;
  pointer-events: all;
}

/* ── HEADER ── */
.nfloat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 16px;
  background: var(--bg-l);
  border-bottom: 1px solid rgba(255,255,255,0.6);
}

.nfloat-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nfloat-avatar {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  background: var(--bg);
  box-shadow: var(--sh-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  flex-shrink: 0;
}

.nfloat-bot-name {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--txt);
  letter-spacing: -0.01em;
  line-height: 1;
  margin-bottom: 3px;
}

.nfloat-status {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--green);
  font-weight: 500;
}

.nfloat-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  animation: nfPulse 2.4s ease-in-out infinite;
}

@keyframes nfPulse {
  0%,100% { opacity:1; transform:scale(1); }
  50%      { opacity:.3; transform:scale(.7); }
}

.nfloat-close-btn {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  border: none;
  background: var(--bg);
  box-shadow: var(--sh-sm);
  color: var(--txt2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.nfloat-close-btn:hover {
  color: var(--acc);
  box-shadow: var(--sh-out);
}
.nfloat-close-btn:active { box-shadow: var(--sh-in); }

/* ── MESSAGES ── */
.nfloat-messages {
  height: 320px;
  overflow-y: auto;
  padding: 16px 14px 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}

.nfloat-messages::-webkit-scrollbar { width: 3px; }
.nfloat-messages::-webkit-scrollbar-thumb { background: var(--bg-d); border-radius: 3px; }

.nfloat-msg {
  display: flex;
  flex-direction: column;
  gap: 2px;
  animation: nfMsgIn 0.32s cubic-bezier(.34,1.4,.64,1) both;
}

@keyframes nfMsgIn {
  from { opacity:0; transform:translateY(10px) scale(.97); }
  to   { opacity:1; transform:none; }
}

.nfloat-bot  { align-items: flex-start; }
.nfloat-user { align-items: flex-end; }

.nfloat-bubble {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 13px;
  line-height: 1.65;
  word-break: break-word;
}

.nfloat-bot .nfloat-bubble {
  background: var(--bg);
  box-shadow: var(--sh-sm);
  color: var(--txt);
  border-bottom-left-radius: 4px;
}

.nfloat-user .nfloat-bubble {
  background: linear-gradient(135deg, var(--acc) 0%, var(--acc2) 100%);
  color: #fff;
  border-bottom-right-radius: 4px;
  box-shadow: var(--sh-acc);
}

.nfloat-ts {
  font-size: 10px;
  color: var(--txt3);
  padding: 0 3px;
}

/* ── TYPING ── */
.nfloat-typing {
  padding: 4px 14px 4px;
}

.nfloat-typing-bub {
  background: var(--bg);
  box-shadow: var(--sh-sm);
  border-radius: 14px;
  border-bottom-left-radius: 4px;
  padding: 10px 14px;
  display: inline-flex;
  gap: 4px;
  align-items: center;
}

.nfloat-typing-bub span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--acc2);
  animation: nfTd 1.3s ease-in-out infinite;
}
.nfloat-typing-bub span:nth-child(2) { animation-delay: .18s; }
.nfloat-typing-bub span:nth-child(3) { animation-delay: .36s; }

@keyframes nfTd {
  0%,60%,100% { transform:translateY(0); opacity:.4; }
  30%          { transform:translateY(-5px); opacity:1; }
}

/* ── INPUT ── */
.nfloat-input-area {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px 14px;
  border-top: 1px solid rgba(255,255,255,0.6);
}

.nfloat-input-wrap {
  flex: 1;
  background: var(--bg);
  box-shadow: var(--sh-in);
  border-radius: 13px;
  padding: 0 13px;
}

.nfloat-input {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  padding: 11px 0;
  font-family: inherit;
  font-size: 13px;
  color: var(--txt);
}
.nfloat-input::placeholder { color: var(--txt3); }

.nfloat-send {
  width: 42px;
  height: 42px;
  border-radius: 13px;
  border: none;
  background: linear-gradient(135deg, var(--acc), var(--acc2));
  box-shadow: var(--sh-acc);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.25s cubic-bezier(.34,1.5,.64,1);
}
.nfloat-send:hover {
  transform: scale(1.08) translateY(-2px);
  box-shadow: 5px 5px 14px rgba(124,92,191,.45), -2px -2px 8px #fff;
}
.nfloat-send:active { transform: scale(.93); box-shadow: var(--sh-in); }
.nfloat-send:disabled { opacity: .4; transform: none; cursor: not-allowed; }

/* ── MOBILE ── */
@media (max-width: 420px) {
  #nfloat-root { bottom: 18px; right: 16px; }
  #nfloat-popup { width: calc(100vw - 32px); right: 0; }
}
