<style>
/* =========================================================
   New Task / Form Modal Redesign (Injected Directly)
   ========================================================= */

/* 1. 优化遮罩层背景：降低纯黑透明度，加入现代化毛玻璃模糊效果 */
#modal-overlay {
    background: rgba(0, 0, 0, 0.45) !important; 
    backdrop-filter: blur(4px); 
}

/* 2. 优化弹窗本身：适当增加宽度，增加现代阴影和圆角 */
#modal-box {
    width: 950px !important; 
    max-width: 95% !important;
    border-radius: 12px !important;
    box-shadow: 0 12px 36px rgba(0,0,0,0.25) !important;
    border: none !important;
}

.custom-task-form-container {
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
}
.custom-task-form-main {
    flex: 2 1 400px;
}
.custom-task-form-secondary {
    flex: 1 1 250px;
}
.custom-task-form-bottom {
    flex: 1 1 100%;
    margin-top: 15px;
    padding-top: 20px;
    border-top: 1px solid #f0f0f0;
}
.custom-task-form-container label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #444;
    margin-bottom: 6px;
    margin-top: 12px;
}
.custom-task-form-container input[type="text"],
.custom-task-form-container input[type="number"],
.custom-task-form-container input[type="password"],
.custom-task-form-container select,
.custom-task-form-container textarea {
    width: 100%;
    max-width: 100%;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    box-sizing: border-box;
    font-size: 14px;
    color: #333;
    transition: all 0.2s ease;
    background-color: #fff;
}
.custom-task-form-container input[type="text"]:focus,
.custom-task-form-container input[type="number"]:focus,
.custom-task-form-container input[type="password"]:focus,
.custom-task-form-container select:focus,
.custom-task-form-container textarea:focus {
    border-color: #3468C0;
    box-shadow: 0 0 0 3px rgba(52, 104, 192, 0.1);
    outline: none;
}
.custom-task-form-bottom label { display: inline-block; margin-top: 0; margin-right: 15px; font-weight: 500; }
.custom-task-form-bottom .btn-blue { padding: 10px 24px; font-size: 15px; font-weight: 600; border-radius: 6px; margin-right: 10px; }
.text-editor-toolbar { background-color: #f9f9f9; border: 1px solid #d1d5db; border-bottom: none; border-radius: 6px 6px 0 0; padding: 6px 10px; }
.text-editor-write-mode { margin-top: 0 !important; }
.text-editor-write-mode textarea { border-radius: 0 0 6px 6px !important; border-top: none !important; }
</style>
<div class="page-header">
    <h2><?= $this->text->e($project['name']) ?> &gt; <?= t('New task') ?></h2>
</div>
<form method="post" action="<?= $this->url->href('TaskCreationController', 'save', array('project_id' => $project['id'])) ?>" autocomplete="off">
    <?= $this->form->csrf() ?>

    <div class="custom-task-form-container">
        <div class="custom-task-form-main">
            <?= $this->task->renderTitleField($values, $errors) ?>
            <?= $this->task->renderDescriptionField($values, $errors) ?>
            <?= $this->task->renderDescriptionTemplateDropdown($project['id']) ?>
            <?= $this->task->renderTagField($project) ?>

            <?= $this->hook->render('template:task:form:first-column', array('values' => $values, 'errors' => $errors)) ?>
        </div>

        <div class="custom-task-form-secondary">
            <?= $this->task->renderColorField($values) ?>
            <?= $this->task->renderAssigneeField($users_list, $values, $errors) ?>
            <?= $this->task->renderCategoryField($categories_list, $values, $errors) ?>
            <?= $this->task->renderSwimlaneField($swimlanes_list, $values, $errors) ?>
            <?= $this->task->renderColumnField($columns_list, $values, $errors) ?>
            <?= $this->task->renderPriorityField($project, $values) ?>

            <?= $this->hook->render('template:task:form:second-column', array('values' => $values, 'errors' => $errors)) ?>

            <?= $this->task->renderDueDateField($values, $errors) ?>
            <?= $this->task->renderStartDateField($values, $errors) ?>
            <?= $this->task->renderTimeEstimatedField($values, $errors) ?>
            <?= $this->task->renderTimeSpentField($values, $errors) ?>
            <?= $this->task->renderScoreField($values, $errors) ?>
            <?= $this->task->renderReferenceField($values, $errors) ?>

            <?= $this->hook->render('template:task:form:third-column', array('values' => $values, 'errors' => $errors)) ?>
        </div>

        <div class="custom-task-form-bottom">

            <details class="accordion-section">
                <summary class="accordion-title"><?= t('Add attachments') ?></summary>
                <div class="accordion-content">
                    <?= $this->task->renderFileUpload($screenshot, $files) ?>
                </div>
            </details>

            <?= $this->hook->render('template:task:form:bottom-before-buttons', array('values' => $values, 'errors' => $errors)) ?>

            <?php if (! isset($duplicate)): ?>
                <?= $this->form->checkbox('another_task', t('Create another task'), 1, isset($values['another_task']) && $values['another_task'] == 1, '', array("tabindex" => "16")) ?>
                <?= $this->form->checkbox('duplicate_multiple_projects', t('Duplicate to multiple projects'), 1, false, '', array("tabindex" => "17")) ?>
            <?php endif ?>

            <?= $this->modal->submitButtons() ?>
        </div>
    </div>
</form>
