/* モンスター検索コンボボックス（極・ぬけめがない／検索バー型 + ドロップダウン）
 * 2 モード:
 *   - detail … 行クリックで /list/detail/<id>/ に遷移
 *   - filter … 行クリックでチェック ON/OFF、即時に絞り込み URL へ遷移（チェック状態を維持）
 */
.msearch-root {
    position: relative;
    min-width: 0;
}
/* 入力バー（常時表示。フォーカス／クリックで panel が開く） */
.msearch-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0;
    width: 100%;
    box-sizing: border-box;
    border-radius: 6px;
    border: 1px solid rgba(251, 191, 36, 0.45);
    background: rgba(2, 6, 23, 0.92);
    transition: border-color 0.12s ease, background 0.12s ease;
}
.msearch-input-wrap:focus-within,
.msearch-root.is-open .msearch-input-wrap {
    border-color: rgba(251, 191, 36, 0.85);
    background: rgba(15, 23, 42, 0.96);
}
.msearch-input-icon {
    flex-shrink: 0;
    padding: 0 0.45rem 0 0.5rem;
    color: #fbbf24;
    font-size: 12px;
    line-height: 1;
    pointer-events: none;
    user-select: none;
}
.msearch-input {
    flex: 1 1 auto;
    min-width: 0;
    box-sizing: border-box;
    border: 0;
    background: transparent;
    color: #f8fafc;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.2;
    padding: 0.42rem 0.5rem 0.42rem 0;
    outline: none;
}
.msearch-input::placeholder {
    color: #94a3b8;
    font-weight: 600;
}
.msearch-input-caret {
    flex-shrink: 0;
    align-self: stretch;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.85rem;
    padding: 0 0.5rem;
    border: 0;
    border-left: 1px solid rgba(51, 65, 85, 0.55);
    background: transparent;
    color: #94a3b8;
    font-size: 11px;
    line-height: 1;
    cursor: pointer;
    user-select: none;
    transition: color 0.12s ease, background 0.12s ease, transform 0.18s ease;
    border-top-right-radius: 5px;
    border-bottom-right-radius: 5px;
}
.msearch-input-caret:hover {
    color: #f1f5f9;
    background: rgba(51, 65, 85, 0.5);
}
.msearch-root.is-open .msearch-input-caret {
    color: #fbbf24;
    transform: rotate(180deg);
}
.msearch-clear-btn {
    flex-shrink: 0;
    margin-right: 0.2rem;
    padding: 0.18rem 0.42rem;
    border: 0;
    background: transparent;
    color: #94a3b8;
    font-size: 13px;
    font-weight: 800;
    line-height: 1;
    cursor: pointer;
    border-radius: 4px;
}
.msearch-clear-btn:hover {
    background: rgba(51, 65, 85, 0.65);
    color: #f1f5f9;
}
.msearch-clear-btn.hidden {
    display: none;
}

/* ドロップダウン本体 */
.msearch-panel {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 3px);
    z-index: 4000;
    border-radius: 8px;
    border: 1px solid rgba(100, 116, 139, 0.65);
    background: #0f172a;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.55);
    display: flex;
    flex-direction: column;
    max-height: 22rem;
    overflow: hidden;
}
.msearch-panel.hidden {
    display: none;
}
.msearch-summary {
    flex-shrink: 0;
    padding: 0.32rem 0.5rem;
    border-bottom: 1px solid rgba(51, 65, 85, 0.7);
    background: rgba(15, 23, 42, 0.98);
    color: #94a3b8;
    font-size: 10px;
    font-weight: 700;
    line-height: 1.3;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    transition: background 0.12s ease, color 0.12s ease;
}
.msearch-summary.is-dirty {
    background: rgba(92, 59, 0, 0.32);
    color: #fde68a;
    border-bottom-color: rgba(251, 191, 36, 0.55);
}
.msearch-summary-count {
    color: #fcd34d;
    font-variant-numeric: tabular-nums;
}
.msearch-summary.is-dirty .msearch-summary-count {
    color: #fef3c7;
}
.msearch-summary-dirty {
    margin-left: 0.4rem;
    color: #fbbf24;
    font-weight: 900;
    font-size: 10px;
}
.msearch-summary-dirty.hidden {
    display: none;
}
.msearch-summary-clear {
    border: 1px solid rgba(190, 18, 60, 0.55);
    background: rgba(127, 29, 29, 0.32);
    color: #fecdd3;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 800;
    padding: 0.14rem 0.45rem;
    cursor: pointer;
}
.msearch-summary-clear:hover {
    background: rgba(127, 29, 29, 0.5);
}
.msearch-summary-clear.hidden {
    display: none;
}

/* 適用フッタ（filter モード時のみ） */
.msearch-footer {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.45rem;
    padding: 0.4rem 0.5rem;
    border-top: 1px solid rgba(51, 65, 85, 0.7);
    background: rgba(15, 23, 42, 0.98);
}
.msearch-footer.hidden {
    display: none;
}
.msearch-footer-cancel,
.msearch-footer-apply {
    border-radius: 5px;
    font-size: 11px;
    font-weight: 900;
    padding: 0.32rem 0.7rem;
    cursor: pointer;
    line-height: 1.2;
}
.msearch-footer-cancel {
    border: 1px solid rgba(100, 116, 139, 0.55);
    background: rgba(30, 41, 59, 0.85);
    color: #cbd5e1;
}
.msearch-footer-cancel:hover:not(:disabled) {
    background: rgba(51, 65, 85, 0.95);
    color: #f1f5f9;
}
.msearch-footer-cancel:disabled {
    opacity: 0.4;
    cursor: default;
}
.msearch-footer-apply {
    border: 1px solid rgba(251, 191, 36, 0.7);
    background: rgba(120, 53, 15, 0.45);
    color: #fde68a;
}
.msearch-footer-apply.is-dirty,
.msearch-footer-apply:hover:not(:disabled) {
    background: linear-gradient(180deg, #f59e0b 0%, #b45309 100%);
    color: #1f2937;
    border-color: rgba(251, 191, 36, 0.9);
    box-shadow: 0 1px 6px rgba(251, 191, 36, 0.35);
}
.msearch-footer-apply:disabled {
    opacity: 0.55;
    cursor: default;
    background: rgba(120, 53, 15, 0.2);
    color: #a3a3a3;
    border-color: rgba(120, 53, 15, 0.35);
    box-shadow: none;
}
.msearch-footer-count {
    font-variant-numeric: tabular-nums;
    margin-left: 0.18rem;
}

.msearch-list {
    overflow-y: auto;
    flex: 1 1 auto;
    min-height: 0;
}
.msearch-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    text-align: left;
    border: 0;
    border-bottom: 1px solid rgba(51, 65, 85, 0.55);
    background: transparent;
    color: #e2e8f0;
    font-size: 12px;
    font-weight: 700;
    padding: 0.42rem 0.5rem;
    cursor: pointer;
}
.msearch-row:last-child {
    border-bottom: 0;
}
.msearch-row:hover,
.msearch-row.is-active {
    background: rgba(30, 41, 59, 0.92);
}
.msearch-row.is-checked {
    background: rgba(120, 53, 15, 0.32);
    color: #fde68a;
}
.msearch-row.is-checked:hover,
.msearch-row.is-checked.is-active {
    background: rgba(120, 53, 15, 0.5);
}
.msearch-row-check {
    flex-shrink: 0;
    width: 14px;
    height: 14px;
    accent-color: #f59e0b;
    cursor: pointer;
    pointer-events: none;
}
.msearch-row-name {
    flex: 1 1 auto;
    min-width: 0;
    overflow-wrap: anywhere;
    line-height: 1.3;
}
.msearch-row-meta {
    flex-shrink: 0;
    font-size: 10px;
    font-weight: 800;
    color: #94a3b8;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}
.msearch-row.is-checked .msearch-row-meta {
    color: #fcd34d;
}
.msearch-empty {
    padding: 0.5rem 0.5rem;
    font-size: 11px;
    color: #64748b;
    font-weight: 600;
}
.msearch-loading {
    padding: 0.5rem 0.5rem;
    font-size: 11px;
    color: #64748b;
    font-weight: 700;
}

@media (max-width: 640px) {
    /* iOS Safari：フォーカス時の自動ズーム回避（/orbs/ 同型・16px 強制） */
    .msearch-input-wrap {
        min-height: 2.4rem;
    }
    .msearch-input-wrap .msearch-input {
        font-size: 16px !important;
        line-height: 1.25rem !important;
        height: 2.05rem !important;
        padding: 0.35rem 0.5rem 0.35rem 0 !important;
        width: 100% !important;
        max-width: 100% !important;
    }
    .msearch-input-wrap .msearch-input::placeholder {
        font-size: 14px !important;
        line-height: 1.25rem;
        opacity: 0.72;
    }
}
