.shop-search-box-container {
    display: flex;
    flex-direction: column;
    /* 元々<section>タグのグローバルスタイル(section{margin:16px})に依存していた分を明示化 */
    margin: 0 16px;
}

.shop-search-box-container p {
    font-size: 12px;
    font-weight: bold;
}

/* 各セクション（キーワード検索/人気エリア/地方/都道府県/第一エリア/第二エリア/業種/ジャンル/検索ボタン）を区切り線で分け、
   高さを45pxに統一する（box-sizing: border-box により padding込みで45px） */
.shop-search-box-container > * {
    box-sizing: border-box;
    height: 45px;
    padding: 7px 12px;
}

.shop-search-box-container > * + * {
    border-top: 1px solid var(--border-line);
}

.shop-search {
    display: flex;
    gap: 10px;
}

.shop-search-form {
    display: flex;
    gap: 10px;
    height: 100%;
    width: 100%;
}

.shop-search-form input[type="text"] {
    box-sizing: border-box;
    height: 100%;
    border: 1px solid var(--border-line);
    font-size: 12px;
    font-weight: bold;
    border-radius: 10px;
    padding: 0 10px;
    background-color: #f9fafb;
    width: 100%;
}

.shop-search-form button {
    cursor: pointer;
}

.shop-search-btn {
    box-sizing: border-box;
    width: 31px;
    min-width: 31px;
    height: 100%;
    border-radius: 10px;
    background-color: var(--red);
}

.AI-link,
.location-search-btn {
    box-sizing: border-box;
    display: flex;
    border: 1px solid var(--border-line);
    background-color: var(--gray-background);
    min-width: 31px;
    width: 31px;
    height: 100%;
    border-radius: 10px;
    cursor: pointer;
}

.AI-link img {
    margin: auto;
    width: 80%;
}

.location-search-btn img {
    margin: auto;
    width: 70%;
}

/* 人気エリア/業種/ジャンル 共通スタイル
   （タグ一覧のUIとして見た目が同一のため、セレクタをまとめて共通化している） */
.popular-area-section,
.business-large-section,
.genre-section {
    display: flex;
    gap: 15px;
    align-items: center;
}

.popular-area-section p,
.business-large-section p,
.genre-section p {
    white-space: nowrap;
}

/* 業種/ジャンルのラベルと、選択解除用×ボタンをまとめるコンテナ */
.tag-section-label {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* 業種/ジャンルの選択済みタグをリセットする×ボタン */
.tag-clear-btn {
    /* iOSはbuttonの標準見た目(appearance)がリセットされていないと、
       line-height:1を指定してもフォントの縦方向の余白の影響で
       "×"の位置が下寄りになるため、appearanceをリセットした上で
       inline-flexで中身を上下中央に揃える */
    appearance: none;
    -webkit-appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    font-size: 16px;
    color: #6a7282;
    cursor: pointer;
    /* "×"の字形自体が行ボックスの中でやや下寄りに描画されるフォントが多く、
       上下中央揃えだけでは円の中心から下にズレて見えるため、
       上下のpaddingをあえて非対称にして見た目の中心を合わせる */
    padding: 0 4px 2px;
    line-height: 1;
    border-radius: 25px;
    margin-left: 8px;
    background-color: #e5e7eb;
}

/* 横スクロールするタグ一覧。スクロールバーは非表示にする */
.popular-areas,
.business-large-list,
.genre-list {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    white-space: nowrap;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE, Edge (legacy) */
}

.popular-areas::-webkit-scrollbar,
.business-large-list::-webkit-scrollbar,
.genre-list::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Edge (Chromium) */
}

.popular-areas a,
.business-large-list button,
.genre-list button {
    box-sizing: border-box;
    height: 31px;
    display: inline-flex;
    align-items: center;
    padding: 0 10px;
    border-radius: 15px;
    border: 1px solid var(--border-line);
    background: none;
    cursor: pointer;
    font-size: 12px;
    font-weight: bold;
    color: inherit;
}

/* タップ操作しかできないタッチデバイス（iOS等）では:hoverが解除されず
   貼り付いたままになるため、実際にホバー可能な環境でのみ適用する */
@media (hover: hover) {
    .popular-areas a:hover,
    .business-large-list button:hover,
    .genre-list button:hover {
        border: 1px solid var(--red);
        color: var(--red);
    }
}

/* 選択中のタグ（人気エリア/業種/ジャンル） */
.popular-areas a.active,
.business-large-list button.active,
.genre-list button.active {
    background-color: var(--red);
    color: #fff;
}

/* エリア選択 */
.custom-select-container {
    position: relative;
    display: block;
}

/* 区切り線と区切り線の間（セクション全体）をそのままプルダウンの操作領域にするため、
   共通の padding（.shop-search-box-container > *）を打ち消し、その分を select 側の padding に持たせる */
.shop-search-box-container > .custom-select-container {
    padding: 0;
}

/* プルダウン本体（見た目のボーダー/背景/角丸は持たせず、閉じた状態の文字も表示しない。
   custom-select-label に重ねて表示し、select 自体は区切り線から区切り線までの透明なクリック領域にする） */
.custom-select {
    box-sizing: border-box;
    width: 100%;
    height: 45px;
    padding: 0 40px 0 12px;
    font-size: 12px;
    font-weight: bold;
    background: none;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    color: transparent;
    border: none;
}

.custom-select:focus {
    outline: none;
}

/* ドロップダウンを開いた中身の文字は常に黒にする（「地方：」は付けない） */
.custom-select option {
    color: #333;
}

/* プルダウンに重ねて表示する「〇〇：〇〇」ラベル */
.custom-select-label {
    position: absolute;
    top: 50%;
    left: 12px;
    right: 40px;
    transform: translateY(-50%);
    pointer-events: none; /* クリックをすり抜けさせてプルダウンを開く */
    font-size: 12px;
    font-weight: bold;
    color: #888; /* 未選択時（プレースホルダー風の色） */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 選択済みのときの文字色（プレフィックスは黒） */
.custom-select-label.active {
    color: #333;
}

/* 選択済みのときの「：」以降（選択された値）の文字色 */
.custom-select-label.active .custom-select-label-value {
    color: var(--red);
}

/* 右端の「▼」アイコン */
.select-arrow {
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    pointer-events: none; /* クリックをすり抜けさせてプルダウンを開く */
    color: #888;
    font-size: 10px;
    padding: 2px 7px;
}

/* 右端の「×」ボタン */
.clear-btn {
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 18px;
    color: #888;
    cursor: pointer;
    padding: 0 5px;
    line-height: 1;
    padding: 2px 7px;
}

.clear-btn:hover {
    color: #333;
}

/* ボタン */
.search-buttons {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
}

.search-buttons button {
    box-sizing: border-box;
    height: 31px;
    padding: 0 20px;
    border-radius: 25px;
    cursor: pointer;
}

.search-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    background-color: var(--red);
    color: #fff;
    font-weight: bold;
    /* 素早い連続タップでダブルタップズームが発生しないようにする */
    touch-action: manipulation;
}

.search-button-icon {
    width: 16px;
    height: 16px;
    display: inline-block;
    /* 虫眼鏡アイコンをボタンのテキスト色(currentColor)で塗るため、
       imgではなくmask-imageでSVGを形状のみのマスクとして使用する。
       これにより非活性時(.search-button:disabled)のcolor変更にも自動で追従する。 */
    background-color: currentColor;
    -webkit-mask: url("/img/renewal/magnifying-glass.svg") center / contain no-repeat;
    mask: url("/img/renewal/magnifying-glass.svg") center / contain no-repeat;
}

.search-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.reset-search-menus {
    background-color: var(--gray-background);
    border: 1px solid var(--border-line);
    /* iOS Safariはcolor未指定のbuttonにシステムのアクセントカラー(青)を
       適用することがあるため、appearanceをリセットした上で明示的に指定する */
    appearance: none;
    -webkit-appearance: none;
    color: #333;
    font-weight: bold;
}


/* 幅が767以下の時 */
@media not all and (min-width: 768px) {
    .shop-search-box-container {
        margin: 0;
    }
}
