/* リセット */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* 基本スタイル */
body {
    font-family: 'Hiragino Kaku Gothic ProN', 'ヒラギノ角ゴ ProN W3', 'メイリオ', Meiryo, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
    padding: 20px;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

/* ヘッダー */
header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px;
    text-align: center;
}

header h1 {
    font-size: 28px;
    margin-bottom: 10px;
}

header p {
    font-size: 14px;
    opacity: 0.9;
}

/* メインコンテンツ */
main {
    padding: 30px;
}

/* フォームスタイル */
form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

fieldset {
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    margin: 0;
}

legend {
    font-weight: bold;
    font-size: 18px;
    color: #667eea;
    padding: 0 10px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 15px;
}

.form-group:last-child {
    margin-bottom: 0;
}

label {
    font-weight: 600;
    color: #555;
    font-size: 14px;
}

.required {
    color: #e74c3c;
}

input[type="text"],
textarea,
select {
    padding: 10px 12px;
    border: 2px solid #e0e0e0;
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.3s;
}

input[type="text"]:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: #667eea;
}

textarea {
    resize: vertical;
    min-height: 80px;
}

small {
    color: #999;
    font-size: 12px;
}

/* ボタン */
.form-actions {
    display: flex;
    gap: 15px;
    margin-top: 10px;
}

button {
    padding: 12px 30px;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    flex: 2;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background-color: #e0e0e0;
    color: #666;
    flex: 1;
}

.btn-secondary:hover {
    background-color: #d0d0d0;
}

/* プレビューエリア */
.preview-area {
    margin-top: 30px;
    padding: 20px;
    background-color: #f9f9f9;
    border-radius: 8px;
    border: 2px dashed #ccc;
}

.preview-area h2 {
    margin-bottom: 15px;
    color: #667eea;
}

#previewContent {
    background-color: white;
    padding: 20px;
    border-radius: 4px;
    min-height: 200px;
}

/* フッター */
footer {
    background-color: #f5f5f5;
    padding: 20px;
    text-align: center;
    color: #999;
    font-size: 14px;
}

/* レスポンシブデザイン */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    .container {
        border-radius: 0;
    }

    header {
        padding: 20px;
    }

    header h1 {
        font-size: 24px;
    }

    main {
        padding: 20px;
    }

    .form-actions {
        flex-direction: column;
    }

    .btn-primary,
    .btn-secondary {
        flex: 1;
    }
}

/* 入力エラー表示 */
input:invalid:not(:focus):not(:placeholder-shown),
textarea:invalid:not(:focus):not(:placeholder-shown) {
    border-color: #e74c3c;
}

input:valid:not(:placeholder-shown),
textarea:valid:not(:placeholder-shown) {
    border-color: #27ae60;
}

/* ローディング表示 */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* テンプレートコントロール */
.template-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.btn-template {
    padding: 8px 16px;
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.btn-template:hover {
    background-color: #2980b9;
}

/* 一括生成チェックボックス */
.batch-checkbox {
    width: 20px;
    height: 20px;
    cursor: pointer;
    margin-left: 10px;
}

/* プレビューcanvas */
#previewContent canvas {
    max-width: 100%;
    height: auto;
    border: 1px solid #ccc;
    margin-top: 10px;
}
