/* 
 * WP Kmap Plugin: Map Styles
 * Premium Aesthetics
 */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;700&display=swap');

html,
body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: #333;
}

#map {
    width: 100%;
    height: 100%;
    background-color: #f8f9fa;
}

/* Info Window — Public Government Style */
.info-window {
    min-width: 260px;
    max-width: 320px;
    padding: 2px 2px 4px;
    color: #1f2937;
    font-size: 13px;
    line-height: 1.55;
}

/* タイプ表示: InfoWindow ヘッダー(✕ボタン左)に表示 — 左色帯 + 太字ラベル */
.iw-type {
    display: inline-flex;
    align-items: center;
    position: relative;
    padding: 2px 0 2px 12px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.05em;
    line-height: 1.4;
}

.iw-type::before {
    content: "";
    position: absolute;
    left: 0;
    top: 3px;
    bottom: 3px;
    width: 4px;
    border-radius: 1px;
}

.iw-type-main {
    color: #b91c1c;
}
.iw-type-main::before {
    background: #dc2626;
}

.iw-type-satellite {
    color: #1d4ed8;
}
.iw-type-satellite::before {
    background: #2563eb;
}

/* タイトル(センター名) */
.iw-title {
    margin: 0 0 2px;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.4;
    color: #111827;
}

/* 市町村 */
.iw-subtitle {
    margin: 0 0 12px;
    font-size: 12px;
    color: #6b7280;
}

/* 詳細グリッド: ラベル列 + 値列 */
.iw-body {
    display: grid;
    grid-template-columns: max-content 1fr;
    column-gap: 14px;
    row-gap: 8px;
    margin: 0;
    padding-top: 10px;
    border-top: 1px solid #e5e7eb;
}

.iw-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    font-size: 12px;
    font-weight: 600;
    color: #4b5563;
    white-space: nowrap;
}

.iw-label svg {
    flex: 0 0 14px;
    color: #9ca3af;
}

.iw-value {
    margin: 0;
    font-size: 13px;
    color: #1f2937;
    line-height: 1.45;
    overflow-wrap: anywhere;
    word-break: break-all;
}

.iw-link {
    color: #1d4ed8;
    text-decoration: underline;
    text-underline-offset: 2px;
    transition: color 0.15s ease;
}

.iw-link:hover,
.iw-link:focus {
    color: #1e3a8a;
}

/* Legend (右上) — 行政公開風のシンプルなパネル */
.sgm-legend {
    margin: 10px 10px 0 0;
    padding: 8px 10px;
    background: #ffffff;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: #1f2937;
    min-width: 0;
    width: max-content;
}

/* 左配置の凡例(ピン)はマージンを左上向きに */
.sgm-legend-left {
    margin: 10px 0 0 10px;
}

/* デスクトップではトグル非表示(常に開いた状態) */
.sgm-legend-toggle {
    display: none;
}

.sgm-legend-title {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: #4b5563;
    padding-bottom: 6px;
    margin-bottom: 6px;
    border-bottom: 1px solid #e5e7eb;
}

.sgm-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: #1f2937;
    line-height: 1.55;
}

.sgm-legend-swatch {
    flex: 0 0 12px;
    width: 12px;
    height: 12px;
    border: 1px solid;
    border-radius: 2px;
    opacity: 0.85;
}

.sgm-legend-pin {
    flex: 0 0 14px;
    width: 14px;
    height: 14px;
    object-fit: contain;
    display: block;
}

/* モバイル(<=600px): 折りたたみ式・小型 */
@media (max-width: 600px) {
    .sgm-legend {
        margin: 6px 6px 0 0;
        padding: 4px 8px;
        min-width: 0;
    }

    .sgm-legend-left {
        margin: 6px 0 0 6px;
    }

    .sgm-legend-toggle {
        display: inline-flex;
        align-items: center;
        gap: 4px;
        background: none;
        border: none;
        padding: 2px 0;
        margin: 0;
        cursor: pointer;
        font-family: inherit;
        font-size: 11px;
        font-weight: 700;
        letter-spacing: 0.04em;
        color: #4b5563;
        line-height: 1.3;
    }

    .sgm-legend-toggle::before {
        content: "▾";
        display: inline-block;
        font-size: 10px;
        color: #6b7280;
        transition: transform 0.15s ease;
    }

    .sgm-legend.is-collapsed .sgm-legend-toggle::before {
        transform: rotate(-90deg);
    }

    .sgm-legend.is-collapsed .sgm-legend-body {
        display: none;
    }

    /* 展開時はトグル(凡例)とタイトル(災害VC設置状況)が重複するのでタイトルを隠す */
    .sgm-legend-body {
        margin-top: 4px;
    }
    .sgm-legend-title {
        display: none;
    }

    .sgm-legend-item {
        font-size: 11px;
        line-height: 1.5;
        gap: 6px;
    }

    .sgm-legend-swatch {
        flex: 0 0 11px;
        width: 11px;
        height: 11px;
    }

    .sgm-legend-pin {
        flex: 0 0 13px;
        width: 13px;
        height: 13px;
    }
}

/* Hide Google Terms/Logos slightly if needed, but keeping for compliance */
.gm-style-cc { display: block; }
