/*
Theme Name: Betheme Child
Theme URI: https://themes.muffingroup.com/betheme
Author: Muffin group
Author URI: https://muffingroup.com
Description: Child Theme for Betheme
Template: betheme
Version: 2.0.2
*/

/* ===== Leaflet マーカー共通 ===== */
.kendo-marker {
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-weight: bold;
    font-size: 12px;
    color: #fff;
    border: 2px solid rgba(255,255,255,0.8);
    box-shadow: 0 1px 4px rgba(0,0,0,0.4);
}
.kendo-marker--budokan { background: #2c5f8a; }
.kendo-marker--kendo   { background: #8a2c2c; }

/* ===== Facility CPT styles ===== */
.facility-section { padding: 30px 0; }

.facility-hero { margin-bottom: 24px; }
.facility-type-badge {
    display: inline-block;
    color: #fff;
    font-size: 0.75em;
    padding: 3px 10px;
    border-radius: 3px;
    margin-bottom: 8px;
    background: #2c5f8a;
}
.facility-type-badge--budokan { background: #2c5f8a; }
.facility-type-badge--kendo   { background: #8a2c2c; }
/* バッジ＋天気ticker 横並び */
.facility-badge-weather-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
    overflow: hidden;
}
.facility-weather-ticker {
    flex: 1;
    overflow: hidden;
    background: rgba(0,0,0,0.04);
    border-radius: 3px;
    padding: 2px 6px;
    font-size: 0.78em;
    color: #555;
    white-space: nowrap;
}
.facility-weather-ticker-inner {
    display: inline-block;
    padding-left: 100%;
    animation: weatherTicker 16.7s linear infinite;
}
@keyframes weatherTicker {
    0%   { transform: translateX(0); }
    100% { transform: translateX(-100%); }
}

.facility-name { font-size: 1.8em; margin: 0 0 8px; color: #333; }
.facility-address { color: #555; margin: 0; }
.facility-addr-link { color: inherit; text-decoration: none; border-bottom: 1px dotted #aaa; }
.facility-addr-link:hover { color: #2c5f8a; border-bottom-color: #2c5f8a; }

/* 地図 + フローティングパネル */
.facility-map-section {
    position: relative;
    height: 70vh;
    margin-bottom: 8px;
    border-radius: 8px;
    overflow: hidden;
}
.facility-map-section iframe {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    border: none;
}
.facility-map-link {
    position: absolute;
    bottom: 6px; right: 8px;
    font-size: 0.78em;
    color: #2c5f8a;
    background: rgba(255,255,255,0.85);
    padding: 2px 6px;
    border-radius: 3px;
    text-decoration: none;
    z-index: 1000;
}

/* フローティングパネル */
.facility-float-panel {
    position: absolute;
    top: 10px; left: 10px;
    width: 320px;
    max-height: calc(100% - 20px);
    background: rgba(255,255,255,0.96);
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.22);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    backdrop-filter: blur(4px);
    cursor: grab;
    user-select: none;
    touch-action: none;
}
.facility-panel-toggle {
    position: absolute;
    top: 8px; right: 8px;
    background: none;
    border: none;
    font-size: 1.1em;
    cursor: pointer;
    color: #555;
    padding: 2px 6px;
    line-height: 1;
    z-index: 1;
}
.facility-panel-body {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    touch-action: pan-y;
    max-height: calc(70vh - 20px);
    padding: 14px 14px 10px;
    scrollbar-width: thin;
}
.facility-panel-body.is-collapsed { display: none; }

/* パネル内セクション */
.fp-section { margin-bottom: 14px; padding-bottom: 12px; border-bottom: 1px solid #eee; }
.fp-section:last-child { border-bottom: none; margin-bottom: 0; }
.fp-title { font-size: 0.82em; font-weight: bold; color: #2c5f8a; margin: 0 0 6px; text-transform: uppercase; letter-spacing: .03em; }

/* 施設情報テーブル */
.fp-table { width: 100%; border-collapse: collapse; font-size: 0.82em; }
.fp-table th, .fp-table td { padding: 4px 6px; border-bottom: 1px solid #f2f2f2; text-align: left; vertical-align: top; }
.fp-table th { width: 72px; color: #888; font-weight: normal; white-space: nowrap; }
.fp-table a { color: #2c5f8a; }

/* Wikipedia */
.fp-wiki-text { font-size: 0.82em; line-height: 1.65; margin: 0 0 6px; color: #333; }
.fp-wiki-credit { font-size: 0.75em; color: #888; margin: 0; }
.fp-wiki-credit a { color: #888; }

/* 近隣 */
.fp-nearby { display: flex; gap: 8px; }
.fp-nearby-col { flex: 1; min-width: 0; }
.fp-nearby-head { font-size: 0.75em; font-weight: bold; color: #555; margin-bottom: 4px; }
.fp-nearby-list { margin: 0; padding: 0; list-style: none; }
.fp-nearby-list li { font-size: 0.75em; padding: 2px 0; border-bottom: 1px solid #f5f5f5; line-height: 1.4; }
.fp-nearby-list a { color: #2c5f8a; text-decoration: none; cursor: pointer; }
.fp-nearby-list a:hover { text-decoration: underline; }
.fp-nearby-none { font-size: 0.75em; color: #bbb; margin: 0; }
.fp-dist { font-size: 0.8em; color: #aaa; white-space: nowrap; }
.fp-nearby-extra { display: none; }

/* ===== 天気カレンダーパネル ===== */
.facility-weather-panel {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    width: 380px;
    max-height: calc(100% - 20px);
    background: rgba(255,255,255,0.97);
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.25);
    z-index: 1100;
    display: flex;
    flex-direction: column;
    backdrop-filter: blur(4px);
    overflow: hidden;
}
.fwp-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 10px;
    border-bottom: 1px solid #eee;
    background: #f5f8fb;
    flex-shrink: 0;
}
.fwp-month-label {
    flex: 1;
    text-align: center;
    font-weight: bold;
    font-size: 0.95em;
    color: #333;
}
.fwp-nav {
    background: none;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 2px 8px;
    cursor: pointer;
    font-size: 0.85em;
    color: #555;
}
.fwp-nav:disabled { opacity: 0.3; cursor: default; }
.fwp-close {
    background: none;
    border: none;
    font-size: 1.1em;
    cursor: pointer;
    color: #888;
    padding: 2px 4px;
    line-height: 1;
}
.fwp-calendar {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    flex: 1;
    padding: 8px;
}
.fwp-seo-list { display: none; }
.fwp-cal-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.78em;
    table-layout: fixed;
}
.fwp-cal-table th {
    padding: 4px 0;
    text-align: center;
    font-size: 0.82em;
    color: #666;
    font-weight: normal;
}
.fwp-cal-table td {
    padding: 3px 1px;
    text-align: center;
    vertical-align: top;
    border: 1px solid #f0f0f0;
    height: 54px;
}
.fwp-dn { font-size: 0.82em; color: #444; }
.fwp-wi { font-size: 1.25em; line-height: 1.2; }
.fwp-t  { font-size: 0.68em; }
.fwp-h  { color: #c0392b; margin-right: 2px; }
.fwp-l  { color: #2980b9; }
.fwp-today { background: #fff9e6 !important; outline: 1px solid #f0c040; }
.fwp-today .fwp-dn { font-weight: bold; color: #b07000; }
.fwp-past { background: #f8f8f8; }
.fwp-past .fwp-dn { color: #aaa; }
.fwp-sun .fwp-dn, .fwp-sun-cell .fwp-dn { color: #c0392b; }
.fwp-sat .fwp-dn, .fwp-sat-cell .fwp-dn { color: #2980b9; }
.fwp-cal-table th.fwp-sun { color: #c0392b; }
.fwp-cal-table th.fwp-sat { color: #2980b9; }

/* カレンダービューSEOセクション */
.facility-cal-seo { margin-bottom: 28px; }
.fcs-month-head { font-size: 1em; margin: 20px 0 6px; color: #2c5f8a; }
.fcs-table { max-width: 480px; }

@media (max-width: 640px) {
    .fcs-table { font-size: 0.72em; }
    .facility-weather-panel {
        position: fixed;
        top: 50%;
        left: 4%;
        right: 4%;
        bottom: auto;
        width: auto;
        max-height: 85dvh;
        transform: translateY(-50%);
        border-radius: 12px;
        z-index: 100100;
        padding-bottom: env(safe-area-inset-bottom);
    }
}

/* 剣洗距離表示 */
.fp-kensen-dist {
    font-size: 0.8em;
    background: #f5f8fb;
    border-left: 3px solid #2c5f8a;
    border-radius: 3px;
    padding: 6px 10px;
    margin-top: 2px;
    line-height: 1.6;
}
.fp-kensen-label { color: #444; }
.fp-kensen-km { font-weight: bold; color: #2c5f8a; margin: 0 4px; }
.fp-kensen-dist a { color: #2c5f8a; text-decoration: none; font-size: 0.95em; }
.fp-kensen-dist a:hover { text-decoration: underline; }
.fp-kensen-route {
    display: inline-block;
    background: #4285f4;
    color: #fff !important;
    font-size: 0.8em;
    padding: 2px 8px;
    border-radius: 3px;
    text-decoration: none !important;
    vertical-align: middle;
}
.fp-kensen-route:hover { opacity: .85; }

/* リンクボタン（パネル内） */
.fp-links { display: flex; flex-wrap: wrap; gap: 6px; }
.fp-links .facility-btn { padding: 5px 10px; font-size: 0.78em; }

@media (max-width: 640px) {
    .facility-map-section { height: 65dvh; border-radius: 0; margin-bottom: 0; overflow: visible; }

    .facility-float-panel {
        position: fixed;
        top: auto !important;
        left: 0 !important;
        right: 0;
        bottom: 0;
        width: 100%;
        max-height: 75dvh;
        border-radius: 16px 16px 0 0;
        box-shadow: 0 -4px 20px rgba(0,0,0,0.2);
        cursor: default;
        touch-action: pan-y;
        transition: transform 0.3s ease;
        transform: translateY(calc(100% - 52px));
        z-index: 99999;
        padding-bottom: env(safe-area-inset-bottom);
    }
    .facility-float-panel.bs-open {
        transform: translateY(0);
    }
    /* ボトムシート開放中はフッタを隠す */
    body.bs-scroll-lock #wrapper > footer,
    body.bs-scroll-lock #Footer,
    body.bs-scroll-lock footer { display: none; }
    /* スクロールロックはbodyではなくオーバーレイで制御 */
    #bs-scroll-overlay { display: none; }

    .facility-panel-toggle { display: none; }

    .facility-bottom-handle {
        display: flex;
        flex-direction: column;
        align-items: center;
        padding: 8px 0 6px;
        margin: 10px;
        cursor: pointer;
        flex-shrink: 0;
    }
    .facility-bottom-handle-bar {
        width: 40px; height: 4px;
        background: #ccc;
        border-radius: 2px;
        margin-bottom: 6px;
    }
    .facility-bottom-handle-label {
        font-size: 0.82em;
        font-weight: bold;
        color: #444;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 260px;
    }

    .facility-panel-body {
        max-height: calc(75dvh - 52px - env(safe-area-inset-bottom));
    }
    .facility-panel-body.is-collapsed { display: block; }

    .fp-nearby { flex-direction: row; }
    .facility-map-link { bottom: 60px; }
}

.facility-links-wrap { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 24px; }
.facility-btn {
    display: inline-block;
    padding: 8px 16px;
    border-radius: 4px;
    background: #2c5f8a;
    color: #fff !important;
    text-decoration: none;
    font-size: 0.9em;
    transition: opacity .2s;
}
.facility-btn:hover { opacity: .85; }
.facility-btn--wiki  { background: #3a6; }
.facility-btn--osm   { background: #e84; }
.facility-btn--gmap  { background: #4285f4; }
.facility-btn--back  { background: #888; }

.facility-section-title { font-size: 1.15em; margin: 28px 0 10px; padding-bottom: 6px; border-bottom: 2px solid #e0e0e0; }

/* Wikipedia引用 */
.facility-wiki-wrap { margin-bottom: 28px; }
.facility-wiki-quote {
    margin: 0;
    padding: 14px 18px;
    background: #f5f8fb;
    border-left: 4px solid #2c5f8a;
    border-radius: 4px;
    font-size: 0.95em;
    line-height: 1.7;
}
.facility-wiki-quote p { margin: 0 0 8px; }
.facility-wiki-quote footer { font-size: 0.85em; color: #666; }

/* 近隣情報 */
.facility-nearby-wrap {
    display: flex;
    gap: 20px;
    margin-bottom: 28px;
    align-items: flex-start;
}
.facility-nearby-group {
    flex: 1;
    min-width: 0;
}
.facility-nearby-list { margin: 0; padding: 0; list-style: none; }
.facility-nearby-list li {
    padding: 6px 8px;
    border-bottom: 1px solid #f0f0f0;
    font-size: 0.88em;
}
.facility-nearby-list li.no-result { color: #aaa; }
.facility-nearby-list a { color: #2c5f8a; text-decoration: none; }
.facility-nearby-list a:hover { text-decoration: underline; }
.nearby-dist {
    display: inline-block;
    margin-left: 6px;
    font-size: 0.8em;
    color: #888;
    background: #f0f0f0;
    padding: 1px 5px;
    border-radius: 10px;
    white-space: nowrap;
}
@media (max-width: 640px) {
    body { font-size: 16px; }
    .facility-nearby-wrap { flex-direction: column; }
}
