/* Snippet Creation Widget Styles */
.sage-ai-snippet-creation-widget {
  min-width: 280px !important;
  font-family: var(--jp-ui-font-family);
  font-size: var(--jp-ui-font-size1);
  color: var(--jp-ui-font-color1);
  background: var(--jp-layout-color1);
  height: 100%;
  width: 100% !important;
  display: flex;
  flex-direction: column;
}

/* Hide widget when menu is closed */
.sage-ai-snippet-creation-widget.hidden {
  display: none !important;
}

.sage-ai-snippet-creation-panel {
  width: 100% !important;
  padding: 16px;
  height: 100%;
  background: var(--jp-layout-color0);
  display: flex;
  flex-direction: column;
}

/* Header Styles */
.sage-ai-snippet-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;

  /* padding-bottom: 8px; */
}

.sage-ai-snippet-header-div {
  border-bottom: 1px solid var(--jp-border-color2);
  padding-bottom: 12px;
  margin-bottom: 12px;
}

.sage-ai-snippet-panel-header h3 {
  margin: 0;
  font-size: var(--jp-ui-font-size2);
  font-weight: 600;
  color: var(--jp-ui-font-color0);
}

.sage-ai-snippet-create-btn {
  background: var(--jp-brand-color1);
  color: white;
  border: none;
  border-radius: 4px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.2s;
}

.sage-ai-snippet-create-btn:hover {
  background: var(--jp-brand-color0);
}

/* Form Styles */
.sage-ai-snippet-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.sage-ai-snippet-form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sage-ai-snippet-form-group label {
  font-weight: 500;
  color: var(--jp-ui-font-color1);
  font-size: var(--jp-ui-font-size0);
}

.sage-ai-snippet-form-group input,
.sage-ai-snippet-form-group textarea {
  border: 1px solid var(--jp-border-color2);
  border-radius: 4px;
  padding: 8px;
  font-family: var(--jp-ui-font-family);
  font-size: var(--jp-ui-font-size1);
  background: var(--jp-layout-color1);
  color: var(--jp-ui-font-color0);
  transition: border-color 0.2s;
}

.sage-ai-snippet-form-group input:focus,
.sage-ai-snippet-form-group textarea:focus {
  outline: none;
  border-color: var(--jp-brand-color1);
}

.sage-ai-snippet-form-group textarea {
  resize: vertical;
  min-height: 120px;
  font-family: var(--jp-code-font-family);
}

.sage-ai-snippet-form-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 8px;
}

.sage-ai-snippet-save-btn,
.sage-ai-snippet-cancel-btn {
  padding: 8px 16px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: var(--jp-ui-font-size1);
  transition: background-color 0.2s;
}

.sage-ai-snippet-save-btn {
  background: var(--jp-brand-color1);
  color: white;
}

.sage-ai-snippet-save-btn:hover:not(:disabled) {
  background: var(--jp-brand-color0);
}

.sage-ai-snippet-save-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.sage-ai-snippet-cancel-btn {
  background: var(--jp-layout-color2);
  color: var(--jp-ui-font-color1);
  border: 1px solid var(--jp-border-color2);
}

.sage-ai-snippet-cancel-btn:hover {
  background: var(--jp-layout-color3);
}

/* Viewer Styles */
.sage-ai-snippet-viewer {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1; /* Expand to fill available space */
  height: 100%; /* Take full height of parent */
  min-height: 0; /* Allow proper flex shrinking */
}

.sage-ai-snippet-viewer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--jp-border-color2);
  padding-bottom: 8px;
}

.sage-ai-snippet-viewer-header h4 {
  margin: 0;
  font-size: var(--jp-ui-font-size2);
  font-weight: 600;
  color: var(--jp-ui-font-color0);
}

.sage-ai-snippet-close-btn {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: var(--jp-ui-font-color2);
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
}

.sage-ai-snippet-close-btn:hover {
  background: var(--jp-layout-color2);
  color: var(--jp-ui-font-color0);
}

.sage-ai-snippet-viewer-description {
  color: var(--jp-ui-font-color2);
  font-style: italic;
  line-height: 1.4;
}

.sage-ai-snippet-viewer-content {
  background: var(--jp-layout-color2);
  border: 1px solid var(--jp-border-color2);
  border-radius: 4px;
  padding: 12px;
  max-height: 300px;
  overflow-y: auto;
}

.sage-ai-snippet-viewer-content pre {
  margin: 0;
  font-family: var(--jp-code-font-family);
  font-size: var(--jp-code-font-size);
  color: var(--jp-content-font-color0);
  white-space: pre-wrap;
  word-wrap: break-word;
}

.sage-ai-snippet-viewer-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-start;
  flex-wrap: wrap;
  position: relative;
}

/* Full action buttons for wider screens */
.sage-ai-snippet-actions-full {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* Compact dropdown for smaller screens */
.sage-ai-snippet-actions-compact {
  position: relative;
  display: none; /* Hidden by default */
}

/* Media query for responsive behavior */
@media (width <= 400px) {
  .sage-ai-snippet-actions-full {
    display: none;
  }

  .sage-ai-snippet-actions-compact {
    display: block;
  }
}

/* Dropdown button styling */
.sage-ai-snippet-actions-dropdown-btn {
  background: var(--jp-layout-color2);
  border: 1px solid var(--jp-border-color2);
  border-radius: 4px;
  padding: 6px 12px;
  cursor: pointer;
  font-size: 16px;
  color: var(--jp-ui-font-color1);
  transition: background-color 0.2s;
}

.sage-ai-snippet-actions-dropdown-btn:hover {
  background: var(--jp-layout-color3);
}

/* Dropdown menu */
.sage-ai-snippet-actions-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  background: var(--jp-layout-color1);
  border: 1px solid var(--jp-border-color1);
  border-radius: 4px;
  box-shadow: 0 2px 8px rgb(0 0 0 / 15%);
  z-index: 1000;
  min-width: 120px;
  margin-top: 4px;
}

/* Dropdown items */
.sage-ai-snippet-dropdown-item {
  display: block;
  width: 100%;
  padding: 8px 12px;
  background: none;
  border: none;
  text-align: left;
  cursor: pointer;
  font-size: var(--jp-ui-font-size0);
  color: var(--jp-ui-font-color1);
  transition: background-color 0.2s;
}

.sage-ai-snippet-dropdown-item:hover {
  background: var(--jp-layout-color2);
}

.sage-ai-snippet-dropdown-item:first-child {
  border-radius: 4px 4px 0 0;
}

.sage-ai-snippet-dropdown-item:last-child {
  border-radius: 0 0 4px 4px;
}

/* Dark theme support for dropdown */
[data-jp-theme-light='false'] .sage-ai-snippet-actions-dropdown {
  background: var(--jp-layout-color0);
  border-color: var(--jp-border-color0);
  box-shadow: 0 2px 8px rgb(0 0 0 / 40%);
}

[data-jp-theme-light='false'] .sage-ai-snippet-actions-dropdown-btn {
  background: var(--jp-layout-color1);
  border-color: var(--jp-border-color1);
}

[data-jp-theme-light='false'] .sage-ai-snippet-actions-dropdown-btn:hover {
  background: var(--jp-layout-color2);
}

.sage-ai-snippet-enable-btn,
.sage-ai-snippet-edit-btn {
  padding: 2px;
  border: none;
  cursor: pointer;
  font-size: var(--jp-ui-font-size0);
  transition: background-color 0.2s;
}

.sage-ai-snippet-enable-btn {
  background: var(--jp-success-color1);
  color: white;
}

.sage-ai-snippet-enable-btn:hover {
  background: var(--jp-success-color0);
}

.sage-ai-snippet-edit-btn {
  background: none !important;
  color: white;
}

/* List Styles */
.sage-ai-snippet-list {
  display: flex;
  flex-direction: column;
  height: 100%;
  flex: 1;
  min-height: 0; /* Important for flex shrinking */
}

.sage-ai-snippet-list-container {
  flex: 1;
  overflow-y: auto;
  min-height: 0; /* Important for flex shrinking */
}

.sage-ai-snippet-empty {
  text-align: center;
  color: var(--jp-ui-font-color2);
  padding: 32px 16px;
}

.sage-ai-snippet-empty p {
  margin: 8px 0;
}

.sage-ai-snippet-items {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-bottom: 8px; /* Add some padding at the bottom */
}

.sage-ai-snippet-item-container {
  display: flex;
  flex-direction: column;
}

.sage-ai-snippet-item {
  /* border: 1px solid var(--jp-border-color2); */
  border-radius: 6px;
  padding: 6px;
  cursor: pointer;
  transition: all 0.2s;

  /* background: var(--jp-layout-color1); */
}

.sage-ai-snippet-item:hover {
  background: var(--jp-layout-color2);
  border-color: var(--jp-brand-color1);
}

[data-jp-theme-light='false'] .sage-ai-snippet-item:hover {
  background: rgb(56 56 56 / 30%) !important;
}

.sage-ai-snippet-item.selected {
  border-color: var(--jp-brand-color1);
  background: var(--jp-layout-color2);
}

.sage-ai-snippet-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  font-style: normal;
  font-weight: 500;
  line-height: 155%;
}

[data-jp-theme-light='false'] .sage-ai-snippet-item-header {
  color: #e7e7e7;
}

.sage-ai-snippet-title-container {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}

.sage-ai-snippet-item-header h5 {
  margin: 0;
  font-size: 13px;
  font-weight: 500 !important;
  color: var(--jp-ui-font-color0);
}

.sage-ai-snippet-checkmark {
  color: var(--jp-brand-color1);
  flex-shrink: 0;
}

.sage-ai-snippet-item-actions {
  position: relative;
  display: flex;
  align-items: center;
}

.sage-ai-snippet-menu-btn {
  background: none;
  border: none;
  font-size: 16px;
  cursor: pointer;
  color: var(--jp-ui-font-color2);
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 3px;
  opacity: 0;
  transition: all 0.2s;
}

.sage-ai-snippet-item:hover .sage-ai-snippet-menu-btn {
  opacity: 1;
}

.sage-ai-snippet-menu-btn:hover {
  background: var(--jp-layout-color3);
  color: var(--jp-ui-font-color0);
}

.sage-ai-snippet-context-menu {
  position: absolute;
  top: 100%;
  right: 0;
  background: var(--jp-layout-color1);
  border: 1px solid var(--jp-border-color2);
  border-radius: 4px;
  box-shadow: 0 4px 12px rgb(0 0 0 / 15%);
  z-index: 1000;
  min-width: 120px;
  padding: 4px 0;
}

.sage-ai-snippet-menu-item {
  display: block;
  width: 100%;
  padding: 8px 12px;
  border: none;
  background: none;
  text-align: left;
  cursor: pointer;
  font-size: var(--jp-ui-font-size0);
  color: var(--jp-ui-font-color0);
  transition: background-color 0.2s;
}

.sage-ai-snippet-menu-item:hover {
  background: var(--jp-layout-color2);
}

.sage-ai-snippet-menu-item.delete:hover {
  background: var(--jp-error-color1);
  color: white;
}

.sage-ai-snippet-delete-btn {
  background: none;
  border: none;
  font-size: 16px;
  cursor: pointer;
  color: var(--jp-ui-font-color2);
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 3px;
  opacity: 0;
  transition: all 0.2s;
}

.sage-ai-snippet-item:hover .sage-ai-snippet-delete-btn {
  opacity: 1;
}

.sage-ai-snippet-delete-btn:hover {
  background: var(--jp-error-color1);
  color: white;
}

.sage-ai-snippet-item-description {
  margin: 0 0 8px;
  color: var(--jp-ui-font-color2);
  font-size: var(--jp-ui-font-size0);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.sage-ai-snippet-item-meta {
  font-size: var(--jp-ui-font-size00);
  color: var(--jp-ui-font-color3);
}

/* Inline Viewer Styles */
.sage-ai-snippet-viewer-inline {
  margin-top: 16px;
  /*padding: 16px;*/
  background: var(--jp-layout-color0);
  border-top: 1px solid var(--jp-border-color1);
  flex-shrink: 0; /* Don't shrink the viewer */
  max-height: 40vh; /* Limit maximum height */
  display: flex;
  flex-direction: column;
  overflow: hidden; /* Remove scrolling from the entire viewer */
}

.sage-ai-snippet-description {
  color: var(--jp-ui-font-color3);
  font-size: 13px;
  font-style: normal;
  font-weight: 500;
  line-height: 155%; /* 20.15px */
}

/* First Row: Toolbar with Preview label and action buttons */
.sage-ai-snippet-viewer-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-top: 16px;
  /*border-bottom: 1px solid var(--jp-border-color2);*/
  flex-shrink: 0; /* Don't shrink the toolbar */
}

.sage-ai-snippet-preview-label {
  font-weight: 600;
  color: var(--jp-ui-font-color0);
  font-size: 13px;
}

.sage-ai-snippet-viewer-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sage-ai-snippet-edit-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--jp-ui-font-color2);

  /* width: 28px; */
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all 0.2s;
}

.sage-ai-snippet-edit-btn:hover {
  background: var(--jp-layout-color2);
  color: var(--jp-brand-color1);
}

.sage-ai-snippet-close-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--jp-ui-font-color2);
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all 0.2s;
}

.sage-ai-snippet-close-btn:hover {
  background: var(--jp-layout-color2);
  color: var(--jp-ui-font-color0);
}

/* Second Row: Title display */
.sage-ai-snippet-viewer-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  flex-shrink: 0; /* Don't shrink the title row */
}

.sage-ai-snippet-title-label {
  font-weight: 600;
  color: var(--jp-ui-font-color1);
  font-size: 13px;
}

.sage-ai-snippet-title-text {
  color: var(--jp-ui-font-color0);
  font-size: 13px;
  flex: 1;
}

/* Third Row: Code block (simplified) */
.sage-ai-snippet-code-block {
  margin: 0;
  border: 1px solid var(--jp-border-color2);
  border-radius: 6px;
  overflow: hidden;
  background: var(--jp-layout-color2);
  flex: 1; /* Take up remaining space */
  display: flex;
  flex-direction: column;
  min-height: 0; /* Allow flexbox to shrink */
}

.sage-ai-snippet-insert-btn {
  background: none;
  display: flex;
  flex-direction: row;
  align-items: center;
  color: var(--jp-brand-color0);
  border-radius: 4px;
  gap: 8px;
  padding: 2px;
  border: none !important;
  cursor: pointer;
  transition: background-color 0.2s;
  text-align: center;
  font-size: 13px;
  font-style: normal;
  font-weight: 600;
  line-height: 155%; /* 20.15px */
}

.insert-icon-container {
  width: 20px;
  height: 20px;
}

.sage-ai-snippet-insert-btn:hover {
  background: none;
}

/* Remove state styling for insert button */
.sage-ai-snippet-insert-btn.sage-ai-snippet-remove-state {
  color: var(--jp-error-color1) !important;
  background: none !important;
}

.sage-ai-snippet-insert-btn.sage-ai-snippet-remove-state
  .insert-icon-container {
  fill: var(--jp-error-color1) !important;
  transform: rotate(180deg);
}

.sage-ai-snippet-insert-btn.sage-ai-snippet-remove-state
  .insert-icon-container {
  div {
    svg {
      g {
        path {
          fill: var(--jp-error-color1) !important;
        }
      }
    }
  }
}

.sage-ai-snippet-insert-btn.sage-ai-snippet-remove-state:hover {
  background: var(--jp-error-color3);
}

.sage-ai-snippet-code-content {
  margin: 0;
  padding: 12px;
  font-family: var(--jp-code-font-family);
  font-size: var(--jp-code-font-size);
  color: var(--jp-content-font-color0);
  background: var(--jp-layout-color2);
  overflow: auto auto; /* Make only the content scrollable */
  white-space: pre;
  line-height: 1.4;
  flex: 1; /* Take up remaining space in the code block */
  min-height: 0; /* Allow flexbox to shrink */
}

.sage-ai-snippet-code-content code {
  background: none;
  padding: 0;
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

.sage-ai-snippet-viewer-meta {
  display: flex;
  gap: 16px;
  margin-top: 12px;
  padding-top: 8px;
  border-top: 1px solid var(--jp-border-color2);
  font-size: var(--jp-ui-font-size00);
  color: var(--jp-ui-font-color3);
  flex-shrink: 0; /* Don't shrink the meta section */
}

/* Custom Icon Styles */
.sage-ai-snippet-icon {
  background-image: url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiIgdmlld0JveD0iMCAwIDE2IDE2IiBmaWxsPSJub25lIj4KICA8cGF0aCBkPSJNNS4xNzc3OCA4TDYuNDg4ODkgNi42ODg4OUM2LjY2NjY3IDYuNTExMTEgNi43NTU1NiA2LjMwMzcgNi43NTU1NiA2LjA2NjY3QzYuNzU1NTYgNS44Mjk2MyA2LjY2NjY3IDUuNjIyMjIgNi40ODg4OSA1LjQ0NDQ0QzYuMzExMTEgNS4yNjY2NyA2LjEgNS4xNzc3OCA1Ljg1NTU2IDUuMTc3NzhDNS42MTExMSA1LjE3Nzc4IDUuNCA1LjI2NjY3IDUuMjIyMjIgNS40NDQ0NEwzLjI4ODg5IDcuMzc3NzhDMy4yIDcuNDY2NjcgMy4xMzcwNCA3LjU2Mjk2IDMuMSA3LjY2NjY3QzMuMDYyOTYgNy43NzAzNyAzLjA0NDQ0IDcuODgxNDggMy4wNDQ0NCA4QzMuMDQ0NDQgOC4xMTg1MiAzLjA2Mjk2IDguMjI5NjMgMy4xIDguMzMzMzNDMy4xMzcwNCA4LjQzNzA0IDMuMiA4LjUzMzMzIDMuMjg4ODkgOC42MjIyMkw1LjIyMjIyIDEwLjU1NTZDNS40IDEwLjczMzMgNS42MTExMSAxMC44MjIyIDUuODU1NTYgMTAuODIyMkM2LjEgMTAuODIyMiA2LjMxMTExIDEwLjczMzMgNi40ODg4OSAxMC41NTU2QzYuNjY2NjcgMTAuMzc3OCA2Ljc1NTU2IDEwLjE3MDQgNi43NTU1NiA5LjkzMzMzQzYuNzU1NTYgOS42OTYzIDYuNjY2NjcgOS40ODg4OSA2LjQ4ODg5IDkuMzExMTFMNS4xNzc3OCA4Wk0xMC44MjIyIDhMOS41MTExMSA5LjMxMTExQzkuMzMzMzMgOS40ODg4OSA5LjI0NDQ0IDkuNjk2MyA5LjI0NDQ0IDkuOTMzMzNDOS4yNDQ0NCAxMC4xNzA0IDkuMzMzMzMgMTAuMzc3OCA5LjUxMTExIDEwLjU1NTZDOS42ODg4OSAxMC43MzMzIDkuOSAxMC44MjIyIDEwLjE0NDQgMTAuODIyMkMxMC4zODg5IDEwLjgyMjIgMTAuNiAxMC43MzMzIDEwLjc3NzggMTAuNTU1NkwxMi43MTExIDguNjIyMjJDMTIuOCA4LjUzMzMzIDEyLjg2MyA4LjQzNzA0IDEyLjkgOC4zMzMzM0MxMi45MzcgOC4yMjk2MyAxMi45NTU2IDguMTE4NTIgMTIuOTU1NiA4QzEyLjk1NTYgNy44ODE0OCAxMi45MzcgNy43NzAzNyAxMi45IDcuNjY2NjdDMTIuODYzIDcuNTYyOTYgMTIuOCA3LjQ2NjY3IDEyLjcxMTEgNy4zNzc3OEwxMC43Nzc4IDUuNDQ0NDRDMTI2ODg4OSA1LjM1NTU2IDEwLjU4ODkgNS4yODg4OSAxMC40Nzc4IDUuMjQ0NDRDMTAuMzY2NyA1LjIgMTAuMjU1NiA1LjE3Nzc4IDEwLjE0NDQgNS4xNzc3OEMxMC4wMzMzIDUuMTc3NzggOS45MjIyMiA1LjIgOS44MTExMSA1LjI0NDQ0QzkuNyA1LjI4ODg5IDkuNiA1LjM1NTU2IDkuNTExMTEgNS40NDQ0NEM5LjMzMzMzIDUuNjIyMjIgOS4yNDQ0NCA1LjgyOTYzIDkuMjQ0NDQgNi4wNjY2N0M5LjI0NDQ0IDYuMzAzNyA5LjMzMzMzIDYuNTExMTEgOS41MTExMSA2LjY4ODg5TDEwLjgyMjIgOFpNMS43Nzc3OCAxNkMxLjI4ODg5IDE2IDAuODcwMzcgMTUuODI1OSAwLjUyMjIyMiAxNS40Nzc4QzAuMTc0MDc0IDE1LjEyOTYgMCAxNC43MTExIDAgMTQuMjIyMlYxLjc3Nzc4QzAgMS4yODg4OSAwLjE3NDA3NCAwLjg3MDM3IDAuNTIyMjIyIDAuNTIyMjIyQzAuODcwMzcgMC4xNzQwNzQgMS4yODg4OSAwIDEuNzc3NzggMEgxNC4yMjIyQzE0LjcxMTEgMCAxNS4xMjk2IDAuMTc0MDc0IDE1LjQ3NzggMC41MjIyMjJDMTUuODI1OSAwLjg3MDM3IDE2IDEuMjg4ODkgMTYgMS43Nzc3OFYxNC4yMjIyQzE2IDE0LjcxMTEgMTUuODI1OSAxNS4xMjk2IDE1LjQ3NzggMTUuNDc3OEMxNS4xMjk2IDE1LjgyNTkgMTQuNzExMSAxNiAxNC4yMjIyIDE2SDEuNzc3NzhaIiBmaWxsPSIjN0E3QTdBIi8+Cjwvc3ZnPg==');
  background-repeat: no-repeat;
  background-position: center;
  background-size: 16px 16px;
}

/* Dark theme adjustments */
[data-jp-theme-light='false'] .sage-ai-snippet-creation-widget {
  color: var(--jp-ui-font-color1);
}

[data-jp-theme-light='false'] .sage-ai-snippet-viewer-content {
  background: var(--jp-layout-color0);
}

/* Dark mode styling for create button */
[data-jp-theme-light='false'] .sage-ai-snippet-create-btn {
  border-radius: 8px;
  border: 0.5px solid var(--Border-Border, #383838);
  background: var(--Button-bg-default, #1a1a1a);
  color: white;
}

[data-jp-theme-light='false'] .sage-ai-snippet-create-btn:hover {
  background: var(--Button-bg-hover, #2a2a2a);
  border-color: var(--Border-Border-hover, #4a4a4a);
}

/* Make SVG icons white in dark mode */
[data-jp-theme-light='true'] .sage-ai-snippet-create-btn svg {
  filter: invert(1);
}

/* Modal Styles */
.sage-ai-custom-snippet-modal .modal-content {
  border-radius: 12px;
  border: 1px solid var(--Border-Border, #383838);
  background: var(--BG-main, #111);
  box-shadow: 0 8px 17.1px 0 rgb(208 208 208 / 9%);
}

/* Ensure modal header and body text are readable */
.sage-ai-custom-snippet-modal .modal-header,
.sage-ai-custom-snippet-modal .modal-body,
.sage-ai-custom-snippet-modal .modal-footer {
  background: transparent;
  border-color: var(--Border-Border, #383838);
  color: var(--jp-ui-font-color0);
}

/* Style the close button to match the dark theme */
.sage-ai-custom-snippet-modal .btn-close {
  filter: invert(1);
}

.sage-ai-snippet-form-modal {
  max-width: 600px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  box-sizing: border-box;
}

.sage-ai-snippet-form-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--jp-border-color2);
  padding-bottom: 12px;
}

.sage-ai-snippet-form-modal-header .sage-ai-dialog-title {
  margin: 0;
  font-size: 1.2em;
  font-weight: 600;
  color: var(--jp-ui-font-color1);
}

.sage-ai-snippet-form-modal .sage-ai-snippet-close-btn {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: var(--jp-ui-font-color2);
  padding: 4px 8px;
  border-radius: 4px;
  line-height: 1;
}

.sage-ai-snippet-form-modal .sage-ai-snippet-close-btn:hover {
  background: var(--jp-layout-color2);
  color: var(--jp-ui-font-color1);
}

/* Modal form inherits existing form styles */
.sage-ai-snippet-form-modal .sage-ai-snippet-form {
  margin: 0;
}

.sage-ai-snippet-form-modal .sage-ai-snippet-form-group textarea {
  min-height: 200px;
  resize: vertical;
}

/* Modal overlay effect */
.sage-ai-modal {
  backdrop-filter: blur(2px);
}

/* Responsive adjustments */
@media (width <= 320px) {
  .sage-ai-snippet-creation-panel {
    padding: 12px;
  }

  .sage-ai-snippet-form-actions {
    flex-direction: column;
  }

  .sage-ai-snippet-viewer-actions {
    flex-direction: column;
  }

  .sage-ai-snippet-form-modal {
    width: 95%;
    max-height: 90vh;
  }
}
