<!-- Audio Template Modal -->
<div id="audio-template-modal" class="modal" role="dialog" aria-modal="true" aria-labelledby="audio-template-modal-title">
    <div class="modal-content">
        <div class="modal-header">
            <h2 id="audio-template-modal-title" data-i18n="audio_template.add">Add Audio Template</h2>
            <button class="modal-close-btn" onclick="closeAudioTemplateModal()" title="Close" data-i18n-aria-label="aria.close">&#x2715;</button>
        </div>
        <div class="modal-body">
            <input type="hidden" id="audio-template-id">
            <form id="audio-template-form">
                <div class="form-group">
                    <label for="audio-template-name" data-i18n="audio_template.name">Template Name:</label>
                    <input type="text" id="audio-template-name" data-i18n-placeholder="audio_template.name.placeholder" placeholder="My Audio Template" required>
                    <div id="audio-template-tags-container"></div>
                </div>

                <div class="form-group">
                    <label for="audio-template-description" data-i18n="audio_template.description.label">Description (optional):</label>
                    <input type="text" id="audio-template-description" data-i18n-placeholder="audio_template.description.placeholder" placeholder="Describe this template..." maxlength="500">
                </div>

                <div class="form-group">
                    <div class="label-row">
                        <label for="audio-template-engine" data-i18n="audio_template.engine">Audio Engine:</label>
                        <button type="button" class="hint-toggle" onclick="toggleHint(this)" title="?">?</button>
                    </div>
                    <small class="input-hint" style="display:none" data-i18n="audio_template.engine.hint">Select the audio capture backend to use</small>
                    <select id="audio-template-engine" onchange="onAudioEngineChange()" required>
                    </select>
                    <small id="audio-engine-availability-hint" class="form-hint" style="display: none;"></small>
                </div>

                <div id="audio-engine-config-section" style="display: none;">
                    <h3 data-i18n="audio_template.config">Configuration</h3>
                    <div id="audio-engine-config-fields"></div>
                </div>

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