/* Wiki検索有効時はCocoon標準の検索オーバーレイを表示しない */
html.imw-search-replaces-cocoon #search-menu-content {
    display: none !important;
}

html.imw-search-open,
body.imw-search-open {
    overflow: hidden !important;
}

.imw-search-modal[hidden] {
    display: none !important;
}

.imw-search-modal {
    position: fixed;
    inset: 0;
    z-index: 2147483000;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: max(108px, env(safe-area-inset-top)) 18px 24px;
    box-sizing: border-box;
}

.imw-search-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(1px);
    -webkit-backdrop-filter: blur(1px);
}

.imw-search-dialog {
    position: relative;
    width: min(790px, 100%);
    max-height: calc(100vh - 145px);
    overflow: visible;
    background: #fff;
    border: 2px solid #aab7c9;
    border-radius: 24px;
    box-shadow: 0 14px 34px rgba(32, 51, 82, 0.18);
    color: #111;
    font-size: 16px;
    box-sizing: border-box;
}

.imw-search-dialog-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 20px 24px 14px;
    border-bottom: 1px solid #d6dce6;
}

.imw-search-dialog-head h2 {
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    background: none !important;
    font-size: 1.25rem !important;
    line-height: 1.35 !important;
    color: #111 !important;
}

.imw-search-close {
    flex: 0 0 auto;
    width: 58px;
    height: 58px;
    margin: -9px -8px -5px 0;
    padding: 0;
    border: 1px solid #d2dbea;
    border-radius: 50%;
    background: #f1f6ff;
    color: #111;
    font-size: 38px;
    font-weight: 300;
    line-height: 1;
    cursor: pointer;
}

.imw-advanced-search-form {
    padding: 20px 24px 24px;
}

.imw-search-input-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    align-items: stretch;
}

.imw-search-input-wrap {
    position: relative;
    min-width: 0;
}

.imw-search-input-wrap input[type="search"] {
    width: 100%;
    height: 62px;
    margin: 0;
    padding: 0 18px 0 54px;
    border: 2px solid #1767d4;
    border-radius: 18px;
    outline: 4px solid rgba(23, 103, 212, 0.10);
    background: #fff;
    color: #111;
    font: inherit;
    font-size: 1.05rem;
    box-sizing: border-box;
}

.imw-search-input-wrap input[type="search"]:focus {
    outline-color: rgba(23, 103, 212, 0.16);
}

.imw-search-input-icon {
    position: absolute;
    left: 19px;
    top: 50%;
    width: 18px;
    height: 18px;
    border: 3px solid #8a93a4;
    border-radius: 50%;
    transform: translateY(-55%);
    pointer-events: none;
    box-sizing: border-box;
}

.imw-search-input-icon::after {
    content: "";
    position: absolute;
    width: 9px;
    height: 3px;
    right: -7px;
    bottom: -4px;
    border-radius: 2px;
    background: #8a93a4;
    transform: rotate(45deg);
    transform-origin: center;
}

.imw-search-submit {
    min-width: 112px;
    height: 62px;
    margin: 0;
    padding: 0 22px;
    border: 0;
    border-radius: 16px;
    background: #2866cf;
    color: #fff;
    font: inherit;
    font-size: 1.05rem;
    font-weight: 700;
    cursor: pointer;
}

.imw-search-options {
    display: flex;
    flex-wrap: wrap;
    gap: 18px;
    margin-top: 20px;
}

.imw-search-option-group {
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
}

.imw-search-option-group legend {
    margin-bottom: 8px;
    padding: 0;
    color: #7a8493;
    font-size: .88rem;
    font-weight: 700;
}

.imw-segmented {
    display: inline-flex;
    align-items: stretch;
    overflow: hidden;
    border: 2px solid #9baac0;
    border-radius: 13px;
    background: #fff;
}

.imw-segmented label {
    margin: 0;
    cursor: pointer;
}

.imw-segmented label + label {
    border-left: 1px solid #9baac0;
}

.imw-segmented input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.imw-segmented span {
    display: flex;
    align-items: center;
    min-height: 48px;
    padding: 0 18px;
    color: #6f7887;
    font-weight: 600;
    white-space: nowrap;
    box-sizing: border-box;
}

.imw-segmented input:checked + span {
    background: #eff5ff;
    color: #2364ca;
    box-shadow: inset 0 0 0 1px #2364ca;
}

.imw-search-help {
    margin: 16px 0 0;
    color: #8992a1;
    font-size: .9rem;
    line-height: 1.5;
}

.imw-search-suggestions {
    position: absolute;
    z-index: 3;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    overflow: hidden;
    max-height: 310px;
    overflow-y: auto;
    border: 1px solid #b9c4d4;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 12px 25px rgba(32, 51, 82, 0.14);
}

.imw-search-suggestion {
    display: block;
    padding: 12px 15px;
    border-bottom: 1px solid #eef1f5;
    color: #245fc0 !important;
    text-decoration: none !important;
    line-height: 1.45;
}

.imw-search-suggestion:last-child {
    border-bottom: 0;
}

.imw-search-suggestion:hover,
.imw-search-suggestion:focus {
    background: #f1f6ff;
    outline: none;
}

@media (max-width: 700px) {
    .imw-search-modal {
        padding: max(118px, env(safe-area-inset-top)) 20px 18px;
    }

    .imw-search-dialog {
        width: 100%;
        border-radius: 20px;
    }

    .imw-search-dialog-head {
        padding: 18px 20px 12px;
    }

    .imw-search-close {
        width: 56px;
        height: 56px;
    }

    .imw-advanced-search-form {
        padding: 18px 20px 22px;
    }

    .imw-search-input-row {
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 10px;
    }

    .imw-search-input-wrap input[type="search"] {
        height: 58px;
        padding-left: 50px;
        font-size: 1rem;
        border-radius: 16px;
    }

    .imw-search-submit {
        min-width: 92px;
        height: 58px;
        padding: 0 16px;
        border-radius: 14px;
        font-size: 1rem;
    }

    .imw-search-options {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 12px 14px;
        align-items: end;
    }

    .imw-segmented span {
        min-height: 44px;
        padding: 0 13px;
        font-size: .92rem;
    }
}

@media (max-width: 440px) {
    .imw-search-modal {
        padding-left: 10px;
        padding-right: 10px;
    }

    .imw-search-dialog-head,
    .imw-advanced-search-form {
        padding-left: 14px;
        padding-right: 14px;
    }

    .imw-search-submit {
        min-width: 78px;
        padding-inline: 12px;
    }

    .imw-search-options {
        grid-template-columns: 1fr;
    }

    .imw-segmented {
        width: 100%;
    }

    .imw-segmented label {
        flex: 1 1 50%;
    }

    .imw-segmented span {
        justify-content: center;
    }
}
