/* Tickory: stijl voor sjablonen (project of taken uit een sjabloon, bewaren, delen en importeren). Staat apart van app.css (die laadt
   eerst) en gebruikt dezelfde kleuren en maten, dus ook de wisseling tussen licht en donker. Opbouw: venster · lijst · rechterdeel ·
   voorbeeld · kleine onderdelen · telefoon. */

/* ---------- het venster ---------- */
.dialog-templates { width: min(900px, calc(100vw - 24px)); }
.tpl-layout { display: grid; grid-template-columns: minmax(210px, 280px) minmax(0, 1fr); gap: 16px; min-height: 0; }

/* ---------- de lijst met sjablonen ---------- */
.tpl-list { max-height: min(62dvh, 540px); overflow-y: auto; border: 1px solid var(--line); border-radius: var(--radius); padding: 6px; background: var(--bg-soft); }
.tpl-fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.tpl-group { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-soft); padding: 8px 8px 4px; }
.tpl-item { position: relative; display: flex; align-items: center; gap: 10px; padding: 8px 10px; min-height: 48px; border-radius: 8px; cursor: pointer; }
.tpl-item input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.tpl-item:hover { background: var(--bg-hover); }
.tpl-item.selected { background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }

/* het bewerkscherm (ui/templateEditor.js) */
.tpl-rows { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; max-height: min(52dvh, 520px); overflow-y: auto; }
.tpl-row { border-bottom: 1px solid var(--line); padding: 4px 0; }
.tpl-row[data-depth="2"] { padding-left: 24px; }
.tpl-row[data-depth="3"] { padding-left: 48px; }
.tpl-row[data-depth="4"] { padding-left: 72px; }
.tpl-row-main { display: flex; align-items: center; gap: 2px; }
.tpl-row-main .tpl-row-text { flex: 1 1 auto; min-width: 0; }
.tpl-row-section .tpl-row-text { font-weight: 700; }
.tpl-row-more { margin: 2px 0 2px 64px; font-size: 0.86rem; }
.tpl-row-more > summary { cursor: pointer; color: var(--text-soft); }
.tpl-row-fields { display: flex; flex-wrap: wrap; gap: 8px 14px; padding: 6px 0; }
.tpl-row-field { display: flex; flex-direction: column; gap: 2px; margin: 0; }
.tpl-row-field .field-small { width: auto; min-width: 7em; }
.tpl-row-field .hint { font-size: 0.75rem; }
.tpl-row-add { display: flex; gap: 8px; flex-wrap: wrap; padding: 8px 0; }
@media (max-width: 760px) {
  .tpl-row[data-depth="2"] { padding-left: 12px; }
  .tpl-row[data-depth="3"] { padding-left: 24px; }
  .tpl-row[data-depth="4"] { padding-left: 36px; }
  .tpl-row-more { margin-left: 0; }
}
.tpl-item:focus-within { outline: 2px solid var(--focus); outline-offset: -2px; }
.tpl-item-text { display: flex; flex-direction: column; min-width: 0; }
.tpl-item-name { font-weight: 600; overflow-wrap: anywhere; }
.tpl-item-meta { font-size: 0.8rem; color: var(--text-soft); }
.tpl-none { padding: 8px; }

/* ---------- het deel rechts: keuzes, samenvatting en voorbeeld ---------- */
.tpl-detail { display: flex; flex-direction: column; gap: 10px; min-width: 0; max-height: min(62dvh, 540px); overflow-y: auto; padding-right: 2px; }
.tpl-title { display: flex; align-items: center; gap: 8px; font-size: 1.05rem; overflow-wrap: anywhere; }
.tpl-description { color: var(--text-soft); }
.tpl-start { border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 12px 10px; margin: 0; min-width: 0; }
.tpl-start legend { font-size: 0.8rem; color: var(--text-soft); padding: 0 4px; }
.tpl-start-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 2px 0 6px 26px; }
.tpl-start-row .quick-dates { margin-top: 0; }
.tpl-date { width: auto; min-height: 40px; }
.tpl-summary { font-size: 0.9rem; color: var(--text-soft); }

/* ---------- het voorbeeld ---------- */
.tpl-preview-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--bg); overflow: hidden; }
.tpl-preview-section { padding: 8px 10px 3px; border-top: 1px solid var(--line); font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-soft); }
.tpl-preview-section:first-child { border-top: 0; }
.tpl-preview-task { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 5px 10px; font-size: 0.92rem; }
.tpl-preview-task[data-depth="2"] { padding-left: 26px; }
.tpl-preview-task[data-depth="3"] { padding-left: 42px; }
.tpl-preview-task[data-depth="4"] { padding-left: 58px; }
.tpl-preview-text { min-width: 0; overflow-wrap: anywhere; }
.tpl-when { flex: none; white-space: nowrap; }

/* ---------- kleine onderdelen ---------- */
.tpl-manage { display: flex; flex-wrap: wrap; gap: 8px; }
.tpl-export { font-family: ui-monospace, "Cascadia Mono", "Segoe UI Mono", Menlo, monospace; font-size: 0.8rem; resize: vertical; }
.tpl-share-buttons { display: flex; flex-wrap: wrap; gap: 8px; }
.tpl-import-result { display: flex; flex-direction: column; gap: 8px; }
.nav-heading-buttons { display: inline-flex; align-items: center; gap: 2px; }
.quick-template { align-self: flex-end; white-space: nowrap; }

/* ---------- telefoon ---------- */
@media (max-width: 760px) {
  .tpl-layout { grid-template-columns: minmax(0, 1fr); }
  .tpl-list { max-height: 34dvh; }
  .tpl-detail { max-height: none; overflow: visible; }
  .tpl-item { min-height: 52px; }
  .tpl-start-row { margin-left: 0; }
  .dialog-templates .dialog-buttons .button { min-height: 44px; }
  .quick-template { min-height: 44px; }
}

@media (forced-colors: active) {
  .tpl-item.selected { outline: 2px solid Highlight; }
}
