/* =================================================
   css/contact.css
   お問い合わせフォーム共通スタイル
   対象: page-contact.php / parts/contact-form.php
   main.css の変数（--color-main 等）をそのまま参照
   ================================================= */


/* =========================================
   お問い合わせ固有の CSS 変数
   ========================================= */
:root {
    --cf-border:        #ddd;
    --cf-border-focus:  var(--color-main, #219cd8);
    --cf-error:         #c0392b;
    --cf-error-bg:      #fdf2f2;
    --cf-label:         #222;
    --cf-hint:          #888;
    --cf-required-bg:   #fde8e8;
    --cf-required-col:  #c0392b;
    --cf-optional-bg:   #f0f0f0;
    --cf-optional-col:  #999;
    --cf-input-bg:      var(--color-white, #fff);
    --cf-radius:        4px;
    --cf-focus-shadow:  0 0 0 3px rgba(33,156,216,0.15);
    --cf-upload-dash:   #ccc;
}


/* =========================================
   ページレイアウト（faq-page に準拠）
   ========================================= */
.contact-page {
    padding: 40px 0 80px;
    background: var(--color-white, #fff);
}

.contact-page-wrapper {
    max-width: 760px;
    margin: 0 auto;
    padding: 0 20px;
}

.contact-page-header {
    text-align: center;
    margin-bottom: 40px;
}

.contact-page-title {
    font-size: 32px;
    font-weight: 700;
    color: #222;
    margin-bottom: 10px;
}

.contact-page-desc {
    font-size: 15px;
    color: var(--cf-hint);
    line-height: 1.8;
}


/* =========================================
   FAQ 誘導バナー（faq-contact-banner に準拠）
   ========================================= */
.contact-guide {
    margin-bottom: 36px;
    padding: 16px 20px;
    background: linear-gradient(135deg, #f0f8ff 0%, #e8f4fd 100%);
    border: 1px solid rgba(33,156,216,0.2);
    border-radius: 8px;
    font-size: 14px;
    color: #333;
    line-height: 1.8;
}

.contact-guide a {
    color: var(--color-main, #219cd8);
    text-decoration: underline;
    text-underline-offset: 2px;
}


/* =========================================
   エラー通知バナー
   ========================================= */
.contact-notice--error {
    margin-bottom: 28px;
    padding: 14px 18px;
    background: var(--cf-error-bg);
    border: 1px solid #f5c6c6;
    border-radius: var(--cf-radius);
    font-size: 14px;
    color: var(--cf-error);
    line-height: 1.8;
    white-space: pre-line;
}


/* =========================================
   フォーム本体
   ========================================= */
.contact-form {
    display: flex;
    flex-direction: column;
    gap: 24px;
}


/* =========================================
   フィールド共通
   ========================================= */
.cf-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.cf-field[hidden] {
    display: none !important;
}

.cf-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 700;
    color: var(--cf-label);
}

.cf-required,
.cf-optional {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 3px;
    letter-spacing: .03em;
}

.cf-required {
    background: var(--cf-required-bg);
    color: var(--cf-required-col);
}

.cf-optional {
    background: var(--cf-optional-bg);
    color: var(--cf-optional-col);
}

.cf-hint {
    font-size: 12px;
    color: var(--cf-hint);
    line-height: 1.7;
    margin: 0;
}


/* =========================================
   テキスト入力・テキストエリア
   ========================================= */
.cf-input,
.cf-textarea {
    width: 100%;
    box-sizing: border-box;
    padding: 12px 14px;
    font-size: 15px;
    font-family: 'Shippori Mincho', serif;
    color: #333;
    background: var(--cf-input-bg);
    border: 1.5px solid var(--cf-border);
    border-radius: var(--cf-radius);
    transition: border-color 0.2s, box-shadow 0.2s;
    line-height: 1.6;
}

.cf-input::placeholder,
.cf-textarea::placeholder {
    color: #bbb;
}

.cf-input:focus,
.cf-textarea:focus {
    outline: none;
    border-color: var(--cf-border-focus);
    box-shadow: var(--cf-focus-shadow);
}

.cf-input.is-error,
.cf-textarea.is-error {
    border-color: var(--cf-error);
    box-shadow: 0 0 0 3px rgba(192,57,43,0.12);
}

.cf-textarea {
    resize: vertical;
    min-height: 140px;
}

/* 文字数カウンター */
.cf-count {
    font-size: 12px;
    color: var(--cf-hint);
    text-align: right;
}


/* =========================================
   インラインエラーメッセージ
   ========================================= */
.cf-error {
    font-size: 12px;
    color: var(--cf-error);
    min-height: 1.2em;
    display: block;
    line-height: 1.5;
}


/* =========================================
   画像アップロードエリア
   ========================================= */
.cf-upload-area {
    position: relative;
    border: 2px dashed var(--cf-upload-dash);
    border-radius: var(--cf-radius);
    padding: 28px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    background: var(--color-bg, #f8f8f8);
    transition: border-color 0.2s, background 0.2s;
}

.cf-upload-area:hover,
.cf-upload-area:focus,
.cf-upload-area.is-dragover {
    border-color: var(--color-main, #219cd8);
    background: #f0f8fd;
    outline: none;
}

.cf-upload-area.is-full,
.cf-upload-area.is-processing {
    opacity: .5;
    pointer-events: none;
}
/* リサイズ処理中スピナー（opacity は上書き） */
.cf-upload-area.is-processing {
    opacity: 1;
}

.cf-upload-area.is-processing .cf-upload-icon {
    animation: cfSpin .8s linear infinite;
    color: var(--color-main, #219cd8);
}

.cf-upload-icon {
    width: 36px;
    height: 36px;
    color: #aaa;
    flex-shrink: 0;
}

.cf-upload-text {
    font-size: 13px;
    color: var(--cf-hint);
    text-align: center;
    line-height: 1.6;
}

/* file input はエリア全体に重ねて非表示 */
.cf-file-input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}


/* =========================================
   画像プレビューリスト
   ========================================= */
.cf-preview-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 4px;
}

.cf-preview-item {
    position: relative;
    width: 80px;
    height: 80px;
    border-radius: var(--cf-radius);
    overflow: hidden;
    border: 1.5px solid var(--cf-border);
    animation: cfPreviewIn .2s ease;
}

@keyframes cfPreviewIn {
    from { opacity: 0; transform: scale(.85); }
    to   { opacity: 1; transform: scale(1);   }
}

.cf-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.cf-preview-remove {
    position: absolute;
    top: 3px;
    right: 3px;
    width: 20px;
    height: 20px;
    background: rgba(0,0,0,.55);
    border: none;
    border-radius: 50%;
    color: #fff;
    font-size: 13px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    transition: background .15s;
}

.cf-preview-remove:hover {
    background: var(--cf-error);
}


/* =========================================
   チェックボックス（プライバシーポリシー同意）
   ========================================= */
.cf-field--check {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 4px 0;
}

.cf-check-label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: #333;
    cursor: pointer;
    line-height: 1.5;
}

.cf-check-label input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.cf-check-box {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    border: 1.5px solid var(--cf-border);
    border-radius: 3px;
    background: #fff;
    display: grid;
    place-items: center;
    transition: background .15s, border-color .15s;
}

.cf-check-label input:checked + .cf-check-box {
    background: var(--color-main, #219cd8);
    border-color: var(--color-main, #219cd8);
}

.cf-check-label input:checked + .cf-check-box::after {
    content: '';
    display: block;
    width: 10px;
    height: 6px;
    border-left: 2px solid #fff;
    border-bottom: 2px solid #fff;
    transform: rotate(-45deg) translate(1px, -1px);
}

.cf-check-label input:focus + .cf-check-box {
    box-shadow: var(--cf-focus-shadow);
}

.cf-check-label a {
    color: var(--color-main, #219cd8);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.cf-field--check .cf-error {
    width: 100%;
    margin-left: 28px;
}


/* =========================================
   送信ボタン（.hero-btn / .faq-contact-btn に準拠）
   ========================================= */
.cf-submit-wrap {
    display: flex;
    justify-content: center;
    padding-top: 8px;
}

.cf-submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: var(--color-main, #219cd8);
    color: #fff;
    border: none;
    border-radius: var(--cf-radius);
    padding: 14px 48px;
    font-size: 16px;
    font-weight: 700;
    font-family: 'Shippori Mincho', serif;
    letter-spacing: .06em;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    min-width: 200px;
}

.cf-submit:hover:not(:disabled) {
    background: var(--color-main-dark, #1a7dac);
    transform: translateY(-1px);
}

.cf-submit:active:not(:disabled) {
    transform: translateY(0);
}

.cf-submit:disabled {
    opacity: .65;
    cursor: not-allowed;
}

/* ローディングスピナー */
.cf-submit__loader {
    display: none;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,.35);
    border-top-color: #fff;
    border-radius: 50%;
}

.cf-submit.is-loading .cf-submit__text {
    opacity: .7;
}

.cf-submit.is-loading .cf-submit__loader {
    display: block;
    animation: cfSpin .7s linear infinite;
}

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


/* =========================================
   送信完了メッセージ
   ========================================= */
.contact-complete {
    text-align: center;
    padding: 56px 24px;
}

.contact-complete__icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 20px;
    color: #27ae60;
}

.contact-complete__icon svg {
    width: 100%;
    height: 100%;
}

.contact-complete__title {
    font-size: 22px;
    font-weight: 700;
    color: #222;
    margin: 0 0 14px;
}

.contact-complete__body {
    font-size: 14px;
    color: #555;
    line-height: 1.9;
    margin: 0 0 32px;
}

.contact-complete__btn {
    display: inline-block;
    background: var(--color-main, #219cd8);
    color: #fff;
    text-decoration: none;
    border-radius: var(--cf-radius);
    padding: 12px 36px;
    font-size: 14px;
    font-weight: 700;
    font-family: 'Shippori Mincho', serif;
    transition: background 0.2s, transform 0.1s;
}

.contact-complete__btn:hover {
    background: var(--color-main-dark, #1a7dac);
    transform: translateY(-1px);
}


/* セレクトボックス */
.cf-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23aaa' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 40px;
    cursor: pointer;
}

/* 条件付きフィールドのアニメーション */
.cf-field--conditional {
    overflow: hidden;
    animation: cfSlideIn .2s ease;
}

@keyframes cfSlideIn {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* =========================================
   レスポンシブ
   ========================================= */
@media (max-width: 767px) {
    .contact-page {
        padding: 28px 0 60px;
    }

    .contact-page-title {
        font-size: 24px;
    }

    .cf-submit {
        width: 100%;
    }

    .cf-upload-area {
        padding: 20px 16px;
    }
}