/* --- 1. 基本・全体レイアウト --- */
html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

body {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

/* --- 2. ヘッダー (ナビゲーション用) --- */
header {
    background: #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    padding: 10px 12px;
    z-index: 1001;
    /* マップより手前 */
    position: relative;
}

header h1 {
    font-size: 1.05em;
    margin: 0 0 8px 0;
    text-align: center;
    color: #333;
}

#controls {
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
}

#controls button, #controls select {
    padding: 8px 10px;
    font-weight: bold;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    background: #007aff;
    color: #fff;
}

#controls button.secondary {
    background: #6c757d;
}

#nav-status {
    margin-left: 8px;
    font-size: 0.9em;
    color: #333;
}

/* --- 3. マップコンテナ と マップ本体 --- */
#map-container {
    flex: 1;
    /* 残りの高さをすべて占める */
    position: relative;
    /* オーバーレイ配置の基準 */
    width: 100%;
    min-height: 200px;
    background: #e0e0e0;
    /* マップ読み込み中の背景 */
}

#map {
    width: 100%;
    height: 100%;
}

/* --- 4. マップオーバーレイ・コントロール --- */
/* コントロール群の共通スタイル */
#map-controls-top-right,
#map-controls-bottom-left,
#map-controls-bottom-right {
    position: absolute;
    z-index: 10;
    display: flex;
    gap: 8px;
}

/* マップ上のボタン・セレクトの基本デザイン */
#map-controls-top-right button, #map-controls-top-right select,
#map-controls-bottom-left button,
#map-controls-bottom-right button {
    padding: 8px 12px;
    font-weight: bold;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    background: #fff;
    color: #333;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    font-size: 0.95em;
}

/* 右上の配置 (フィルター) */
#map-controls-top-right {
    top: 10px;
    right: 10px;
    flex-direction: column;
    align-items: flex-end;
}

#map-controls-top-right select {
    min-width: 160px;
}

/* 左下の配置 (描画) */
#map-controls-bottom-left {
    bottom: 10px;
    left: 10px;
}

/* 右下の配置 (現在地) */
#map-controls-bottom-right {
    bottom: 10px;
    right: 10px;
}

/* --- 5. オーバーレイ・ボタンの配色 --- */

/* プライマリボタン (検索, 範囲) */
#search-button,
#draw-button {
    background: #007aff;
    color: #fff;
}

/* セカンダリボタン (クリア) */
#clear-button {
    background: #6c757d;
    color: #fff;
}

/* 現在地ボタン (丸型アイコン) */
button#current-location-button {
    font-size: 1.2em;
    padding: 10px;
    border-radius: 50%;
    width: 44px;
    /* 固定幅 */
    height: 44px;
    /* 固定高 */
    line-height: 1;
    /* アイコン中央寄せ */
}


/* --- 6. 検索結果リスト --- */
#results {
    display: none;
    /* JSで 'block' に切り替え */
    padding: 12px;
    overflow-y: auto;
    max-height: 36vh;
    /* 高さを画面の36%までに制限 */
    border-top: 1px solid #ddd;
    background: #f8f9fa;
    box-sizing: border-box;
    /* paddingを含めて高さを計算 */
}

.result-item {
    display: flex;
    align-items: center;
    padding: 10px 6px;
    border-bottom: 1px solid #e9ecef;
    cursor: pointer;
}

.result-item:last-child {
    border-bottom: none;
}

.place-photo {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    object-fit: cover;
    margin-right: 12px;
    background: #ccc;
    /* 画像がない場合の背景 */
    flex-shrink: 0;
}

.place-details {
    flex: 1;
    min-width: 0;
    /* flex-itemが縮小できるように */
}

/* 駐車場の空き状況バッジ */
.badge {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 6px;
    font-size: 0.8em;
    color: #fff;
    margin-left: 6px;
}

.badge.available {
    background: #28a745;
}

.badge.full {
    background: #dc3545;
}

.badge.unknown {
    background: #6c757d;
}

/* マーカーと連動するハイライト */
.highlighted {
    background: #dbeaff;
    border-left: 4px solid #007aff;
}


/* --- 7. レスポンシブ対応 (モバイル) --- */
@media (max-width: 640px) {

    /* ヘッダー内コントロールの調整 */
    #controls {
        gap: 6px;
    }

    #controls button, #controls select {
        padding: 6px 8px;
        font-size: 0.9em;
    }

    /* マップオーバーレイの共通調整 */
    #map-controls-top-right,
    #map-controls-bottom-left,
    #map-controls-bottom-right {
        gap: 6px;
    }


    /* 右上 (フィルター) */
    #map-controls-top-right {
        top: 8px;
        right: 8px;
    }

    /* 左下 (描画) */
    #map-controls-bottom-left {
        bottom: 14px;
        left: 14px;
        flex-wrap: wrap;
        /* 画面が狭い時にボタンを縦並びにする */
    }

    /* 右下 (現在地) */
    #map-controls-bottom-right {
        bottom: 14px;
        right: 14px;
    }

    /* マップ上のボタン・セレクトのサイズ調整 */
    #map-controls-top-right button,
    #map-controls-top-right select,
    #map-controls-bottom-left button {
        padding: 7px 10px;
        font-size: 0.9em;
    }

    /* セレクトボックスの最小幅を解除し、幅を指定 */
    #map-controls-top-right select {
        min-width: 0;
        width: 130px;
    }

    /* 検索ボタンも幅を合わせる */
    #map-controls-top-right button#search-button {
        width: 130px;
        box-sizing: border-box;
    }



    /* 現在地ボタン (小) */
    #current-location-button {
        padding: 8px;
        width: 38px;
        height: 38px;
    }
}

/* ポリシー削除 */
.gm-style-cc {
    display: none !important;
}

.parking-badge {
    background: #28a745;
    color: #fff;
    font-size: 0.75em;
    padding: 2px 6px;
    border-radius: 6px;
    margin-left: 6px;
}
