/* AI Assistant — fixed to the viewport bottom-right, independent of Notes */
#ai-assistant.ai-assistant,
.ai-assistant {
  position: fixed !important;
  right: 20px !important;
  bottom: 20px !important;
  left: auto !important;
  top: auto !important;
  transform: none !important;
  margin: 0 !important;
  z-index: 800000 !important; /* above notes (incl. maximized) */
  pointer-events: none;
}
.ai-assistant .ai-toggle {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 2px solid #fff;
  background-color: var(--blue-500, var(--navbar-blue, #7CAADC)) !important;
  color: #fff !important;
  box-shadow: 0 6px 16px rgba(47, 111, 183, 0.35);
  cursor: pointer;
}
.ai-assistant .ai-toggle:hover {
  background-color: var(--blue-700, #2F6FB7) !important;
  filter: none;
  color: #fff !important;
}
.ai-assistant .ai-toggle i {
  color: #fff !important;
}

.ai-assistant .ai-panel {
  pointer-events: auto;
  position: absolute !important;
  right: 0 !important;
  bottom: 64px !important;
  left: auto !important;
  top: auto !important;
  width: min(92vw, 320px);
  max-height: 60vh;
  background: #ffffff;
  border: 1px solid rgba(0,0,0,0.1);
  border-radius: 12px;
  box-shadow: 0 14px 32px rgba(0,0,0,0.2);
  overflow: hidden;
  transform-origin: bottom right;
  transition: transform .18s ease, opacity .18s ease, visibility .18s ease;
}
.ai-assistant.collapsed .ai-panel { opacity: 0; visibility: hidden; transform: scale(0.96); }
.ai-assistant:not(.collapsed) .ai-panel { opacity: 1; visibility: visible; transform: scale(1); }

.ai-assistant .ai-header { padding: 10px 12px; background: rgba(124,170,220,0.16); border-bottom: 1px solid rgba(0,0,0,0.06); }
.ai-assistant .ai-header i { color: #7CAADC; }
.ai-assistant .ai-body { padding: 10px; overflow: auto; max-height: calc(60vh - 50px); }

/* Search row */
.ai-search {
  position: relative;
  width: 100%;
  margin-bottom: 8px;
}
.ai-search-input {
  width: 100%;
  padding: 10px 44px 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(0,0,0,0.18);
  background: #fff;
  box-sizing: border-box;
}
.ai-search-input:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(124,170,220,0.25);
}
.ai-search-btn {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: none;
  background: var(--navbar-bg-color, #7CAADC);
  color: #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,0.12);
  cursor: pointer;
}
.ai-search-btn:hover { filter: brightness(0.95); }
.ai-search-btn:focus { outline: none; }
.ai-search-btn:focus-visible { box-shadow: 0 0 0 3px rgba(124,170,220,0.35); }

/* Suggestion items */
.ai-suggestions { display: grid; grid-template-columns: 1fr; gap: 8px; }
.ai-suggestion {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px;
  background: #fff;
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
}
.ai-suggestion:hover { background: #f7fbff; border-color: rgba(124,170,220,0.45); }
.ai-suggestion .icon { width: 22px; text-align: center; color: #7CAADC; }
.ai-suggestion .text { flex: 1; }
.ai-suggestion .text .title { font-weight: 600; font-size: 0.95rem; }
.ai-suggestion .text .desc { font-size: 0.85rem; color: #555; }

.ai-assistant .ai-close { padding: 2px 6px; }

@media (max-width: 576px) {
  #ai-assistant.ai-assistant,
  .ai-assistant { right: 12px !important; bottom: 12px !important; }
  .ai-assistant .ai-toggle { width: 48px; height: 48px; }
}
