/* ==========================================================
   1. ピン・アイコン（Leaflet divIcon用）
   ========================================================== */

.custom-div-icon {
    background: none !important;
    border: none !important;
}

/* 空港・都市ピン（起点） */
.airport-pin {
    position: relative;
    width: 40px;
    height: 40px;
}

.airport-pin-svg {
    fill: #e74c3c;
    stroke: #fff;
    stroke-width: 2;
    filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.3));
}

.airport-icon-inner {
    position: absolute;
    top: 8px;
    left: 0;
    width: 40px;
    text-align: center;
    color: white;
    font-weight: bold;
    font-size: 16px;
    pointer-events: none;
}

/* 観光協会ピン（HUB/LOCAL） */
.assoc-pin {
    position: relative;
    width: 28px;
    height: 38px;
}

.pin-svg-blue {
    fill: #3498db;
    stroke: #fff;
    stroke-width: 2;
    filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.3));
}

.pin-svg-gray {
    fill: #95a5a6;
    stroke: #fff;
    stroke-width: 2;
    filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.2));
}

.pin-svg-local {
    fill: #64B5F6;
    stroke: #fff;
    stroke-width: 2;
    filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.3));
}

.pin-number {
    position: absolute;
    top: 6px;
    left: 0;
    width: 28px;
    text-align: center;
    color: white;
    font-weight: 800;
    font-size: 10px;
    pointer-events: none;
}

/* 観光スポットピン */
.spot-pin-wrap {
    position: relative;
    width: 24px;
    height: 32px;
}

.spot-pin-svg {
    fill: #2ecc71;
    stroke: #fff;
    stroke-width: 1.5;
    filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.3));
}

.spot-icon-inner {
    position: absolute;
    top: 5px;
    left: 0;
    width: 24px;
    text-align: center;
    font-size: 10px;
    pointer-events: none;
}

/* ツールチップ（ピンホバー時のラベル） */
.custom-tooltip {
    background: rgba(44, 62, 80, 0.95) !important;
    color: #fff !important;
    border: 1px solid #fff !important;
    border-radius: 6px !important;
    padding: 6px 10px !important;
    font-weight: bold !important;
    font-size: 13px !important;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3) !important;
    white-space: nowrap;
}


/* ==========================================================
   2. ポップアップ：基本構造（createPopupHtmlの土台）
   ========================================================== */

.popup-card {
    width: 250px;
}

/* 旧タイトル形式（スポットピン・都市ピン・空港ピンが使用中） */
.popup-title {
    font-size: 16px;
    font-weight: bold;
    padding-bottom: 5px;
    margin-bottom: 10px;
    display: block;
    text-decoration: underline;
}

.popup-title-assoc {
    color: #0056b3;
    border-bottom: 2px solid #3498db;
}

.popup-title-spot {
    color: #219150;
    border-bottom: 2px solid #2ecc71;
}

.popup-title-airport {
    color: #c0392b;
    border-bottom: 2px solid #e74c3c;
}

.info-row {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
    font-size: 13px;
    text-decoration: none;
}

/* 大型ボタン（プラン追加ボタン等が流用） */
.map-card-btn {
    display: block;
    width: 100%;
    padding: 10px 0;
    margin-top: 8px;
    border-radius: 8px;
    text-align: center;
    color: white;
    font-weight: bold;
    text-decoration: none;
    font-size: 13px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.map-btn-red {
    background-color: #f28d85;
}

/* 未使用の可能性：旧「出発地を変更して計画」ボタン用。Phase1で全ピンから削除済みだが、
   他画面（書籍マップ等）で参照されていないか確認が取れるまで残す */
.map-btn-blue {
    background-color: #85c1e9;
}

.map-btn-orange {
    background-color: #f8c471;
    color: #784212;
}


/* ==========================================================
   3. ポップアップ：協会ピン専用（Phase1改修分）
   ========================================================== */

/* 公式サイト誘導ボタン（旧・下線テキストリンクから格上げ） */
.popup-title-site-btn {
    display: block;
    text-align: center;
    background: #fff;
    border: 2px solid #007bff;
    color: #007bff;
    font-weight: bold;
    border-radius: 8px;
    padding: 8px 12px;
    margin-bottom: 8px;
    text-decoration: none;
    font-size: 1rem;
}

.popup-title-site-btn:hover {
    background: #007bff;
    color: #fff;
}

/* ボタン内、協会名部分だけ強調 */
.popup-assoc-name {
    font-weight: 500;
}

.popup-assoc-suffix {
    font-weight: 400;
}

/* 天気予報・イベント情報（Japan47GO）の横並びリンク */
.popup-info-row {
    display: flex;
    gap: 8px;
    margin: 8px 0;
}

.popup-info-link {
    flex: 1;
    font-size: 12px;
    text-decoration: none;
}

.popup-info-weather {
    color: #ed9121;
}

.popup-info-event {
    color: #007bff;
}

/* カテゴリ内訳チップ（旧・オレンジ3ボタンの代わり） */
.assoc-category-breakdown {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin: 6px 0;
}

.assoc-category-chip {
    background: #eef3f8;
    border: 1px solid #ccd6e0;
    border-radius: 12px;
    padding: 3px 8px;
    font-size: 0.75rem;
    color: #333;
    cursor: pointer;
}

.assoc-category-chip:hover {
    background: #dce6f0;
}

.assoc-category-hint {
    font-size: 0.7rem;
    color: #888;
    margin-bottom: 6px;
}

/* 「○○から行く」の小型テキストリンク化（旧・赤ボタン） */
.popup-bottom-info {
    text-align: center;
    margin-top: 8px;
}

.popup-route-link {
    font-size: 11px;
    color: #888;
    text-decoration: none;
}


/* ==========================================================
   4. ポップアップ：スポット・都市・空港ピン専用（オレンジ3ボタン維持組）
   ========================================================== */

/* 周辺検索3ボタン：小型・横並び */
.search-group {
    display: flex;
    gap: 4px;
}

.search-label {
    font-size: 11px;
    color: #888;
    margin-top: 4px;
}

.map-btn-xs {
    flex: 1;
    padding: 4px 2px;
    font-size: 0.75rem;
    text-align: center;
}


/* ==========================================================
   5. カテゴリ絞り込みパネル（L.Control.CategoryFilter）
   ※ 過去2回に分けて追記された定義を、実際に効いている値へ統合済み
   ========================================================== */

.filter-bar-container {
    position: absolute;
    top: 0px;
    left: 55px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 5px;
    background: white;
    padding: 8px;
    border: 2px solid rgba(0, 0, 0, 0.2);
    border-radius: 4px;
    width: 260px;
    box-shadow: 0 1px 5px rgba(0, 0, 0, 0.3);
    pointer-events: auto;
}

/* Leafletの標準コントロール位置に対する微調整 */
.leaflet-top.leaflet-left .filter-bar-container {
    margin-top: 5px !important;
    margin-left: 10px !important;
}

/* 5列×2段グリッド */
.filter-buttons-row {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    justify-content: space-between;
    overflow-x: auto;
    white-space: nowrap;
}

.filter-btn {
    flex: 0 0 18.5%;
    padding: 4px 0;
    border: 1px solid #ccc;
    background: #f8f9fa;
    cursor: pointer;
    border-radius: 4px;
    font-size: 10px;
    color: #2ecc71;
    transition: all 0.2s;
    font-weight: 600;
    text-align: center;
}

.filter-btn:hover {
    background: #e8f8f0;
}

.filter-btn.active {
    background-color: #28a745 !important;
    color: white !important;
    border-color: #27ae60;
}

.hidden-ui {
    display: none !important;
}

/* 未使用の可能性：将来の協会単位フィルターUI用に確保されたクラスの見込み。要確認 */
.assoc-filter-bar-container {
    background: white;
    border-radius: 8px;
    padding: 8px 10px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    border: 1px solid #ddd;
}


/* ==========================================================
   6. マップ自体の基本スタイル
   ========================================================== */

#map {
    width: 100%;
    background: #f0f2f5;
}


/* ==========================================================
   7. 全画面マップ専用レイアウト（親に .map-page-container がある場合のみ）
   ========================================================== */

.map-page-container {
    position: relative;
    width: 100%;
    height: 100dvh;
    overflow: hidden;
}

.map-page-container #map {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.map-page-container .leaflet-top.leaflet-left {
    top: 110px !important;
}

.top-control-bar {
    position: absolute;
    top: 50px;
    left: 15px;
    z-index: 2000;
}

.btn-back-compact {
    background-color: rgba(255, 255, 255, 0.95) !important;
    color: #0056b3 !important;
    border: 1px solid #0056b3 !important;
    padding: 6px 16px !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    border-radius: 20px !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15) !important;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}

.btn-back-compact:active {
    background-color: #eef7ff !important;
    transform: translateY(1px);
}

.bottom-copyright {
    position: absolute;
    bottom: 10px;
    right: 10px;
    z-index: 1000;
    font-size: 11px;
    color: #666;
    background: rgba(255, 255, 255, 0.8);
    padding: 4px 8px;
    border-radius: 4px;
    pointer-events: none;
}

/* 拡大マップ用ボタン（色は3案コメントアウト中、③ミント案が有効。色味相談時に決定） */
.map-expand-btn {
    /* ① 琥珀色(オレンジ系)の場合 */
    /* background-color: #e67e22 !important;
    border-color: #e67e22 !important; */

    /* ② ダークスレート(濃紺グレー)の場合 */
    /* background-color: #34495e !important;
       border-color: #34495e !important; */

    /* ③ ミント(青緑)の場合 ← 現在有効 */
    background-color: #1abc9c !important;
    border-color: #1abc9c !important;

    color: #ffffff !important;
    padding: 3px 10px !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    border-radius: 4px !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2) !important;
    display: inline-block;
    transition: all 0.2s ease !important;
}

.map-expand-btn:hover {
    filter: brightness(110%);
    transform: translateY(-1px);
}


/* ==========================================================
   8. レスポンシブ（スマホ表示）
   ========================================================== */

@media screen and (max-width: 600px) {
    .leaflet-popup {
        max-width: 95vw !important;
    }

    .leaflet-popup-content-wrapper {
        padding: 5px;
    }

    .popup-card {
        width: 100% !important;
        box-sizing: border-box;
    }

    .popup-title {
        font-size: 18px !important;
    }

    .info-row {
        font-size: 16px !important;
        padding: 4px 0;
    }
}