/* ===== Search Modal ===== */

/* --- モーダルコンテナ --- */
.search-modal-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #E4F1EE;
    z-index: 9990;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.search-modal-container.is-visible {
    opacity: 1;
    visibility: visible;
}

/* --- モーダルコンテンツ --- */
.search-modal-content {
    width: 100%;
    height: 100%;
    overflow-y: auto;
    padding: 44px 24px;
    box-sizing: border-box;
    max-width: 1080px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 40px;
}

/* --- スクロール時に追従する検索ボタンのスタイル --- */
#search-modal-trigger.is-sticky {
    position: fixed;
    top: 10px;
    right: 10px;
    z-index: 9980;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 93px;
    height: 80px;
    background-image: url('/img/top/bg-kuma3.png');
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    color: white;
    text-decoration: none;
    border-radius: 0;
    transition: opacity 0.3s ease-in-out, transform 0.3s ease-in-out;
}

/* --- 「検索」ボタンが「閉じる」に変化した時のスタイル --- */
#search-modal-trigger.is-active {
    position: fixed;
    top: 10px;
    right: calc(10px + var(--scrollbar-compensation, 0px));
    z-index: 9999;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 93px;
    height: 80px;
    background-image: url('/img/top/bg-kuma3.png');
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    color: white;
    text-decoration: none;
    border-radius: 0;
    /* ▼ Button-specific resets ▼ */
    border: none;
    padding: 0;
    background-color: transparent;
    font-family: inherit;
    font-size: inherit;
    cursor: pointer;
    /* ▲ End resets ▲ */
}

#search-modal-trigger.is-active::before {
    content: '';
    display: block;
    width: 20px;
    height: 20px;
    margin-bottom: 4px;
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    background-image: url('/img/top/bg-kuma3-close.png');
    margin-top: 4px;
}


/* --- 以下、モーダル内部のコンテンツスタイル --- */
.search-modal-grid-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    align-items: start;
}

.search-modal-content h2 {
    font-size: 2rem;
    /* font-weight: 500; */
    text-align: center;
    padding-bottom: 15px;
    background-image: url('/img/top/shasen-green.png');
    background-repeat: repeat-x;
    background-position: bottom center;
    background-size: auto 10px;
    margin: 0 10% 30px;
}

.search-modal-content #search_trend_word h2 {
    margin: 0 10% 30px;
    padding-bottom: 15px;
}

.search-modal-content #search_trend_word {
    margin: 0px;
}

.search-modal-content #search_trend_word p {
    background-color: #fff;
    padding: 16px;
    border-radius: 6px;
    gap: 14px 21px;
}

.search-modal-content #search_trend_word p a {
    background-color: transparent;
    padding: 0;
    margin: 0;
}

.search-modal-content .kesakuLinks {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 15px;
}

.search-modal-content .kesakuLinks a {
    display: flex;
    align-items: center;
    padding: 12px 6px;
    background-color: #FFF;
    border-radius: 6px;
    color: #333;
    text-decoration: none;
    gap: 8px;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    justify-content: center;
}

.search-modal-content .kesakuLinks a::before {
    width: 50px;
    height: 50px;
}

.search-modal-content .kesakuLinks a:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.search-modal-content .lifeEventLinkItems {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
}

.search-modal-content .lifeEventLinkItems a {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100px;
    text-decoration: none;
    text-align: center;
    color: #333;
    background-color: #FFF;
    border-radius: 8px;
    transition: transform 0.2s, box-shadow 0.2s;
    padding: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.search-modal-content .lifeEventLinkItems a:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.search-modal-content .oyakudachiLinks {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    width: 100%;
}

.search-modal-content .komattaLinks a,
.search-modal-content .oyakudachiLinks a {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 80px;
    text-decoration: none;
    text-align: center;
    color: #333;
    background-image: url('/img/top/bg-kuma.png');
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    border-radius: 8px;
    padding: 10px;
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.05));
    transition: transform 0.2s, filter 0.2s;
}

.search-modal-content .komattaLinks a:hover,
.search-modal-content .oyakudachiLinks a:hover {
    transform: translateY(-3px);
    filter: drop-shadow(2px 0 0 #48d1b0) drop-shadow(-2px 0 0 #48d1b0) drop-shadow(0 2px 0 #48d1b0) drop-shadow(0 -2px 0 #48d1b0) drop-shadow(0 4px 10px rgba(0, 0, 0, 0.1));
}

.search-modal-content .oyakudachiLinks a::before {
    display: none;
}

.search-modal-content .komattaLinks {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
}

.search-modal-content .lifeEventLinks {
    overflow: visible;
}

.search-modal-content .search_ipt {
    display: flex;
    border: 8px solid #FFF;
    border-radius: 6px;
    overflow: hidden;
    max-width: 600px;
    margin: 0 auto;
    background-color: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.search-modal-content .search_ipt #tmp_query_modal {
    flex-grow: 1;
    border: none;
    outline: none;
    padding: 8px;
    font-size: 1.6rem;
    width: 100%;
}

.search-modal-content .search_ipt #submit_modal {
    border: none;
    background-color: #3BCEAC;
    color: #333;
    cursor: pointer;
    transition: background-color 0.3s ease;
    background-image: url('/img/top/search.png');
    background-repeat: no-repeat;
    background-size: 20px 20px;
    background-position: right 12px center;
    padding: 0 40px 0 20px;
    border-radius: 6px;
}

.search-modal-content .search_ipt #submit_modal:hover {
    background-color: #48d6b8;
}

.search-modal-content .search_ipt #tmp_query_modal:placeholder-shown {
    flex-grow: 1;
    border: none;
    outline: none;
    font-size: 1.6rem;
    background-image: url('https://www.google.com/cse/static/images/1x/ja/branding.png');
    background-repeat: no-repeat;
    background-position: left 10px center;
    background-size: auto;
}

#cse-search-box-modal label.search_ttl {
    font-size: 2rem;
    padding-bottom: 15px;
    margin-bottom: 30px;
}

@media (max-width: 900px) {
    .search-modal-grid-2col {
        grid-template-columns: 1fr;
    }

    .search-modal-content .kesakuLinks,
    .search-modal-content .lifeEventLinkItems,
    .search-modal-content .oyakudachiLinks,
    .search-modal-content .komattaLinks {
        grid-template-columns: repeat(2, 1fr);
    }

    .search-modal-content h2 {
        margin-left: 0;
        margin-right: 0;
    }

    .search-modal-content {
        padding-left: 16px;
        padding-right: 16px;
    }

    #search-modal-trigger.is-active {
        width: 65px;
        height: 55px;
    }

    #search-modal-trigger.is-active::before {
        width: 14px;
        height: 14px;
        margin: 3px 0px 1px;
    }
}

@media (max-width: 600px) {
    .search-modal-content .kesakuLinks a {
        flex-direction: column;
        text-align: center;
    }
}