/* =================================================================
   大型車OKホテルマップ — style.css
   スコープは #app-map-truckhotel に限定
   ================================================================= */

#app-map-truckhotel {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 56px);
    min-height: 480px;
    overflow: hidden;
}

/* ---------- ヘッダー ---------- */
#app-map-truckhotel .th-header {
    flex: 0 0 auto;
    padding: 0.4rem 0.75rem;
    border-bottom: 1px solid var(--bs-border-color);
    background: var(--bs-body-bg);
}
#app-map-truckhotel .th-header-title {
    display: flex;
    align-items: baseline;
}
#app-map-truckhotel .th-counter {
    font-size: 0.95rem;
}
#app-map-truckhotel .th-counter strong {
    color: var(--bs-primary);
    font-size: 1.15rem;
}

/* ---------- 地域ナビ ---------- */
#app-map-truckhotel .th-region-nav {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--bs-border-color);
    background: var(--bs-body-bg);
}
#app-map-truckhotel .th-region-row {
    display: flex;
    gap: 0.4rem;
    overflow-x: auto;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
}
#app-map-truckhotel .th-region-prefs {
    padding-top: 0.4rem;
    border-top: 1px dashed var(--bs-border-color);
}
#app-map-truckhotel .th-region-btn {
    flex: 0 0 auto;
    border: 1px solid var(--bs-border-color);
    background: var(--bs-body-bg);
    color: var(--bs-body-color);
    border-radius: 999px;
    padding: 0.25rem 0.85rem;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}
#app-map-truckhotel .th-region-btn:hover {
    border-color: var(--bs-primary);
    color: var(--bs-primary);
}
#app-map-truckhotel .th-region-btn.is-active {
    background: var(--bs-primary);
    border-color: var(--bs-primary);
    color: #fff;
}
#app-map-truckhotel .th-region-btn-sm {
    padding: 0.18rem 0.7rem;
    font-size: 0.8rem;
    font-weight: 500;
}

/* ---------- コンテンツ（地図＋サイドバー） ---------- */
#app-map-truckhotel .th-content {
    flex: 1 1 auto;
    display: flex;
    min-height: 0;
}
#app-map-truckhotel .th-map-wrap {
    position: relative;
    flex: 1 1 auto;
    min-width: 0;
}
#app-map-truckhotel #map {
    position: absolute;
    inset: 0;
    background: var(--bs-tertiary-bg);
}

/* ---------- 凡例 ---------- */
#app-map-truckhotel .th-legend {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 500;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    padding: 0.4rem 0.6rem;
    background: color-mix(in srgb, var(--bs-body-bg) 92%, transparent);
    border: 1px solid var(--bs-border-color);
    border-radius: 8px;
    font-size: 0.75rem;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
    transition: opacity 0.15s;
}
#app-map-truckhotel .th-legend-group {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
}
#app-map-truckhotel .th-legend-label {
    font-weight: 700;
    font-size: 0.68rem;
    color: var(--bs-secondary-color);
    min-width: 2.8em;
}
#app-map-truckhotel .th-map-wrap.is-popup-open .th-legend {
    opacity: 0;
    pointer-events: none;
}
#app-map-truckhotel .th-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    white-space: nowrap;
}
#app-map-truckhotel .th-legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
}
/* 施設種別 = 色 */
#app-map-truckhotel .th-legend-dot.is-ts { background: #a855f7; }
#app-map-truckhotel .th-legend-dot.is-hotel { background: #3b82f6; }
#app-map-truckhotel .th-legend-dot.is-ryokan { background: #22c55e; }
#app-map-truckhotel .th-legend-dot.is-driver { background: #f59e0b; }
/* 駐車料金 = 塗り（無料）/ 中抜き（有料・不明） */
#app-map-truckhotel .th-legend-dot.is-free {
    background: #64748b;
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px #64748b;
}
#app-map-truckhotel .th-legend-dot.is-paid {
    background: transparent;
    border: 2px solid #64748b;
}

/* ---------- 都道府県バッジ ---------- */
#app-map-truckhotel .th-pref-badge {
    position: absolute;
    left: 10px;
    top: 10px;
    z-index: 500;
    padding: 0.25rem 0.6rem;
    background: color-mix(in srgb, var(--bs-body-bg) 90%, transparent);
    border: 1px solid var(--bs-border-color);
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 700;
    pointer-events: none;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
}

/* ---------- サイドバー ---------- */
#app-map-truckhotel .th-sidebar {
    flex: 0 0 340px;
    max-width: 340px;
    display: flex;
    flex-direction: column;
    border-left: 1px solid var(--bs-border-color);
    background: var(--bs-body-bg);
    overflow: hidden;
    padding: 0.75rem;
    gap: 0.6rem;
}

/* フィルタ */
#app-map-truckhotel .th-filter-label {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--bs-secondary-color);
    margin-bottom: 0.25rem;
}
#app-map-truckhotel .th-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}
#app-map-truckhotel .th-chip {
    border: 1px solid var(--bs-border-color);
    background: var(--bs-body-bg);
    color: var(--bs-body-color);
    border-radius: 999px;
    padding: 0.2rem 0.7rem;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}
#app-map-truckhotel .th-chip:hover {
    border-color: var(--bs-primary);
    color: var(--bs-primary);
}
#app-map-truckhotel .th-chip.is-active {
    background: var(--bs-primary);
    border-color: var(--bs-primary);
    color: #fff;
}
/* 条件トグル（複数選択可）は主フィルタと区別するため成功色 */
#app-map-truckhotel .th-chip.th-chip-cond.is-active {
    background: var(--bs-success);
    border-color: var(--bs-success);
    color: #fff;
}

/* 検索 */
#app-map-truckhotel .th-search-wrap {
    position: relative;
}
#app-map-truckhotel .th-search-wrap .fa-magnifying-glass {
    position: absolute;
    left: 0.6rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--bs-secondary-color);
    font-size: 0.85rem;
    pointer-events: none;
}
#app-map-truckhotel .th-search-wrap input {
    padding-left: 2rem;
    padding-right: 2rem;
}
#app-map-truckhotel .th-search-wrap #hotel-search-clear {
    position: absolute;
    right: 0.4rem;
    top: 50%;
    transform: translateY(-50%);
    border: none;
    background: transparent;
    color: var(--bs-secondary-color);
    cursor: pointer;
}

/* 一覧 */
#app-map-truckhotel .th-list-block {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
}
#app-map-truckhotel .th-list-title {
    font-size: 0.9rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}
#app-map-truckhotel .th-acc-body {
    display: none;
}
#app-map-truckhotel .th-acc.is-open > .th-acc-body {
    display: block;
}
#app-map-truckhotel .th-acc-head {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    width: 100%;
    text-align: left;
    border: none;
    background: transparent;
    color: var(--bs-body-color);
    cursor: pointer;
}
#app-map-truckhotel .th-acc-caret {
    flex: 0 0 auto;
    font-size: 0.7rem;
    color: var(--bs-secondary-color);
    transition: transform 0.15s;
}
#app-map-truckhotel .th-acc.is-open > .th-acc-head .th-acc-caret {
    transform: rotate(90deg);
}
#app-map-truckhotel .th-acc-title {
    flex: 1 1 auto;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
#app-map-truckhotel .th-acc-count {
    flex: 0 0 auto;
    background: var(--bs-tertiary-bg);
    border-radius: 999px;
    padding: 0 0.5rem;
    font-size: 0.72rem;
    color: var(--bs-secondary-color);
}
#app-map-truckhotel .th-acc-area {
    margin-bottom: 0.35rem;
}
#app-map-truckhotel .th-acc-area > .th-acc-head {
    font-size: 0.95rem;
    font-weight: 800;
    padding: 0.5rem 0.35rem;
    border-radius: 8px;
    background: var(--bs-tertiary-bg);
}
#app-map-truckhotel .th-acc-area > .th-acc-head:hover {
    background: var(--bs-secondary-bg);
}
#app-map-truckhotel .th-acc-area > .th-acc-body {
    padding: 0.35rem 0 0.15rem 0.5rem;
}
#app-map-truckhotel .th-acc-pref {
    margin-bottom: 0.15rem;
}
#app-map-truckhotel .th-acc-pref > .th-acc-head {
    font-size: 0.9rem;
    font-weight: 700;
    padding: 0.45rem 0.2rem;
    border-bottom: 1px solid var(--bs-border-color);
}
#app-map-truckhotel .th-acc-pref > .th-acc-head:hover {
    background: var(--bs-tertiary-bg);
}
#app-map-truckhotel .th-acc-pref > .th-acc-body {
    padding: 0.15rem 0 0.35rem 0.35rem;
}

/* 施設行 */
#app-map-truckhotel .th-hotel-row {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    width: 100%;
    text-align: left;
    border: none;
    background: transparent;
    color: var(--bs-body-color);
    padding: 0.45rem 0.3rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
}
#app-map-truckhotel .th-hotel-row:hover {
    background: var(--bs-tertiary-bg);
}
#app-map-truckhotel .th-hotel-chip {
    flex: 0 0 auto;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-top: 0.22rem;
}
#app-map-truckhotel .th-hotel-main {
    flex: 1 1 auto;
    min-width: 0;
}
#app-map-truckhotel .th-hotel-name {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 600;
}
#app-map-truckhotel .th-hotel-meta {
    display: block;
    font-size: 0.72rem;
    color: var(--bs-secondary-color);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
#app-map-truckhotel .th-hotel-free {
    flex: 0 0 auto;
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--bs-success);
    border: 1px solid var(--bs-success);
    border-radius: 4px;
    padding: 0 0.25rem;
    margin-top: 0.15rem;
}

/* ヒント */
#app-map-truckhotel .th-hint {
    margin: 0;
    font-size: 0.78rem;
}

/* ---------- ツールチップ ---------- */
.th-tooltip {
    font-size: 0.78rem;
    font-weight: 600;
}
.th-tooltip .th-tip-type {
    display: inline-block;
    margin-left: 0.4rem;
    padding: 0 0.35rem;
    background: rgba(0, 0, 0, 0.12);
    border-radius: 4px;
    font-weight: 500;
    font-size: 0.7rem;
}

/* ---------- ポップアップ ---------- */
.th-popup-wrap .leaflet-popup-content-wrapper {
    background: var(--bs-body-bg);
    color: var(--bs-body-color);
    border: 1px solid var(--bs-border-color);
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.45);
}
.th-popup-wrap .leaflet-popup-tip {
    background: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color);
}
.th-popup-wrap .leaflet-popup-close-button {
    color: var(--bs-secondary-color) !important;
    width: 22px;
    height: 22px;
    font-size: 20px;
}
.th-popup-wrap .leaflet-popup-content {
    margin: 0.6rem 0.75rem;
}
.th-popup-head {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
    margin-bottom: 0.4rem;
    padding-right: 1.1rem;
}
.th-popup-badge {
    flex: 0 0 auto;
    font-size: 0.7rem;
    font-weight: 700;
    color: #fff;
    border-radius: 4px;
    padding: 0.05rem 0.4rem;
}
.th-popup-name {
    font-weight: 700;
    font-size: 0.95rem;
    width: 100%;
}
.th-popup-addr {
    font-size: 0.75rem;
    color: var(--bs-secondary-color);
    margin-bottom: 0.45rem;
}

/* 駐車情報ボックス（このツールの主役） */
.th-park {
    background: var(--bs-tertiary-bg);
    border-radius: 6px;
    padding: 0.45rem 0.55rem;
    margin-bottom: 0.45rem;
}
.th-park-row {
    display: flex;
    gap: 0.4rem;
    font-size: 0.78rem;
    line-height: 1.5;
}
.th-park-row + .th-park-row {
    margin-top: 0.15rem;
}
.th-park-key {
    flex: 0 0 3.6em;
    color: var(--bs-secondary-color);
    font-weight: 600;
}
.th-park-val {
    flex: 1 1 auto;
    font-weight: 600;
}
.th-park-val .th-free {
    color: var(--bs-success);
    font-weight: 700;
}
.th-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin-bottom: 0.45rem;
}
.th-tag {
    font-size: 0.68rem;
    font-weight: 600;
    border-radius: 999px;
    padding: 0.05rem 0.45rem;
    border: 1px solid var(--bs-border-color);
    color: var(--bs-secondary-color);
}
.th-tag.is-vehicle {
    border-color: var(--bs-primary);
    color: var(--bs-primary);
}
.th-evidence {
    font-size: 0.72rem;
    line-height: 1.5;
    color: var(--bs-secondary-color);
    border-left: 3px solid var(--bs-border-color);
    padding: 0.1rem 0 0.1rem 0.5rem;
    margin-bottom: 0.5rem;
}
.th-evidence a {
    font-size: 0.7rem;
}
.th-actions {
    display: flex;
    gap: 0.35rem;
}
.th-popup-wrap a.th-btn,
.th-popup-wrap a.th-btn:hover,
.th-popup-wrap a.th-btn:focus {
    flex: 1 1 auto;
    display: block;
    text-align: center;
    background: var(--bs-primary);
    color: #fff !important;
    text-decoration: none;
    border-radius: 6px;
    padding: 0.4rem;
    font-size: 0.8rem;
    font-weight: 600;
}
.th-popup-wrap a.th-btn.is-sub,
.th-popup-wrap a.th-btn.is-sub:hover,
.th-popup-wrap a.th-btn.is-sub:focus {
    background: var(--bs-secondary-bg);
    color: var(--bs-body-color) !important;
    border: 1px solid var(--bs-border-color);
}
.th-popup-wrap a.th-btn:hover {
    filter: brightness(1.08);
}

/* ---------- モバイル ---------- */
@media (max-width: 767.98px) {
    #app-map-truckhotel {
        height: auto;
        min-height: 0;
        overflow: visible;
    }
    #app-map-truckhotel .th-content {
        flex-direction: column;
    }
    #app-map-truckhotel .th-map-wrap {
        height: 62vh;
        min-height: 340px;
        flex: 0 0 auto;
    }
    #app-map-truckhotel .th-sidebar {
        flex: 1 1 auto;
        max-width: none;
        border-left: none;
        border-top: 1px solid var(--bs-border-color);
        max-height: none;
        overflow: visible;
    }
    #app-map-truckhotel .th-list-block {
        overflow: visible;
    }
    #app-map-truckhotel .th-legend {
        font-size: 0.68rem;
        padding: 0.3rem 0.45rem;
    }
}
