/* Editor Document Layout */
.editor-document {
  max-width: 800px;
}

/* Editor Block */
.editor-block {
  padding: 1rem;
  margin-bottom: 1rem;
  border: 1px solid var(--tblr-border-color);
  border-radius: var(--tblr-border-radius);
  background: var(--tblr-bg-surface);
}

.editor-block-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--tblr-body-color);
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--tblr-border-color);
}

/* Block Type Variants */
.editor-block--metadata {
  background: var(--tblr-bg-surface-secondary, #f8fafc);
}

.editor-block--signature {
  border-style: dashed;
}

/* Metadata Grid */
.editor-metadata-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
}

/* Rich Text Content */
.editor-block-content {
  line-height: 1.6;
}

.editor-block-content p {
  margin-bottom: 0.5rem;
}

.editor-block-content p:last-child {
  margin-bottom: 0;
}

/* Signature Cell */
.signature-cell {
  min-width: 120px;
  height: 40px;
  border-bottom: 1px solid var(--tblr-border-color);
}

/* Save Indicator */
.editor-save-indicator {
  font-size: 0.75rem;
  padding: 0.125rem 0.5rem;
  border-radius: var(--tblr-border-radius);
  transition: all 0.2s ease;
}

.editor-save-indicator--saving {
  color: var(--tblr-blue);
}

.editor-save-indicator--saved {
  color: var(--tblr-green);
}

.editor-save-indicator--error {
  color: var(--tblr-red);
}

/* AI Generating Overlay */
.editor-block--ai-generating {
  position: relative;
  pointer-events: none;
  user-select: none;
}

.ai-generating-overlay {
  position: relative;
  padding: 0.5rem 0;
}

.ai-generating-shimmer {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
}

.ai-shimmer-line {
  height: 0.75rem;
  border-radius: 0.25rem;
  background: linear-gradient(
    90deg,
    rgba(2, 108, 255, 0.06) 0%,
    rgba(2, 108, 255, 0.12) 40%,
    rgba(2, 108, 255, 0.06) 80%
  );
  background-size: 200% 100%;
  animation: shimmer 1.8s ease-in-out infinite;
}

.ai-shimmer-line--long { width: 95%; }
.ai-shimmer-line--medium { width: 72%; animation-delay: 0.15s; }
.ai-shimmer-line--short { width: 48%; animation-delay: 0.3s; }

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.ai-generating-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  margin-top: 0.875rem;
  padding: 0.25rem 0.625rem;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--tblr-primary);
  background: rgba(2, 108, 255, 0.06);
  border-radius: 1rem;
  animation: pulse-opacity 2.4s ease-in-out infinite;
}

@keyframes pulse-opacity {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

/* Table Textarea */
.table textarea.form-control {
  resize: vertical;
  min-height: 2.5rem;
}

/* Lexxy Editor Styling */
lexxy-editor {
  display: block;
  min-height: 120px;
}

/* Override Tabler resets that conflict with Lexxy's :where() selectors (specificity 0) */
lexxy-editor button,
lexxy-editor summary {
  line-height: normal;
}

lexxy-editor .lexxy-editor__toolbar-button {
  display: grid;
  place-items: center;
}

lexxy-editor svg {
  vertical-align: baseline;
}

lexxy-editor [contenteditable] {
  padding: 0.5rem;
  border: 1px solid var(--tblr-border-color);
  border-radius: var(--tblr-border-radius);
  min-height: 120px;
  outline: none;
}

lexxy-editor [contenteditable]:focus {
  border-color: var(--tblr-primary);
  box-shadow: 0 0 0 0.25rem rgba(2, 108, 255, 0.15);
}

/* Block Builder: hide Bootstrap validation icon on textareas */
.block-builder-ai-fields textarea.is-invalid {
  background-image: none;
  padding-right: 0.75rem;
}

/* Block Builder (Admin Template Editor) */
.block-builder-card {
  transition: box-shadow 0.15s ease;
}

.block-builder-card:hover {
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.block-builder-ghost {
  opacity: 0.4;
  box-shadow: 0 0 0 2px var(--tblr-primary);
  border-radius: var(--tblr-border-radius);
}

.block-builder-drag-handle {
  cursor: grab;
  color: var(--tblr-secondary);
  display: flex;
  align-items: center;
}

.block-builder-drag-handle:active {
  cursor: grabbing;
}

.block-builder-field-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.block-builder-json-preview {
  max-height: 400px;
  overflow-y: auto;
  font-size: 0.8125rem;
}

.block-builder-card .card-header input.form-control {
  background: transparent;
}

.block-builder-card .card-header input.form-control:focus {
  background: var(--tblr-bg-surface);
}
