/* =================================================================
 * 日本百名湯 制覇ログ — style.css (Leaflet 版・モバイルファースト)
 * ================================================================= */

/* ---------- レイアウト ---------- */

.app-onsen-main {
    display: flex;
    flex-direction: column;
    background: var(--bs-body-bg);
    min-height: 100dvh;
}

/* ヘッダー */
.on-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.6rem 1rem;
    border-bottom: 1px solid var(--bs-border-color);
    background: var(--bs-body-bg);
    flex-shrink: 0;
}

.on-header-title {
    display: flex;
    align-items: center;
    min-width: 0;
    flex: 1;
}

.on-header-actions {
    flex-shrink: 0;
}

.on-counter {
    display: inline-flex;
    align-items: baseline;
    gap: 0.15rem;
    white-space: nowrap;
}

.on-counter strong {
    font-size: 1.15rem;
    color: var(--bs-primary);
    font-weight: 800;
}

.on-filter-select {
    width: auto;
    min-width: 11rem;
    max-width: 16rem;
}

/* 地域ナビ */
.on-region-nav {
    display: flex;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    border-bottom: 1px solid var(--bs-border-color);
    background: var(--bs-body-tertiary-bg);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    flex-shrink: 0;
}

.on-region-nav::-webkit-scrollbar {
    height: 4px;
}

.on-region-nav::-webkit-scrollbar-thumb {
    background: var(--bs-border-color);
    border-radius: 2px;
}

.on-region-btn {
    flex-shrink: 0;
    padding: 0.35rem 0.9rem;
    border: 1px solid var(--bs-border-color);
    background: var(--bs-body-bg);
    color: var(--bs-body-color);
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.15s, color 0.15s, border-color 0.15s;
    white-space: nowrap;
}

.on-region-btn:hover {
    background: var(--bs-primary-bg-subtle);
    border-color: var(--bs-primary);
    color: var(--bs-primary);
}

.on-region-btn.is-active {
    background: var(--bs-primary);
    color: #fff;
    border-color: var(--bs-primary);
}

/* メインコンテンツ */
.on-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.on-map-wrap {
    position: relative;
    flex-shrink: 0;
    width: 100%;
    background: #e0f2fe;
}

[data-bs-theme="dark"] .on-map-wrap {
    /* タイル間の隙間（読み込み中のチラ見え）と同じ暗色 */
    background: #1a2433;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1);
}

/* 地理院タイル（淡色地図）はライト前提なので、ダークモードでは invert で暗転 */
[data-bs-theme="dark"] .leaflet-tile-pane {
    filter: invert(0.92) hue-rotate(180deg) brightness(0.95) contrast(0.95);
}

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

/* 凡例 */
.on-legend {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 600;
    background: rgba(var(--bs-body-bg-rgb), 0.92);
    border: 1px solid var(--bs-border-color);
    border-radius: 8px;
    padding: 0.35rem 0.65rem;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
    font-size: 0.78rem;
    display: flex;
    gap: 0.75rem;
    backdrop-filter: blur(4px);
}

.on-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    color: var(--bs-body-color);
}

.on-legend-dot {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    line-height: 1;
    /* 絵文字フォントを使わず、color が効くテキスト記号として描画する */
    font-family: "Hiragino Sans", "Yu Gothic", "Meiryo", system-ui, sans-serif;
    font-weight: 700;
}

.on-legend-dot.is-none {
    background: #fff;
    border: 1.5px solid #94a3b8;
    color: #64748b;
}

.on-legend-dot.is-visited {
    background: #d97706;
    color: #ffffff;
    border: 1.5px solid #b45309;
}

[data-bs-theme="dark"] .on-legend-dot.is-none {
    background: #1e293b;
    border-color: #94a3b8;
    color: #ffffff;
}

/* サイドバー */
.on-sidebar {
    background: var(--bs-body-bg);
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    flex: 1;
    min-height: 0;
    min-width: 0;
}

.on-progress-block {
    padding: 0.6rem 0.85rem;
    background: var(--bs-body-tertiary-bg);
    border-radius: 10px;
    min-width: 0;
}

.on-progress {
    height: 12px;
    border-radius: 6px;
    background: var(--bs-secondary-bg);
}

.on-list-block {
    flex: 1;
    min-height: 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.on-list-title {
    font-size: 0.95rem;
    font-weight: 700;
    margin: 0 0 0.6rem;
    color: var(--bs-body-color);
    flex-shrink: 0;
}

.on-list {
    flex: 1;
    overflow-y: auto;
    min-height: 60px;
    padding-right: 0.25rem;
}

.on-region-block + .on-region-block {
    margin-top: 0.9rem;
}

.on-region-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    border-bottom: 1px solid var(--bs-border-color);
    padding-bottom: 0.2rem;
    margin-bottom: 0.45rem;
}

.on-region-name {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--bs-secondary-color);
}

.on-region-count {
    font-size: 1rem;
    font-weight: 700;
    color: var(--bs-primary);
    line-height: 1;
}

.on-region-unit {
    font-size: 0.7rem;
    color: var(--bs-secondary-color);
    margin-left: 2px;
    font-weight: 400;
}

.on-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.on-badge {
    border: 1px solid var(--bs-border-color);
    background: var(--bs-body-bg);
    color: var(--bs-body-color);
    border-radius: 8px;
    padding: 3px 9px;
    font-size: 0.78rem;
    cursor: pointer;
    transition: background-color 0.15s, border-color 0.15s, transform 0.1s;
    line-height: 1.4;
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

.on-badge:hover {
    background: var(--bs-primary-bg-subtle);
    border-color: var(--bs-primary);
    color: var(--bs-primary);
}

.on-badge:active {
    transform: scale(0.96);
}

.on-badge-mark {
    color: #d97706;
    font-size: 0.85rem;
    line-height: 1;
}

.on-hint {
    margin: 0;
    padding: 0.6rem 0.85rem;
    font-size: 0.8rem;
}

.on-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* ---------- Leaflet マーカー (♨) ---------- */

.on-marker {
    background: transparent !important;
    border: 0 !important;
    cursor: pointer;
    display: flex !important;
    align-items: center;
    justify-content: center;
}

.on-marker-inner {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    line-height: 1;
    border: 2px solid;
    transition: background-color 0.2s, color 0.2s, border-color 0.2s, transform 0.15s, box-shadow 0.15s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
    /* ♨ は絵文字フォント (Apple Color Emoji 等) を使うと固定カラーで描画され color が効かない。
       テキスト記号として描画させるため、絵文字フォントを避けたシンプルな sans-serif スタックを採用。
       Variation Selector U+FE0E を文字列側で付けるとさらに確実 (main.js 側で対応)。 */
    font-family: "Hiragino Sans", "Yu Gothic", "Meiryo", system-ui, sans-serif;
    font-weight: 700;
}

.on-marker.is-none .on-marker-inner {
    background: #ffffff;
    color: #64748b;
    border-color: #94a3b8;
}

.on-marker.is-visited .on-marker-inner {
    background: #d97706;     /* 温泉オレンジ */
    color: #ffffff;
    border-color: #b45309;
}

.on-marker:hover .on-marker-inner {
    transform: scale(1.25);
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.5);
}

[data-bs-theme="dark"] .on-marker.is-none .on-marker-inner {
    background: #1e293b;
    color: #ffffff;
    border-color: #cbd5e1;
}

[data-bs-theme="dark"] .on-marker.is-visited .on-marker-inner {
    background: #d97706;
    color: #ffffff;
    border-color: #b45309;
}

/* Leaflet ツールチップ */
.on-tooltip {
    background: rgba(33, 37, 41, 0.94);
    color: #fff;
    border: 0;
    border-radius: 6px;
    padding: 4px 9px;
    font-size: 0.82rem;
    font-weight: 600;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

.on-tooltip::before {
    border-top-color: rgba(33, 37, 41, 0.94) !important;
}

/* Leaflet 帰属表示を控えめに */
.leaflet-control-attribution {
    font-size: 0.65rem !important;
    background: rgba(255, 255, 255, 0.75) !important;
}

[data-bs-theme="dark"] .leaflet-control-attribution {
    background: rgba(15, 23, 42, 0.75) !important;
    color: #cbd5e1 !important;
}

[data-bs-theme="dark"] .leaflet-control-attribution a {
    color: #9d83d9 !important;
}

[data-bs-theme="dark"] .leaflet-bar a {
    background-color: #1e293b;
    color: #e2e8f0;
    border-bottom-color: #334155;
}

[data-bs-theme="dark"] .leaflet-bar a:hover {
    background-color: #334155;
}

/* ---------- ローディング ---------- */

.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.88);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.loading-overlay[hidden] {
    display: none;
}

/* ---------- レスポンシブ ---------- */

@media (max-width: 991.98px) {
    .on-header {
        padding: 0.5rem 0.75rem;
    }

    .on-region-nav {
        padding: 0.45rem 0.75rem;
    }

    .on-filter-select {
        min-width: 9rem;
        max-width: 12rem;
        font-size: 0.8rem;
    }

    .on-map-wrap {
        height: 60dvh;
        min-height: 360px;
    }

    .on-sidebar {
        padding: 0.85rem 0.85rem 1.5rem;
        border-top: 1px solid var(--bs-border-color);
    }

    .on-list {
        max-height: none;
        overflow: visible;
    }

    .on-list-block {
        flex: initial;
    }

    .on-marker-inner {
        width: 32px;
        height: 32px;
        font-size: 20px;
    }
}

@media (min-width: 992px) {
    .app-onsen-main {
        height: calc(100vh - 60px);
        min-height: 640px;
        max-height: 100dvh;
    }

    .on-content {
        flex-direction: row;
    }

    .on-map-wrap {
        flex: 7;
        height: auto;
        min-width: 0;
    }

    .on-sidebar {
        flex: 3;
        max-width: 480px;
        min-width: 300px;
        flex-shrink: 0;
        border-left: 1px solid var(--bs-border-color);
        overflow-y: auto;
    }
}

/* X (旧 Twitter) シェアボタン: ダークモードで body bg と同化しないよう、純黒+ボーダーで分離 */
[data-bs-theme="dark"] #btn-share-x {
    background-color: #000000;
    border: 1px solid #495057;
    color: #ffffff;
}
[data-bs-theme="dark"] #btn-share-x:hover {
    background-color: #1a1a1a;
    border-color: #6c757d;
    color: #ffffff;
}
