@charset "UTF-8";

/* ▼▼▼ 自動生成されたGoogle Fonts読み込み ▼▼▼ */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@400;700&display=swap');

/* ==========================================
   リセット & ベーススタイル
   ========================================== */
* {
    box-sizing: border-box;
}

body {
    font-family: "Helvetica Neue", Arial, "Hiragino Kaku Gothic ProN", "Hiragino Sans", sans-serif;
    background: #f4f4f4;
    color: #333;
    line-height: 1.6;
    margin: 0;
    font-size: 16px;
}

/* ==========================================
   コンテナ・レイアウト
   ========================================== */
.form-container {
    max-width: 800px;
    margin: 0 auto;
    background: #fff;
    padding: 40px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}

@media (max-width: 600px) {
    .form-container {
        padding: 20px;
    }
}

/* ==========================================
   見出し
   ========================================== */
.form-container h2 {
    border-bottom: 2px solid #ff6600;
    padding-bottom: 10px;
    font-size: 1.4rem;
    margin-bottom: 25px;
    color: #333;
}

.form-container h3 {
    background: #f9f9f9;
    padding: 12px 15px;
    font-size: 1.1rem;
    margin-top: 35px;
    margin-bottom: 15px;
    border-left: 5px solid #ff6600;
    font-weight: bold;
}

/* ==========================================
   ステップインジケーター
   ========================================== */
.step-indicator {
    list-style: none;
    padding: 0;
    display: flex;
    justify-content: space-between;
    margin-bottom: 40px;
    overflow: hidden;
    border-radius: 4px;
    background: #eee;
}

.step-indicator li {
    flex: 1;
    text-align: center;
    padding: 12px 0;
    font-size: 0.9rem;
    color: #999;
    border-right: 1px solid #fff;
    background: #e6e6e6;
    position: relative;
}

.step-indicator li:last-child {
    border-right: none;
}

.step-indicator li.active {
    background: #ff6600;
    color: #fff;
    font-weight: bold;
}

@media (max-width: 480px) {
    .step-indicator li {
        font-size: 0.75rem;
        padding: 10px 0;
    }
}

/* ==========================================
   フォーム要素
   ========================================== */
.form-container label {
    display: block;
    font-weight: bold;
    margin-bottom: 8px;
    margin-top: 15px;
}

.form-container input[type="text"],
.form-container input[type="tel"],
.form-container input[type="email"],
.form-container input[type="url"],
.form-container input[type="date"],
.form-container select,
.form-container textarea {
    width: 100%;
    padding: 12px;
    margin-bottom: 15px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 16px;
    background: #fff;
    appearance: none;
    -webkit-appearance: none;
}

.form-container textarea {
    resize: vertical;
    min-height: 120px;
}

.form-container input[required], 
.form-container select[required] {
    background-color: #fffbfc;
}

/* ラジオボタン・チェックボックス */
.radio-group {
    margin-bottom: 15px;
}
.radio-group label {
    display: inline-block;
    margin-right: 20px;
    margin-bottom: 10px;
    font-weight: normal;
    cursor: pointer;
}
.radio-group input[type="radio"] {
    margin-right: 5px;
    transform: scale(1.2);
}

/* ==========================================
   裏面デザイン（グリッドレイアウト）
   ========================================== */
.backside-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 15px;
    margin-bottom: 15px;
}

.backside-item {
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fff;
    overflow: hidden;
    cursor: pointer;
    text-align: center;
    transition: 0.2s;
    display: flex;
    flex-direction: column;
}

.backside-item:hover {
    border-color: #ff6600;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.backside-item label {
    cursor: pointer;
    margin: 0;
    padding: 10px;
    display: block;
    flex: 1;
    font-weight: normal;
}

.backside-img-wrap {
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fafafa;
    margin-bottom: 8px;
    border-bottom: 1px solid #eee;
}

.backside-img {
    max-width: 100%;
    max-height: 100%;
    display: block;
}

.backside-item input[type="radio"] {
    margin-right: 5px;
    vertical-align: middle;
}

.backside-no-img {
    color: #ccc;
    font-size: 0.8rem;
}

/* ==========================================
   グリッドシステム (2列レイアウト)
   ========================================== */
.input-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
}

@media (min-width: 600px) {
    .input-grid {
        grid-template-columns: 1fr 1fr;
    }
}

/* ==========================================
   ボタン
   ========================================== */
.btn-area {
    display: flex;
    justify-content: space-between;
    margin-top: 40px;
    gap: 15px;
}

.form-container button {
    padding: 15px 30px;
    font-size: 1rem;
    cursor: pointer;
    border: none;
    border-radius: 4px;
    transition: background 0.3s;
    font-weight: bold;
}

.btn-next, .btn-submit {
    background: #ff6600;
    color: white;
    width: 100%;
    flex: 2;
}
.btn-next:hover, .btn-submit:hover {
    background: #e65c00;
}

/* ▼▼▼ 修正: 次へボタンがグレーになる問題を解消 ▼▼▼ */
/* 戻るボタン（または特定の戻る操作）のみグレーにする */
.form-container button[onclick="history.back()"],
.form-container button[name="next_step"][formnovalidate] {
    background: #999;
    color: white;
    flex: 1;
}
.form-container button[onclick="history.back()"]:hover,
.form-container button[name="next_step"][formnovalidate]:hover {
    background: #777;
}

/* 次へボタン（クラス指定を優先） */
.btn-next, .btn-submit {
    background: #ff6600 !important; /* 強制的にオレンジ色に */
    color: white;
    width: 100%;
    flex: 2;
}
.btn-next:hover, .btn-submit:hover {
    background: #e65c00 !important;
}
/* ▲▲▲ 修正終了 ▲▲▲ */

.form-container button[type="button"][onclick*="add"] {
    background: #f0f0f0;
    color: #333;
    border: 1px solid #ccc;
    padding: 8px 15px;
    font-size: 0.9rem;
    width: auto;
    margin-top: 5px;
}

.btn-price {
    display: inline-block;
    background: #0073aa;
    color: #fff;
    padding: 10px 20px;
    text-decoration: none;
    font-size: 0.9rem;
    border-radius: 4px;
    border: none;
    cursor: pointer;
}
.btn-price:hover {
    background: #005177;
}

/* ==========================================
   その他パーツ
   ========================================== */
.info-box {
    background: #f4faff;
    border-left: 5px solid #2c88d9;
    padding: 15px;
    margin-bottom: 20px;
    font-size: 0.95rem;
}

.terms-box {
    height: 250px;
    overflow-y: scroll;
    border: 1px solid #ccc;
    padding: 15px;
    margin-bottom: 20px;
    font-size: 0.9rem;
    background: #fdfdfd;
}

.consent-label {
    display: block;
    background: #fff0f5;
    padding: 20px;
    text-align: center;
    font-weight: bold;
    border: 2px solid #ff99cc;
    margin-bottom: 30px;
    cursor: pointer;
    border-radius: 4px;
}
.consent-label input {
    transform: scale(1.5);
    margin-right: 10px;
}

.complete-box {
    text-align: center;
    padding: 50px 20px;
}
.complete-box h2 {
    border-bottom: none;
    color: #2c88d9;
}
.complete-box a {
    display: inline-block;
    margin-top: 30px;
    padding: 10px 30px;
    background: #666;
    color: #fff;
    text-decoration: none;
    border-radius: 4px;
}

#file-inputs input[type="file"] {
    background: #f9f9f9;
    padding: 10px;
    border: 1px dashed #ccc;
}

/* ==========================================
   ポップアップ（モーダル） & 追加スタイル
   ========================================== */
.modal {
    display: none; 
    position: absolute; 
    z-index: 9999; 
    left: 0;
    width: 100%; 
    background-color: rgba(0,0,0,0.8); 
    animation: fadeIn 0.3s;
    cursor: pointer; /* iOS Safari用タップ判定ハック */
}
.modal-content {
    display: block;
    width: auto;
    max-width: 90%;
    margin: 0 auto;
    border-radius: 4px;
    box-shadow: 0 0 20px rgba(0,0,0,0.5);
    background: #fff;
    padding: 5px;
    position: relative;
    cursor: default; /* 画像上では通常のカーソルに戻す */
}
.modal-close {
    position: fixed; /* absolute から fixed に変更して画面に追従させる */
    top: 20px;
    right: 40px;
    color: #f1f1f1;
    font-size: 50px;
    font-weight: bold;
    transition: 0.3s;
    cursor: pointer;
    line-height: 1;
    z-index: 10000;
}
.modal-close:hover {
    color: #bbb;
}
@keyframes fadeIn {
    from {opacity: 0;}
    to {opacity: 1;}
}

/* 複数人入力欄 */
.member-group {
    background: #f9f9f9;
    border: 1px solid #e0e0e0;
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 5px;
    position: relative;
}
.member-group-title {
    background: #666;
    color: #fff;
    padding: 5px 10px;
    font-size: 0.9em;
    display: inline-block;
    margin-bottom: 10px;
    border-radius: 3px;
    vertical-align: middle;
}
.btn-copy-prev {
    margin-left: 15px;
    font-size: 0.8em;
    background: #fff;
    border: 1px solid #ccc;
    color: #333;
    padding: 4px 8px;
    cursor: pointer;
    border-radius: 3px;
    vertical-align: middle;
}
.btn-copy-prev:hover {
    background: #eee;
    color: #000;
}

/* 用紙選択ブロック */
.paper-select-block {
    margin-bottom: 20px;
    padding: 15px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 5px;
}
.paper-person-name {
    font-weight: bold;
    color: #0073aa;
    margin-bottom: 10px;
    display: block;
    border-bottom: 1px dashed #ccc;
    padding-bottom: 5px;
}

/* ファイル削除ボタン等 */
.file-input-wrapper {
    margin-bottom: 10px;
    display: flex;
    gap: 5px;
    align-items: center;
}

/* エラーメッセージ */
.error-msg {
    background-color: #f8d7da;
    color: #721c24;
    padding: 15px;
    margin-bottom: 20px;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
    font-weight: bold;
}

/* 管理画面用追加スタイル（予約） */
.btn-delete-mode {
    background: #d63638;
    color: white;
    border: none;
    padding: 3px 10px;
    border-radius: 4px;
    cursor: pointer;
    margin-left: 5px;
    font-size: 0.9rem;
}
.btn-delete-mode:hover {
    background: #a0282a;
}
.ind-opt-wrapper {
    margin-top: 10px;
    padding: 10px;
    background: #fff;
    border: 1px dashed #ccc;
    border-radius: 4px;
}

ご要望の詳細なデザイン編集機能（Fabric.jsを利用したSVG編集、レイヤー管理、プレビュー、テキスト・画像・図形追加など）を実装します。

既存の機能を維持しつつ、大規模な機能追加となりますので、以下の手順で修正を行います。

style.css: エディタ画面とフル幅レイアウト用のスタイルを追加

admin.php: デザイン編集機能の有効化、フォント管理、SVGフォルダ設定などのタブを追加

index.php:

自動削除ロジックの追加

編集画面（モーダル）のHTML追加

Fabric.js（描画ライブラリ）の読み込み

各メンバーごとの編集ボタンとデータ保持ロジックの実装

SVG読み込み、テキスト置換、編集機能のJavaScript実装

1. style.css の修正
フォームの幅を100%にするためのクラスと、デザインエディタ用のスタイルを追加します。

挿入箇所: ファイルの末尾に追加してください。

CSS
/* ... (前略：既存のコード) ... */

/* 管理画面用追加スタイル（予約） */
.btn-delete-mode {
    background: #d63638;
    color: white;
    border: none;
    padding: 3px 10px;
    border-radius: 4px;
    cursor: pointer;
    margin-left: 5px;
    font-size: 0.9rem;
}
.btn-delete-mode:hover {
    background: #a0282a;
}
.ind-opt-wrapper {
    margin-top: 10px;
    padding: 10px;
    background: #fff;
    border: 1px dashed #ccc;
    border-radius: 4px;
}

/* ==========================================
   ▼▼▼ 追加: デザイン編集機能用スタイル ▼▼▼
   ========================================== */

/* フォーム幅100%拡張用クラス */
.form-container.full-width {
    max-width: 100%;
    padding: 20px;
}

/* デザインエディタモーダル */
#designEditorModal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.9);
    overflow: hidden;
}

.editor-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    background: #e0e0e0;
}

.editor-header {
    background: #333;
    color: #fff;
    padding: 10px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 50px;
}

.editor-body {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* 左サイドバー（ツール） */
.editor-toolbar {
    width: 250px;
    background: #f5f5f5;
    border-right: 1px solid #ccc;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    padding: 10px;
}

.tool-section {
    margin-bottom: 20px;
    border-bottom: 1px solid #ddd;
    padding-bottom: 15px;
}
.tool-section h4 {
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 0.9rem;
    color: #0073aa;
}

.editor-btn {
    display: block;
    width: 100%;
    margin-bottom: 5px;
    padding: 8px;
    background: #fff;
    border: 1px solid #ccc;
    cursor: pointer;
    text-align: left;
    font-size: 0.9rem;
}
.editor-btn:hover {
    background: #eee;
}

/* キャンバスエリア */
.editor-canvas-area {
    flex: 1;
    background: #999;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: auto;
    position: relative;
}
.canvas-wrapper {
    box-shadow: 0 0 10px rgba(0,0,0,0.5);
}

/* 右サイドバー（レイヤー・プロパティ） */
.editor-panels {
    width: 280px;
    background: #fff;
    border-left: 1px solid #ccc;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.panel-block {
    padding: 10px;
    border-bottom: 1px solid #eee;
}
.panel-title {
    font-weight: bold;
    background: #eee;
    padding: 5px 10px;
    margin: -10px -10px 10px -10px;
    font-size: 0.85rem;
}

/* プロパティ入力 */
.prop-row {
    display: flex;
    align-items: center;
    margin-bottom: 5px;
}
.prop-label {
    width: 80px;
    font-size: 0.8rem;
    color: #666;
}
.prop-input {
    flex: 1;
    padding: 4px;
    font-size: 0.9rem;
    border: 1px solid #ccc;
}
.prop-color {
    width: 100%;
    height: 30px;
    padding: 0;
    border: none;
}

/* レイヤーリスト */
#layer-list {
    list-style: none;
    padding: 0;
    margin: 0;
}
#layer-list li {
    padding: 5px 10px;
    border-bottom: 1px solid #eee;
    font-size: 0.85rem;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
#layer-list li.active {
    background: #e6f7ff;
    border-left: 3px solid #0073aa;
}
#layer-list li:hover {
    background: #f9f9f9;
}
.layer-controls button {
    font-size: 0.7rem;
    padding: 1px 5px;
    margin-left: 2px;
}

/* 拡大縮小・情報表示 */
.zoom-controls {
    position: absolute;
    bottom: 20px;
    right: 20px;
    background: rgba(255,255,255,0.8);
    padding: 5px;
    border-radius: 4px;
    display: flex;
    gap: 5px;
}

/* 編集ボタン */
.btn-design-edit {
    background: #28a745;
    color: #fff;
    border: none;
    padding: 8px 15px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    margin-top: 10px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
.btn-design-edit:hover {
    background: #218838;
}

/* サムネイルプレビュー */
.design-preview-thumb {
    margin-top: 10px;
    border: 1px solid #ccc;
    max-width: 200px;
    display: block;
    background: #fff;
}

/* ==========================================
   ▼▼▼ フォント追加用設定例 (機能2) ▼▼▼
   ========================================== */

/* 【手順】
  1. フォントファイルをサーバー（例: fonts/MyFont.ttf）にアップロード
  2. 以下のように @font-face を記述
  3. admin.php の「フォント設定」に font-family 名（ここでは 'MyOriginalFont'）を追記
*/

/*
@font-face {
    font-family: 'MyOriginalFont';
    src: url('fonts/MyFont.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}
*/

/* (ここに記述していた @import はファイルの先頭に移動しました) */

/* これで admin.php に 'Noto Sans JP' 等と書けばエディタで使えます */

/* ==========================================
   ▼▼▼ 追加: タブレット・スマホ用レスポンシブ対応 (機能追加) ▼▼▼
   ========================================== */
@media screen and (max-width: 900px) {
    /* モーダル全体：画面いっぱいに */
    .editor-container {
        height: 100vh;
        height: 100dvh; /* モバイルブラウザのアドレスバー対策 */
    }

    /* エディタ本体：縦並びに変更 */
    .editor-body {
        flex-direction: column;
    }

    /* 1. キャンバスエリア（最優先・上部） */
    .editor-canvas-area {
        order: 1;       /* 1番目に表示 */
        width: 100%;
        height: 45%;    /* 画面の45%を使用 */
        border-bottom: 1px solid #ccc;
        background: #999;
    }

    /* 2. プロパティ・レイヤーパネル（編集用・中部） */
    .editor-panels {
        order: 2;       /* 2番目に表示 */
        width: 100%;
        height: 30%;    /* 画面の30%を使用 */
        border-left: none;
        border-bottom: 1px solid #ccc;
    }

    /* 3. ツールバー（追加用・下部） */
    .editor-toolbar {
        order: 3;       /* 3番目に表示 */
        width: 100%;
        height: 25%;    /* 画面の25%を使用 */
        border-right: none;
        
        /* ツールセクションを横並びにしてスクロールさせる */
        display: flex;
        flex-direction: row;
        overflow-x: auto;
        white-space: nowrap;
        align-items: flex-start;
        padding: 5px;
    }

    /* ツールバー内の各セクション調整 */
    .editor-toolbar .tool-section {
        min-width: 160px; /* 各セクションの幅を確保 */
        margin-right: 10px;
        margin-bottom: 0;
        border-bottom: none;
        border-right: 1px solid #ddd;
        padding-right: 10px;
        white-space: normal; /* 中のボタンは折り返し許可 */
    }
    
    /* ズームボタンの調整（指で押しやすく） */
    .zoom-controls {
        bottom: 10px;
        right: 10px;
        padding: 2px;
    }
    .zoom-controls button {
        padding: 8px 12px;
        font-size: 1.2rem;
    }
    
    /* ボタン類の押しやすさ向上 */
    .editor-btn {
        padding: 10px;
        font-size: 0.85rem;
    }

    /* ▼▼▼ 追加: スマホでのヘッダーボタン表示崩れ対応 (機能修正) ▼▼▼ */
    .editor-header {
        height: auto;           /* 高さを固定せず中身に合わせて伸ばす */
        flex-direction: column; /* 上下2段（タイトル行/保存ボタン行）に分ける */
        padding: 10px 5px;      /* 余白調整 */
        gap: 10px;              /* 段落間の隙間 */
    }

    .editor-header > div {
        display: flex;
        flex-wrap: wrap;        /* 横幅が足りない時にボタンを折り返す */
        justify-content: center;/* 中央揃え */
        width: 100%;
        gap: 6px;               /* ボタン間の隙間 */
        align-items: center;
        line-height: 1.2;
    }

    /* ヘッダー内の全ボタン共通スタイル（インラインスタイルを強制上書き） */
    .editor-header button {
        margin-left: 0 !important;   /* PC用の左マージンを解除 */
        margin-right: 0 !important;
        margin-top: 2px;
        margin-bottom: 2px;
        padding: 8px 12px !important; /* タップしやすい広さに調整 */
        font-size: 0.8rem !important;
        flex: 1 1 auto;              /* 横幅を自動伸縮して押しやすくする */
        min-width: 80px;             /* 最小幅を確保 */
        text-align: center;
    }
    
    /* タイトル文字の調整 */
    #editor_target_name {
        font-weight: bold;
        margin-right: 5px;
    }
    /* ▲▲▲ 追加終了 ▲▲▲ */
}