/**
 * 予約フォームUI スタイル（プラグイン版）
 * STEP11-3: 参考テーマのスタイルをプラグイン向けに移植
 */

/* 予約フォーム全体コンテナ */
#onebuild-reservation-form {
    max-width: 600px;
    margin: 20px auto;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* ローディング表示 */
.loading-indicator {
    text-align: center;
    padding: 40px;
}

.loading-spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 4px solid rgba(0, 0, 0, 0.1);
    border-top-color: #333;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

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

/* フォームカード */
.form-card {
    background: #fff;
    border: 1px solid #e1e1e1;
    border-radius: 8px;
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    overflow-y: auto;
}

/* スクロールバー（Webkit対応） */
.form-card::-webkit-scrollbar {
    width: 6px;
}

.form-card::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.form-card::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.form-card::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* フォーム概要テーブル */
.form-summary {
    width: 100%;
    margin-bottom: 24px;
    border-collapse: collapse;
    border: 1px solid #e1e1e1;
    border-radius: 6px;
    overflow: hidden;
}

.form-summary th {
    width: 25%;
    background: #f8f9fa;
    font-weight: 600;
    color: #495057;
}

.form-summary th,
.form-summary td {
    padding: 12px 16px;
    text-align: left;
    vertical-align: top;
    font-size: 14px;
    line-height: 2;
}

.form-summary td {
    background: #fff;
    font-weight: 500;
}

/* フォームグループ */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    color: #495057;
    font-size: 14px;
}

.form-group .required {
    color: #dc3545;
    margin-left: 4px;
    font-weight: bold;
}

/* 入力フィールド共通スタイル */
.form-card input[type="text"],
.form-card input[type="email"],
.form-card input[type="tel"],
.form-card textarea,
.form-card select {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    box-sizing: border-box;
    font-size: 16px;
    font-family: inherit;
    line-height: 1.5;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.form-card input[type="text"]:focus,
.form-card input[type="email"]:focus,
.form-card input[type="tel"]:focus,
.form-card textarea:focus,
.form-card select:focus {
    outline: none;
    border-color: #80bdff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

/* テキストエリア */
.form-card textarea {
    height: 120px;
    resize: vertical;
}

/* セレクトボックス */
.form-card select {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 12px center;
    background-repeat: no-repeat;
    background-size: 16px 12px;
    padding-right: 40px;
    appearance: none;
}

/* ラジオボタングループ */
.radio-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 6px;
}

.radio-inline {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: normal;
    margin-bottom: 0;
    cursor: pointer;
}

.radio-inline input[type="radio"] {
    width: auto;
    margin: 0;
}

/* ボタン共通スタイル */
.submit-button,
.back-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease;
    min-height: 48px;
}

/* 送信ボタン */
.submit-button {
    background-color: #1c90f3!important;
    color: white!important;
    margin: 20px auto 10px;
    display: block;
    min-width: 200px;
    border-radius: 8px!important;
}

.submit-button:hover:not(:disabled) {
    background-color: #005a87;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 124, 186, 0.3);
}

.submit-button:disabled {
    background-color: #6c757d;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* 戻るボタン */
.back-button {
    background-color: #f8f9fa;
    color: #495057;
    border: 1px solid #ced4da;
    margin: 10px auto;
    display: block;
}

.back-button:hover {
    background-color: #e9ecef;
    border-color: #adb5bd;
    color: #495057;
    text-decoration: none;
}

/* スピナー */
.onebuild-btn-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #fff;
    border-top: 2px solid transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-left: 8px;
    vertical-align: middle;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* エラーメッセージ */
.error-message {
    color: #dc3545;
    font-size: 12px!important;
    margin-top: 6px;
    padding: 6px 12px;
    background-color: none;
    border: none;
}

.is-error {
    border-color: #dc3545 !important;
    background-color: #fff5f5;
}

/* 確認画面 */
#confirm-view h3 {
    margin-top: 0;
    margin-bottom: 20px;
    color: #495057;
    font-size: 20px;
    font-weight: 600;
    text-align: center;
}

/* 確認画面テーブル */
.confirmation-table {
    width: 100%;
    border-collapse: collapse;
    border: 1px solid #e1e1e1;
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 24px;
}

.confirmation-table th,
.confirmation-table td {
    border-bottom: 1px solid #e1e1e1;
    padding: 12px 16px;
    vertical-align: top;
    font-size: 12px;
}

.confirmation-table tr:last-child th,
.confirmation-table tr:last-child td {
    border-bottom: none;
}

.confirmation-table th {
    width: 35%;
    background: #f8f9fa;
    text-align: left;
    font-weight: 600;
    color: #495057;
}

.confirmation-table td {
    background: #fff;
    color: #212529;
}

/* 確認画面ボタン配置 */
#confirm-view>div:last-child {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

#confirm-view .submit-button,
#confirm-view .back-button {
    margin: 0;
    flex: 0 0 auto;
}

/* 特定フィールドの幅調整 */
.form-card input[name="zip"] {
    max-width: 200px;
}

.form-card input[name="name"],
.form-card input[name="kana"] {
    max-width: 300px;
}

/* 郵便番号・住所フィールド */
#zip {
    width: 120px;
    ime-mode: disabled;
}

#address {
    transition: background-color 0.3s ease;
}

#address:disabled {
    background-color: #f5f5f5;
    cursor: wait;
}

/* 郵便番号フィールドのヘルプテキスト */
.form-group:has(#zip)::after {
    content: "※ 7桁の数字を入力すると住所が自動入力されます";
    display: block;
    font-size: 12px;
    color: #666;
    margin-top: 4px;
}

/* 必須マーク */
.required {
    color: #ff0000;
    margin-left: 4px;
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
    #onebuild-reservation-form {
        margin: 10px;
        max-width: none;
    }

    .form-card {
        padding: 16px;
        border-radius: 0;
        border-left: none;
        border-right: none;
    }

    .form-summary th {
        width: 35%;
    }

    .form-summary th,
    .form-summary td {
        padding: 10px 12px;
        font-size: 14px;
    }

    .confirmation-table th {
        width: 35%;
    }

    .confirmation-table th,
    .confirmation-table td {
        padding: 10px 12px;
        font-size: 13px;
    }

    #confirm-view>div:last-child {
        flex-direction: column;
        align-items: center;
    }

    .submit-button,
    .back-button {
        width: 100%;
        max-width: 300px;
    }
}

@media (max-width: 480px) {
    .form-card {
        padding: 12px;
    }

    .form-group {
        margin-bottom: 16px;
    }

    .form-card input[type="text"],
    .form-card input[type="email"],
    .form-card input[type="tel"],
    .form-card textarea,
    .form-card select {
        padding: 10px 12px;
        font-size: 16px;
        /* iOS zoom防止 */
    }

    .submit-button,
    .back-button {
        padding: 12px 20px;
        font-size: 16px;
    }

    .submit-button {
        background-color: #1c90f3!important;
        color: #fff!important;
        border-radius: 5px!important;
    }
}

/* アクセシビリティ */
@media (prefers-reduced-motion: reduce) {

    .submit-button,
    .back-button,
    .onebuild-btn-spinner {
        transition: none;
        animation: none;
    }
}

/* ハイコントラストモード */
@media (prefers-contrast: high) {

    .form-card input[type="text"],
    .form-card input[type="email"],
    .form-card input[type="tel"],
    .form-card textarea,
    .form-card select {
        border: 2px solid #000;
    }

    .submit-button {
        background-color: #000;
        color: #fff;
        border: 2px solid #000;
    }

    .back-button {
        background-color: #fff;
        color: #000;
        border: 2px solid #000;
    }
}