/* Tiptap Editor Styles */

/* Enhanced Context Panel Styles */
.context-panel {
  scrollbar-width: thin;
  scrollbar-color: #d1d5db transparent;
  flex-shrink: 0; /* Prevent shrinking */
  width: 320px; /* Fixed width */
  max-height: 100vh; /* Max height constraint */
  overflow-y: auto; /* Allow scrolling */
}

.context-panel::-webkit-scrollbar {
  width: 6px;
}

.context-panel::-webkit-scrollbar-track {
  background: transparent;
}

.context-panel::-webkit-scrollbar-thumb {
  background-color: #d1d5db;
  border-radius: 3px;
}

.data-card {
  transition: all 0.2s ease-in-out;
}

.data-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Toolbar group containers */
.toolbar-group {
  transition: border-color 0.2s, background-color 0.2s;
}

.toolbar-group:hover {
  @apply border-gray-300 bg-gray-100;
}

.toolbar-group:focus-within {
  @apply border-blue-300 bg-blue-50;
}

/* Toolbar button styles. Visual sizing (h-8 w-8, hover bg-gray-100) is
 * set on the markup via Tailwind utilities — the rules here just lock
 * the FA icon size to 14px (down from 16px) so heavy glyphs like
 * fa-image / fa-signature read at the same weight as line glyphs like
 * fa-align-*, and provide the .active state. */
.toolbar-button {
  position: relative;
}

.toolbar-button .fa,
.toolbar-button [class^="fa-"],
.toolbar-button [class*=" fa-"] {
  font-size: 14px;
  line-height: 1;
}

.toolbar-button.active {
  @apply bg-blue-50 text-blue-700;
  font-weight: 500;
}

.toolbar-button.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 25%;
  height: 50%;
  width: 2px;
  background: currentColor;
  border-radius: 0 2px 2px 0;
}

/* Autosave status styles */
.autosave-status {
  min-width: 140px;
}

.autosave-indicator {
  transition: background-color 0.3s;
}

/* Autosave state colors */
.autosave-status[data-status="saved"] .autosave-indicator {
  background-color: #22c55e; /* green-500 */
}

.autosave-status[data-status="saved"] {
  border-color: #bbf7d0; /* green-200 */
}

.autosave-status[data-status="saving"] .autosave-indicator {
  background-color: #3b82f6; /* blue-500 */
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.autosave-status[data-status="saving"] {
  border-color: #bfdbfe; /* blue-200 */
}

.autosave-status[data-status="error"] .autosave-indicator {
  background-color: #ef4444; /* red-500 */
}

.autosave-status[data-status="error"] {
  border-color: #fecaca; /* red-200 */
}

.autosave-status[data-status="ready"] .autosave-indicator {
  background-color: #d1d5db; /* gray-300 */
}

.autosave-status[data-status="pending"] .autosave-indicator {
  background-color: #eab308; /* yellow-500 */
}

.autosave-status[data-status="pending"] {
  border-color: #fef08a; /* yellow-200 */
}

/* Editor container */
.ProseMirror {
  outline: none;
  word-wrap: break-word;
  min-height: 150px;
}

/* Editor content styles for Stimulus controller */
[data-tiptap-editor-target="editor"] {
  @apply px-6 py-4;
}

[data-tiptap-editor-target="editor"]:focus {
  @apply outline-none ring-2 ring-blue ring-offset-2;
}

/* Basic typography */
.ProseMirror h1 {
  font-size: 1.75rem;
  font-weight: bold;
  margin-top: 1.5rem;
  margin-bottom: 1rem;
  line-height: 1.2;
}

.ProseMirror h2 {
  font-size: 1.5rem;
  font-weight: bold;
  margin-top: 1.25rem;
  margin-bottom: 0.75rem;
  line-height: 1.3;
}

.ProseMirror p {
  margin-bottom: 0.75rem;
  line-height: 1.5;
}

/* Lists */
.ProseMirror ul,
.ProseMirror ol {
  margin-top: 0.5rem;
  margin-bottom: 1rem;
  padding-left: 1.5rem;
}

.ProseMirror ul {
  list-style-type: disc;
}

.ProseMirror ol {
  list-style-type: decimal;
}

.ProseMirror li {
  margin-bottom: 0.25rem;
  line-height: 1.5;
}

.ProseMirror li > h1,
.ProseMirror li > h2 {
  display: inline;
  margin: 0;
}

/* Fix for nested headings and lists */
.ProseMirror li h1,
.ProseMirror li h2 {
  font-size: inherit;
  font-weight: inherit;
  margin: 0;
  display: inline;
}

/* Toolbar */
.tiptap-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  padding: 0.5rem;
  border-bottom: 1px solid #e5e7eb;
  margin-bottom: 0.5rem;
  background-color: #f9fafb;
}

/* Toolbar buttons */
.tiptap-button {
  padding: 0.375rem;
  border-radius: 0.25rem;
  font-weight: 500;
  font-size: 0.875rem;
  line-height: 1.25rem;
  transition: background-color 0.2s;
}

.tiptap-button:hover {
  background-color: #e5e7eb;
}

.tiptap-button.active,
.tiptap-button.bg-lavender/20 {
  @apply bg-blue/20;
}

/* RTL support */
[dir="rtl"] .ProseMirror ul,
[dir="rtl"] .ProseMirror ol {
  padding-right: 1.5rem;
  padding-left: 0;
}

/* RTL lists in editor */
.ProseMirror ul[dir="rtl"],
.ProseMirror ol[dir="rtl"] {
  direction: rtl;
  padding-left: 0;
  padding-right: 2.5rem;
  margin-left: 0;
  margin-right: 0;
}

.ProseMirror ul[dir="rtl"] li,
.ProseMirror ol[dir="rtl"] li {
  direction: rtl;
  text-align: right;
}

/* For Webkit browsers (Chrome, Safari) */
.ProseMirror ul[dir="rtl"] {
  list-style-type: disc;
}

.ProseMirror ol[dir="rtl"] {
  list-style-type: decimal;
}

/* RTL paragraphs and headings */
.ProseMirror p[dir="rtl"],
.ProseMirror h1[dir="rtl"],
.ProseMirror h2[dir="rtl"],
.ProseMirror h3[dir="rtl"] {
  direction: rtl;
  text-align: right;
}

/* Placeholder Styling with Prominent Amber/Orange Gradients */
.placeholder-highlight {
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 50%, #d97706 100%);
  color: white;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 600;
  font-size: 0.9em;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  box-shadow: 0 2px 4px rgba(245, 158, 11, 0.3);
  display: inline-block;
  margin: 0 2px;
  animation: placeholderPulse 2s ease-in-out infinite;
}

@keyframes placeholderPulse {
  0%, 100% {
    box-shadow: 0 2px 4px rgba(245, 158, 11, 0.3);
  }
  50% {
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.5);
    transform: translateY(-1px);
  }
}

/* Template Preview Modal Styles */
.template-preview-content .placeholder-highlight {
  background: linear-gradient(135deg, #fde68a 0%, #fbbf24 50%, #f59e0b 100%);
  color: #92400e;
  text-shadow: none;
  font-weight: 500;
}

/* Template Item Hover Effects */
.template-item {
  position: relative;
  overflow: hidden;
}

.template-item::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(59, 130, 246, 0.1), transparent);
  transition: left 0.5s;
}

.template-item:hover::before {
  left: 100%;
}

/* Quick Insert Panel Styles */
#quick-insert-panel {
  backdrop-filter: blur(10px);
  background-color: rgba(255, 255, 255, 0.95);
}

/* Quick Add Form Styles */
#quick-add-form {
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  border-radius: 0;
  animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

#quick-add-form input,
#quick-add-form select,
#quick-add-form textarea {
  background-color: white;
  transition: all 0.2s ease;
}

#quick-add-form input:focus,
#quick-add-form select:focus,
#quick-add-form textarea:focus {
  background-color: #fefefe;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
}

.template-category h4 {
  position: sticky;
  top: 0;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(5px);
  z-index: 10;
  padding: 8px 0;
  margin: 0 -16px 12px -16px;
  padding-left: 16px;
  border-bottom: 1px solid #f3f4f6;
}

/* Search Input Enhancement */
#template-search:focus {
  background-color: #fefefe;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}


/* Success Feedback Animation */
.insert-success-feedback {
  animation: slideInRight 0.3s ease-out, slideOutRight 0.3s ease-in 2s forwards;
}

@keyframes slideInRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideOutRight {
  from {
    transform: translateX(0);
    opacity: 1;
  }
  to {
    transform: translateX(100%);
    opacity: 0;
  }
}

/* Modal Entrance Animation */
#template-preview-modal.show {
  animation: modalFadeIn 0.2s ease-out;
}

#template-preview-modal.show > div {
  animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalFadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes modalSlideIn {
  from {
    transform: translateY(-20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* Editor Layout Fixes */
.report-editor-container {
  min-height: 100vh;
  display: flex;
  flex-direction: row; /* Ensure horizontal layout */
}

.report-editor-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Ensure editor content has enough bottom padding */
.ProseMirror {
  min-height: 400px;
  padding-bottom: 4rem; /* Increased bottom padding */
}

/* Footer overlap fix */
body.report-editor-page {
  overflow-x: hidden; /* Only hide horizontal overflow */
  position: relative;
}

.report-editor-page footer {
  display: none; /* Hide footer on report editor page */
}

/* Variable Conversion Modal Animations */
.animate-fadeIn {
  animation: fadeIn 0.2s ease-out;
}

.animate-fadeOut {
  animation: fadeOut 0.2s ease-out;
}

.animate-slideUp {
  animation: slideUp 0.3s ease-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes fadeOut {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Hide ProseMirror's default horizontal drop cursor */
.ProseMirror .ProseMirror-dropcursor,
.ProseMirror-dropcursor {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
  width: 0 !important;
  height: 0 !important;
}

/* Drop Cursor Animation */
@keyframes blink {
  0%, 50% {
    opacity: 1;
  }
  51%, 100% {
    opacity: 0;
  }
}

/* Insertion Point Pulse (shows where content WILL be inserted) */
@keyframes insertion-point-pulse {
  0%, 100% {
    background-color: #3B82F6;
    transform: scaleX(1);
    opacity: 1;
  }
  50% {
    background-color: #60A5FA;
    transform: scaleX(1.5);
    opacity: 0.8;
  }
}

.insertion-point-indicator {
  display: inline-block;
  width: 3px;
  height: 1.3em;
  background-color: #3B82F6;
  margin-left: -1.5px;
  margin-right: -1.5px;
  animation: insertion-point-pulse 1.2s ease-in-out infinite;
  pointer-events: none;
  vertical-align: text-bottom;
  border-radius: 1px;
}

/* Inserted Content Highlight (shows what WAS just inserted) - Notion-like */
@keyframes inserted-content-highlight {
  0% {
    background-color: rgba(251, 191, 36, 0.4); /* Much brighter amber - amber-400 at 40% */
    box-shadow: 0 0 0 4px rgba(251, 191, 36, 0.2);
  }
  20% {
    background-color: rgba(251, 191, 36, 0.3);
  }
  100% {
    background-color: transparent;
    box-shadow: 0 0 0 0 transparent;
  }
}

.just-inserted {
  animation: inserted-content-highlight 2500ms cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 4px;
}

/* Entry Animation for Inserted Content */
@keyframes slide-in-fade {
  0% {
    opacity: 0.3;
    transform: translateY(-4px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

.inserting {
  animation: slide-in-fade 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* Responsive Adjustments */
@media (max-width: 768px) {
  #quick-insert-panel {
    right: 1rem;
    left: 1rem;
    width: auto;
  }

  #template-preview-modal .max-w-2xl {
    max-width: calc(100vw - 2rem);
  }

  .context-panel {
    width: 280px; /* Slightly narrower on mobile */
  }

  /* Make header button smaller on mobile */
  .report-editor-main .bg-blue-600 {
    padding: 0.5rem 0.75rem;
    font-size: 0.75rem;
  }
}
/* Note Tiptap WYSIWYG editor (note-tiptap controller).
 * Lightweight rules so the empty state is visible/editable and the
 * Placeholder extension renders its hint text. The wrapper element
 * carries data-controller="note-tiptap" so we scope by that instead
 * of bleeding into other Tiptap mounts on the page. */
[data-controller~="note-tiptap"] [data-note-tiptap-target="editorElement"] {
  display: flex;
  flex-direction: column;
}

[data-controller~="note-tiptap"] [data-note-tiptap-target="editorElement"] .ProseMirror {
  min-height: inherit;
  outline: none;
  /* Stretch the editable region to fill the wrapper so clicking
   * anywhere inside it (e.g. the empty space below a short note in
   * expanded compose mode) lands on ProseMirror and focuses the
   * caret instead of being eaten by padding. */
  flex: 1;
}

[data-controller~="note-tiptap"] [data-note-tiptap-target="editorElement"] .ProseMirror p.is-editor-empty:first-child::before {
  content: attr(data-placeholder);
  float: left;
  color: #9ca3af;
  pointer-events: none;
  height: 0;
}

[data-controller~="note-tiptap"] [data-note-tiptap-target="editorElement"] .ProseMirror[dir="rtl"] p.is-editor-empty:first-child::before {
  float: right;
}

/* Report image rendering — used both in the editor and in exported HTML/PDF.
 * Alignment classes shift only the <img>; the caption stays centered under
 * the figure, regardless of image position. */
.report-image-figure {
  display: block;
  margin: 1.25rem 0;
  max-width: 100%;
}

.report-image {
  display: block;
  height: auto;
  border-radius: 0.375rem;
}

.report-image--small  { max-width: 33%; }
.report-image--medium { max-width: 66%; }
.report-image--full   { max-width: 100%; }

/* Auto-margin positioning of the image within its figure block. `left` puts
 * the image flush left, `right` flush right, `center` centered — physical
 * positioning, not logical, so it matches the PDF's text-align rules
 * regardless of writing direction. */
.report-image-figure--left   .report-image { margin-left: 0;    margin-right: auto; }
.report-image-figure--center .report-image { margin-left: auto; margin-right: auto; }
.report-image-figure--right  .report-image { margin-left: auto; margin-right: 0; }

.report-image-figure figcaption {
  margin-top: 0.5rem;
  font-size: 0.875rem;
  font-style: italic;
  color: #4b5563;
  text-align: center;
}

.report-image-figure.is-uploading .report-image {
  opacity: 0.55;
  filter: blur(0.5px);
}

/* Selected image — soft Notion-style ring, no hard outline jump. */
.report-image-nodeview {
  transition: box-shadow 120ms ease;
}
.report-image-nodeview.is-selected .report-image-figure {
  border-radius: 0.5rem;
  box-shadow:
    0 0 0 1.5px rgb(59 130 246 / 0.85),
    0 0 0 4px rgb(59 130 246 / 0.12);
  transition: box-shadow 120ms ease;
}
.report-image-nodeview .report-image {
  transition: box-shadow 120ms ease, opacity 120ms ease, max-width 160ms ease;
}

/* Floating toolbar — pill, soft shadow, dense, snappy. */
.report-image-toolbar {
  position: absolute;
  top: -2.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  display: none;
  align-items: center;
  gap: 2px;
  padding: 4px;
  background: #ffffff;
  border: 1px solid rgb(15 23 42 / 0.08);
  border-radius: 8px;
  box-shadow:
    0 1px 2px rgb(15 23 42 / 0.04),
    0 4px 16px -4px rgb(15 23 42 / 0.18);
  white-space: nowrap;
  pointer-events: auto;
  opacity: 0;
  transition: opacity 90ms ease, transform 90ms ease;
  z-index: 20;
}
.report-image-toolbar.is-visible {
  display: flex;
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.report-image-toolbar__button {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 28px;
  min-width: 28px;
  padding: 0 8px;
  background: transparent;
  border: none;
  border-radius: 6px;
  color: #475569;
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  transition: background-color 80ms ease, color 80ms ease;
}
.report-image-toolbar__button:hover {
  background: #f1f5f9;
  color: #0f172a;
}
.report-image-toolbar__button:active {
  background: #e2e8f0;
}
.report-image-toolbar__button.is-active {
  background: #1e293b;
  color: #ffffff;
}
.report-image-toolbar__button.is-active:hover {
  background: #0f172a;
}
.report-image-toolbar__button--danger:hover {
  background: #fef2f2;
  color: #dc2626;
}
.report-image-toolbar__button .fas {
  font-size: 13px;
}
.report-image-toolbar__label {
  letter-spacing: 0.01em;
}

.report-image-toolbar__separator {
  display: inline-block;
  width: 1px;
  height: 16px;
  background: rgb(15 23 42 / 0.08);
  margin: 0 4px;
}

/* Caption — clean, lightweight, modern. Italics only when the user
 * explicitly applies them via the toolbar. */
.report-image-figure__caption {
  min-height: 1.25rem;
  margin-top: 0.5rem;
  font-size: 0.875rem;
  color: #64748b;
  line-height: 1.4;
}
.report-image-figure__caption:empty::before {
  content: attr(data-placeholder);
  color: #cbd5e1;
  font-weight: 400;
  pointer-events: none;
}
.report-image-figure__caption-editable {
  display: inline-block;
  min-width: 8rem;
}
.report-image-figure__caption-editable:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgb(59 130 246 / 0.25);
  border-radius: 4px;
  padding: 0 4px;
  margin: 0 -4px;
}

@media print {
  .report-image-figure { page-break-inside: avoid; }
  .report-image        { max-height: 60vh; object-fit: contain; }
}

/* --- Pagination prototype (tiptap-pagination-plus) --- */
/* Editor body = white "paper". The gap between pages is gray (matching the
 * desk) so the white reads as discrete sheets. */
.ProseMirror.rm-with-pagination {
  margin: 24px auto;
  background: #ffffff;
  border: none !important;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08), 0 4px 16px rgba(0,0,0,0.06);
  border-radius: 0;
}
/* Gap = gray slice spanning the full page width.
 * Plugin sets inline `width: calc(100% + 2px) !important`, which inline+important
 * beats any external !important — but max-width still clamps it down to 100%. */
.ProseMirror.rm-with-pagination .rm-pagination-gap {
  background: #f9fafb !important;        /* match Tailwind bg-gray-50 (desk) */
  max-width: 100% !important;
  min-width: 100% !important;
  box-sizing: border-box !important;
  margin: 0 !important;
  left: 0 !important;
  border: 0 !important;
  /* Layered box-shadows:
   *  1) horizontal gray "extensions" that paint over the editor's L/R
   *     side-shadow at the gap's y-range, visually cutting the page stack
   *     into discrete blocks.
   *  2) inset top: the page above casts a drop-shadow down into the gap.
   *  3) inset bottom: subtle rim from the page below. */
  box-shadow:
    -300px 0 0 0 #f9fafb,
     300px 0 0 0 #f9fafb,
    inset 0  10px 10px -10px rgba(0,0,0,0.18),
    inset 0 -3px  4px  -3px rgba(0,0,0,0.06) !important;
}
/* Make sure the gap and its ancestors don't clip the horizontal shadow extensions. */
.ProseMirror.rm-with-pagination,
.ProseMirror.rm-with-pagination .breaker,
.ProseMirror.rm-with-pagination .rm-page-break,
.ProseMirror.rm-with-pagination .rm-pages-wrapper {
  overflow: visible !important;
}

/* The plugin increments a CSS counter on each page-break, but doesn't wire
 * the counter value to the empty `.rm-page-number` spans. We do that here. */
.ProseMirror.rm-with-pagination .rm-page-number::before {
  content: counter(page-number);
}
.ProseMirror.rm-with-pagination .rm-page-number-plus::before {
  content: counter(page-number-plus);
}

/* Center the footer page number. Plugin renders the footer with left/right
 * child divs; some inline/plugin CSS resists `justify-content: center`. So
 * we make the footer a positioning context and absolute-center the
 * number span itself. */
.ProseMirror.rm-with-pagination .rm-page-footer {
  position: relative !important;
}
.ProseMirror.rm-with-pagination .rm-page-footer-left,
.ProseMirror.rm-with-pagination .rm-page-footer-right {
  visibility: hidden !important;
}
.ProseMirror.rm-with-pagination .rm-page-number,
.ProseMirror.rm-with-pagination .rm-page-number-plus {
  visibility: visible !important;
  position: absolute !important;
  left: 50% !important;
  top: 50% !important;
  transform: translate(-50%, -50%) !important;
  font-size: 11px !important;
  color: #9ca3af !important;             /* Tailwind gray-400 */
  font-weight: 400 !important;
  letter-spacing: 0.02em !important;
}
[data-controller~="tiptap-editor"]:has(.ProseMirror.rm-with-pagination) {
  background: #f9fafb;                   /* match bg-gray-50 */
}

/* Manual page break — visible "— Page break —" divider in the editor.
 * Renders as a horizontal line with a centered label so authors can see
 * exactly where the PDF will break. Serializes to <div class="forced-page-break">
 * which the PDF layout treats as `break-before: page`. */
.ProseMirror .page-break-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 16px 0;
  user-select: none;
  cursor: default;
}
.ProseMirror .page-break-divider__line {
  flex: 1;
  height: 0;
  border-top: 1px dashed #9ca3af;
}
.ProseMirror .page-break-divider__label {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: #6b7280;
  text-transform: uppercase;
  white-space: nowrap;
}
.ProseMirror .page-break-divider.ProseMirror-selectednode {
  outline: 2px solid #3b82f6;
  outline-offset: 4px;
  border-radius: 2px;
}

/* Header strip — in-place editable PDF page-header preview above the editor.
 * Mimics the Google Docs / Word "header zone": faded text by default, with
 * a visible affordance on hover; expands into an inline editor on click. */
.header-strip {
  position: relative;
}
.header-strip [data-header-strip-target="resolvedText"],
.header-strip [data-header-strip-target="placeholder"] {
  font-family: 'Inter', 'Noto Sans Hebrew', 'Assistant', sans-serif;
}
.header-strip:hover {
  border-bottom-color: #9ca3af; /* gray-400 on hover so the zone reads as clickable */
}
.header-strip--editing {
  border-bottom-color: #93c5fd; /* blue-300 while editing */
}

/* Signature sizing + ink color — match the PDF's @page rules
 * (pdf_paged.html.erb). Signatures get a fixed small cap so the editor
 * preview matches the PDF, plus a blue-ink SVG filter so they look like
 * a ballpoint pen. The #signature-blue-ink filter is inlined in
 * _editor_content.html.erb (editor) and pdf_paged.html.erb (PDF). */
.ProseMirror .report-image-figure img[alt="Signature"],
.ProseMirror .report-image-figure img[alt="חתימה"] {
  max-width: 140px !important;
  width: auto !important;
  height: auto;
  filter: url(#signature-blue-ink);
}

/* Tables — Notion-style appearance in the editor. */
.ProseMirror .report-table {
  border-collapse: collapse;
  table-layout: fixed;
  /* Notion-style resize: total width is the SUM of column widths. The
   * resize plugin sets `colwidth` on the dragged column; the table grows
   * or shrinks accordingly. No min-width on the table or its cells —
   * any min-width crutch makes the plugin's colwidth changes invisible
   * past the floor, so dragging one column past the floor mysteriously
   * shrinks the others. Fresh tables get a sensible 120px-per-column
   * default from `insertReportTable` so they're not tiny without the
   * min-width crutch. */
  width: max-content;
  margin: 16px 0;
}

/* In RTL documents, force the table layout to LTR so the column-resize
 * plugin's hardcoded `clientX` math lines up visually: the boundary the
 * user grabbed tracks the cursor instead of extending leftward. Cell
 * CONTENT stays RTL (Hebrew text still flows right-to-left). */
[dir="rtl"] .ProseMirror .report-table { direction: ltr; }
[dir="rtl"] .ProseMirror .report-table td,
[dir="rtl"] .ProseMirror .report-table th {
  direction: rtl;
  text-align: start;
}
.ProseMirror .report-table td,
.ProseMirror .report-table th {
  border: 1px solid #d1d5db;
  padding: 8px 12px;
  vertical-align: top;
  position: relative;
  word-break: break-word;
}
.ProseMirror .report-table th {
  background-color: #f3f4f6;
  font-weight: 600;
  text-align: inherit;
}
.ProseMirror .report-table .selectedCell::after {
  z-index: 2;
  position: absolute;
  content: "";
  inset: 0;
  background: rgba(59, 130, 246, 0.10);
  pointer-events: none;
}
.ProseMirror .report-table .column-resize-handle {
  position: absolute;
  right: -2px;
  top: 0;
  bottom: -2px;
  width: 4px;
  background-color: #3b82f6;
  pointer-events: none;
  opacity: 0;
  transition: opacity 120ms ease;
}
.ProseMirror .report-table:hover .column-resize-handle { opacity: 1; }
.ProseMirror.resize-cursor { cursor: col-resize; }
.ProseMirror .report-table tr { break-inside: avoid; page-break-inside: avoid; }

/* Table alignment — driven by the `align` attr on the Table node,
 * mirrored to `data-table-align` on the live DOM by tagInEditorTables.
 * Matching rules in pdf_paged.html.erb keep the PDF in sync. */
.ProseMirror .report-table[data-table-align="left"]   { width: auto; margin: 16px auto 16px 0; }
.ProseMirror .report-table[data-table-align="center"] { width: auto; margin: 16px auto; }
.ProseMirror .report-table[data-table-align="right"]  { width: auto; margin: 16px 0 16px auto; }
