/* Floating bottom widget styles */
.sage-ai-floating-bottom-widget {
  /* Base positioning and layout */
  position: fixed !important;
  bottom: 20px;
  right: 20px;
  width: 300px;
  max-height: 200px;
  z-index: 1000;
  
  /* Visual styling */
  background-color: var(--jp-layout-color1, #ffffff);
  border: 1px solid var(--jp-border-color1, #e1e5e9);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  
  /* Interaction */
  pointer-events: auto;
  
  /* Animation */
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.sage-ai-floating-bottom-widget.jp-mod-hidden {
  opacity: 0;
  transform: translateY(20px);
  pointer-events: none;
}

/* Content container */
.sage-ai-floating-content {
  padding: 16px;
  position: relative;
  border-radius: 8px;
  background-color: var(--jp-layout-color1, #ffffff);
  color: var(--jp-ui-font-color1, #333);
}

/* Close button styling */
.sage-ai-floating-close-btn {
  position: absolute;
  top: 8px;
  right: 12px;
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: var(--jp-ui-font-color2, #999);
  line-height: 1;
  padding: 0;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.sage-ai-floating-close-btn:hover {
  background-color: var(--jp-layout-color2, #f5f5f5);
  color: var(--jp-ui-font-color1, #333);
}

/* Typography within the floating widget */
.sage-ai-floating-content h3 {
  margin: 0 0 10px 0;
  color: var(--jp-ui-font-color1, #333);
  font-size: 16px;
  font-weight: 600;
  line-height: 1.3;
}

.sage-ai-floating-content p {
  margin: 0;
  font-size: 14px;
  color: var(--jp-ui-font-color2, #666);
  line-height: 1.4;
}

/* Dark theme support */
[data-jp-theme-light="false"] .sage-ai-floating-bottom-widget {
  background-color: var(--jp-layout-color1, #1e1e1e);
  border-color: var(--jp-border-color1, #3e3e3e);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

[data-jp-theme-light="false"] .sage-ai-floating-content {
  background-color: var(--jp-layout-color1, #1e1e1e);
  color: var(--jp-ui-font-color1, #ffffff);
}

[data-jp-theme-light="false"] .sage-ai-floating-close-btn:hover {
  background-color: var(--jp-layout-color2, #2e2e2e);
}

/* Responsive design */
@media (max-width: 768px) {
  .sage-ai-floating-bottom-widget {
    width: calc(100vw - 40px);
    max-width: 300px;
    right: 20px;
    bottom: 20px;
  }
}

/* Ensure the widget stays above other content */
.sage-ai-floating-bottom-widget {
  z-index: 9999 !important;
}

/* Override any potential conflicting styles */
.sage-ai-floating-bottom-widget * {
  box-sizing: border-box;
}

/* Prevent the widget from interfering with scrolling */
.jp-WindowedPanel-outer {
  position: relative;
}

/* Ensure the floating widget doesn't scroll with notebook content */
.jp-NotebookPanel .sage-ai-floating-bottom-widget {
  position: fixed !important;
}

/* Notebook-specific floating widget styles */
.sage-ai-notebook-floating-widget {
  /* Base positioning and layout */
  position: fixed !important;
  bottom: 20px;
  right: 20px;
  width: 320px;
  max-height: 180px;
  z-index: 1000;
  
  /* Visual styling */
  background-color: var(--jp-layout-color1, #ffffff);
  border: 1px solid var(--jp-border-color1, #e1e5e9);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  
  /* Interaction */
  pointer-events: auto;
  
  /* Animation */
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.sage-ai-notebook-floating-widget.jp-mod-hidden {
  opacity: 0;
  transform: translateY(20px);
  pointer-events: none;
}

/* Content container for notebook widget */
.sage-ai-notebook-floating-content {
  padding: 16px;
  position: relative;
  border-radius: 8px;
  background-color: var(--jp-layout-color1, #ffffff);
  color: var(--jp-ui-font-color1, #333);
}

/* Action button styling */
.sage-ai-floating-action-btn {
  background-color: var(--jp-brand-color1, #1976d2);
  color: white;
  border: none;
  border-radius: 4px;
  padding: 6px 12px;
  font-size: 13px;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.sage-ai-floating-action-btn:hover {
  background-color: var(--jp-brand-color0, #135ba2);
}

/* Ensure notebook floating widget stays in position within notebook panels */
.jp-NotebookPanel .sage-ai-notebook-floating-widget {
  position: fixed !important;
  /* Adjust z-index to be above notebook content but below modals */
  z-index: 999;
}

/* Hide widget when notebook is not active */
.jp-NotebookPanel:not(.jp-mod-current) .sage-ai-notebook-floating-widget {
  display: none !important;
}