﻿/* ============================================
   INLINE EDITOR
   ============================================ */
/* Wrapper */
.inline-editor-wrapper {
  position: relative;
  width: 100%;
}
/* Label */
.inline-editor-label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  margin-bottom: 4px;
  color: var(--mud-palette-text-secondary);
}
/* Toolbar */
.inline-editor-toolbar {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 4px 8px;
  background: var(--mud-palette-surface);
  border: 1px solid var(--mud-palette-lines-default);
  border-radius: 4px 4px 0 0;
  margin-bottom: -1px;
  flex-wrap: wrap;
  z-index: 10;
}
.toolbar-divider {
  width: 1px;
  height: 24px;
  background: var(--mud-palette-lines-default);
  margin: 0 4px;
}
/* Content Area */
.inline-editor-content {
  border: 1px dashed transparent;
  cursor: text;
  outline: none;
  word-wrap: break-word;
}
.inline-editor-content:hover:not([contenteditable="false"]) {
  border-color: rgba(255, 255, 255, 0.3);
}
.inline-editor-content.focused {
  border-color: var(--mud-palette-primary);
  background: rgba(255, 255, 255, 0.08);
}
.inline-editor-content[contenteditable="false"] {
  cursor: default;
  opacity: 0.6;
}
.inline-editor-content:empty:before {
  content: attr(data-placeholder);
  color: var(--mud-palette-text-disabled);
  font-style: italic;
}
/* Character Count */
.inline-editor-char-count {
  font-size: 11px;
  color: var(--mud-palette-text-secondary);
  text-align: right;
  margin-top: 4px;
}
/* ============================================
   COLOR PICKER STYLES
   ============================================ */
.color-picker-container {
  padding: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.inline-color-picker {
  width: auto !important;
}
.inline-color-picker .mud-picker-color-grid {
  gap: 2px;
}
.inline-color-picker .mud-picker-color-dot {
  width: 20px;
  height: 20px;
  min-width: 20px;
  min-height: 20px;
}
/* ============================================
   LIST STYLES
   ============================================ */
.inline-editor-content ul,
.inline-editor-content ol {
  margin: 8px 0;
  padding-left: 40px;
  list-style-position: outside;
}
.inline-editor-content ul {
  list-style-type: disc;
}
.inline-editor-content ol {
  list-style-type: decimal;
}
.inline-editor-content li {
  margin: 4px 0;
}
/* Nested Lists */
.inline-editor-content ul ul,
.inline-editor-content ol ol,
.inline-editor-content ul ol,
.inline-editor-content ol ul {
  margin: 4px 0;
  padding-left: 40px;
}
.inline-editor-content ul ul {
  list-style-type: circle;
}
.inline-editor-content ul ul ul {
  list-style-type: square;
}
.inline-editor-content ol ol {
  list-style-type: lower-alpha;
}
.inline-editor-content ol ol ol {
  list-style-type: lower-roman;
}
/* Blockquote (browser fallback for indent) */
.inline-editor-content blockquote {
  margin: 4px 0 4px 40px;
  padding: 0;
  border: none;
  background: transparent;
  font-style: normal;
}
/* ============================================
   INLINE EDITOR IMAGE STYLES
   ============================================ */
/* Image wrapper */
.inline-editor-image-wrapper {
  display: inline-block;
  position: relative;
  max-width: 100%;
  cursor: pointer;
  margin: 4px 0;
  transition: box-shadow 0.2s ease;
}
.inline-editor-image-wrapper:hover {
  box-shadow: 0 0 0 2px rgba(var(--mud-palette-primary-rgb), 0.3);
}
.inline-editor-image-wrapper.image-selected {
  box-shadow: 0 0 0 2px var(--mud-palette-primary);
}
.inline-editor-image {
  display: block;
  max-width: 100%;
  height: auto;
  user-select: none;
}
/* Image overlay (when selected) */
.inline-editor-image-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  z-index: 10;
}
/* Image toolbar */
.image-toolbar {
  position: absolute;
  top: -40px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--mud-palette-surface);
  border: 1px solid var(--mud-palette-lines-default);
  border-radius: 6px;
  padding: 4px 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  pointer-events: auto;
  z-index: 20;
  white-space: nowrap;
}
.image-toolbar-btn {
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: var(--mud-palette-text-primary);
  transition: background-color 0.15s ease;
}
.image-toolbar-btn:hover {
  background-color: var(--mud-palette-action-default-hover);
}
.image-toolbar-btn.delete-btn:hover {
  background-color: var(--mud-palette-error);
  color: var(--mud-palette-error-text);
}
.image-rotate-slider {
  width: 80px;
  height: 4px;
  cursor: pointer;
  accent-color: var(--mud-palette-primary);
}
/* Resize handles */
.image-resize-handle {
  position: absolute;
  width: 12px;
  height: 12px;
  background: var(--mud-palette-primary);
  border: 2px solid white;
  border-radius: 50%;
  pointer-events: auto;
  z-index: 15;
}
.image-resize-handle:hover {
  transform: scale(1.2);
}
.handle-nw {
  top: -6px;
  left: -6px;
  cursor: nw-resize;
}
.handle-ne {
  top: -6px;
  right: -6px;
  cursor: ne-resize;
}
.handle-sw {
  bottom: -6px;
  left: -6px;
  cursor: sw-resize;
}
.handle-se {
  bottom: -6px;
  right: -6px;
  cursor: se-resize;
}
.image-toolbar-separator {
  color: var(--mud-palette-lines-default);
  margin: 0 4px;
  user-select: none;
}
/* ===== CROP OVERLAY ===== */
.image-crop-container {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 100;
  overflow: visible;
}
.crop-dark-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  pointer-events: none;
}
.crop-selection-box {
  position: absolute;
  border: 2px dashed white;
  background: transparent;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.5);
  cursor: move;
  z-index: 101;
}
/* Crop handles */
.crop-handle {
  position: absolute;
  background: white;
  border: 1px solid var(--mud-palette-primary);
  z-index: 102;
}
.crop-handle-n,
.crop-handle-s {
  width: 20px;
  height: 6px;
  left: 50%;
  transform: translateX(-50%);
  cursor: ns-resize;
}
.crop-handle-e,
.crop-handle-w {
  width: 6px;
  height: 20px;
  top: 50%;
  transform: translateY(-50%);
  cursor: ew-resize;
}
.crop-handle-n {
  top: -3px;
}
.crop-handle-s {
  bottom: -3px;
}
.crop-handle-e {
  right: -3px;
}
.crop-handle-w {
  left: -3px;
}
.crop-handle-nw,
.crop-handle-ne,
.crop-handle-sw,
.crop-handle-se {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}
.crop-handle-nw {
  top: -5px;
  left: -5px;
  cursor: nw-resize;
}
.crop-handle-ne {
  top: -5px;
  right: -5px;
  cursor: ne-resize;
}
.crop-handle-sw {
  bottom: -5px;
  left: -5px;
  cursor: sw-resize;
}
.crop-handle-se {
  bottom: -5px;
  right: -5px;
  cursor: se-resize;
}
/* Crop toolbar */
.crop-toolbar {
  position: absolute;
  bottom: -50px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--mud-palette-surface);
  border: 1px solid var(--mud-palette-lines-default);
  border-radius: 6px;
  padding: 6px 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  white-space: nowrap;
  z-index: 103;
}
.crop-preset-select {
  padding: 4px 8px;
  border: 1px solid var(--mud-palette-lines-default);
  border-radius: 4px;
  background: var(--mud-palette-surface);
  color: var(--mud-palette-text-primary);
  font-size: 12px;
  cursor: pointer;
}
.crop-btn {
  padding: 6px 12px;
  border: none;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
  transition: background-color 0.15s ease;
}
.crop-apply-btn {
  background: var(--mud-palette-primary);
  color: var(--mud-palette-primary-text);
}
.crop-apply-btn:hover {
  background: var(--mud-palette-primary-darken);
}
.crop-reset-btn {
  background: var(--mud-palette-warning);
  color: var(--mud-palette-warning-text);
}
.crop-reset-btn:hover {
  opacity: 0.9;
}
.crop-cancel-btn {
  background: var(--mud-palette-action-default);
  color: var(--mud-palette-text-primary);
}
.crop-cancel-btn:hover {
  background: var(--mud-palette-action-default-hover);
}
/* Cropping state */
.inline-editor-image-wrapper.image-cropping .inline-editor-image {
  opacity: 0.3;
}
/* ============================================
   TABLE STYLES
   ============================================ */
/* Table wrapper - editor only */
.inline-editor-table-wrapper {
  display: block;
  position: relative;
  margin: 12px 0;
  cursor: default;
}
.inline-editor-table-wrapper:hover {
  outline: 2px dashed rgba(var(--mud-palette-primary-rgb), 0.3);
  outline-offset: 2px;
}
.inline-editor-table-wrapper.table-selected {
  outline: 2px solid var(--mud-palette-primary);
  outline-offset: 2px;
}
/* Table base styles - applies to both editor and output */
.inline-editor-table,
.inline-editor-content table {
  border-collapse: collapse;
  margin: 0;
}
/* Bordered table - using class */
.inline-editor-table.bordered td,
.inline-editor-table.bordered th,
.inline-editor-content table.bordered td,
.inline-editor-content table.bordered th {
  border: 1px solid rgba(128, 128, 128, 0.6);
}
/* Cell styles - applies to all tables in editor */
.inline-editor-table td,
.inline-editor-table th,
.inline-editor-content table td,
.inline-editor-content table th {
  padding: 8px;
  vertical-align: top;
  min-width: 40px;
  outline: none;
}
.inline-editor-table td:focus,
.inline-editor-table th:focus {
  outline: 2px solid var(--mud-palette-primary);
  outline-offset: -2px;
  background-color: rgba(var(--mud-palette-primary-rgb), 0.1);
}
.inline-editor-table th,
.inline-editor-content table th {
  background-color: rgba(128, 128, 128, 0.2);
  font-weight: bold;
  text-align: left;
}
/* For resize handles, we need position relative on cells */
.inline-editor-table td,
.inline-editor-table th {
  position: relative;
}
/* Column resize handle - editor only */
.table-col-resize-handle {
  position: absolute;
  top: 0;
  right: -3px;
  width: 6px;
  height: 100%;
  cursor: col-resize;
  background: transparent;
  z-index: 5;
}
.table-col-resize-handle:hover,
.table-col-resize-handle.resizing {
  background: var(--mud-palette-primary);
  opacity: 0.5;
}
/* Table select button - editor only */
.table-select-btn {
  position: absolute;
  top: -12px;
  right: -12px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--mud-palette-primary);
  color: white;
  border: 2px solid white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  z-index: 15;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.inline-editor-table-wrapper:hover .table-select-btn,
.inline-editor-table-wrapper.table-selected .table-select-btn {
  opacity: 1;
}
.table-select-btn:hover {
  transform: scale(1.1);
}
/* Table overlay */
.inline-editor-table-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  z-index: 10;
}
/* Table toolbar */
.table-toolbar {
  position: absolute;
  top: -44px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 2px;
  background: var(--mud-palette-surface);
  border: 1px solid var(--mud-palette-lines-default);
  border-radius: 6px;
  padding: 4px 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  pointer-events: auto;
  z-index: 20;
  white-space: nowrap;
}
.table-toolbar-separator {
  color: var(--mud-palette-lines-default);
  margin: 0 4px;
  user-select: none;
}
.table-toolbar .image-toolbar-btn {
  font-size: 14px;
}
.table-toolbar .delete-btn {
  margin-left: 4px;
}
.table-toolbar .delete-btn:hover {
  background-color: var(--mud-palette-error);
  color: var(--mud-palette-error-text);
}
/* Resizing state */
.inline-editor-table-wrapper.col-resizing {
  cursor: col-resize;
  user-select: none;
}
.inline-editor-table-wrapper.col-resizing * {
  cursor: col-resize !important;
  user-select: none !important;
}
/* ============================================
   TABLE COLOR PICKER STYLES
   ============================================ */
.table-color-picker-popup {
  background: var(--mud-palette-surface);
  border: 1px solid var(--mud-palette-lines-default);
  border-radius: 8px;
  padding: 12px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
  min-width: 240px;
}
.color-picker-options {
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.color-picker-label {
  font-size: 12px;
  color: var(--mud-palette-text-secondary);
  white-space: nowrap;
}
.color-picker-select {
  flex: 1;
  padding: 4px 8px;
  border: 1px solid var(--mud-palette-lines-default);
  border-radius: 4px;
  background: var(--mud-palette-background);
  color: var(--mud-palette-text-primary);
  font-size: 12px;
  cursor: pointer;
}
.color-picker-grid {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 2px;
}
.color-swatch {
  width: 20px;
  height: 20px;
  border-radius: 3px;
  cursor: pointer;
  border: 1px solid rgba(128, 128, 128, 0.3);
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}
.color-swatch:hover {
  transform: scale(1.15);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  z-index: 1;
  position: relative;
}
.color-swatch.transparent-swatch {
  background: linear-gradient(45deg, #ccc 25%, transparent 25%), linear-gradient(-45deg, #ccc 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #ccc 75%), linear-gradient(-45deg, transparent 75%, #ccc 75%);
  background-size: 8px 8px;
  background-position: 0 0, 0 4px, 4px -4px, -4px 0px;
}
.color-swatch.transparent-swatch::after {
  content: '✕';
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  color: #999;
  font-size: 10px;
}