<!-- Processing Template Modal — sectioned rack-panel layout.
     The dynamic filter list (#pp-filter-list) is the heart of the modal,
     so it gets its own Filters section with the cyan source channel. -->
<div id="pp-template-modal" class="modal" role="dialog" aria-modal="true" aria-labelledby="pp-template-modal-title">
    <div class="modal-content">
        <div class="modal-header">
            <h2 id="pp-template-modal-title" data-i18n="postprocessing.add">Add Processing Template</h2>
            <button class="modal-close-btn" onclick="closePPTemplateModal()" title="Close" data-i18n-aria-label="aria.close">&#x2715;</button>
        </div>
        <div class="modal-body">
            <input type="hidden" id="pp-template-id">
            <form id="pp-template-form">

                <!-- ── 01 · IDENTITY ───────────────────────────────── -->
                <section class="ds-section" data-ds-key="identity" data-ch="signal">
                    <div class="ds-section-header">
                        <span class="ds-section-dot" aria-hidden="true"></span>
                        <span class="ds-section-title" data-i18n="settings.section.identity">Identity</span>
                        <span class="ds-section-index" aria-hidden="true">01</span>
                    </div>
                    <div class="ds-section-body">
                        <div class="form-group ds-name-group">
                            <label for="pp-template-name" data-i18n="postprocessing.name">Template Name:</label>
                            <input type="text" id="pp-template-name" data-i18n-placeholder="postprocessing.name.placeholder" placeholder="My Processing Template" required>
                            <div id="pp-template-tags-container"></div>
                        </div>

                        <div class="form-group">
                            <label for="pp-template-description" data-i18n="postprocessing.description_label">Description (optional):</label>
                            <input type="text" id="pp-template-description" data-i18n-placeholder="postprocessing.description_placeholder" placeholder="Describe this template...">
                        </div>
                    </div>
                </section>

                <!-- ── 02 · FILTERS ────────────────────────────────── -->
                <section class="ds-section" data-ds-key="filters" data-ch="cyan">
                    <div class="ds-section-header">
                        <span class="ds-section-dot" aria-hidden="true"></span>
                        <span class="ds-section-title" data-i18n="settings.section.filters">Filters</span>
                        <span class="ds-section-index" aria-hidden="true">02</span>
                    </div>
                    <div class="ds-section-body">
                        <div id="pp-filter-list" class="pp-filter-list"></div>

                        <div class="pp-add-filter-row">
                            <select id="pp-add-filter-select" class="pp-add-filter-select">
                                <option value="" data-i18n="filters.select_type">Select filter type...</option>
                            </select>
                        </div>
                    </div>
                </section>

                <div id="pp-template-error" class="error-message" style="display: none;"></div>
            </form>
        </div>
        <div class="modal-footer">
            <button class="btn btn-icon btn-secondary" onclick="closePPTemplateModal()" title="Cancel" data-i18n-aria-label="aria.cancel">&#x2715;</button>
            <button class="btn btn-icon btn-primary" onclick="savePPTemplate()" title="Save" data-i18n-aria-label="aria.save">&#x2713;</button>
        </div>
    </div>
</div>
