/* Editor Styling */

.ProseMirror {
  outline: none;
  padding: 1rem;
  border-radius: 0.5rem;
  border: 1px solid #e2e8f0;
  background-color: white;
  min-height: 300px;
  cursor: text;
}

.ProseMirror p {
  margin-bottom: 1em;
}

.ProseMirror h1 {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 0.75em;
  margin-top: 1em;
}

.ProseMirror h2 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 0.75em;
  margin-top: 1em;
}

.ProseMirror h3 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 0.75em;
  margin-top: 1em;
}

.ProseMirror h4 {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 0.75em;
  margin-top: 1em;
}

.ProseMirror a {
  color: #2563eb;
  text-decoration: underline;
  cursor: pointer;
}

.ProseMirror ul,
.ProseMirror ol {
  padding-left: 1.5rem;
  margin-bottom: 1em;
}

.ProseMirror ul {
  list-style-type: disc;
}

.ProseMirror ol {
  list-style-type: decimal;
}

.ProseMirror blockquote {
  border-left: 3px solid #e2e8f0;
  padding-left: 1rem;
  font-style: italic;
  margin: 1em 0;
  color: #64748b;
}

.ProseMirror pre {
  background-color: #f8fafc;
  border-radius: 0.375rem;
  padding: 0.75rem 1rem;
  margin: 1em 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  overflow-x: auto;
}

.ProseMirror code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.875em;
  padding: 0.25rem 0.5rem;
  background-color: #f1f5f9;
  border-radius: 0.25rem;
}

.ProseMirror pre code {
  background-color: transparent;
  padding: 0;
  border-radius: 0;
}

/* Task List Styles */
ul[data-type="taskList"] {
  list-style: none;
  padding: 0;
}

li[data-type="taskItem"] {
  display: flex;
  align-items: baseline;
  margin-bottom: 0.5em;
}

li[data-type="taskItem"] > label {
  margin-right: 0.5em;
  user-select: none;
}

li[data-type="taskItem"] > div {
  flex: 1;
}

/* Table Styles */
.ProseMirror table {
  border-collapse: collapse;
  margin: 1em 0;
  overflow: hidden;
  width: 100%;
  table-layout: fixed;
}

.ProseMirror th,
.ProseMirror td {
  border: 2px solid #e2e8f0;
  padding: 0.75rem;
  position: relative;
  vertical-align: top;
}

.ProseMirror th {
  font-weight: bold;
  text-align: left;
  background-color: #f8fafc;
}

/* Bubble Menu Styles */
.bubble-menu,
.text-menu,
.link-menu {
  display: flex;
  background-color: white;
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  padding: 0.5rem;
  gap: 0.25rem;
}

.editor-button {
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: none;
  border-radius: 0.25rem;
  padding: 0.375rem;
  cursor: pointer;
  transition: background-color 0.2s;
}

.editor-button:hover {
  background-color: #f1f5f9;
}

.editor-button.is-active {
  background-color: #e2e8f0;
  color: #2563eb;
}

/* Character Count */
.character-count {
  margin-top: 0.5rem;
  color: #64748b;
  font-size: 0.875rem;
  text-align: right;
}

/* Block Editor Header */
.editor-header {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
  padding: 0.5rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  background-color: #f8fafc;
}

.editor-header-group {
  display: flex;
  gap: 0.25rem;
  border-right: 1px solid #e2e8f0;
  padding-right: 0.5rem;
  margin-right: 0.5rem;
}

.editor-header-group:last-child {
  border-right: none;
  padding-right: 0;
  margin-right: 0;
}

/* Link Input */
.link-input {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.link-input input {
  border: 1px solid #e2e8f0;
  border-radius: 0.25rem;
  padding: 0.25rem 0.5rem;
  font-size: 0.875rem;
}

/* Focus Styles */
.ProseMirror:focus {
  border-color: #93c5fd;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Table styling */
.ProseMirror table {
  border-collapse: collapse;
  margin: 0;
  overflow: hidden;
  table-layout: fixed;
  width: 100%;
}

.ProseMirror table td,
.ProseMirror table th {
  border: 2px solid #eee;
  box-sizing: border-box;
  min-width: 1em;
  padding: 3px 5px;
  position: relative;
  vertical-align: top;
}

.ProseMirror table th {
  background-color: #f1f3f5;
  font-weight: bold;
  text-align: left;
}

.ProseMirror table .selectedCell:after {
  background: rgba(200, 200, 255, 0.4);
  content: "";
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
  pointer-events: none;
  position: absolute;
  z-index: 2;
}

.ProseMirror table .column-resize-handle {
  background-color: #adf;
  bottom: -2px;
  position: absolute;
  right: -2px;
  pointer-events: none;
  top: 0;
  width: 4px;
}

.ProseMirror .tableWrapper {
  overflow-x: auto;
  margin: 1rem 0;
  padding: 0.5rem;
}

/* Placeholder text */
.editor-placeholder {
  color: #999;
  pointer-events: none;
  position: absolute;
}

/* Drag handle for resizable tables */
.resize-cursor {
  cursor: col-resize;
}

/* Focus state */
.ProseMirror-focused {
  border-color: #1a73e8;
}

/* Make editor buttons more accessible */
.editor-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.25rem;
  padding: 0.25rem 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.2s;
}

.editor-button:hover {
  background-color: rgba(0, 0, 0, 0.05);
}

.editor-button.is-active {
  background-color: #1a73e8;
  color: white;
}

.editor-button.is-active:hover {
  background-color: #1557b0;
}

/* Menu Item Styling */
.menu-item {
  background-color: white;
  border: 1px solid #ddd;
  border-radius: 0.25rem;
  color: #333;
  cursor: pointer;
  display: inline-flex;
  font-size: 0.875rem;
  align-items: center;
  justify-content: center;
  padding: 0.375rem 0.625rem;
  transition: all 0.2s ease;
  min-width: 2.5rem;
}

.menu-item:hover {
  background-color: #f5f5f5;
  border-color: #ccc;
}

.menu-item.is-active {
  background-color: #3b82f6;
  border-color: #2563eb;
  color: white;
}

.menu-item.is-disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.menu-item .icon {
  display: inline-block;
  font-weight: bold;
  margin-right: 0.25rem;
}

/* Task list styling */
ul[data-type="taskList"] {
  list-style: none;
  padding: 0;
}

ul[data-type="taskList"] li {
  display: flex;
  align-items: flex-start;
  margin-bottom: 0.5em;
}

ul[data-type="taskList"] li > label {
  margin-right: 0.5em;
  user-select: none;
}

ul[data-type="taskList"] li > div {
  flex: 1;
}

.task-item {
  display: flex;
  align-items: flex-start;
}

.task-item input[type="checkbox"] {
  margin-right: 0.5em;
}

/* Simple Editor Bubble Menu Styles */

/* Separator styles */
.menu-separator {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 24px;
  margin: 0 8px;
}

/* Menu separator styling that matches DevTools */
div.menu-separator, .menu-separator {
  display: flex !important;
  align-items: center !important;
  height: 22px !important;
  margin: 0 8px !important;
}

img[src*="vertical-seperator.svg"] {
  height: 24px !important;
  width: 2px !important;
}

/* Menu group styles */
.menu-group {
  display: flex;
  gap: 2px;
  width: auto;
}

/* AI Edit styles */
.ai-edit-button {
  display: flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 4px;
  transition: background-color 0.2s ease;
}

.ai-edit-button:hover {
  background-color: #f3f4f6;
}

.ai-edit-icon {
  margin-right: 4px;
}

.ai-edit-text {
  color: rgba(162, 89, 255, 1);
}

/* Formatting button styles */
.format-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 28px;
  border-radius: 4px;
  transition: background-color 0.2s ease;
}

.format-button:hover {
  background-color: #f3f4f6;
}

.format-button.active {
  background-color: #f3f4f6; /* Light gray background for active state */
}

/* Icon styles */
.menu-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* SVG icon color control */
.format-button img {
  filter: opacity(0.64); /* Make inactive icons slightly transparent */
  transition: filter 0.2s ease;
}

.format-button.active img {
  filter: brightness(0) saturate(100%); /* Make active icons black */
  opacity: 1;
}

/* Don't apply any filters to AI Edit icon */
.ai-edit-button img {
  filter: none !important; /* Preserve the gradient coloring */
}

/* Bubble menu styles */
.bubble-menu {
  background-color: white;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  border: 1px solid #e5e7eb;
  padding: 8px;
  display: flex;
  align-items: center;
  gap: 0; /* Ensure no gap between menu-group and separator */
  font-family: 'Inter Display', sans-serif;
  pointer-events: auto;
  z-index: 50;
}

/* Simple Editor ProseMirror Styles */
.simple-editor .ProseMirror {
  width: 720px;
  height: 100%;
  outline: none;
  font-family: 'Inter Display', sans-serif;
  margin: 0 auto; /* Center the editor */
  max-width: 100%; /* Ensure it doesn't overflow on small screens */
  white-space: normal; /* Ensure text wraps */
  word-break: break-word; /* Break long words if necessary */
  overflow-wrap: break-word; /* Alternative to word-break for better browser support */
  text-wrap: wrap; /* Modern property for text wrapping */
  display: flex;
  flex-direction: column;
  align-items: center;
  border: none;
  padding: 0;
  gap: 8px; /* Add gap between blocks */
  position: relative; /* For proper bubble menu positioning */
}

/* Apply consistent padding to all blocks to prevent layout shifts */
.simple-editor .ProseMirror > * {
  width: 100%;
  padding: 16px;
  border-radius: 24px;
  transition: background-color 0.2s ease-in-out;
  margin: 0;
}

.simple-editor .ProseMirror h1 {
  font-size: 72px;
  font-weight: 800;
  text-align: left;
  line-height: 1.2;
  font-family: 'Inter Display', sans-serif;
}

.simple-editor .ProseMirror h2 {
  font-size: 64px;
  font-weight: 600;
  line-height: 1.2;
  font-family: 'Inter Display', sans-serif;
}

.simple-editor .ProseMirror h3 {
  font-size: 48px;
  font-weight: 500;
  line-height: 1.2;
  font-family: 'Inter Display', sans-serif;
}

.simple-editor .ProseMirror p {
  font-size: 24px;
  font-weight: 400;
  font-family: 'Inter Display', sans-serif;
}

/* Hover effect for blocks - only when not focused */
.simple-editor .ProseMirror > *:hover:not(.has-focus) {
  background: var(--States-primary-tertiary, rgba(48, 48, 48, 0.03));
  cursor: pointer;
}

/* Ensure mouse cursor is visible on all blocks */
.simple-editor .ProseMirror > * {
  cursor: pointer;
}

/* Focus extension styling */
.ProseMirror .has-focus {
  background: var(--States-primary-tertiary, rgba(48, 48, 48, 0.03));
  cursor: text;
}

/* Only use text cursor when actually editing text */
.ProseMirror .has-focus:focus,
.ProseMirror .has-focus:active {
  cursor: text;
}

/* Make sure text content is properly aligned within focus state */
.ProseMirror .has-focus > * {
  margin: 0;
  padding: 0;
  width: 100%;
}

/* Ensure the text cursor is visible when editing */
.ProseMirror {
  cursor: text;
}

/* Ensure headings maintain their styles within focus state */
.ProseMirror .has-focus h1,
.ProseMirror .has-focus h2,
.ProseMirror .has-focus h3,
.ProseMirror .has-focus p {
  margin: 0;
  padding: 0;
} 