/* search_form.css - 検索フォームに関連するスタイル */

.form-main-box {
    font-size: 14px;
    margin-top: 24px;
    border: none;
    background-color: transparent;
    padding: 12px 0;
    border-top: 1px solid #e5e5e5;
}

.form {
    margin-top: 20px;
}

.input p {
    margin: 8px 0;
    text-align: center;
    height: 20px;
    line-height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.input {
    margin-top: 16px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    max-width: 500px;
}

.onePside,
.twoPside,
.player,
.character {
    display: contents;
}

.onePside p,
.onePside .player-input-wrap,
.onePside input,
.onePside .chara-btn-wrapper {
    grid-column: 1;
}

.twoPside p,
.twoPside .player-input-wrap,
.twoPside input,
.twoPside .chara-btn-wrapper {
    grid-column: 3;
}

.player p {
    grid-row: 1;
}

.player-input-wrap {
    grid-row: 2;
    margin-bottom: 24px;
    position: relative;
}

.player-input-inner {
    position: relative;
    width: 100%;
}

.player-input-inner input {
    padding-right: 32px !important;
}

.player-clear-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    background-color: #f2f2f2;
    color: #606060;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    cursor: pointer;
    z-index: 2;
    transition: background-color 0.2s;
}

.player-input-inner.has-value .player-clear-btn {
    display: flex;
}

.player-clear-btn:hover {
    background-color: #e5e5e5;
    color: #0f0f0f;
}

.character p {
    grid-row: 3;
}

.character .chara-btn-wrapper {
    grid-row: 4;
}

.onePside input,
.twoPside input {
    width: 100%;
}

.Vs {
    grid-column: 2;
    grid-row: 2 / 5;
    align-self: center;
    font-size: 2em;
    width: 50px;
    text-align: center;
    line-height: 1;
}

input {
    border: 1px solid #cccccc;
    border-radius: 20px;
    line-height: 1.5;
    padding: 8px 16px;
    font-size: 14px;
    text-align: center;
    background-color: #ffffff;
    transition: border 0.2s ease;
}

.select-box1,
.select-box2 {
    display: none;
}

input:focus {
    outline: none;
    border-color: #065fd4;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
}

.btn {
    position: relative;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    box-sizing: border-box;
    width: 100%;
    border: 1px solid #cccccc;
    border-radius: 20px;
    padding: 8px 16px;
    font-size: 14px;
    line-height: 1.5;
    color: #0f0f0f;
    background: #ffffff no-repeat right 16px center/10px 12px;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3e%3cpath fill='%23606060' d='M7 10l5 5 5-5z'/%3e%3c/svg%3e");
    text-align: center;
    height: 38px;
    transition: background-color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    /* 追加: クリック可能であることを示す */
}

.chara-btn-wrapper {
    position: relative;
    width: 100%;
    min-width: 0;
}

.chara-btn-text {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    display: inline-block;
    text-align: center;
    line-height: 1;
    padding: 0 12px;
}

.chara-btn-wrapper.has-value .btn {
    background-image: none;
}

.chara-clear-btn {
    position: absolute;
    right: 11px;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    background-color: transparent;
    color: #606060;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    cursor: pointer;
    z-index: 2;
    transition: background-color 0.2s, color 0.2s;
}

.chara-btn-wrapper.has-value .chara-clear-btn {
    display: flex;
}

.chara-clear-btn:hover {
    background-color: #e5e5e5;
    color: #0f0f0f;
}

.btn:hover {
    background-color: #f2f2f2;
}

/* --------------- Free Word Section --------------- */
.free_word_box {
    margin: 24px auto 16px;
    display: flex;
    justify-content: flex-start;
    /* 左寄せに統一してグルーピングを改善 */
    align-items: flex-end;
    max-width: 500px;
    width: 100%;
    gap: 12px;
    /* 要素間を適度な距離に（広げすぎない） */
}

.word {
    min-width: 0;
    flex: 2;
    /* フリーワード欄を主役として広く取る */
    display: flex;
    flex-direction: column;
    align-items: center;
    /* 自身の中（入力欄に対して）で中央に寄せる */
}

.word_header {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    /* 左右1frずつで中央を確保 */
    align-items: center;
    width: 100%;
    margin-bottom: 4px;
}

.word label {
    grid-column: 2;
    /* 中央に配置 */
    font-size: 12px;
    color: #606060;
    margin-bottom: 0;
    white-space: nowrap;
}

.region_box label {
    font-size: 12px;
    margin-bottom: 4px;
    color: #606060;
    text-align: center;
}

.word-input-inner {
    position: relative;
    width: 100%;
    max-width: 280px;
    /* 入力欄が広がりすぎないように制限 */
}

.word-input-inner input {
    width: 100%;
    /* 入力欄をコンテナいっぱいに広げる */
    padding-right: 36px !important;
}

.free-word-clear-btn {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    background-color: #f2f2f2;
    color: #606060;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    cursor: pointer;
    z-index: 2;
    transition: background-color 0.2s;
}

.word-input-inner.has-value .free-word-clear-btn {
    display: flex;
}

.free-word-clear-btn:hover {
    background-color: #e5e5e5;
    color: #0f0f0f;
}

.region_box {
    flex: 1;
    /* フリーワードの半分程度の幅で配置 */
    min-width: 90px;
    display: flex;
    flex-direction: column;
}

.region {
    width: 100%;
    height: 38px;
    box-sizing: border-box;
    border: 1px solid #cccccc;
    border-radius: 20px;
    padding: 0 16px;
    font-size: 14px;
    background-color: #ffffff;
    appearance: none;
    -webkit-appearance: none;
    text-align: center;
    text-align-last: center;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3e%3cpath fill='%23606060' d='M7 10l5 5 5-5z'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 12px;
}

.clear_box {
    flex: 0 0 auto;
    margin-left: 0;
    /* 右端への押し出しを解除 */
}

.clear {
    width: 38px;
    height: 38px;
    box-sizing: border-box;
    border: 1px solid #cccccc;
    border-radius: 50%;
    padding: 0;
    cursor: pointer;
    background-color: #ffffff;
    color: #0f0f0f;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background-color 0.2s;
}

.clear:hover {
    background-color: #f2f2f2;
}

.tooltip5 {
    grid-column: 3;
    /* 右側に配置 */
    justify-self: start;
    margin-left: 6px;
    position: relative;
    cursor: pointer;
    display: flex;
    align-items: center;
}

.tooltip5 img {
    width: 18px;
    height: 18px;
    opacity: 0.6;
}

.description5 {
    display: none;
    position: absolute;
    padding: 8px 12px;
    font-size: 12px;
    line-height: 1.5;
    color: #fff;
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.8);
    width: 160px;
    left: 50%;
    transform: translateX(-50%);
    bottom: 45px;
    z-index: 100;
}

.description5:before {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    border: 6px solid transparent;
    border-top: 6px solid rgba(0, 0, 0, 0.8);
    margin-left: -6px;
}

.tooltip5:hover .description5 {
    display: block;
}

.submit-box {
    margin: 0px auto 32px;
    text-align: center;
    position: relative;
}

.hit-count {
    font-size: 13px;
    color: #606060;
    margin-bottom: 8px;
    height: 24px;
    opacity: 0;
    visibility: hidden;
    overflow: hidden;
    transition: opacity 0.3s ease;
}

.hit-count.show {
    opacity: 1;
    visibility: visible;
}

.hit-count span {
    font-weight: bold;
    color: #0f0f0f;
    margin-right: 2px;
}

.submit {
    width: 45%;
    max-width: 400px;
    padding: 10px 32px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    background-color: #0f0f0f;
    color: #fff;
    border: none;
    border-radius: 20px;
    transition: background-color 0.2s, opacity 0.2s;
}

.submit:hover:not(:disabled) {
    background-color: #272727;
}

.submit:disabled,
.submit.is-disabled {
    background-color: #e0e0e0;
    color: #8e8e8e;
    border: 1px solid #dcdcdc;
    cursor: not-allowed;
}

/* Autocomplete Styles */
.onePside.player,
.twoPside.player {
    position: relative;
}

.autocomplete-items {
    position: absolute;
    border: 1px solid #d4d4d4;
    border-bottom: none;
    border-top: none;
    z-index: 99;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 200px;
    overflow-y: auto;
    background-color: #fff;
    display: none;
}

.autocomplete-items div {
    padding: 10px;
    cursor: pointer;
    background-color: #fff;
    border-bottom: 1px solid #d4d4d4;
    text-align: left;
    color: #000;
}

.autocomplete-items div:hover {
    background-color: #e9e9e9;
}

.autocomplete-active {
    background-color: DodgerBlue !important;
    color: #ffffff !important;
}