﻿/* ========================================
   検索機能スタイル
======================================== */

/* 検索エリア用オーバーレイ（背景グレーアウト） */
.search-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--Semantic-BG-Modal, rgba(72, 72, 72, 0.90));
    z-index: 998;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
    pointer-events: none;
}

.search-overlay.active {
    display: block;
    opacity: 1;
    pointer-events: auto;
}

/* 検索ボタン（ヘッダー） */
.menu-system .search {
    display: flex;
    align-items: center;
    margin-right: 0;
}

.menu-system .search button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s ease;
}

.menu-system .search button:hover {
    opacity: 0.7;
}

.menu-system .search img {
    display: block;
    width: 32px;
    height: 32px;
}

/* 検索エリア */
.search-area {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background: var(--Semantic-BG-Primary, #F8F7F3);
    z-index: 999;
    display: block;
    transform: translateY(-100%);
    max-height: 500px;
    overflow: hidden;
    transition: transform 0.3s ease-in-out, visibility 0.3s ease-in-out;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    pointer-events: none;
    visibility: hidden;
    will-change: transform;
}

.search-area.active {
    transform: translateY(0);
    pointer-events: auto;
    visibility: visible;
    box-shadow: 0 10px 10px 0 rgba(72, 72, 72, 0.10);
}

.search-area.search-area-hidden,
.search-area.active.search-area-hidden {
    transform: translateY(-100%);
    pointer-events: none;
    visibility: hidden;
}

.search-area-inner {
    max-width: 680px;
    margin: 64px auto 0;
}

/* 検索エリアフッター */
.search-area-footer {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px 0 24px 0;
}

/* 検索エリア閉じるボタン（PC版のみ） */
.search-close-btn {
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s ease;
    width: 32px;
    height: 32px;
}

.search-close-btn:hover {
    opacity: 0.7;
}

.search-close-icon {
    width: 32px;
    height: 32px;
    display: block;
    transition: transform 0.3s ease-in-out;
    transform: rotate(180deg);
}

.search-area.active .search-close-icon {
    transform: rotate(0deg);
}

/* 検索フォーム */
#search-form {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 16px;
}

/* gap未対応ブラウザ（iOS 14.5未満）向けフォールバック */
#search-form > .search-close-btn {
    margin-left: 16px;
}

@supports (gap: 16px) {
    #search-form > .search-close-btn {
        margin-left: 0;
    }
}

/* 検索入力欄 */
.search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    border-radius: 4px;
    border: 1px solid var(--Semantic-Gray-100, #ECECEC);
    background: var(--Semantic-Gray-0, #FFF);
    padding: 12px 16px;
    flex: 1;
}

.search-input-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
    flex-shrink: 0;
}

.search-input {
    flex: 1;
    border: none;
    background: transparent;
    outline: none;
    padding-right: 40px;
    overflow: hidden;
    color: var(--Semantic-Gray-900, #353131);
    text-overflow: ellipsis;
    
    /* paragraph/M/PC/Regular */
    font-family: "Noto Sans JP";
    font-size: 16px;
    font-style: normal;
    font-weight: 400;
    line-height: 160%; /* 25.6px */
    letter-spacing: 1.12px;
}

.search-input::placeholder {
    color: #C3C3C3;
}

/* 検索ボタン（送信） */
.search-submit-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    display: none;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s ease;
    flex-shrink: 0;
}

.search-submit-btn:hover {
    opacity: 0.7;
}




/* ========================================
   SP版対応（max-width: 842px）
======================================== */
@media screen and (max-width: 842px) {
    /* 検索ボタンサイズ */
    .menu-system .search {
        margin-right: 0;
    }

    .menu-system .search img {
        width: 28px;
        height: 28px;
    }

    /* 検索エリア */
    .search-area {
        max-height: none;
        height: 100vh;     /* iOS 15.4未満のフォールバック（vh は iOS 6+対応） */
        height: 100lvh;    /* iOS 15.4+ 対応（大ビューポート高さ） */
    }

    .search-area-inner {
        margin: 32px auto 0;
        width: calc(100% - 32px);
    }

    /* 検索入力欄 */
    .search-input-wrapper {
        padding: 10px 12px;
    }

    .search-input {
        font-size: 14px;
        padding-right: 12px;
        padding-left: 0;
    }

    /* 検索ボタン */
    .search-submit-btn {
        display: none;
    }

    /* フッター非表示 */
    .search-area-footer {
        display: none;
    }
}

/* SP版のみ表示するクラス */
.sp-only {
    display: none;
}

@media screen and (max-width: 842px) {
    .sp-only {
        display: block !important;
    }

    /* ボタン要素は flex を維持（SVG中央配置のため） */
    button.sp-only {
        display: flex !important;
    }
}
