/* Loaded into the TinyMCE editor's iframe via `content_css` (classic mode
   runs the editable area in its own document, so it doesn't inherit our
   app's stylesheet automatically). Also mirrored for the .mce-mergetag chip
   look in application.tailwind.css, which is what preview/print use since
   they render plain HTML rather than a TinyMCE iframe. */

body {
  margin: 4px;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 12px;
  /* Positioning context for "pinned" elements (see setupPinButtons in
     label_editor_controller.js) - matches .lg-canvas's position: relative
     in application.tailwind.css, which is what preview/print actually
     anchor against. */
  position: relative;
}

/* Tailwind (used by preview/print) resets default margins via its
   preflight, but this iframe has its own separate stylesheet (see file
   comment above) and otherwise gets the browser's default ~1em top/bottom
   <p> margin - a WYSIWYG mismatch, and worse, it silently added that
   margin's height on top of any explicit height set on content inside a
   <p> (e.g. a rotated vertical-text span sized to fit its table cell),
   so every wrap-height resync (see setWrapHeight/resyncWrapHeights in
   label_editor_controller.js) grew the row a little taller than the cell
   it was supposedly just matching. */
p {
  margin: 0;
}

/* Match .lg-canvas in application.tailwind.css (preview/print) so a table
   row containing a barcode/data matrix merge tag renders the same way here
   as it will once that tag is swapped for the real (taller) image. */
td,
th {
  vertical-align: top;
}

/* Cell Properties can write a border width and/or color with no
   border-style; here TinyMCE's dashed "invisible table border" guide style
   filled that gap, so a border you added looked dashed while editing.
   Draw it solid, matching preview/print (see .lg-canvas in
   application.tailwind.css). An explicit inline border-style still wins. */
.mce-content-body table td[style*="border-width"]:not([style*="border-width: 0"]),
.mce-content-body table td[style*="border-color"]:not([style*="border-width: 0"]),
.mce-content-body table th[style*="border-width"]:not([style*="border-width: 0"]),
.mce-content-body table th[style*="border-color"]:not([style*="border-width: 0"]) {
  border-style: solid;
}

/* Merge Tags plugin output: <span class="mce-mergetag"><span
   class="mce-mergetag-affix">{{</span>key<span
   class="mce-mergetag-affix">}}</span></span> */
.mce-mergetag {
  background-color: rgba(59, 130, 246, 0.12);
  border: 1px dashed rgba(59, 130, 246, 0.55);
  border-radius: 2px;
  padding: 0 2px;
}

.mce-mergetag-affix {
  opacity: 0.55;
}

/* Pinned (position: absolute) elements are draggable anywhere on the
   label - see setupPinButtons/setupDragging in label_editor_controller.js. */
.lg-pinned {
  cursor: grab;
}
