
/* Toolbar styling */
.toolbar {
  padding: 10px;
  background: #f5f5f5;
  border-bottom: 1px solid #ddd;
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}

.toolbar.sticky {
  position: sticky;
  top: 0;
  z-index: 100;
  background: white;
  padding: 10px;
  border-bottom: 1px solid #ccc;
}

.toolbar button {
  padding: 6px 12px;
  background: white;
  border: 1px solid #ccc;
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.2s;
}

.toolbar button:hover {
  background: #e6e6e6;
}

.toolbar select {
  padding: 5px;
  border-radius: 3px;
  border: 1px solid #ccc;
}

/* Content area styling */
.editor-content {
  min-height: 300px;
  padding: 20px;
  overflow-y: auto;
  line-height: 1.6;
  font-family: Arial, sans-serif;
  text-align: justify;
}

.editor-content:focus {
  outline: none;
}

.editor-image {
  max-width: 100%;
  height: auto;
  margin: 10px 0;
  border-radius: 4px;
  cursor: grab;
  transition: opacity 0.2s;
  position: relative;
}

.editor-image:active {
  cursor: grabbing;
}

.editor-image.resizing {
  border: 2px dashed #2196F3;
  cursor: ew-resize;
}

.editor-image::after {
  content: '';
  position: absolute;
  bottom: 0;
  right: 0;
  width: 10px;
  height: 10px;
  background: #2196F3;
  cursor: se-resize;
  opacity: 0;
  transition: opacity 0.2s;
}

.editor-image:hover::after {
  opacity: 1;
}

/* Apply selected font to the editor */
.editor-content [style*="font-family"] {
  font-family: inherit !important;
  /* Ensure font is applied correctly */
}

.word-count {
  position: absolute;
  bottom: 10px;
  left: 10px;
  font-size: 12px;
  color: #666;
  background: rgba(255, 255, 255, 0.8);
  padding: 4px 8px;
  border-radius: 3px;
  pointer-events: none;
  /* Prevent interaction */
}

.text-editor-widget {
  position: relative;
  /* Ensure the count display is positioned relative to the editor */
  border: 1px solid #ccc;
  border-radius: 4px;
  max-width: 800px;
  margin: 20px auto;
  padding-bottom: 30px;
  /* Space for the count display */
}

.count-display {
  position: absolute;
  bottom: 10px;
  left: 10px;
  font-size: 12px;
  color: #666;
  background: rgba(255, 255, 255, 0.8);
  padding: 4px 8px;
  border-radius: 3px;
  pointer-events: none;
  /* Prevent interaction */
}

.editor-content ul,
.editor-content ol {
  padding-left: 40px;
  /* Indent lists */
  margin: 10px 0;
  /* Add spacing */
}

.editor-content ul {
  list-style-type: disc;
  /* Bulleted list */
}

.editor-content ol {
  list-style-type: decimal;
  /* Numbered list */
}

.editor-content li {
  line-height: 1.6;
  /* Improve readability */
}

.editor-content ul ul,
.editor-content ol ol {
  padding-left: 20px;
  /* Adjust indentation */
}

.editor-content s {
  text-decoration: line-through;
  color: #666;
  /* Optional: Make strikethrough text slightly faded */
}

.toolbar button.active {
  background: #ddd;
}

.editor-content a[href] {
  position: relative;
}

.editor-content a[href]:hover::after {
  content: attr(href);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: #333;
  color: #fff;
  padding: 4px 8px;
  border-radius: 3px;
  font-size: 12px;
  white-space: nowrap;
}

.editor-content span[style*="background-color"] {
  padding: 2px 4px;
  /* Add padding for better visibility */
  border-radius: 3px;
  /* Rounded corners */
}

@media print {

  .toolbar,
  .count-display {
    display: none;
  }

  .editor-content {
    padding: 20px;
    font-family: Arial, sans-serif;
  }

  img {
    max-width: 100%;
    height: auto;
  }
}

.editor-content pre {
  background: #f5f5f5;
  padding: 10px;
  border-radius: 4px;
  border: 1px solid #ddd;
  font-family: 'Courier New', monospace;
  white-space: pre-wrap;
  /* Preserve line breaks and wrap text */
  word-wrap: break-word;
  margin: 10px 0;
}

.editor-content code {
  font-family: 'Courier New', monospace;
  color: #d63384;
  background: #f5f5f5;
  padding: 2px 4px;
  border-radius: 3px;
}