/* Lexxy Dark Theme Customization for Admin Panel */

/* Override Lexxy CSS variables for dark theme */
lexxy-editor {
  /* Editor background and text colors */
  --lexxy-editor-bg: rgb(55, 65, 81); /* bg-gray-700 */
  --lexxy-editor-color: rgb(243, 244, 246); /* text-gray-100 */
  --lexxy-editor-border: rgb(75, 85, 99); /* border-gray-600 */
  --lexxy-editor-placeholder: rgb(156, 163, 175); /* text-gray-400 */

  /* Toolbar colors */
  --lexxy-toolbar-bg: rgb(31, 41, 55); /* bg-gray-800 */
  --lexxy-toolbar-border: rgb(75, 85, 99); /* border-gray-600 */

  /* Button colors */
  --lexxy-button-bg: rgb(55, 65, 81); /* bg-gray-700 */
  --lexxy-button-color: rgb(209, 213, 219); /* text-gray-300 */
  --lexxy-button-hover-bg: rgb(75, 85, 99); /* hover:bg-gray-600 */
  --lexxy-button-active-bg: rgb(20, 184, 166); /* bg-accent (teal) */
  --lexxy-button-active-color: rgb(17, 24, 39); /* text-gray-900 */

  /* Selection colors */
  --lexxy-selection-bg: rgba(20, 184, 166, 0.3); /* accent with opacity */
  --lexxy-selection-color: rgb(243, 244, 246);

  /* Link colors */
  --lexxy-link-color: rgb(96, 165, 250); /* text-blue-400 */
  --lexxy-link-hover: rgb(59, 130, 246); /* text-blue-500 */

  /* Focus ring */
  --lexxy-focus-ring: rgb(20, 184, 166); /* accent color */

  /* Code block colors */
  --lexxy-code-bg: rgb(31, 41, 55); /* bg-gray-800 */
  --lexxy-code-color: rgb(209, 213, 219); /* text-gray-300 */
  --lexxy-code-border: rgb(75, 85, 99); /* border-gray-600 */
}

/* Editor content area styling */
lexxy-editor .ProseMirror {
  background-color: rgb(55, 65, 81) !important;
  color: rgb(243, 244, 246) !important;
  caret-color: rgb(20, 184, 166) !important; /* accent color for cursor */
  padding: 1rem;
  min-height: 300px;
  border-radius: 0.5rem;
}

/* Placeholder text */
lexxy-editor .ProseMirror p.is-editor-empty:first-child::before {
  color: rgb(156, 163, 175) !important;
  opacity: 0.6;
}

/* Toolbar styling */
lexxy-editor [role="toolbar"] {
  background-color: rgb(31, 41, 55) !important;
  border-color: rgb(75, 85, 99) !important;
  padding: 0.5rem;
  border-radius: 0.5rem 0.5rem 0 0;
  gap: 0.25rem;
}

/* Toolbar buttons */
lexxy-editor [role="toolbar"] button {
  background-color: rgb(55, 65, 81) !important;
  color: rgb(255, 255, 255) !important; /* Changed to white for better visibility */
  border: 1px solid rgb(75, 85, 99) !important;
  border-radius: 0.375rem;
  padding: 0.375rem 0.5rem;
  transition: all 0.2s;
  font-size: 0.875rem;
  font-weight: 600; /* Increased font weight for better visibility */
}

/* Custom toolbar buttons - base styling */
lexxy-editor [role="toolbar"] .toolbar-btn {
  background-color: rgb(55, 65, 81) !important;
  color: rgb(255, 255, 255) !important;
  border: 1px solid rgb(75, 85, 99) !important;
  border-radius: 0.375rem;
  padding: 0.375rem 0.625rem;
  transition: all 0.2s;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
}

lexxy-editor [role="toolbar"] .toolbar-btn:hover {
  background-color: rgb(75, 85, 99) !important;
  color: rgb(243, 244, 246) !important;
  border-color: rgb(20, 184, 166) !important;
}

/* Toolbar separator */
lexxy-editor [role="toolbar"] .toolbar-separator {
  width: 1px;
  height: 1.5rem;
  background-color: rgb(75, 85, 99);
  margin: 0 0.5rem;
  display: inline-block;
}

/* Specific button styles */
lexxy-editor [role="toolbar"] .toolbar-btn[data-heading-btn] {
  min-width: 2.5rem;
  font-weight: 700;
}

lexxy-editor [role="toolbar"] .toolbar-btn[data-undo-btn],
lexxy-editor [role="toolbar"] .toolbar-btn[data-redo-btn] {
  min-width: 2rem;
  font-size: 1.25rem;
  line-height: 1;
}

lexxy-editor [role="toolbar"] .toolbar-btn[data-code-block-btn] {
  padding: 0.375rem 0.5rem;
}

lexxy-editor [role="toolbar"] button:hover {
  background-color: rgb(75, 85, 99) !important;
  color: rgb(243, 244, 246) !important;
  border-color: rgb(20, 184, 166) !important;
}

lexxy-editor [role="toolbar"] button[aria-pressed="true"],
lexxy-editor [role="toolbar"] button.is-active {
  background-color: rgb(20, 184, 166) !important;
  color: rgb(17, 24, 39) !important;
  border-color: rgb(20, 184, 166) !important;
  font-weight: 600;
}

/* Headings in editor with glowing bottom border */
lexxy-editor .ProseMirror h1 {
  color: rgb(243, 244, 246) !important;
  font-size: 2rem;
  font-weight: 700;
  margin-top: 1.5rem;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  line-height: 1.2;
  border-bottom: 2px solid rgb(20, 184, 166); /* Accent color border */
  box-shadow: 0 2px 8px 0px rgba(20, 184, 166, 0.4); /* Glowing effect */
}

lexxy-editor .ProseMirror h2 {
  color: rgb(243, 244, 246) !important;
  font-size: 1.5rem;
  font-weight: 700;
  margin-top: 1.25rem;
  margin-bottom: 0.75rem;
  padding-bottom: 0.4rem;
  line-height: 1.3;
  border-bottom: 2px solid rgb(20, 184, 166); /* Accent color border */
  box-shadow: 0 2px 6px 0px rgba(20, 184, 166, 0.3); /* Subtle glow */
}

lexxy-editor .ProseMirror h3 {
  color: rgb(243, 244, 246) !important;
  font-size: 1.25rem;
  font-weight: 600;
  margin-top: 1rem;
  margin-bottom: 0.5rem;
  padding-bottom: 0.3rem;
  line-height: 1.4;
  border-bottom: 2px dotted rgb(20, 184, 166); /* Dotted accent border */
  box-shadow: 0 1px 4px 0px rgba(20, 184, 166, 0.2); /* Light glow */
}

lexxy-editor .ProseMirror h4 {
  color: rgb(243, 244, 246) !important;
  font-size: 1.125rem;
  font-weight: 600;
  margin-top: 0.75rem;
  margin-bottom: 0.5rem;
}

/* Paragraphs */
lexxy-editor .ProseMirror p {
  color: rgb(243, 244, 246) !important;
  margin-bottom: 0.75rem;
  line-height: 1.7;
}

/* Lists */
lexxy-editor .ProseMirror ul,
lexxy-editor .ProseMirror ol {
  color: rgb(243, 244, 246) !important;
  padding-left: 1.5rem;
  margin-bottom: 1rem;
}

lexxy-editor .ProseMirror ul li {
  list-style-type: disc;
  margin-bottom: 0.5rem;
  color: rgb(243, 244, 246) !important;
}

lexxy-editor .ProseMirror ol li {
  list-style-type: decimal;
  margin-bottom: 0.5rem;
  color: rgb(243, 244, 246) !important;
}

lexxy-editor .ProseMirror li p {
  margin-bottom: 0.25rem;
}

/* Nested lists */
lexxy-editor .ProseMirror ul ul,
lexxy-editor .ProseMirror ol ul {
  margin-top: 0.5rem;
  margin-bottom: 0.5rem;
}

lexxy-editor .ProseMirror ul ul li {
  list-style-type: circle;
}

lexxy-editor .ProseMirror ul ul ul li {
  list-style-type: square;
}

/* Links */
lexxy-editor .ProseMirror a {
  color: rgb(96, 165, 250) !important;
  text-decoration: underline;
  cursor: pointer;
}

lexxy-editor .ProseMirror a:hover {
  color: rgb(59, 130, 246) !important;
}

/* Bold and italic */
lexxy-editor .ProseMirror strong {
  color: rgb(243, 244, 246) !important;
  font-weight: 700;
}

lexxy-editor .ProseMirror em {
  color: rgb(243, 244, 246) !important;
  font-style: italic;
}

/* Code blocks with pre tag */
lexxy-editor .ProseMirror pre {
  background-color: rgb(31, 41, 55) !important;
  color: rgb(209, 213, 219) !important;
  border: 1px solid rgb(75, 85, 99);
  border-radius: 0.5rem;
  padding: 1rem;
  overflow-x: auto;
  margin: 1rem 0;
  font-family: 'Menlo', 'Monaco', 'Courier New', monospace;
  font-size: 0.875rem;
  line-height: 1.6;
}

lexxy-editor .ProseMirror pre code {
  background-color: transparent !important;
  color: inherit !important;
  padding: 0 !important;
  border: none !important;
  border-radius: 0 !important;
  font-weight: normal !important;
}

/* Default: All code tags as code blocks (standalone) */
lexxy-editor .ProseMirror code {
  display: block;
  background-color: rgb(31, 41, 55) !important;
  color: rgb(209, 213, 219) !important;
  border: 1px solid rgb(75, 85, 99);
  border-radius: 0.5rem;
  padding: 1rem;
  overflow-x: auto;
  margin: 1rem 0;
  font-family: 'Menlo', 'Monaco', 'Courier New', monospace;
  font-size: 0.875rem;
  line-height: 1.6;
  white-space: pre-wrap;
  word-wrap: break-word;
}

/* Inline code - code inside paragraphs or other text elements */
lexxy-editor .ProseMirror p code,
lexxy-editor .ProseMirror li code,
lexxy-editor .ProseMirror h1 code,
lexxy-editor .ProseMirror h2 code,
lexxy-editor .ProseMirror h3 code,
lexxy-editor .ProseMirror h4 code,
lexxy-editor .ProseMirror h5 code,
lexxy-editor .ProseMirror h6 code,
lexxy-editor .ProseMirror td code,
lexxy-editor .ProseMirror th code {
  display: inline !important;
  background-color: rgb(31, 41, 55) !important;
  color: rgb(96, 165, 250) !important;
  padding: 0.125rem 0.375rem !important;
  border-radius: 0.25rem !important;
  font-size: 0.875em !important;
  border: 1px solid rgb(75, 85, 99) !important;
  margin: 0 !important;
  white-space: normal !important;
}

/* Blockquotes */
lexxy-editor .ProseMirror blockquote {
  border-left: 4px solid rgb(20, 184, 166);
  padding-left: 1rem;
  margin-left: 0;
  margin-right: 0;
  color: rgb(209, 213, 219) !important;
  font-style: italic;
  margin-bottom: 1rem;
}

/* Horizontal rule */
lexxy-editor .ProseMirror hr {
  border: none;
  border-top: 2px solid rgb(75, 85, 99);
  margin: 2rem 0;
}

/* Selection */
lexxy-editor .ProseMirror ::selection {
  background-color: rgba(20, 184, 166, 0.3) !important;
  color: rgb(243, 244, 246) !important;
}

/* Focus state */
lexxy-editor:focus-within {
  outline: 2px solid rgb(20, 184, 166);
  outline-offset: 2px;
  border-radius: 0.5rem;
}

/* Attachments */
lexxy-editor .ProseMirror .attachment {
  background-color: rgb(31, 41, 55) !important;
  border: 1px solid rgb(75, 85, 99);
  border-radius: 0.5rem;
  padding: 0.75rem;
  margin: 1rem 0;
}

lexxy-editor .ProseMirror .attachment__caption {
  color: rgb(156, 163, 175) !important;
  font-size: 0.875rem;
}

/* Toolbar separators */
lexxy-editor [role="toolbar"] [role="separator"] {
  background-color: rgb(75, 85, 99) !important;
  width: 1px;
  height: 1.5rem;
  margin: 0 0.25rem;
}

/* Button groups */
lexxy-editor [role="toolbar"] [role="group"] {
  display: flex;
  gap: 0.25rem;
}

/* Dropdown menus */
lexxy-editor [role="menu"] {
  background-color: rgb(31, 41, 55) !important;
  border: 1px solid rgb(75, 85, 99) !important;
  border-radius: 0.5rem;
  padding: 0.25rem;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
}

lexxy-editor [role="menuitem"] {
  color: rgb(255, 255, 255) !important; /* Changed to white for better visibility */
  padding: 0.5rem 0.75rem;
  border-radius: 0.25rem;
  cursor: pointer;
  font-weight: 500;
}

lexxy-editor [role="menuitem"]:hover {
  background-color: rgb(55, 65, 81) !important;
  color: rgb(243, 244, 246) !important;
}

lexxy-editor [role="menuitem"][aria-checked="true"] {
  background-color: rgb(20, 184, 166) !important;
  color: rgb(17, 24, 39) !important;
}

/* Ensure wrapper has proper styling */
.glass-card lexxy-editor {
  border-radius: 0.5rem;
  overflow: hidden;
}
