/*
 * eCon jstree 3.x theme — reskins the jstree 3.x "default" theme to the look of
 * the old jstree 1.0 "classic" theme (W-G3 / G3.3a). Loaded right AFTER the
 * default theme on jstree-3 pages only (default_js.tpl, $jstreeVersion=3).
 *
 * Reuses the proven classic sprite pub/resources/js/themes/classic/d.png, which
 * contains the dotted connector line, the small +/- open/close boxes, and the
 * tan folder (closed/open) icon — i.e. the exact old visuals. The 3.x default
 * theme is re-metriced from 24px rows / 32px sprite down to the classic
 * 18px rows / 18px sprite grid so d.png aligns.
 *
 * Per-type custom icons (the econfilter PNGs used by the cluster/report trees)
 * still win, because they render as `.jstree-themeicon-custom` (inline
 * background-image) which we leave untouched — only the DEFAULT icon becomes the
 * classic tan folder.
 *
 * Brand: primary #55ab26, secondary #e5f1e0, text #303030, mono #646464,
 *        border #c8c8c8, ultralight #f8f8f8.
 */

/* --- re-metric the default theme to the classic 18px grid --- */
.jstree-default .jstree-node {
	min-height: 18px;
	line-height: 18px;
	margin-left: 18px;
	min-width: 18px;
	background: url("/resources/js/themes/classic/d.png") -90px 0 repeat-y; /* vertical dotted line */
}
.jstree-default .jstree-anchor      { line-height: 18px; height: 18px; }
.jstree-default .jstree-icon        { width: 18px; height: 18px; line-height: 18px; }
.jstree-default .jstree-icon:empty  { width: 18px; height: 18px; line-height: 18px; }
.jstree-default .jstree-last        { background-image: none; } /* no line on the last child */

/* --- open/close expander + connector: classic +/- boxes from d.png --- */
.jstree-default .jstree-ocl                 { background: url("/resources/js/themes/classic/d.png") no-repeat; }
.jstree-default .jstree-closed > .jstree-ocl { background-position: -54px 0; } /* + */
.jstree-default .jstree-open   > .jstree-ocl { background-position: -72px 0; } /* - */
.jstree-default .jstree-leaf   > .jstree-ocl { background-position: -36px 0; } /* leaf connector */

/* --- default node icon = classic tan folder (closed / open). Custom econ icons
       (.jstree-themeicon-custom) still override this. --- */
.jstree-default .jstree-themeicon:not(.jstree-themeicon-custom) {
	background: url("/resources/js/themes/classic/d.png") -54px -19px no-repeat; /* closed folder */
}
.jstree-default .jstree-open > .jstree-anchor > .jstree-themeicon:not(.jstree-themeicon-custom) {
	background-position: -54px -36px; /* open folder */
}

/* econfilter custom icons are 16x16 — centre them in the 18px box */
.jstree-default .jstree-themeicon-custom {
	background-position: center center !important;
	background-size: 16px 16px !important;
}

/* the filter (search plugin) just hides non-matches — no red/italic highlight on
   the matched text, matching the old filtertree look */
.jstree-default .jstree-anchor.jstree-search {
	font-style: normal;
	font-weight: normal;
	color: inherit;
}

/* --- brand selection / hover --- */
.jstree-default .jstree-anchor.jstree-hovered {
	background: #f8f8f8;
	border-radius: 2px;
	box-shadow: none;
}
.jstree-default .jstree-anchor.jstree-clicked {
	background: #e5f1e0;
	color: #303030;
	border-radius: 2px;
	box-shadow: none;
}
.jstree-default .jstree-wholerow-hovered { background: #f8f8f8; box-shadow: none; }
.jstree-default .jstree-wholerow-clicked { background: #e5f1e0; box-shadow: none; }
/* Manual report-selection marker toggled by the favourite-report field pickers
   (AutoberichtLayout / ComplexLayout editBerichtField+editTableField); the app sets
   li.jstree-selected itself — 1.0 styled it via ".jstree-classic .jstree-selected". */
.jstree-default li.jstree-selected > a.jstree-anchor {
	background: #e5f1e0;
	color: #303030;
	border-radius: 2px;
}

/* --- checkbox trees ---
   Brand SVG tri-state checkbox. Used by BOTH the custom checkbox_filtered plugin
   (Bereichsverwaltung/editBereich — state class on the <li>) AND the built-in 3.x
   checkbox plugin (berichtSichten / report sicht-trees — state class on the <a>).
   The built-in checkbox renders <i class="jstree-icon jstree-checkbox">, so the
   rel-based TYPE-icon rules must target .jstree-themeicon (not .jstree-icon) or they
   would paint the checkbox with the type icon (doubled-icon bug). Default = unchecked
   square; checked/undetermined match either the <li> OR the <a> carrying the class. */
.jstree-default a.jstree-anchor > .jstree-checkbox {
	display: inline-block;
	width: 18px;
	height: 18px;
	margin: 0;
	vertical-align: top;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 18 18'%3E%3Crect x='2.5' y='2.5' width='13' height='13' rx='2' fill='%23ffffff' stroke='%23c8c8c8' stroke-width='1.5'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	/* !important: the dist default theme shifts .jstree-checkbox background-position on
	   :hover / :checked (sprite coords) which would move our SVG out of view — pin it. */
	background-position: center center !important;
	background-size: 14px 14px;
}
.jstree-default li.jstree-checked > a.jstree-anchor > .jstree-checkbox,
.jstree-default a.jstree-anchor.jstree-checked > .jstree-checkbox {
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 18 18'%3E%3Crect x='2.5' y='2.5' width='13' height='13' rx='2' fill='%2355ab26' stroke='%2355ab26' stroke-width='1.5'/%3E%3Cpolyline points='5.5,9 8,11.5 12.5,6' fill='none' stroke='%23ffffff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
/* undetermined: the custom checkbox_filtered sets the class on the <li>; the built-in
   3.x checkbox sets it on the .jstree-checkbox <i> itself (not the <li>/anchor). */
.jstree-default li.jstree-undetermined > a.jstree-anchor > .jstree-checkbox,
.jstree-default a.jstree-anchor > .jstree-checkbox.jstree-undetermined {
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 18 18'%3E%3Crect x='2.5' y='2.5' width='13' height='13' rx='2' fill='%23ffffff' stroke='%2355ab26' stroke-width='1.5'/%3E%3Cline x1='5.5' y1='9' x2='12.5' y2='9' stroke='%2355ab26' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
}

/* filtertree (2-arg DOM mode) hides non-matching nodes via this class */
.jstree-default li.jstree-filtered { display: none; }

/* On the checkbox tree the checkbox IS the state indicator — suppress the brand
   selection highlight so a click (which still selects in jstree core) isn't
   confused with "assigned". */
#messstellenliste .jstree-anchor.jstree-clicked,
#messstellenliste .jstree-anchor.jstree-clicked.jstree-hovered {
	background: transparent;
	box-shadow: none;
}
