/* =====================================================================
   住所入力補助 - 共通スタイル
   ===================================================================== */

/* ---- オーバーレイ ---- */
.modal-address-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 6000;
}

/* =====================================================================
   ステップモーダル
   ===================================================================== */
.modal-address-search {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 800px;
    max-height: 85vh;
    background: #f0f5fb;
    border-radius: 8px;
    z-index: 6001;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.modal-address-search__inner {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

/* ---- ヘッダー ---- */
.modal-address-search__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: #f0f5fb;
    flex-shrink: 0;
}

.modal-address-search__title {
    font-size: 18px;
    font-weight: bold;
    color: #1a5fa8;
    margin: 0;
}

.modal-address-search__close {
    background: none;
    border: none;
    font-size: 20px;
    color: #666;
    cursor: pointer;
    padding: 4px 8px;
    line-height: 1;
}

.modal-address-search__close:hover {
    color: #333;
}

/* ---- 確定済み住所 ---- */
.modal-address-search__confirmed {
    background: #fff;
    border-radius: 6px;
    margin: 0 16px 12px;
    padding: 12px 16px;
    flex-shrink: 0;
}

.modal-address-search__confirmed-label {
    font-size: 12px;
    color: #666;
    margin: 0 0 4px;
}

.modal-address-search__confirmed-address {
    font-size: 16px;
    font-weight: bold;
    color: #1a5fa8;
    margin: 0;
    min-height: 1.5em;
}

/* ---- 検索ボックス ---- */
.modal-address-search__search-wrap {
    display: flex;
    align-items: center;
    background: #fff9e6;
    border: 1px solid #e0d9c0;
    border-radius: 6px;
    margin: 0 16px 12px;
    padding: 8px 12px;
    flex-shrink: 0;
}

.modal-address-search__search-icon {
    font-size: 16px;
    margin-right: 8px;
    color: #999;
}

.modal-address-search__search-input {
    border: none;
    background: transparent;
    outline: none;
    font-size: 15px;
    width: 100%;
}

/* ---- 候補リスト ---- */
.modal-address-search__list {
    background: #fff;
    border-radius: 6px;
    margin: 0 16px;
    padding: 8px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

/* リストレイアウト */
.modal-address-search__list.is-list {
    display: flex;
    flex-direction: column;
}

/* グリッドレイアウト（4列） */
.modal-address-search__list.is-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
    align-content: start;
}

/* 候補アイテム */
.address-modal__candidate-item {
    background: none;
    border: none;
    text-align: left;
    padding: 10px 12px;
    cursor: pointer;
    color: #1a5fa8;
    font-size: 15px;
    border-radius: 4px;
    transition: background 0.15s;
}

.address-modal__candidate-item:hover {
    background: #e8f0fc;
    text-decoration: none;
}

/* グリッド時は中央寄せ */
.modal-address-search__list.is-grid .address-modal__candidate-item {
    text-align: center;
    padding: 10px 4px;
}

/* 「選択肢にないその他の住所」リンク */
.address-modal__other-link {
    display: block;
    padding: 10px 12px;
    color: #1a5fa8;
    font-size: 14px;
    text-decoration: none;
    border-top: 1px solid #eee;
    margin-top: 4px;
}

.address-modal__other-link:hover {
    text-decoration: underline;
}

/* グリッド時は全幅 */
.modal-address-search__list.is-grid .address-modal__other-link {
    grid-column: 1 / -1;
}

/* ---- フッター ---- */
.modal-address-search__footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 20px;
    flex-shrink: 0;
    background: #f0f5fb;
}

.modal-address-search__back {
    background: #fff;
    border: 1px solid #1a5fa8;
    color: #1a5fa8;
    border-radius: 24px;
    padding: 10px 20px;
    font-size: 14px;
    cursor: pointer;
    white-space: nowrap;
}

.modal-address-search__back:hover {
    background: #e8f0fc;
}

.modal-address-search__manual {
    background: #1a5fa8;
    border: none;
    color: #fff;
    border-radius: 24px;
    padding: 10px 20px;
    font-size: 14px;
    cursor: pointer;
    white-space: nowrap;
}

.modal-address-search__manual:hover {
    background: #1550a0;
}

/* =====================================================================
   エラーモーダル
   ===================================================================== */
.modal-address-error {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 480px;
    background: #f0f5fb;
    border-radius: 8px;
    z-index: 6001;
    padding: 32px 24px;
    text-align: center;
}

.modal-address-error__close {
    position: absolute;
    top: 12px;
    right: 16px;
    background: none;
    border: none;
    font-size: 20px;
    color: #666;
    cursor: pointer;
}

.modal-address-error__content {
    background: #fff;
    border-radius: 6px;
    padding: 24px;
    margin-bottom: 20px;
}

.modal-address-error__title {
    font-size: 18px;
    font-weight: bold;
    color: #1a5fa8;
    margin: 0 0 8px;
}

.modal-address-error__message {
    font-size: 14px;
    color: #555;
    margin: 0;
    white-space: pre-line;
    line-height: 1.6;
}

.modal-address-error__btn {
    background: #1a5fa8;
    border: none;
    color: #fff;
    border-radius: 24px;
    padding: 14px 32px;
    font-size: 16px;
    cursor: pointer;
    min-width: 200px;
}

.modal-address-error__btn:hover {
    background: #1550a0;
}

/* =====================================================================
   住所リセットボタン（白地・青アウトライン）
   ===================================================================== */
.address-reset-btn {
    display: none;              /* 住所検索で自動入力後に .is-visible で表示する */
    background: #fff;
    color: #1a5fa8;
    border: 1px solid #1a5fa8;
    border-radius: 4px;        /* 「住所検索」ボタンと同じ角丸 */
    /* 「住所検索」ボタンは border:none・padding 8px 16px。こちらは1pxボーダーがある分、
       パディングを1px減らして高さ・幅を揃える（8-1=7 / 16-1=15） */
    padding: 7px 15px;
    font-size: 14px;
    cursor: pointer;
    text-decoration: none;
    margin-left: 8px;
    vertical-align: middle;
    white-space: nowrap;
}

.address-reset-btn.is-visible {
    display: inline-block;      /* PC: 「住所検索」ボタンの横に並ぶ */
}

.address-reset-btn:hover {
    background: #eef4fb;
    color: #1550a0;
    text-decoration: none;
}

/* =====================================================================
   グレーアウト（自動入力済みフィールド）
   ===================================================================== */
.is-address-locked,
input.is-address-locked,
select.is-address-locked {
    background-color: #e8e8e8 !important;
    color: #666 !important;
    cursor: not-allowed !important;
}

/* select は disabled にするとサブミット対象外になるため pointer-events で操作不可にする */
select.is-address-locked {
    pointer-events: none;
}

/* =====================================================================
   住所検索ボタン
   ===================================================================== */
.address-search-btn {
    display: inline-block;
    background: #1a5fa8;
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 8px 16px;
    font-size: 14px;
    cursor: pointer;
    margin-left: 8px;
    vertical-align: middle;
}

.address-search-btn:hover {
    background: #1550a0;
}

.address-search-btn:disabled {
    background: #999;
    cursor: not-allowed;
}

/* =====================================================================
   レスポンシブ
   ===================================================================== */
@media (max-width: 767px) {
    .modal-address-search {
        width: 100%;
        height: 100%;
        max-width: 100%;
        max-height: 100%;
        top: 0;
        left: 0;
        transform: none;
        border-radius: 0;
    }

    .modal-address-search__title {
        font-size: 15px;
    }

    /* SP時グリッドは2列 */
    .modal-address-search__list.is-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .modal-address-search__footer {
        flex-direction: column-reverse;
        padding: 12px 16px;
    }

    .modal-address-search__manual,
    .modal-address-search__back {
        width: 100%;
        text-align: center;
        padding: 14px 20px;
    }

    .c_list2__desc:has(.address-search-btn) .u_tb {
        flex: 1;
        width: auto;
        min-width: 0;
    }

    .modal-address-error {
        width: 94%;
        padding: 24px 12px;
    }

    .modal-address-error__content {
        padding: 20px 12px;
    }

    /* SP: リセットボタンは検索ボタンの下に全幅で配置 */
    .address-reset-btn {
        margin-left: 0;
    }
    .address-reset-btn.is-visible {
        display: block;
        width: 100%;
        margin-top: 8px;
        text-align: center;
    }
}
