{% extends layout_template|default('default_frame.twig') %}
{% block main %}
<style>
/* フォント強制読み込み */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@400;500;700&display=swap');
* {
font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", "Segoe UI", Arial, "Hiragino Kaku Gothic ProN", "Hiragino Sans", Meiryo, "Noto Sans JP", sans-serif !important;
}
/* NZCustomPlugin専用スタイル */
.nzcustom-form-wrapper {
max-width: 800px;
margin: 60px auto;
padding: 0 20px;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
.nzcustom-form-card {
background: #ffffff;
border-radius: 20px;
box-shadow: 0 10px 40px rgba(0, 0, 0, 0.08);
overflow: hidden;
}
.nzcustom-form-header {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
padding: 60px 40px;
text-align: center;
}
.nzcustom-form-title {
font-size: 42px;
font-weight: 800;
color: #ffffff;
margin: 0 0 16px 0;
letter-spacing: -0.5px;
}
.nzcustom-form-description {
font-size: 18px;
color: rgba(255, 255, 255, 0.95);
line-height: 1.7;
}
.nzcustom-form-body {
padding: 50px 40px;
}
.nzcustom-field {
margin-bottom: 35px;
}
/* 質問タイトル(メインラベル) */
.nzcustom-main-label,
.nzcustom-field > label {
display: block !important;
font-size: 16px !important;
font-weight: 700 !important;
color: #2d3748 !important;
margin-bottom: 14px !important;
line-height: 1.5 !important;
}
.nzcustom-main-label .required,
.nzcustom-field > label .required {
color: #e53e3e !important;
margin-left: 4px !important;
}
.nzcustom-field input[type="text"],
.nzcustom-field input[type="email"],
.nzcustom-field input[type="tel"],
.nzcustom-field input[type="number"],
.nzcustom-field input[type="date"],
.nzcustom-field textarea,
.nzcustom-field select,
.nzcustom-field select.form-control,
.nzcustom-field select.form-select {
width: 100%;
padding: 5px 18px;
font-size: 16px;
color: #2d3748 !important;
border: 2px solid #e2e8f0;
border-radius: 10px;
background: #ffffff !important;
background-color: #ffffff !important;
transition: all 0.3s ease;
font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", "Segoe UI", Arial, "Hiragino Kaku Gothic ProN", "Hiragino Sans", Meiryo, sans-serif !important;
-webkit-text-fill-color: #2d3748 !important;
opacity: 1 !important;
}
/* プレースホルダーを薄くする */
.nzcustom-field input::placeholder,
.nzcustom-field textarea::placeholder,
.nzcustom-field select::placeholder {
color: #aaa !important;
-webkit-text-fill-color: #aaa !important;
opacity: 1 !important;
}
.nzcustom-field input::-webkit-input-placeholder,
.nzcustom-field textarea::-webkit-input-placeholder,
.nzcustom-field select::-webkit-input-placeholder {
color: #aaa !important;
-webkit-text-fill-color: #aaa !important;
}
.nzcustom-field input::-moz-placeholder,
.nzcustom-field textarea::-moz-placeholder,
.nzcustom-field select::-moz-placeholder {
color: #aaa !important;
-webkit-text-fill-color: #aaa !important;
opacity: 1 !important;
}
.nzcustom-field input:-ms-input-placeholder,
.nzcustom-field textarea:-ms-input-placeholder,
.nzcustom-field select:-ms-input-placeholder {
color: #aaa !important;
-webkit-text-fill-color: #aaa !important;
}
select#form_question2,
select[id*="question"],
select[id^="form_"],
.nzcustom-field select,
.nzcustom-form-body select {
color: #2d3748 !important;
-webkit-text-fill-color: #2d3748 !important;
background: white !important;
opacity: 1 !important;
visibility: visible !important;
text-indent: 0 !important;
text-shadow: none !important;
font-size: 16px !important;
font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", "Segoe UI", Arial, "Hiragino Kaku Gothic ProN", "Hiragino Sans", Meiryo, sans-serif !important;
height: auto !important;
min-height: 30px !important;
line-height: 1.5 !important;
}
.nzcustom-field select option {
font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", "Segoe UI", Arial, "Hiragino Kaku Gothic ProN", "Hiragino Sans", Meiryo, sans-serif !important;
}
.nzcustom-field select::placeholder {
color: #999 !important;
opacity: 0.7 !important;
}
.nzcustom-field select:invalid {
color: #718096 !important;
}
.nzcustom-field select:valid {
color: #2d3748 !important;
}
.nzcustom-field select {
background-color: #ffffff !important;
background-image: none !important;
}
.nzcustom-field select option {
color: #2d3748 !important;
background: #ffffff !important;
padding: 10px;
font-size: 16px !important;
opacity: 1 !important;
}
.nzcustom-field select option:checked {
background: #667eea !important;
color: #ffffff !important;
}
.nzcustom-field input:focus,
.nzcustom-field textarea:focus,
.nzcustom-field select:focus {
outline: none;
border-color: #667eea;
box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}
.nzcustom-field textarea {
min-height: 140px;
resize: vertical;
}
/* チェックボックス・ラジオボタン - カスタムレンダリング */
.nzcustom-choices {
display: flex;
flex-direction: column;
gap: 8px;
}
.nzcustom-choice-item {
display: flex;
align-items: center;
padding: 12px 16px;
background: #f7fafc;
border: 2px solid transparent;
border-radius: 10px;
cursor: pointer;
transition: all 0.3s ease;
}
.nzcustom-choice-item:hover {
background: #edf2f7;
border-color: #e2e8f0;
}
.nzcustom-choice-item input[type="checkbox"],
.nzcustom-choice-item input[type="radio"] {
width: 18px;
height: 18px;
margin-right: 10px;
flex-shrink: 0;
cursor: pointer;
}
.nzcustom-choice-label {
font-size: 16px !important;
font-weight: 500 !important;
color: #2d3748 !important;
margin: 0 !important;
cursor: pointer !important;
line-height: 1.4 !important;
flex: 1;
}
/* ファイルアップロード */
.nzcustom-file-upload {
margin-bottom: 35px;
}
.nzcustom-file-drop-area {
border: 3px dashed #cbd5e0;
border-radius: 16px;
padding: 50px 30px;
text-align: center;
background: #f7fafc;
transition: all 0.3s ease;
cursor: pointer;
position: relative;
}
.nzcustom-file-drop-area:hover {
border-color: #667eea;
background: #edf2f7;
}
.nzcustom-file-icon {
font-size: 64px;
margin-bottom: 16px;
}
.nzcustom-file-text {
font-size: 18px;
font-weight: 600;
color: #2d3748;
margin-bottom: 8px;
}
.nzcustom-file-hint {
font-size: 14px;
color: #718096;
}
.nzcustom-file-drop-area input[type="file"] {
position: absolute;
opacity: 0;
width: 100%;
height: 100%;
top: 0;
left: 0;
cursor: pointer;
}
.nzcustom-file-selected {
margin-top: 16px;
padding: 12px 16px;
background: #e6fffa;
border: 1px solid #81e6d9;
border-radius: 8px;
display: none;
align-items: center;
font-size: 14px;
color: #234e52;
}
.nzcustom-file-selected::before {
content: '✓';
margin-right: 8px;
color: #38b2ac;
font-weight: bold;
}
/* 送信ボタン */
.nzcustom-submit-btn {
width: 100%;
padding: 18px 40px;
font-size: 18px;
font-weight: 700;
color: #ffffff;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
border: none;
border-radius: 12px;
cursor: pointer;
transition: all 0.3s ease;
box-shadow: 0 4px 20px rgba(102, 126, 234, 0.3);
margin-top: 20px;
}
.nzcustom-submit-btn:hover {
transform: translateY(-3px);
box-shadow: 0 8px 30px rgba(102, 126, 234, 0.4);
}
/* アラート */
.nzcustom-alert {
background: linear-gradient(135deg, #fef5e7 0%, #fdebd0 100%);
border-left: 5px solid #f39c12;
padding: 20px 24px;
margin-bottom: 30px;
border-radius: 10px;
display: flex;
align-items: center;
}
.nzcustom-alert::before {
content: 'ℹ️';
font-size: 24px;
margin-right: 12px;
}
.nzcustom-alert-text {
font-size: 15px;
color: #7d6608;
font-weight: 500;
}
@media (max-width: 768px) {
.nzcustom-form-wrapper {
margin: 30px 15px;
}
.nzcustom-form-header {
padding: 40px 25px;
}
.nzcustom-form-title {
font-size: 32px;
}
.nzcustom-form-body {
padding: 35px 25px;
}
}
/* 選択肢は中太 */
.nzcustom-choice-label {
font-weight: 500 !important;
}
/* 日付フィールド - 横並びプルダウン */
.nzcustom-date-selects {
display: flex;
align-items: center;
gap: 8px;
flex-wrap: wrap;
}
.nzcustom-date-selects select {
width: auto !important;
min-width: 80px;
flex: 1;
max-width: 120px;
padding: 5px 12px !important;
font-size: 16px !important;
color: #2d3748 !important;
border: 2px solid #e2e8f0 !important;
border-radius: 10px !important;
background: #ffffff !important;
height: auto !important;
min-height: 30px !important;
line-height: 1.5 !important;
-webkit-appearance: none !important;
-moz-appearance: none !important;
appearance: none !important;
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23333' d='M6 8L1 3h10z'/%3E%3C/svg%3E") !important;
background-repeat: no-repeat !important;
background-position: right 10px center !important;
padding-right: 30px !important;
}
.nzcustom-date-selects select:focus {
outline: none;
border-color: #667eea !important;
box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}
.nzcustom-date-label {
font-size: 16px;
font-weight: 500;
color: #2d3748;
margin-right: 12px;
}
@media (max-width: 480px) {
.nzcustom-date-selects {
flex-direction: row;
justify-content: space-between;
}
.nzcustom-date-selects select {
min-width: 60px;
max-width: none;
flex: 1;
}
.nzcustom-date-label {
margin-right: 8px;
}
}
</style>
<div class="nzcustom-form-wrapper">
<div class="nzcustom-form-card">
<div class="nzcustom-form-header">
<h1 class="nzcustom-form-title">{{ customForm.name }}</h1>
{% if customForm.description %}
<div class="nzcustom-form-description">{{ customForm.description|raw }}</div>
{% endif %}
</div>
<div class="nzcustom-form-body">
{% if app.user %}
<div class="nzcustom-alert">
<div class="nzcustom-alert-text">会員情報から自動入力されています。必要に応じて修正してください。</div>
</div>
{% endif %}
{{ form_start(form) }}
{% for field in form %}
{% if field.vars.name != '_token' and field.vars.block_prefixes[1] != 'submit' %}
<div class="nzcustom-field">
<div class="nzcustom-main-label">
{{ field.vars.label }}
{% if field.vars.required is defined and field.vars.required %}
<span class="required">*</span>
{% endif %}
</div>
{% if field.vars.block_prefixes[1] == 'file' %}
<div class="nzcustom-file-upload">
<div class="nzcustom-file-drop-area" id="file-drop-{{ field.vars.id }}">
<div class="nzcustom-file-icon">📁</div>
<div class="nzcustom-file-text">ファイルを選択</div>
<div class="nzcustom-file-hint">クリックしてファイルを選択<br>対応形式: PDF, Word, Excel, 画像 (最大5MB)</div>
{{ form_widget(field) }}
</div>
<div class="nzcustom-file-selected" id="file-selected-{{ field.vars.id }}">
<span class="file-name"></span>
</div>
</div>
{% elseif field.vars.block_prefixes[1] == 'choice' and field.vars.expanded == false %}
{{ form_widget(field) }}
{% elseif field.vars.block_prefixes[1] == 'date' %}
{# 日付フィールド - 横並びプルダウン #}
<div class="nzcustom-date-selects">
{{ form_widget(field.year) }}<span class="nzcustom-date-label">年</span>
{{ form_widget(field.month) }}<span class="nzcustom-date-label">月</span>
{{ form_widget(field.day) }}<span class="nzcustom-date-label">日</span>
</div>
{% elseif field.vars.block_prefixes[1] == 'choice' and field.vars.expanded == true %}
<div class="nzcustom-choices">
{% for child in field %}
<div class="nzcustom-choice-item">
<input type="{{ field.vars.multiple ? 'checkbox' : 'radio' }}"
id="{{ child.vars.id }}"
name="{{ child.vars.full_name }}"
value="{{ child.vars.value }}"
{% if child.vars.checked %}checked="checked"{% endif %}
{% if child.vars.disabled %}disabled="disabled"{% endif %}>
<label for="{{ child.vars.id }}" class="nzcustom-choice-label">
{{ child.vars.label }}
</label>
</div>
{% endfor %}
</div>
{% else %}
{{ form_widget(field) }}
{% endif %}
{{ form_errors(field) }}
</div>
{% endif %}
{% endfor %}
{{ form_widget(form._token) }}
<button type="submit" class="nzcustom-submit-btn">送信する</button>
{{ form_end(form, {'render_rest': false}) }}
</div>
</div>
</div>
{{ nz_recaptcha_script('form') }}
<script>
document.addEventListener('DOMContentLoaded', function() {
// ファイルアップロード
document.querySelectorAll('.nzcustom-file-drop-area').forEach(function(dropArea) {
const fileInput = dropArea.querySelector('input[type="file"]');
if (!fileInput) return;
const fileId = dropArea.id.replace('file-drop-', '');
const selectedDiv = document.getElementById('file-selected-' + fileId);
fileInput.addEventListener('change', function(e) {
if (this.files.length > 0) {
const fileName = this.files[0].name;
selectedDiv.querySelector('.file-name').textContent = fileName;
selectedDiv.style.display = 'flex';
}
});
dropArea.addEventListener('dragover', function(e) {
e.preventDefault();
this.style.borderColor = '#667eea';
this.style.background = '#edf2f7';
});
dropArea.addEventListener('dragleave', function(e) {
e.preventDefault();
this.style.borderColor = '#cbd5e0';
this.style.background = '#f7fafc';
});
dropArea.addEventListener('drop', function(e) {
e.preventDefault();
this.style.borderColor = '#cbd5e0';
this.style.background = '#f7fafc';
if (e.dataTransfer.files.length > 0) {
fileInput.files = e.dataTransfer.files;
const fileName = e.dataTransfer.files[0].name;
selectedDiv.querySelector('.file-name').textContent = fileName;
selectedDiv.style.display = 'flex';
}
});
});
});
</script>
{% endblock %}