/* ==========================================================
   1. 共通パーツ (ピン、ポップアップ、ツールチップ、フィルターUI)
   ========================================================== */

/* フィルターUI */
.filter-bar-container {
    position: absolute;
    top: 0px;
    left: 55px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 5px;
    background: rgba(255, 255, 255, 0.9);
    padding: 8px;
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    pointer-events: auto;
}

.filter-buttons-row {
    display: flex;
    gap: 4px;
    overflow-x: auto;
    white-space: nowrap;
}

.filter-btn {
    padding: 4px 6px;
    border: 1px solid #2ecc71;
    background: #ffffff;
    cursor: pointer;
    border-radius: 20px;
    font-size: 11px;
    color: #2ecc71;
    transition: all 0.2s;
    font-weight: 600;
}

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

.filter-btn.active {
    background: #2ecc71;
    color: white;
    border-color: #27ae60;
}

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

/* ピン・アイコン */
.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;
}

.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;
}

.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;
}

.map-btn-blue {
    background-color: #85c1e9;
}

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

/* ==========================================================
   2. マップ自体の基本スタイル (小さいマップにも適用)
   ========================================================== */
#map {
    width: 100%;
    background: #f0f2f5;
}

/* ==========================================================
   3. 全画面マップ専用レイアウト (親に .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;
}

.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;
}

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

/* ==========================================================
   4. レスポンシブ
   ========================================================== */
@media screen and (max-width: 1024px) {
    /* 必要であればカード内のマップ高さをここで微調整できます */
    /* #map { height: 500px !important; } */
}

@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;
    }
}