/* 地図フィルターコントロールとコンポーネントのCSS - 最適化・修正適用バージョン */

/* Leafletコントロールコンテナ - フィルターコントロール */
.map-filter-control.leaflet-control {
    background: rgba(255, 255, 255, 0.85);
    padding: 8px;
    border-radius: 4px;
    box-shadow: 0 1px 5px rgba(0,0,0,0.4);
    backdrop-filter: blur(3px);
}

/* フィルターコンテナ全体のスタイル */
.filter-container {
    padding: 10px;
    background: white;
    border-radius: 5px;
    box-shadow: 0 0 5px rgba(0,0,0,0.3);
    margin-bottom: 5px;
    max-width: 200px; /* PC表示時の最大幅 */
    display: flex;
    flex-direction: column;
    gap: 5px;
}

/* 検索入力コンテナのスタイル */
.search-input-container {
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    background: white;
    border-radius: 5px;
    border: 1px solid #ccc;
    padding-left: 5px; /* ボタンとのスペースを考慮し、右パディングは削除 */
    width: 100%;
    box-sizing: border-box;
    overflow: hidden; /* ボタンの角丸を綺麗に見せるため */
}

/* 検索アイコンのスタイル */
.search-input-container span {
    margin-right: 5px;
    display: flex;
    align-items: center;
    flex-shrink: 0;
    color: #777;
}

/* --- ▼▼▼ 修正箇所 ▼▼▼ --- */
/* 検索入力フィールドのスタイル */
.search-input-container input[type="search"] {
    flex: 1; /* 残りのスペースを全て埋める */
    padding: 5px;
    font-size: 14px;
    border: none;
    outline: none;
    box-sizing: border-box;
    background-color: transparent;
    /* width: 100% は削除 */
    min-width: 50px; /* 縮小時の最小幅を確保 */
}
/* --- ▲▲▲ 修正箇所 ▲▲▲ --- */


/* フィルターセクションのスタイル */
.filter-section {
    margin-top: 10px;
}

/* 最初のフィルターセクションは上マージンなし */
.filter-section:first-of-type {
    margin-top: 0;
}

/* フィルターセクションのタイトル */
.filter-section p {
    margin: 5px 0;
    font-size: 13px;
    font-weight: bold;
}

/* チェックボックスラベルのスタイル */
.filter-section label {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 13px;
    cursor: pointer;
}

/* チェックボックス自体のスタイル */
.filter-checkbox,
.marker-style-radio {
    margin-right: 5px;
}

/* 雨雲ナウキャストボタンのスタイル */
.nowcast-toggle-button {
    width: 100%;
    padding: 6px 8px;
    background: #f8f8f8;
    border: 1px solid #ccc;
    border-radius: 3px;
    cursor: pointer;
    font-size: 0.9em;
    text-align: left;
    margin-top: 3px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* アクティブ状態のボタン */
.nowcast-toggle-button.active {
    background-color: #e6f2ff;
    border-color: #99ccff;
}

/* 雨雲ナウキャスト凡例のラッパー */
.legend-wrapper-embedded {
    margin-top: 8px;
    background-color: rgba(255, 255, 255, 0.7);
    border-radius: 4px;
    padding: 6px;
}

/* 凡例コンテナ */
.legend-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    margin: 0 auto;
}

/* 凡例のタイトル */
.legend-title {
    font-weight: bold;
    font-size: 12px;
    margin-bottom: 6px;
    text-align: center;
}

/* 単位のスタイル */
.unit {
    font-size: 10px;
    font-weight: normal;
    margin-left: 3px;
}

/* 横型凡例の1列表示 */
.legend-single-row {
    display: flex;
    flex-direction: column;
    width: 100%;
    margin: 5px 0;
}

/* 色を連続表示するバー */
.color-bar {
    display: flex;
    flex-direction: row;
    width: 100%;
    height: 20px;
    border: 1px solid #999;
    border-radius: 2px;
    overflow: hidden;
    box-sizing: border-box;
}

/* 色のセグメント */
.color-segment {
    flex: 1;
    height: 100%;
}

/* 値のラベルコンテナ */
.value-labels {
    display: flex;
    flex-direction: row;
    width: 100%;
    margin-top: 2px;
    position: relative;
}

/* 値のティック(目盛り) */
.value-tick {
    flex: 1;
    font-size: 9px;
    text-align: left;
    position: relative;
    padding-left: 2px;
}

/* GPXボタンコンテナ */
.gpx-action-buttons {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

/* GPXボタンのスタイル */
.gpx-action-buttons button {
    padding: 5px 8px;
    background: #f8f8f8;
    border: 1px solid #ccc;
    border-radius: 3px;
    cursor: pointer;
    font-size: 0.9em;
    width: 100%;
    text-align: center;
}

/* GPXボタンのホバー状態 */
.gpx-action-buttons button:hover {
    background-color: #f0f0f0;
}

/* レスポンシブデザイン対応 */
/* タブレットとスマホ向け (最大幅834px) */
@media screen and (max-width: 834px) {
    .filter-container,
    .map-filter-control.leaflet-control {
        max-width: calc(100% - 20px);
        margin-left: auto;
        margin-right: auto;
        box-sizing: border-box;
    }
    
    /* タブレット向けにボタン領域を拡大 */
    .gpx-action-buttons button,
    .nowcast-toggle-button {
        padding: 8px;
        min-height: 36px; /* タップしやすい高さに */
    }
}

/* 小型スマホ向け (最大幅480px) */
@media screen and (max-width: 480px) {
    .leaflet-control-layers {
        max-height: 70vh;
        font-size: 13px;
    }
    
    .leaflet-control-container .leaflet-top {
        top: 5px;
    }
    
    .leaflet-control-container .leaflet-right {
        right: 5px;
    }
    
    /* モバイル向けにチェックボックス領域を拡大 */
    .filter-section label {
        padding: 3px 0;
        min-height: 24px; /* タップしやすい高さに */
    }
}

/*20250523追加優先*/
.filter-section { margin-top: 5px; }
.filter-section:first-of-type { margin-top: 0; }
.filter-section p { margin: 5px 0; font-size: 13px; font-weight: bold; }
.filter-section label { display: flex; align-items: center; gap: 5px; font-size: 13px; cursor: pointer; }

/* =============================================== */
/* --- モバイル専用検索コントロールのスタイル --- */
/* =============================================== */

.mobile-search-control.leaflet-control {
    background-color: rgba(255, 255, 255, 0.9);
    padding: 5px;
    border-radius: 4px;
    box-shadow: 0 1px 5px rgba(0,0,0,0.4);
    backdrop-filter: blur(3px);
    margin-top: 10px;
    margin-left: 10px;
}

.mobile-search-control .search-input-container {
    margin-bottom: 0;
    min-width: 180px;
    max-width: calc(100vw - 80px);
}

.mobile-search-control .search-input-container input[type="search"] {
    min-height: 30px;
    font-size: 15px;
}

/* =============================================== */
/* --- 検索ボタンのスタイル --- */
/* =============================================== */

.search-button {
    padding: 5px 10px;
    border: none;
    background-color: #f0f0f0;
    color: #333;
    font-size: 13px;
    cursor: pointer;
    border-radius: 0 3px 3px 0; /* 右側の角を丸める */
    margin-left: -1px; /* 入力欄とぴったり合わせる */
    transition: background-color 0.2s;
    flex-shrink: 0; /* ボタンが縮まないようにする */
}

.search-button:hover {
    background-color: #e0e0e0;
}