/* Floating trigger button */
.nb-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9998;
  width: 70px;
  height: 70px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-container) 100%);
  color: var(--color-on-primary);
  cursor: pointer;
  box-shadow: 0 6px 24px rgba(53, 37, 205, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease;
}

.nb-fab:hover {
  transform: scale(1.08);
  box-shadow: 0 8px 32px rgba(53, 37, 205, 0.45);
}

.nb-fab:active {
  transform: scale(0.95);
}

.nb-fab img {
  width: 85px;
  height: 85px;
  object-fit: contain;
  transition: transform 0.3s ease;
  position: absolute;
  /* To center it perfectly */
  top: -3px;
}

.nb-fab.open img {
  transform: scale(0.9);
}

/* Pulse ring */
.nb-fab::before {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid var(--color-primary-fixed-dim);
  animation: nb-pulse 2.5s ease-in-out infinite;
  pointer-events: none;
}

.nb-fab.open::before {
  animation: none;
  opacity: 0;
}

@keyframes nb-pulse {

  0%,
  100% {
    transform: scale(1);
    opacity: 0.6;
  }

  50% {
    transform: scale(1.18);
    opacity: 0;
  }
}

.nb-tooltip {
  position: fixed;
  bottom: 96px;
  right: 24px;
  background-color: rgb(168, 240, 168);
  color: rgb(15, 82, 15);
  padding: 12px 18px;
  border-radius: 20px;
  border-bottom-right-radius: 4px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  font-family: var(--font-family);
  font-size: 13px;
  font-weight: 600;
  z-index: 9998;
  pointer-events: none;
  opacity: 0;
  transform: translateY(10px) scale(0.9);
  transform-origin: bottom right;
  animation: nb-tooltip-show 6s ease-in-out 3s forwards;
  /* Shows for 6 seconds, starting 3s after page load */
}

@keyframes nb-tooltip-show {
  0% {
    opacity: 0;
    transform: translateY(10px) scale(0.9);
  }

  10%,
  90% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }

  100% {
    opacity: 0;
    transform: translateY(10px) scale(0.9);
  }
}

.nb-fab.open~.nb-tooltip {
  display: none !important;
}

/* ============================================
   Chat Panel
   ============================================ */
.nb-panel {
  position: fixed;
  bottom: 96px;
  right: 24px;
  z-index: 9999;
  width: 380px;
  max-width: calc(100vw - 32px);
  height: 540px;
  max-height: calc(100vh - 140px);
  background: var(--color-surface-container);
  border-radius: 20px;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.04);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: scale(0.4) translateY(40px);
  transform-origin: bottom right;
  opacity: 0;
  pointer-events: none;
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.25s ease;
}

.nb-panel.open {
  transform: scale(1) translateY(0);
  opacity: 1;
  pointer-events: auto;
}

/* Header */
.nb-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-container) 100%);
  color: var(--color-on-primary);
  flex-shrink: 0;
}

.nb-header-avatar {
  width: 35px;
  height: 35px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.nb-header-avatar img {
  width: 38px;
  height: 38px;
  object-fit: contain;
}

.nb-header-info {
  flex: 1;
  min-width: 0;
}

.nb-header-name {
  font-family: var(--font-family);
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.nb-header-status {
  font-size: 11px;
  opacity: 0.85;
  display: flex;
  align-items: center;
  gap: 5px;
}

.nb-header-status::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--color-secondary-container);
  display: inline-block;
}

.nb-close {
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: inherit;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s ease;
  flex-shrink: 0;
}

.nb-close:hover {
  background: rgba(255, 255, 255, 0.3);
}

.nb-close .material-symbols-outlined {
  font-size: 18px;
}

/* Messages area */
.nb-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}

.nb-messages::-webkit-scrollbar {
  width: 4px;
}

.nb-messages::-webkit-scrollbar-track {
  background: transparent;
}

.nb-messages::-webkit-scrollbar-thumb {
  background: var(--color-outline-variant);
  border-radius: 4px;
}

/* Message bubbles */
.nb-msg {
  display: flex;
  gap: 8px;
  max-width: 88%;
  animation: nb-msgIn 0.3s ease both;
}

@keyframes nb-msgIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.nb-msg.bot {
  align-self: flex-start;
}

.nb-msg.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.nb-msg-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 14px;
  font-weight: 700;
  margin-top: 2px;
}

.nb-msg.bot .nb-msg-icon {
  background: var(--color-primary-fixed);
  color: var(--color-primary);
}

.nb-msg.bot .nb-msg-icon img {
  width: 30px;
  height: 30px;
  object-fit: contain;
}

.nb-msg.user .nb-msg-icon {
  background: var(--color-secondary-container);
  color: var(--color-on-secondary-container);
}

.nb-bubble {
  padding: 10px 14px;
  border-radius: 16px;
  font-family: var(--font-family);
  font-size: 13px;
  line-height: 1.55;
  word-break: break-word;
}

.nb-msg.bot .nb-bubble {
  background: var(--color-surface-container-lowest);
  color: var(--color-on-surface);
  border-bottom-left-radius: 4px;
}

.nb-msg.user .nb-bubble {
  background: var(--color-primary);
  color: var(--color-on-primary);
  border-bottom-right-radius: 4px;
}

.nb-bubble strong {
  font-weight: 700;
}

.nb-time {
  font-size: 10px;
  color: var(--color-outline);
  margin-top: 3px;
  padding: 0 36px;
}

.nb-msg.user+.nb-time {
  text-align: right;
}

/* Typing indicator */
.nb-typing {
  display: flex;
  gap: 8px;
  align-self: flex-start;
  max-width: 88%;
  animation: nb-msgIn 0.3s ease both;
}

.nb-typing .nb-msg-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--color-primary-fixed);
  color: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
}

.nb-typing .nb-msg-icon img {
  width: 18px;
  height: 18px;
  object-fit: contain;
}

.nb-typing-dots {
  display: flex;
  gap: 4px;
  align-items: center;
  padding: 12px 16px;
  background: var(--color-surface-container);
  border-radius: 16px;
  border-bottom-left-radius: 4px;
}

.nb-typing-dots span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--color-outline);
  animation: nb-dotBounce 1.4s ease-in-out infinite;
}

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

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

@keyframes nb-dotBounce {

  0%,
  60%,
  100% {
    transform: translateY(0);
    opacity: 0.4;
  }

  30% {
    transform: translateY(-6px);
    opacity: 1;
  }
}

/* ============================================
   Suggestion Chips
   ============================================ */
.nb-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 14px 6px;
  border-top: 1px solid var(--color-surface-container-high);
  flex-shrink: 0;
}

.nb-chip {
  padding: 6px 14px;
  border-radius: var(--radius-full);
  border: 1.5px solid var(--color-outline-variant);
  background: var(--color-surface-container-lowest);
  color: var(--color-on-surface);
  font-family: var(--font-family);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.nb-chip:hover {
  background: var(--color-primary-fixed);
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.nb-chip:active {
  transform: scale(0.96);
}

/* ============================================
   Input bar
   ============================================ */
.nb-input-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px 14px;
  border-top: 1px solid var(--color-surface-container-high);
  flex-shrink: 0;
  background: var(--color-surface-container-lowest);
}

.nb-input {
  flex: 1;
  padding: 10px 14px;
  border: 1.5px solid var(--color-outline-variant);
  border-radius: var(--radius-full);
  background: var(--color-surface-container);
  font-family: var(--font-family);
  font-size: 13px;
  color: var(--color-on-surface);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.nb-input::placeholder {
  color: var(--color-outline);
}

.nb-input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(53, 37, 205, 0.1);
}

.nb-send {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  background: var(--color-primary);
  color: var(--color-on-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.15s ease;
  flex-shrink: 0;
}

.nb-send:hover {
  background: var(--color-primary-container);
}

.nb-send:active {
  transform: scale(0.9);
}

.nb-send .material-symbols-outlined {
  font-size: 20px;
}

.nb-send:disabled {
  opacity: 0.4;
  cursor: default;
  pointer-events: none;
}

/* ============================================
   Mobile responsive
   ============================================ */
@media (max-width: 480px) {
  .nb-fab {
    bottom: 16px;
    right: 16px;
    width: 54px;
    height: 54px;
  }

  .nb-fab img {
    width: 85px;
    height: 85px;
    object-fit: contain;
    transition: transform 0.3s ease;
    position: absolute;
    top: -10px;
  }

  .nb-fab .material-symbols-outlined {
    font-size: 24px;
  }

  .nb-panel {
    bottom: 0;
    right: 0;
    width: 100vw;
    max-width: 100vw;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
    transform: translateY(100%);
    transform-origin: bottom center;
  }

  .nb-panel.open {
    transform: translateY(0);
  }
}