/* NexEditor CDN Styles */

/* Container */
.nexeditor-container {
  border: 1px solid #e1e5e9;
  border-radius: 8px;
  background: #ffffff;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  overflow: hidden;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  animation: fadeIn 0.3s ease-in-out;
}

.nexeditor-container.dark {
  background: #1a1a1a;
  border-color: #333;
  color: #ffffff;
}

/* Wrapper */
.nexeditor-wrapper {
  display: flex;
  flex-direction: column;
  height: 100%;
}

/* Toolbar - Exact Demo Style */
.nexeditor-toolbar {
  border-bottom: 1px solid #e5e7eb;
  /* border-gray-200 */
  background: rgba(249, 250, 251, 0.5);
  /* bg-gray-50/50 */
  padding: 12px 16px;
  /* px-4 py-3 */
}

.nexeditor-container.dark .nexeditor-toolbar {
  background: rgba(17, 24, 39, 0.5);
  /* dark mode equivalent */
  border-bottom-color: #374151;
}

.nexeditor-toolbar-content {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  /* gap-2 */
}

/* Toolbar Groups - Exact Demo Style */
.nexeditor-toolbar-group {
  display: flex;
  align-items: center;
  border-right: 1px solid #d1d5db;
  /* border-gray-300 */
  padding-right: 12px;
  /* pr-3 */
  margin-right: 12px;
  /* mr-3 */
}

.nexeditor-toolbar-group:last-child {
  border-right: none;
  padding-right: 0;
  margin-right: 0;
}

.nexeditor-container.dark .nexeditor-toolbar-group {
  border-right-color: #4b5563;
}

/* Toolbar Buttons - Exact Demo Style (shadcn Button ghost variant) */
.nexeditor-toolbar-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 36px;
  /* h-9 from shadcn */
  padding: 8px;
  /* p-2 */
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  /* rounded-md */
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: #0f172a;
  /* text-slate-900 */
  transition: all 150ms cubic-bezier(0.4, 0, 0.2, 1);
  outline: none;
  position: relative;
  white-space: nowrap;
  user-select: none;
}

/* SVG icons inside buttons - exact Lucide sizing */
.nexeditor-toolbar-button svg {
  width: 16px;
  /* h-4 w-4 */
  height: 16px;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nexeditor-dropdown-trigger svg {
  width: 12px;
  /* h-3 w-3 */
  height: 12px;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Ghost button hover state - matches shadcn exactly */
.nexeditor-toolbar-button:hover {
  background: #f1f5f9;
  /* bg-slate-100 */
  color: #0f172a;
  /* text-slate-900 */
}

.nexeditor-toolbar-button:focus-visible {
  outline: 2px solid #0f172a;
  outline-offset: 2px;
}

.nexeditor-toolbar-button:disabled {
  pointer-events: none;
  opacity: 0.5;
}

/* Dark mode buttons */
.nexeditor-container.dark .nexeditor-toolbar-button {
  color: #f8fafc;
  /* dark:text-slate-50 */
}

.nexeditor-container.dark .nexeditor-toolbar-button:hover {
  background: #334155;
  /* dark:bg-slate-800 */
  color: #f8fafc;
  /* dark:text-slate-50 */
}

.nexeditor-container.dark .nexeditor-toolbar-button:focus-visible {
  outline-color: #f8fafc;
}

/* Active state for toggle buttons */
.nexeditor-toolbar-button.active {
  background: #0f172a;
  /* bg-slate-900 */
  color: #f8fafc;
  /* text-slate-50 */
}

.nexeditor-container.dark .nexeditor-toolbar-button.active {
  background: #f8fafc;
  /* dark:bg-slate-50 */
  color: #0f172a;
  /* dark:text-slate-900 */
}

/* Heading Dropdown - Exact Demo Style */
.nexeditor-heading-dropdown {
  position: relative;
}

.nexeditor-dropdown-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  /* space-x-2 */
  height: 36px;
  /* h-9 */
  padding: 8px 12px;
  /* px-3 py-2 */
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  /* rounded-md */
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: #0f172a;
  /* text-slate-900 */
  transition: all 150ms cubic-bezier(0.4, 0, 0.2, 1);
  outline: none;
  white-space: nowrap;
  user-select: none;
}

.nexeditor-dropdown-trigger:hover {
  background: #f1f5f9;
  /* bg-slate-100 */
  color: #0f172a;
  /* text-slate-900 */
}

.nexeditor-dropdown-trigger:focus-visible {
  outline: 2px solid #0f172a;
  outline-offset: 2px;
}

.nexeditor-container.dark .nexeditor-dropdown-trigger {
  color: #f8fafc;
  /* dark:text-slate-50 */
}

.nexeditor-container.dark .nexeditor-dropdown-trigger:hover {
  background: #334155;
  /* dark:bg-slate-800 */
  color: #f8fafc;
  /* dark:text-slate-50 */
}

.nexeditor-heading-label {
  font-weight: 500;
}

.nexeditor-dropdown-arrow {
  width: 12px;
  /* h-3 w-3 */
  height: 12px;
  font-size: 12px;
  transition: transform 0.15s ease;
}

/* Dropdown Menu - Exact shadcn style */
.nexeditor-dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 128px;
  /* w-32 */
  background: #ffffff;
  border: 1px solid #e2e8f0;
  /* border */
  border-radius: 6px;
  /* rounded-md */
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  z-index: 50;
  padding: 4px;
  /* p-1 */
  margin-top: 4px;
  display: none;
  animation: slideIn 150ms cubic-bezier(0.16, 1, 0.3, 1);
}

.nexeditor-container.dark .nexeditor-dropdown-menu {
  background: #020617;
  /* dark:bg-slate-950 */
  border-color: #334155;
  /* dark:border-slate-800 */
  color: #f8fafc;
  /* dark:text-slate-50 */
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Dropdown Items - Exact shadcn style */
.nexeditor-dropdown-item {
  position: relative;
  display: flex;
  align-items: center;
  border-radius: 2px;
  /* rounded-sm */
  padding: 6px 8px 6px 32px;
  /* px-2 py-1.5 pl-8 */
  font-size: 14px;
  outline: none;
  transition: all 150ms cubic-bezier(0.4, 0, 0.2, 1);
  color: #0f172a;
  cursor: pointer;
}

.nexeditor-dropdown-item:hover {
  background: #f1f5f9;
  /* bg-slate-100 */
  color: #0f172a;
  /* text-slate-900 */
}

.nexeditor-dropdown-item:focus {
  background: #f1f5f9;
  /* bg-slate-100 */
  color: #0f172a;
  /* text-slate-900 */
}

.nexeditor-container.dark .nexeditor-dropdown-item {
  color: #f8fafc;
  /* dark:text-slate-50 */
}

.nexeditor-container.dark .nexeditor-dropdown-item:hover {
  background: #334155;
  /* dark:bg-slate-800 */
  color: #f8fafc;
  /* dark:text-slate-50 */
}

.nexeditor-container.dark .nexeditor-dropdown-item:focus {
  background: #334155;
  /* dark:bg-slate-800 */
  color: #f8fafc;
  /* dark:text-slate-50 */
}

/* Specific heading styles in dropdown */
.nexeditor-dropdown-item.heading-h1 {
  font-size: 18px;
  /* text-lg */
  font-weight: 700;
  /* font-bold */
}

.nexeditor-dropdown-item.heading-h2 {
  font-size: 16px;
  /* text-base */
  font-weight: 700;
  /* font-bold */
}

.nexeditor-dropdown-item.heading-h3 {
  font-size: 14px;
  /* text-sm */
  font-weight: 700;
  /* font-bold */
}

.nexeditor-dropdown-item.heading-h4 {
  font-size: 12px;
  /* text-xs */
  font-weight: 700;
  /* font-bold */
}

.nexeditor-dropdown-item.heading-h5 {
  font-size: 12px;
  /* text-xs */
  font-weight: 600;
  /* font-semibold */
}

.nexeditor-dropdown-item.heading-normal {
  font-size: 14px;
  /* text-sm */
  font-weight: 400;
  /* font-normal */
}

/* Editor Content */
.nexeditor-content {
  flex: 1;
  min-height: 200px;
  padding: 16px;
  outline: none;
  line-height: 1.6;
  color: #374151;
  background: #ffffff;
  overflow-y: auto;
}

.nexeditor-container.dark .nexeditor-content {
  background: #1a1a1a;
  color: #d1d5db;
}

.nexeditor-content:empty::before {
  content: attr(data-placeholder);
  color: #9ca3af;
  pointer-events: none;
  font-style: italic;
}

.nexeditor-container.dark .nexeditor-content:empty::before {
  color: #6b7280;
}

/* Typography */
.nexeditor-content h1 {
  font-size: 2em;
  font-weight: 700;
  margin: 0.67em 0;
  line-height: 1.2;
}

.nexeditor-content h2 {
  font-size: 1.5em;
  font-weight: 600;
  margin: 0.75em 0;
  line-height: 1.3;
}

.nexeditor-content h3 {
  font-size: 1.25em;
  font-weight: 600;
  margin: 0.83em 0;
  line-height: 1.4;
}

.nexeditor-content p {
  margin: 0.5em 0;
}

.nexeditor-content ul,
.nexeditor-content ol {
  margin: 0.5em 0;
  padding-left: 2em;
}

.nexeditor-content li {
  margin: 0.25em 0;
}

.nexeditor-content strong {
  font-weight: 600;
}

.nexeditor-content em {
  font-style: italic;
}

.nexeditor-content u {
  text-decoration: underline;
}

/* Focus States */
.nexeditor-content:focus {
  outline: none;
  box-shadow: inset 0 0 0 2px #3b82f6;
}

.nexeditor-container.dark .nexeditor-content:focus {
  box-shadow: inset 0 0 0 2px #60a5fa;
}

/* Selection */
.nexeditor-content ::selection {
  background-color: #3b82f6;
  color: white;
}

.nexeditor-container.dark .nexeditor-content ::selection {
  background-color: #60a5fa;
  color: #1f2937;
}

/* Tables */
.nexeditor-table {
  border-collapse: collapse;
  width: 100%;
  margin: 1rem 0;
  border: 1px solid #e1e5e9;
}

.nexeditor-container.dark .nexeditor-table {
  border-color: #444;
}

.nexeditor-table td {
  border: 1px solid #e1e5e9;
  padding: 8px 12px;
  vertical-align: top;
  min-width: 50px;
  min-height: 20px;
}

.nexeditor-container.dark .nexeditor-table td {
  border-color: #444;
}

.nexeditor-table td:empty::before {
  content: ' ';
  white-space: pre;
}

.nexeditor-table tr:nth-child(even) {
  background-color: #f9fafb;
}

.nexeditor-container.dark .nexeditor-table tr:nth-child(even) {
  background-color: #2d2d2d;
}

/* Images */
.nexeditor-image {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 1rem 0;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.nexeditor-container.dark .nexeditor-image {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* Formulas */
.nexeditor-formula {
  display: inline-block;
  margin: 0 2px;
  padding: 2px 4px;
  background-color: #fff3cd;
  border: 2px solid #ffc107;
  border-radius: 3px;
  min-height: 20px;
  min-width: 20px;
  vertical-align: baseline;
  cursor: pointer;
  user-select: none;
}

.nexeditor-container.dark .nexeditor-formula {
  background-color: #7c2d12;
  border-color: #ea580c;
}

.nexeditor-formula:hover {
  background-color: #ffeaa7;
  border-color: #fdcb6e;
}

.nexeditor-container.dark .nexeditor-formula:hover {
  background-color: #9a3412;
  border-color: #f97316;
}

/* Character Count */
.nexeditor-character-count {
  position: absolute;
  bottom: 12px;
  right: 12px;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 11px;
  color: #6b7280;
  z-index: 10;
  backdrop-filter: blur(4px);
  font-weight: 500;
}

/* Voice Button Animation */
.nexeditor-voice-indicator {
  position: relative;
}

.nexeditor-voice-indicator.listening {
  animation: pulseVoice 1s infinite;
  background: #ef4444 !important;
  color: white !important;
}

.nexeditor-voice-indicator.listening::after {
  content: '';
  position: absolute;
  top: -2px;
  right: -2px;
  width: 8px;
  height: 8px;
  background: #ef4444;
  border-radius: 50%;
  animation: pulse 1s infinite;
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes pulse {

  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.1);
  }
}

@keyframes pulseVoice {

  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.1);
  }
}

/* Responsive Design */
@media (max-width: 768px) {
  .nexeditor-toolbar {
    padding: 6px 8px;
  }

  .nexeditor-toolbar-button {
    width: 28px;
    height: 28px;
    font-size: 12px;
  }

  .nexeditor-content {
    padding: 12px;
    min-height: 150px;
  }
}

/* Print Styles */
@media print {

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

  .nexeditor-container {
    border: none;
    box-shadow: none;
  }

  .nexeditor-content {
    padding: 0;
  }
}

/* CDN-specific overrides for shadcn components */
.nexeditor-container .bg-gray-50\/50 {
  background: rgba(249, 250, 251, 0.5) !important;
  border-bottom: 1px solid #e5e7eb !important;
  padding: 12px 16px !important;
  /* Force horizontal layout */
  display: flex !important;
  flex-wrap: wrap !important;
  align-items: center !important;
  gap: 8px !important;
}

.nexeditor-container .dark .bg-gray-50\/50 {
  background: rgba(17, 24, 39, 0.5) !important;
  border-bottom-color: #374151 !important;
}

/* Force horizontal layout for all toolbar groups - Target exact classes */
.nexeditor-container .flex.items-center.border-r.border-gray-300.pr-3.mr-3,
.nexeditor-container .border-r.border-gray-300.pr-3.mr-3,
.nexeditor-container .flex.items-center.gap-1.flex-wrap,
.nexeditor-container .flex.flex-wrap.items-center.gap-2 {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  gap: 6px !important;
  border-right: 1px solid #d1d5db !important;
  padding-right: 12px !important;
  margin-right: 12px !important;
}

/* Remove right border from last group */
.nexeditor-container .flex.items-center.border-r.border-gray-300.pr-3.mr-3:last-child,
.nexeditor-container .border-r.border-gray-300.pr-3.mr-3:last-child,
.nexeditor-container .flex.items-center.gap-1.flex-wrap:last-child,
.nexeditor-container .flex.flex-wrap.items-center.gap-2:last-child {
  border-right: none !important;
  padding-right: 0 !important;
  margin-right: 0 !important;
}

/* Dark mode separators */
.nexeditor-container .dark .flex.items-center.border-r.border-gray-300.pr-3.mr-3,
.nexeditor-container .dark .border-r.border-gray-300.pr-3.mr-3,
.nexeditor-container .dark .flex.items-center.gap-1.flex-wrap,
.nexeditor-container .dark .flex.flex-wrap.items-center.gap-2 {
  border-right-color: #4b5563 !important;
}

/* Force individual buttons to be inline */
.nexeditor-container .flex.items-center button {
  margin: 0 !important;
}

/* Modal and Dialog styling for CDN - More specific targeting */

/* Target all potential dialog containers */
.nexeditor-container [data-radix-popper-content-wrapper],
.nexeditor-container [data-state="open"][data-side],
/* Target via class names that shadcn uses */
.nexeditor-container .fixed.inset-0,
.nexeditor-container .fixed.left-0.top-0 {
  z-index: 999999 !important;
}

/* Dialog Overlay - Target the exact shadcn classes */
.nexeditor-container .fixed.inset-0.z-50.bg-black\/80,
.nexeditor-container .fixed.inset-0.z-50,
/* Also target via data attributes */
.nexeditor-container [data-radix-dialog-overlay] {
  position: fixed !important;
  inset: 0 !important;
  background-color: rgba(0, 0, 0, 0.8) !important;
  backdrop-filter: blur(4px) !important;
  animation: fade-in 0.2s ease-out !important;
}

/* Dialog Content - Target the exact shadcn classes */
.nexeditor-container .fixed.left-\[50\%\].top-\[50\%\].z-50.grid,
.nexeditor-container .fixed[data-state="open"].grid,
.nexeditor-container [role="dialog"],
.nexeditor-container [data-radix-dialog-content] {
  position: fixed !important;
  left: 50% !important;
  top: 50% !important;
  z-index: 999999 !important;
  transform: translate(-50%, 0%) !important;
  width: 90% !important;
  max-width: 32rem !important;
  padding: 24px !important;
  background: white !important;
  border-radius: 8px !important;
  border: 1px solid #e5e7eb !important;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25) !important;
  font-family: system-ui, -apple-system, sans-serif !important;
  animation: scale-in 0.2s ease-out !important;
}

/* Global modal portal styling - target outside container */
[data-radix-portal] {
  z-index: 999999 !important;
}

/* Alternative approach: Target any dialog-like fixed positioned elements */
body>div[data-radix-portal] .fixed.inset-0 {
  position: fixed !important;
  inset: 0 !important;
  z-index: 999998 !important;
  background-color: rgba(0, 0, 0, 0.8) !important;
  backdrop-filter: blur(4px) !important;
}

body>div[data-radix-portal] .fixed[data-state="open"] {
  position: fixed !important;
  left: 50% !important;
  top: 50% !important;
  z-index: 999999 !important;
  transform: translate(-50%, 0%) !important;
  width: 90% !important;
  max-width: 32rem !important;
  padding: 24px !important;
  background: white !important;
  border-radius: 8px !important;
  border: 1px solid #e5e7eb !important;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25) !important;
  font-family: system-ui, -apple-system, sans-serif !important;
}

/* Dialog animations */
@keyframes fade-in {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes scale-in {
  from {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.95);
  }

  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

/* Popover Styles - Color Picker */
[data-radix-popper-content-wrapper] {
  position: fixed !important;
  z-index: 2147483647 !important;
  overflow: visible !important;
  pointer-events: none !important;
  width: max-content !important;
  max-width: calc(100vw - 16px) !important;
}

[data-radix-popper-content-wrapper]>* {
  pointer-events: auto !important;
}

[data-radix-popover-content] {
  position: fixed !important;
  z-index: 2147483647 !important;
  width: max-content !important;
  min-width: unset !important;
  max-width: calc(100vw - 16px) !important;
  max-height: min(60vh, 420px) !important;
  overflow: auto !important;
  border-radius: 0.375rem !important;
  border: 1px solid #e5e7eb !important;
  background-color: white !important;
  padding: 1rem !important;
  color: #0f172a !important;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06) !important;
  outline: none !important;
}

[data-radix-popover-content]>* {
  width: auto !important;
  min-width: unset !important;
}

[data-radix-popper-content-wrapper]>[role="dialog"] {
  width: max-content !important;
  min-width: max-content !important;
  transform: translate(-50%, 0%) !important;
}

/* Dialog Header */
.nexeditor-container [data-radix-dialog-content] h2 {
  margin: 0 0 16px 0 !important;
  font-size: 18px !important;
  font-weight: 600 !important;
  color: #111827 !important;
}

/* Dialog Description */
.nexeditor-container [data-radix-dialog-content] p {
  margin: 0 0 16px 0 !important;
  font-size: 14px !important;
  color: #6b7280 !important;
}

/* Dialog buttons */
.nexeditor-container [data-radix-dialog-content] button {
  padding: 8px 16px !important;
  border-radius: 6px !important;
  font-size: 14px !important;
  font-weight: 500 !important;
  transition: all 0.2s !important;
}

/* Primary button in modal */
.nexeditor-container [data-radix-dialog-content] button:not([data-variant="outline"]) {
  background: #3b82f6 !important;
  color: white !important;
  border: none !important;
}

.nexeditor-container [data-radix-dialog-content] button:not([data-variant="outline"]):hover {
  background: #2563eb !important;
}

/* Cancel button in modal */
.nexeditor-container [data-radix-dialog-content] button[data-variant="outline"] {
  background: white !important;
  color: #374151 !important;
  border: 1px solid #d1d5db !important;
}

.nexeditor-container [data-radix-dialog-content] button[data-variant="outline"]:hover {
  background: #f9fafb !important;
  border-color: #9ca3af !important;
}

/* Input styling in modals */
.nexeditor-container [data-radix-dialog-content] input {
  width: 100% !important;
  padding: 8px 12px !important;
  border: 1px solid #d1d5db !important;
  border-radius: 6px !important;
  font-size: 14px !important;
}

.nexeditor-container [data-radix-dialog-content] input:focus {
  outline: none !important;
  border-color: #3b82f6 !important;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1) !important;
}

/* Label styling in modals */
.nexeditor-container [data-radix-dialog-content] label {
  display: block !important;
  margin-bottom: 4px !important;
  font-size: 14px !important;
  font-weight: 500 !important;
  color: #374151 !important;
}

/* Table preview in modal */
.nexeditor-container [data-radix-dialog-content] table {
  width: 100% !important;
  border-collapse: collapse !important;
  font-size: 12px !important;
}

.nexeditor-container [data-radix-dialog-content] table td {
  border: 1px solid #d1d5db !important;
  padding: 4px 8px !important;
  text-align: center !important;
}

/* Dark mode support for modals */
.nexeditor-container.dark [data-radix-dialog-overlay] {
  background-color: rgba(0, 0, 0, 0.9) !important;
}

.nexeditor-container.dark [data-radix-dialog-content] {
  background: #1f2937 !important;
  border-color: #374151 !important;
  color: white !important;
}

.nexeditor-container.dark [data-radix-dialog-content] h2 {
  color: white !important;
}

.nexeditor-container.dark [data-radix-dialog-content] p {
  color: #9ca3af !important;
}

/* Style shadcn buttons to match CDN design */
.nexeditor-container button {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  height: 36px !important;
  padding: 8px !important;
  background: transparent !important;
  border: 1px solid transparent !important;
  border-radius: 6px !important;
  cursor: pointer !important;
  font-size: 14px !important;
  font-weight: 500 !important;
  transition: all 150ms cubic-bezier(0.4, 0, 0.2, 1) !important;
  outline: none !important;
  white-space: nowrap !important;
  user-select: none !important;
}

.nexeditor-container button:hover {
  background: #f1f5f9 !important;
  color: #0f172a !important;
}

.nexeditor-container button:disabled {
  pointer-events: none !important;
  opacity: 0.5 !important;
}

.nexeditor-container .dark button {
  color: #f8fafc !important;
}

.nexeditor-container .dark button:hover {
  background: #334155 !important;
  color: #f8fafc !important;
}

/* Button SVG icons */
.nexeditor-container button svg {
  width: 16px !important;
  height: 16px !important;
  stroke-width: 2 !important;
  stroke-linecap: round !important;
  stroke-linejoin: round !important;
}

/* Dropdown triggers */
.nexeditor-container [role="combobox"] {
  gap: 8px !important;
  padding: 8px 12px !important;
}

.nexeditor-container [role="combobox"] svg {
  width: 12px !important;
  height: 12px !important;
}

/* Override any blue button styles from demo */
.nexeditor-container .bg-blue-600,
.nexeditor-container .bg-blue-500 {
  background: transparent !important;
  color: #0f172a !important;
}

.nexeditor-container .bg-blue-600:hover,
.nexeditor-container .bg-blue-500:hover {
  background: #f1f5f9 !important;
  color: #0f172a !important;
}

.nexeditor-container .dark .bg-blue-600,
.nexeditor-container .dark .bg-blue-500 {
  background: transparent !important;
  color: #f8fafc !important;
}

.nexeditor-container .dark .bg-blue-600:hover,
.nexeditor-container .dark .bg-blue-500:hover {
  background: #334155 !important;
  color: #f8fafc !important;
}

/* Ensure proper toolbar layout */
.nexeditor-container .flex.flex-wrap.items-center.gap-2 {
  border-right: 1px solid #d1d5db;
  padding-right: 12px;
  margin-right: 12px;
}

.nexeditor-container .flex.flex-wrap.items-center.gap-2:last-child {
  border-right: none !important;
  padding-right: 0 !important;
  margin-right: 0 !important;
}

.nexeditor-container .dark .flex.flex-wrap.items-center.gap-2 {
  border-right-color: #4b5563;
}

/* Modal/Dialog Styles for Formula Builder */
.nexeditor-dialog-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  background-color: rgba(0, 0, 0, 0.8);
  opacity: 0;
  transition: opacity 200ms ease-in-out;
}

.nexeditor-dialog-overlay[data-state="open"] {
  opacity: 1;
  animation: fadeIn 200ms ease-in-out;
}

.nexeditor-dialog-overlay[data-state="closed"] {
  opacity: 0;
  animation: fadeOut 200ms ease-in-out;
}

.nexeditor-dialog-content {
  position: fixed;
  left: 50%;
  top: 50%;
  z-index: 50;
  display: grid;
  width: 100%;
  max-width: 32rem;
  transform: translate(-50%, -50%) scale(0.95);
  gap: 1rem;
  border: 1px solid #e5e7eb;
  background-color: white;
  padding: 1.5rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  transition: all 200ms ease-in-out;
  border-radius: 0.5rem;
}

.nexeditor-dialog-content[data-state="open"] {
  transform: translate(-50%, -50%) scale(1);
  animation: dialogContentShow 200ms ease-in-out;
}

.nexeditor-dialog-content[data-state="closed"] {
  transform: translate(-50%, -50%) scale(0.95);
  animation: dialogContentHide 200ms ease-in-out;
}

.nexeditor-container.dark .nexeditor-dialog-content {
  background-color: #1f2937;
  border-color: #374151;
  color: white;
}

/* Large formula builder modal */
.nexeditor-dialog-content.formula-builder {
  max-width: 72rem;
  max-height: 95vh;
  overflow-y: auto;
  padding: 0;
}

.nexeditor-dialog-close {
  position: absolute;
  right: 1rem;
  top: 1rem;
  border-radius: 0.25rem;
  opacity: 0.7;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0.25rem;
  transition: opacity 150ms ease-in-out;
}

.nexeditor-dialog-close:hover {
  opacity: 1;
}

.nexeditor-dialog-close:focus {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

.nexeditor-dialog-close svg {
  width: 1rem;
  height: 1rem;
}

/* Animation keyframes */
@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes fadeOut {
  from {
    opacity: 1;
  }

  to {
    opacity: 0;
  }
}

@keyframes dialogContentShow {
  from {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.95);
  }

  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

@keyframes dialogContentHide {
  from {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }

  to {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.95);
  }
}

/* Formula builder specific styles */
.nexeditor-formula-tabs {
  display: flex;
  border-bottom: 1px solid #e5e7eb;
  background-color: #f9fafb;
}

.nexeditor-container.dark .nexeditor-formula-tabs {
  border-bottom-color: #374151;
  background-color: #111827;
}

.nexeditor-formula-tab {
  padding: 0.75rem 1rem;
  border: none;
  background: transparent;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 150ms ease-in-out;
  font-weight: 500;
  color: #6b7280;
}

.nexeditor-formula-tab:hover {
  color: #374151;
  background-color: #f3f4f6;
}

.nexeditor-formula-tab.active {
  color: #3b82f6;
  border-bottom-color: #3b82f6;
  background-color: white;
}

.nexeditor-container.dark .nexeditor-formula-tab {
  color: #9ca3af;
}

.nexeditor-container.dark .nexeditor-formula-tab:hover {
  color: #d1d5db;
  background-color: #1f2937;
}

.nexeditor-container.dark .nexeditor-formula-tab.active {
  color: #60a5fa;
  border-bottom-color: #60a5fa;
  background-color: #1f2937;
}

.nexeditor-formula-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(3rem, 1fr));
  gap: 0.5rem;
  padding: 1rem;
}

.nexeditor-formula-symbol {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 3rem;
  border: 1px solid #e5e7eb;
  border-radius: 0.375rem;
  background-color: white;
  cursor: pointer;
  transition: all 150ms ease-in-out;
  font-size: 1.25rem;
}

.nexeditor-formula-symbol:hover {
  background-color: #f3f4f6;
  border-color: #d1d5db;
  transform: scale(1.05);
}

.nexeditor-container.dark .nexeditor-formula-symbol {
  background-color: #1f2937;
  border-color: #374151;
  color: white;
}

.nexeditor-container.dark .nexeditor-formula-symbol:hover {
  background-color: #374151;
  border-color: #4b5563;
}