/* =========================================
   基本レイアウト
   ========================================= */
body,
html {
    margin: 0;
    padding: 0;
    height: 100%;
    overflow: hidden;
}

#map {
    width: 100%;
    height: 100vh;
    position: relative;
    background-color: #ffffff;
}

/* =========================================
   ヘッダー・タイトルエリア
   ========================================= */
#map-title {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 55px;
    z-index: 2000;
    background-color: rgba(255, 255, 255, 0.9);
    color: #333;
    font-family: 'Zen Maru Gothic', serif;
    font-weight: 700;
    font-size: 28px;
    line-height: 55px;
    text-align: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    letter-spacing: 0.1em;
    pointer-events: auto;
}

#home-link {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    text-decoration: none;
    color: #be2e2e;
    font-size: 14px;
    font-family: 'Noto Sans JP', sans-serif;
    border: 1px solid #be2e2e;
    height: 28px;
    line-height: 28px;
    padding: 0 15px;
    border-radius: 15px;
    background: rgba(255, 255, 255, 0.8);
    transition: all 0.3s;
}

#home-link:hover {
    background: #be2e2e;
    color: #fff;
}

/* =========================================
   検索機能（検索窓・結果リスト）
   ========================================= */
#search-wrapper {
    position: fixed;
    top: 65px;
    left: 10px;
    z-index: 2500;
}

#search-container {
    box-sizing: border-box;
    display: flex;
    align-items: center;
    background: white;
    border: 2px solid rgba(0, 0, 0, 0.2);
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transition: width 0.3s ease;
    width: 34px;
    height: 34px;
}

#search-container.expanded {
    width: 250px;
}

#search-toggle {
    width: 30px;
    height: 30px;
    background: white;
    border: none;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#search-input {
    width: 100%;
    border: none;
    padding: 0 10px;
    font-size: 16px; /* 自動ズーム防止 */
    font-family: 'Noto Sans JP', sans-serif;
    outline: none;
    display: none;
}

#search-container.expanded #search-input {
    display: block;
}

#search-results {
    list-style: none;
    margin: 4px 0 0;
    padding: 0;
    background: white;
    max-height: 250px;
    overflow-y: auto;
    border-radius: 4px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    display: none;
    width: 250px;
}

#search-results li {
    padding: 8px 12px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    font-size: 13px;
    font-family: 'Noto Sans JP', sans-serif;
}

#search-results li.active {
    background-color: #be2e2e;
    color: white;
}

#search-results li.active .sub-text {
    color: #ffdada;
}

#search-results li:hover:not(.active) {
    background-color: #f8f8f8;
}

#search-results li .sub-text {
    font-size: 10px;
    color: #888;
    display: block;
}

/* =========================================
   Leafletコントロール調整
   ========================================= */
.leaflet-top.leaflet-right {
    top: 65px !important;
}

.leaflet-bar,
.leaflet-control-layers {
    margin-top: 0 !important;
    border: 2px solid rgba(0, 0, 0, 0.2) !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important;
}

/* =========================================
   地図上のラベル（小字・大字）
   ========================================= */
.label-hidden {
    opacity: 0 !important;
    visibility: hidden;
}

.koaza-label,
.oaza-label {
    font-family: 'Noto Sans JP', sans-serif;
    text-align: center;
    pointer-events: none;
    transition: opacity 0.3s ease;
    text-shadow: 1px 1px 0 #fff, -1px 1px 0 #fff, 1px -1px 0 #fff, -1px -1px 0 #fff;
}

.koaza-label {
    color: #be2e2e;
}

.koaza-label .label-read {
    font-size: 8px;
    font-weight: 700;
    line-height: 1.1;
}

.koaza-label .label-name {
    font-size: 11px;
    font-weight: 700;
    line-height: 1.1;
}

.oaza-label {
    color: rgba(22, 90, 200, 0.7);
}

.oaza-label .label-read {
    font-size: 12px;
    font-weight: 700;
    line-height: 1.1;
}

.oaza-label .label-name {
    font-size: 18px;
    font-weight: 700;
    line-height: 1.1;
}

/* =========================================
   ポップアップ内テーブル
   ========================================= */
.koaza-popup-table {
    border-collapse: collapse;
    width: 220px;
    font-size: 12px;
}

.koaza-popup-table th,
.koaza-popup-table td {
    border: 1px solid #ccc;
    padding: 6px;
}

.koaza-popup-table th {
    background-color: #f4f4f4;
    width: 80px;
    text-align: left;
}

/* =========================================
   同意モーダル（初回アクセス時）
   ========================================= */
#consent-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

#consent-modal {
    background: white;
    padding: 30px;
    border-radius: 12px;
    max-width: 500px;
    width: 90%;
    text-align: center;
    font-family: 'Noto Sans JP', sans-serif;
}

#consent-modal h2 {
    font-family: 'Zen Maru Gothic', serif;
    color: #be2e2e;
    margin-top: 0;
}

#consent-content {
    text-align: left;
    font-size: 14px;
    margin: 20px 0;
    background: #fafafa;
    padding: 15px;
    border: 1px solid #eee;
    font-family: 'Noto Sans JP', sans-serif;
    line-height: 1.6;
}

#consent-btn {
    background: #be2e2e;
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 25px;
    font-weight: 700;
    cursor: pointer;
    font-family: 'Noto Sans JP', sans-serif;
}

.modal-open {
    overflow: hidden;
}

/* =========================================
   レスポンシブ設定（スマホ・タブレット）
   ========================================= */
@media (max-width: 768px) {
    #map-title {
        font-size: 20px;
        height: 50px;
        line-height: 50px;
    }

    #home-link {
        font-size: 12px;
        padding: 0 10px;
        right: 10px;
    }

    #search-wrapper,
    .leaflet-top.leaflet-right {
        top: 60px !important;
    }
}
